diff --git a/android/app/build.gradle b/android/app/build.gradle index 49e45a83..5fe0dced 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -97,8 +97,8 @@ android { applicationId "com.standardnotes" minSdkVersion 19 targetSdkVersion 25 - versionCode 14 - versionName "0.0.14" + versionCode 16 + versionName "0.0.16" multiDexEnabled true ndk { abiFilters "armeabi-v7a", "x86" diff --git a/android/app/src/main/java/com/standardnotes/MainApplication.java b/android/app/src/main/java/com/standardnotes/MainApplication.java index e6db6dd9..f9601be2 100644 --- a/android/app/src/main/java/com/standardnotes/MainApplication.java +++ b/android/app/src/main/java/com/standardnotes/MainApplication.java @@ -87,6 +87,7 @@ public class MainApplication extends NavigationApplication { @Override public void onActivityResumed(Activity activity) { + } @Override diff --git a/ios/StandardNotes/Info.plist b/ios/StandardNotes/Info.plist index 4d66dcad..4cf6e60f 100644 --- a/ios/StandardNotes/Info.plist +++ b/ios/StandardNotes/Info.plist @@ -23,7 +23,7 @@ CFBundleSignature ???? CFBundleVersion - 9 + 10 LSRequiresIPhoneOS NSAppTransportSecurity diff --git a/package.json b/package.json index d7594f3f..525a7dc7 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "StandardNotes", "version": "0.0.1", - "versionIOS" : "1.0.9", - "versionAndroid" : "0.0.14", + "versionIOS" : "1.0.11", + "versionAndroid" : "0.0.16", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", diff --git a/src/containers/AuthModal.js b/src/containers/AuthModal.js index 2ad8e158..73090041 100644 --- a/src/containers/AuthModal.js +++ b/src/containers/AuthModal.js @@ -17,37 +17,61 @@ export default class AuthModal extends Component { authProps: ApplicationState.get().getAuthenticationPropsForAppState(mostRecentState), applicationState: mostRecentState }; - - this.stateObserver = ApplicationState.get().addStateObserver((state) => { - if(ApplicationState.get().isStateAppCycleChange(state) && !ApplicationState.get().isAuthenticationInProgress()) { - let authProps = ApplicationState.get().getAuthenticationPropsForAppState(state); - this.setState({authProps: authProps, applicationState: state}); - } - }); + this.stateChanged(); } componentWillUnmount() { ApplicationState.get().removeStateObserver(this.stateObserver); } - render() { - let authProps = this.state.authProps; - let visible = (authProps.passcode || authProps.fingerprint) || false; - if(visible) { - // Once visible is true even once, we need to lock it in place, - // and only make it in-visible after authentication completes. - // This value is checked above in the application state observer to make sure we - // don't accidentally change the value and dismiss this while its in view - if(!ApplicationState.get().isAuthenticationInProgress()) { - if(this.state.applicationState == ApplicationState.Launching || this.state.applicationState == ApplicationState.Resuming) { - setTimeout(() => { - this.refs.authenticate.beginAuthentication(); - ApplicationState.get().setAuthenticationInProgress(true); - }, 0); + componentDidMount() { + this.mounted = true; + + this.stateObserver = ApplicationState.get().addStateObserver((state) => { + if(ApplicationState.get().isStateAppCycleChange(state) && !ApplicationState.get().isAuthenticationInProgress()) { + let authProps = ApplicationState.get().getAuthenticationPropsForAppState(state); + this.setState({authProps: authProps, applicationState: state}); + this.stateChanged(); + } + }); + + if(this.beginAuthOnMount) { + this.beginAuthOnMount = false; + this.beginAuth(); + } + } + + stateChanged() { + // Once visible is true even once, we need to lock it in place, + // and only make it in-visible after authentication completes. + // This value is checked above in the application state observer to make sure we + // don't accidentally change the value and dismiss this while its in view + + if(!ApplicationState.get().isAuthenticationInProgress()) { + if(this.state.applicationState == ApplicationState.Launching || this.state.applicationState == ApplicationState.Resuming) { + if(this.mounted) { + this.beginAuth(); + } else { + this.beginAuthOnMount = true; } } } + } + beginAuth() { + this.refs.authenticate.beginAuthentication(); + ApplicationState.get().setAuthenticationInProgress(true); + } + + get visible() { + let authProps = this.state.authProps; + let _visible = (authProps.passcode || authProps.fingerprint) || false; + return _visible; + } + + render() { + let authProps = this.state.authProps; + let visible = this.visible; return (