Skip to content

Commit

Permalink
Merge pull request #30 from BindCreative/development
Browse files Browse the repository at this point in the history
Milestone 2 merge
  • Loading branch information
Alvar Laigna authored Jul 19, 2020
2 parents 00826a9 + d48a9e1 commit d6f3318
Show file tree
Hide file tree
Showing 82 changed files with 1,721 additions and 983 deletions.
36 changes: 31 additions & 5 deletions App.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
console.disableYellowBox = true;
import './shim.js';
import React, { useEffect, useState } from 'react';
import React, { useEffect, useState, useRef } from 'react';
import { AppState, StatusBar } from 'react-native';
import { Provider } from 'react-redux';
import { SafeAreaProvider } from 'react-native-safe-area-context';
Expand All @@ -9,24 +9,29 @@ import { PersistGate } from 'redux-persist/integration/react';
import configureStore from './src/store/configureStore';
import Navigator from './src/navigation/Root';
import NavigationService from './src/navigation/service';
import LoadingScreen from './src/screens/LoadingScreen';
import { initWallet } from './src/actions/wallet';
import { oClient } from './src/lib/oCustom';

const App = () => {
const [store, setStore] = useState(undefined);
const [persistor, setPersistor] = useState(undefined);
const [appState, setAppState] = useState('active');
const [appReady, setAppReady] = useState(false);
const readynessIntervalRef = useRef();

useEffect(() => {
const storeSetup = configureStore();
setStore(storeSetup.store);
setPersistor(storeSetup.persistor);
}, [configureStore, initWallet]);
}, []);

useEffect(() => {
if (!!store) {
store.dispatch(initWallet());
}
}, [store]);

useEffect(() => {
AppState.addEventListener('change', nextAppState =>
setAppState(nextAppState),
Expand All @@ -38,22 +43,43 @@ const App = () => {
};
}, [setAppState]);

StatusBar.setBarStyle('dark-content');
useEffect(() => {
if (!appReady) {
const id = setInterval(() => {
if (store?.getState && persistor) {
setAppReady(true);
} else {
setAppReady(false);
}
}, 4000);
readynessIntervalRef.current = id;
}

return () => {
clearInterval(readynessIntervalRef.current);
};
}, [appReady, store, persistor]);

// TODO: close and restart hub connection
// useEffect(() => {
// if (appState !== 'active') {
// oClient.close();
// }
// }, [appState]);

if (!store | !persistor) {
return null;
if (!appReady) {
return (
<SafeAreaProvider>
<LoadingScreen messages={['Starting up']} />
</SafeAreaProvider>
);
}

return (
<Provider store={store}>
<PersistGate persistor={persistor}>
<SafeAreaProvider>
<StatusBar backgroundColor='#ffffff' barStyle='dark-content' />
<Navigator
ref={navigatorRef => {
NavigationService.setTopLevelNavigator(navigatorRef);
Expand Down
14 changes: 12 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ android {
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
missingDimensionStrategy 'react-native-camera', 'general'
}
splits {
abi {
Expand All @@ -150,6 +151,14 @@ android {
keyAlias 'androiddebugkey'
keyPassword 'android'
}
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
buildTypes {
debug {
Expand All @@ -158,7 +167,7 @@ android {
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
signingConfig signingConfigs.debug
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
Expand All @@ -182,8 +191,9 @@ android {
dependencies {
implementation project(':react-native-randombytes')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "com.facebook.react:react-native:0.61.5" // From node_modules
addUnimodulesDependencies()
implementation project(':react-native-camera')

if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/java/com/obby/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ public class MainActivity extends ReactActivity {
*/
@Override
protected String getMainComponentName() {
return "Obby";
return "Obby chat";
}
}
12 changes: 7 additions & 5 deletions android/app/src/main/java/com/obby/MainApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.react.ReactApplication;
import com.bitgo.randombytes.RandomBytesPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import com.myapp.generated.BasePackageList;
import java.util.Arrays;
import com.obby.generated.BasePackageList;
import org.reactnative.camera.RNCameraPackage;
import org.unimodules.adapters.react.ModuleRegistryAdapter;
import org.unimodules.adapters.react.ReactModuleRegistryProvider;
import org.unimodules.core.interfaces.SingletonModule;
Expand All @@ -29,10 +32,9 @@ public boolean getUseDeveloperSupport() {
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages() {
new MainReactPackage(),
new ModuleRegistryAdapter(mModuleRegistryProvider)
};
List<ReactPackage> packages = new PackageList(this).getPackages();
// packages.add(new MainReactPackage());
packages.add(new ModuleRegistryAdapter(mModuleRegistryProvider));
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
Expand Down
Binary file removed android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/app/src/main/res/mipmap/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<resources>
<string name="app_name">Obby</string>
<string name="app_name">Obby chat</string>
</resources>
5 changes: 5 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@

android.useAndroidX=true
android.enableJetifier=true

MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
MYAPP_RELEASE_STORE_PASSWORD=ObbyMan
MYAPP_RELEASE_KEY_PASSWORD=ObbyMan
2 changes: 2 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ include ':react-native-randombytes'
project(':react-native-randombytes').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-randombytes/android')
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
include ':react-native-camera'
project(':react-native-camera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-camera/android')
Loading

0 comments on commit d6f3318

Please sign in to comment.