From 9d57e9cc7b3cdb06722747ac73bc97a6c6038835 Mon Sep 17 00:00:00 2001 From: Simbad Marino Date: Wed, 6 Sep 2023 00:25:12 -0600 Subject: [PATCH] Improving node setup and general UI improvements --- ios/justshare/AppDelegate.m | 7 ++- ios/justshare/Info.plist | 8 ++++ navigation/MainNavigator.tsx | 82 +++++++++++++++-------------------- screens/Browser.tsx | 2 +- screens/Settings/Settings.tsx | 2 +- 5 files changed, 51 insertions(+), 50 deletions(-) diff --git a/ios/justshare/AppDelegate.m b/ios/justshare/AppDelegate.m index 4934187..1383caa 100644 --- a/ios/justshare/AppDelegate.m +++ b/ios/justshare/AppDelegate.m @@ -1,5 +1,7 @@ #import "AppDelegate.h" - +#if RCT_DEV +#import +#endif #import #import #import @@ -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]; diff --git a/ios/justshare/Info.plist b/ios/justshare/Info.plist index b34bab7..06eb616 100644 --- a/ios/justshare/Info.plist +++ b/ios/justshare/Info.plist @@ -2,6 +2,10 @@ + BGTaskSchedulerPermittedIdentifiers + + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName @@ -74,6 +78,10 @@ Allow $(PRODUCT_NAME) to save photos NSPhotoLibraryUsageDescription Allow $(PRODUCT_NAME) to access your photos + UIBackgroundModes + + processing + UIFileSharingEnabled UILaunchStoryboardName diff --git a/navigation/MainNavigator.tsx b/navigation/MainNavigator.tsx index 3561e82..641d700 100644 --- a/navigation/MainNavigator.tsx +++ b/navigation/MainNavigator.tsx @@ -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; @@ -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(() => { @@ -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(); } @@ -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); } @@ -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); @@ -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); @@ -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); @@ -248,29 +232,6 @@ export const MainNavigator: React.FC = () => { }; - _renderItem = ({ item }) => { - return ( - - {item.title} - {btfs_sts} - - {item.text} - {str_BTT_Addy} - {enableGuide && } - - ); - } - _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 ( @@ -321,8 +282,35 @@ export const MainNavigator: React.FC = () => { ) else - return (this.slider = ref)} onDone={this._onDone} showNextButton={nodeFilledWithBTT}/>; + return( + + {slideTitleText} + + {nodeLoadingText} + + {str_BTT_Addy} + + {enableGuide && } + + + + ) }; diff --git a/screens/Browser.tsx b/screens/Browser.tsx index 39dce9b..00c75c2 100644 --- a/screens/Browser.tsx +++ b/screens/Browser.tsx @@ -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) diff --git a/screens/Settings/Settings.tsx b/screens/Settings/Settings.tsx index e11e6d6..5e550a9 100644 --- a/screens/Settings/Settings.tsx +++ b/screens/Settings/Settings.tsx @@ -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; }