Skip to content

Commit

Permalink
Improving node setup and general UI improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Simbad Marino authored and Simbad Marino committed Sep 6, 2023
1 parent f08250c commit 9d57e9c
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 50 deletions.
7 changes: 6 additions & 1 deletion ios/justshare/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#import "AppDelegate.h"

#if RCT_DEV
#import <React/RCTDevLoadingView.h>
#endif
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
Expand Down Expand Up @@ -36,6 +38,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
#endif

RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:launchOptions];
#if RCT_DEV
[bridge moduleForClass:[RCTDevLoadingView class]];
#endif
RCTRootView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"main" initialProperties:nil];
rootView.backgroundColor = [UIColor whiteColor];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
Expand Down
8 changes: 8 additions & 0 deletions ios/justshare/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
Expand Down Expand Up @@ -74,6 +78,10 @@
<string>Allow $(PRODUCT_NAME) to save photos</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Allow $(PRODUCT_NAME) to access your photos</string>
<key>UIBackgroundModes</key>
<array>
<string>processing</string>
</array>
<key>UIFileSharingEnabled</key>
<true/>
<key>UILaunchStoryboardName</key>
Expand Down
82 changes: 35 additions & 47 deletions navigation/MainNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ import { useAppDispatch, useAppSelector } from '../hooks/reduxHooks';

/* Slider Intro section Start */
import Client10 from '../utils/APIClient10.js'
import AppIntroSlider from 'react-native-app-intro-slider';
import NodeLoadingGIF from '../assets/nodeLoading.gif';
import NodeLoadedGIF from '../assets/nodeHungry.gif';
import BTFSLoadingFilledGIF from '../assets/loading_test.gif';
import Logo from '../assets/nodeHungry.gif';
import { setSnack, snackActionPayload } from '../features/files/snackbarSlice';
import AsyncStorage from '@react-native-async-storage/async-storage';
const {BTFSmodule} = NativeModules;
Expand Down Expand Up @@ -45,22 +43,6 @@ export const MainNavigator: React.FC = () => {
const dispatch = useAppDispatch();


const slides = [
{
key: 'one',
title: slideTitleText,
text: nodeLoadingText,
image: flagGuideDone?NodeLoadedGIF:NodeLoadingGIF,
backgroundColor: '#59b2ab',
},
{
key: 'two',
title: 'Your node is ready',
text: 'You can now start uploading and sharing :)',
image: require('../assets/node_ok.png'),
backgroundColor: '#22bcb5',
}
];


useEffect(() => {
Expand Down Expand Up @@ -132,12 +114,14 @@ export const MainNavigator: React.FC = () => {

const copyToClipboard = () => {
Clipboard.setString(bttcAddress);
Alert.alert("Address copied to clipboard");
//Alert.alert("Address copied to clipboard");
dispatch(setSnack({ message: "Address copied to clipboard" }));
};


function triggerAppRestart(){
Alert.alert("Init completed", "Please restart app");
//enableBTFSDaemon();
}


Expand All @@ -149,7 +133,7 @@ export const MainNavigator: React.FC = () => {
if(data.Type == 'error')
{
//console.log(data);
console.log("Guide is DONE, nothing else to do");
// console.log("Guide is DONE, nothing else to do");
//setnodeFilledWithBTT(true);
}

Expand All @@ -160,7 +144,7 @@ export const MainNavigator: React.FC = () => {
console.log(str_BTT_Addy)
if(str_BTT_Addy != '')
{
setnodeLoadingText("Send at least 1K BTT to your address:");
setnodeLoadingText("Send at least 1K BTT to your address and wait a moment...");
setslideTitleText("Setup your Wallet")
AsyncStorage.setItem('bttcWalletSts', 'fillOngoing');
setflagGuideDone(true);
Expand All @@ -183,7 +167,7 @@ export const MainNavigator: React.FC = () => {
let data4 = Client10.getHostVersion();
let data5 = Client10.getNetworkStatus();
//let data6 = Client10.requestGuide();
console.log("Network Status update");
//console.log("Network Status update");
return Promise.all([data1, data2, data3, data4, data5]).then((result) => {
//console.log(result[4]);
//console.log(result[0].BttcAddress);
Expand All @@ -199,7 +183,7 @@ export const MainNavigator: React.FC = () => {
status = 1;
message = 'online';
setbtfs_sts('Online');
console.log("Network Status update:Online");
//console.log("Network Status update:Online");
setslideTitleText("All Set :)")
setnodeLoadingText("Tap Next to finalize setup");
setnodeFilledWithBTT(true);
Expand Down Expand Up @@ -248,29 +232,6 @@ export const MainNavigator: React.FC = () => {
};


_renderItem = ({ item }) => {
return (
<View style={styles.slide}>
<Text style={styles.title}>{item.title}</Text>
<Text style={styles.title}>{btfs_sts}</Text>
<Image source={item.image} style={styles.image}/>
<Text style={styles.text }>{item.text}</Text>
<Text style={styles.text } numberOfLines={1} ellipsizeMode = 'middle' >{str_BTT_Addy}</Text>
{enableGuide && <Icon
name="copy"
type="font-awesome"
color={theme.colors.primary}
size={18}
onPress={copyToClipboard}
/>}
</View>
);
}
_onDone = () => {
// User finished the introduction. Show real app through
// navigation or simply by controlling state
setshowRealApp(true);
}
if((showRealApp || btfs_sts == 'Online') & bttcWalletStatus == 'filled')
{
return (
Expand Down Expand Up @@ -321,8 +282,35 @@ export const MainNavigator: React.FC = () => {

)
else
return <AppIntroSlider renderItem={this._renderItem} data={slides} ref={(ref) => (this.slider = ref)} onDone={this._onDone} showNextButton={nodeFilledWithBTT}/>;
return(
<View style={styles.container}>
<Text style={[styles.text, { color: theme.colors.primary }]}> {slideTitleText} </Text>
<Image
style={styles.logo}
source={BTFSLoadingFilledGIF}
/>
<Text style={[styles.text, { color: theme.colors.primary }]}> {nodeLoadingText} </Text>
<View
style={{
flexDirection: "row",
justifyContent: "flex-start",
width: 220,
}}
>
<Text style={styles.text } numberOfLines={1} ellipsizeMode = 'middle' >{str_BTT_Addy}</Text>
</View>
{enableGuide && <Icon
name="copy"
type="font-awesome"
color={theme.colors.primary}
size={25}
onPress={copyToClipboard}
/>}

</View>


)
};


Expand Down
2 changes: 1 addition & 1 deletion screens/Browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ function addFileToBTFS(file)
.then((dirFiles) => {
if (currentDir !== route?.params?.prevDir) {
const filteredFiles = dirFiles.filter(
(file) => file !== 'RCTAsyncLocalStorage' && file != 'ReactNativeDevBundle.js' && file != '.expo-internal'
(file) => file !== 'RCTAsyncLocalStorage' && file != 'ReactNativeDevBundle.js' && file != '.expo-internal' && file != '.btfs' && file != 'home' //We have to filter here all system related hidden folders toa void user accidentaly erasing them ;)
);
const filesProms = filteredFiles.map((fileName) =>
FileSystem.getInfoAsync(currentDir + '/' + fileName)
Expand Down
2 changes: 1 addition & 1 deletion screens/Settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function getGuideData(){
Promise.resolve(data).then(function(data) {
if(data.Type == 'error')
{
console.log("Guide is DONE, nothing else to do from Settings");
//console.log("Guide is DONE, nothing else to do from Settings");
flagGuideDone = 1;
}

Expand Down

0 comments on commit 9d57e9c

Please sign in to comment.