react-native#AppState JavaScript Examples

The following examples show how to use react-native#AppState. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: App.js    From universal-verifier-app with GNU General Public License v3.0 6 votes vote down vote up
Router = () => {
  const {authData, loading, signIn, signOut} = useContext(AuthContext);

  useEffect(() => {
    AppState.addEventListener("change", _handleAppStateChange);

    return () => {
      AppState.removeEventListener("change", _handleAppStateChange);
    };
  }, []);

  const _handleAppStateChange = (nextAppState) => {
    if (nextAppState !== "active") {
      signOut();
    }
  };

  if (loading) {
    return ( <Loading /> );
  }
  return (
    <NavigationContainer>
      {authData ? <AppStack /> : <AuthStack />}
    </NavigationContainer>
  );
}
Example #2
Source File: FinancesApp.js    From actual with MIT License 6 votes vote down vote up
function useForegroundSync(sync) {
  let appState = useRef(null);

  useEffect(() => {
    let onChange = nextAppState => {
      let state = appState.current;

      // Detect when the app is coming into the foreground
      if (state && state === 'background' && nextAppState === 'active') {
        sync();
      }

      appState.current = nextAppState;
    };

    AppState.addEventListener('change', onChange);

    return () => {
      AppState.removeEventListener('change', onChange);
    };
  }, [sync]);
}
Example #3
Source File: index.android.js    From bluezone-app with GNU General Public License v3.0 6 votes vote down vote up
async componentDidMount() {
    // this.checkBluetoothState();
    registerBluetoothStateListener(this.setStatusBluetooth);

    AppState.addEventListener('change', this.handleAppStateChange);

    // TODO both DeviceEventEmitter and NativeAppEventEmitter are deprecated, you should use NativeEventEmitter instead.
    DeviceEventEmitter.addListener(
      RNSettings.GPS_PROVIDER_EVENT,
      this.handleGPSProviderEvent,
    );

    this.timer = setTimeout(this.requestPermissionLocation, 500);
  }
Example #4
Source File: MsgListScreen.js    From RRWallet with MIT License 6 votes vote down vote up
constructor(props) {
    super(props);

    this.state = {
      messageList: [],
      pushEnabled: PushEnabled,
      index: 0,
    };

    this.props.navigator.addOnNavigatorEvent(this.onNavigatorEvent.bind(this));
    AppState.addEventListener("change", nextAppState => {
      if (nextAppState == "active") {
        this.getNotoficationPermission();
      }
    });
    this.getNotoficationPermission();
  }
Example #5
Source File: DeviceSecurity.js    From RRWallet with MIT License 6 votes vote down vote up
constructor() {
    AppState.addEventListener("change", nextAppState => {
      if (nextAppState == "active") {
        this.showUnlockIfNeed();
      } else {
        this.leaveTimestamp = new Date().getTime();
      }
    });
    DeviceEventEmitter.addListener(NOTIFICATION_AUTH_FINISH, () => {
      this.isUnlocking = false;
    });
  }
Example #6
Source File: BackgroundSync.js    From hugin-mobile with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Complete the background syncing and pull down a few vars
 */
function finishBackgroundSync() {
    AppState.removeEventListener('change', onStateChange);

    State.unsubscribe();

    BackgroundFetch.finish(BackgroundFetch.FETCH_RESULT_NEW_DATA);

    State.running = false;

    Globals.logger.addLogMessage('[Background Sync] Background sync complete.');
}
Example #7
Source File: MainScreen.js    From hugin-mobile with GNU Affero General Public License v3.0 6 votes vote down vote up
componentDidMount() {
        this.unsubscribe = NetInfo.addEventListener(this.handleNetInfoChange);
        AppState.addEventListener('change', this.handleAppStateChange);
        Linking.addEventListener('url', this.handleURI);
        initBackgroundSync();
        let flipFlop = false;

        let keepAnimating = () => {

          Animated.timing(this.animatedValue, {
            toValue: flipFlop ? 0 : 224,
            duration: 30000
          }).start(() => {
            flipFlop = flipFlop ? false : true;
            keepAnimating();
          });

        }

          Animated.timing(this.animatedValue, {
            toValue: 224,
            duration: 30000
          }).start(() => {
            keepAnimating();

      });
    }
Example #8
Source File: PasswordInput.js    From RRWallet with MIT License 6 votes vote down vote up
componentDidMount() {
    Keyboard.addListener("keyboardDidHide", this._handleKeyboardDidHide);
    AppState.addEventListener("change", this._handleAppStateChange);
    setTimeout(() => {
      this.textinput && this.textinput.focus();
    }, 600);
    autorun(() => {
      if (this.inputCode.length == 6) {
        console.log("completion", this.inputCode);
        if (this.props.onCompletion && this.completionCode != this.inputCode) {
          this.completionCode = this.inputCode;
          this.props.onCompletion(this.inputCode);
        }
      }
    });
  }
Example #9
Source File: index.js    From tcap-mobile with GNU General Public License v3.0 6 votes vote down vote up
componentDidMount() {
      AppState.addEventListener('change', this._handleAppStateChange);

      if (this.state.mode === PIN_SCREEN_MODE.LOGIN_PIN && !this.isPinFallback) {
          SecurityServices.authenticateOnStartup().then(() => this.allowLogin = true).catch(() => {
              this.allowLogin = true;
          });
      }
  }
Example #10
Source File: index.js    From tcap-mobile with GNU General Public License v3.0 6 votes vote down vote up
componentDidMount() {
      this.focusListener = this.props.navigation.addListener('focus', () => {
          this.setState({isFocused:true});
      });
      this.props.updateZkSyncTokens();
      if(this.props.route.params.accountDetails)
          this.props.setAccountDetails(this.props.route.params.accountDetails);
      AppState.addEventListener('change', this._handleAppStateChange);
  }
Example #11
Source File: index.js    From tcap-mobile with GNU General Public License v3.0 6 votes vote down vote up
constructor(props) {
      super(props);
      if (this.props.route && this.props.route.params) {
          if (this.props.route.params.accountDetails)
              this.accountDetails = this.props.route.params.accountDetails;
      }
      this.state = {
          appState: AppState.currentState,
          index: 0,
          refreshing:false,
          isFocused:false,
      };
  }
Example #12
Source File: HomeScreen.js    From WhatsApp-Clone with MIT License 6 votes vote down vote up
HomeScreen = ({children, style, navigation, ...rest}) => {
  useEffect(() => {
    registerStateChangeListener();
    sendPageLoadStatus()

    return () => {
      // Clean up the subscription
      unRgisterStateChangeListener()
    };
  }, []);

  function registerStateChangeListener() {
    AppState.addEventListener('change', handleAppStateChange);
  }

  function unRgisterStateChangeListener() {
    AppState.removeEventListener('change', handleAppStateChange);
  } 

  return (
    <SafeAreaView style={DEFAULT_STYLES.container}>
      <View style={DEFAULT_STYLES.container}>
        {/* <Header hasTabs style={styles.headerStyle}> */}
        <HomeHeader navigation={navigation} />
        {/* </Header> */}
        <TabView navigation={navigation} />
      </View>
    </SafeAreaView>
  );
}
Example #13
Source File: SettingsScreen.js    From hugin-mobile with GNU Affero General Public License v3.0 5 votes vote down vote up
componentDidMount() {
        this.updateDozeStatus();
        AppState.addEventListener('change', this.updateDozeStatus);
    }
Example #14
Source File: NPS.js    From monsuivipsy with Apache License 2.0 5 votes vote down vote up
async componentDidMount() {
    if (__DEV__) {
      this.reset();
    }
    this.NPSListener = AppState.addEventListener("change", this.handleAppStateChange);
    this.notificationsListener = Notifications.listen(this.handleNotification);
    this.checkNeedNPS();
  }
Example #15
Source File: MainScreen.js    From hugin-mobile with GNU Affero General Public License v3.0 5 votes vote down vote up
componentWillUnmount() {
        NetInfo.removeEventListener('connectionChange', this.handleNetInfoChange);
        AppState.removeEventListener('change', this.handleAppStateChange);
        Linking.removeEventListener('url', this.handleURI);
        this.unsubscribe();
    }
Example #16
Source File: index.js    From stayaway-app with European Union Public License 1.2 5 votes vote down vote up
function* watchAppStateChange() {
  const channel = eventChannel((emitter) => {
    AppState.addEventListener('change', emitter);
    return () => AppState.removeEventListener('change', emitter);
  });

  try {
    let previousState = 'unknown';

    while (true) {
      const nextState = yield take(channel);
      const onboarding = yield select(isOnboarding);

      if (! onboarding && previousState !== nextState) {
        if (nextState === 'active') {
          const isProtectorOpen = yield select(isProtectorModalOpen);
          if (isProtectorOpen) {
            yield delay(200);
            yield put(modalsActions.closeProtectorModal());
            yield take(modalsTypes.PROTECTOR_MODAL_CLOSED);
          }

          try {
            if (! Configuration.UI) {
              yield call(TracingManager.sync);

              // Get status
              const status = yield call(TracingManager.getStatus);
              yield put(accountActions.updateStatus(status));
            }
          } catch (error) {
            // Sync error. Probably exposure check limit reached.
            console.log(error);
          }
        } else if (nextState === 'inactive') {
          const isProtectorOpen = yield select(isProtectorModalOpen);
          if (! isProtectorOpen) {
            yield put(modalsActions.openProtectorModal());
            yield take(modalsTypes.PROTECTOR_MODAL_OPEN);
          }
        }
      }

      previousState = nextState;
    }
  } finally {
    channel.close();
  }
}
Example #17
Source File: index.js    From tcap-mobile with GNU General Public License v3.0 5 votes vote down vote up
componentWillUnmount() {
      AppState.removeEventListener('change', this._handleAppStateChange);
  }
Example #18
Source File: index.js    From tcap-mobile with GNU General Public License v3.0 5 votes vote down vote up
componentWillUnmount() {
      this.focusListener();
      AppState.removeEventListener('change', this._handleAppStateChange);
  }
Example #19
Source File: BackgroundSync.js    From hugin-mobile with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Check background syncing is all good and setup a few vars
 */
async function setupBackgroundSync() {
    /* Probably shouldn't happen... but check we're not already running. */
    if (State.running) {
        Globals.logger.addLogMessage('[Background Sync] Background sync already running. Not starting.');
        return false;
    }

    /* Not in the background, don't sync */
    if (AppState.currentState !== 'background') {
        Globals.logger.addLogMessage('[Background Sync] Background sync launched while in foreground. Not starting.');
        return false;
    }

    /* Wallet not loaded yet. Probably launching from headlessJS */
    if (Globals.wallet === undefined) {
        const backgroundInitSuccess = await fromHeadlessJSInit();

        if (!backgroundInitSuccess) {
            return false;
        }
    }

    const netInfo = await NetInfo.fetch();

    if (Globals.preferences.limitData && netInfo.type === 'cellular') {
        Globals.logger.addLogMessage('[Background Sync] On mobile data. Not starting background sync.');
        return false;
    }

    State.unsubscribe = NetInfo.addEventListener(handleNetInfoChange);

    AppState.addEventListener('change', onStateChange);

    State.shouldStop = false;

    Globals.logger.addLogMessage('[Background Sync] Running background sync...');

    return true;
}
Example #20
Source File: main.js    From astrale with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @returns {*}
 * @constructor
 */
function Main() {
  const [{ session, theme, day }, dispatch] = useGlobals();
  const [isReady, setIsReady] = React.useState(false);
  const [appState, setAppState] = React.useState(AppState.currentState);
  const _theme = themes[theme];

  // Deal with background/active app
  React.useEffect(() => {
    // Handles screen focus and case when user reopens app one day later (Date has to be updated)
    const handleAppStateChange = (nextAppState) => {
      if (appState.match(/active/) && nextAppState === 'active') {
        const nDate = DateUtils.toAmerican(new Date());
        if (nDate !== day) {
          dispatch({
            type: 'setDay',
            day: nDate,
          });
        }
      }
      setAppState(nextAppState);
    };

    AppState.addEventListener('change', handleAppStateChange);
    return () => {
      AppState.removeEventListener('change', handleAppStateChange);
    };
  }, [appState, day, dispatch]);

  // Backbones
  React.useEffect(() => {
    (async () => {
      try {
        const session = await Storer.get(SESSION_KEY);
        if (session) {
          dispatch({
            type: 'setSession',
            fields: { ...session },
          });
        }
      } finally {
        setIsReady(true);
      }
    })();
  }, [dispatch]);

  if (!isReady) {
    return <AppLoading />;
  }

  return (
    <PaperProvider theme={_theme}>
      <NavigationContainer theme={_theme}>
        {session.basicsDone ? (
          <MainStackNavigation />
        ) : (
          <InitialStackNavigation />
        )}
      </NavigationContainer>
    </PaperProvider>
  );
}
Example #21
Source File: router.js    From monsuivipsy with Apache License 2.0 5 votes vote down vote up
async componentDidMount() {
    await logEvents.initMatomo();
    logEvents.logAppVisit();
    RNBootsplash.hide({ fade: true });
    this.appListener = AppState.addEventListener("change", this.onAppChange);
  }
Example #22
Source File: notificationHandler.js    From RRWallet with MIT License 5 votes vote down vote up
notificationHandler = (notification, forceOpen = false) => {
  const state = AppState.currentState;

  console.log(state);
  if (!notification) {
    return;
  }

  const data = {};
  if (Platform.OS === "ios") {
    Object.assign(data, notification.getData() || {}, notification.getAlert() || {});
    data.content = data["body"];
    data.inApp = data["in-app"];
    data.bizType = data["biz-type"];
  } else if (Platform.OS === "android") {
    Object.assign(data, notification.extra);
    data.title = notification.title;
    data.content = notification.text;
    data.inApp = data["in-app"];
    data.bizType = data["biz-type"];
  }

  if (data.inApp) {
    data.inApp = parseInt(data.inApp);
  }

  if (data.bizType) {
    data.bizType = parseInt(data.bizType);
  }

  if (data.time) {
    data.time = parseInt(data.time);
  }

  let { url, title, content, time, bizType, inApp } = data;
  let clicked = false;
  if (!url) {
    url = DEEPLINK_LINK_BLANK;
  }

  if (Platform.OS === "ios") {
    if (state == "background") {
      inApp = false;
      clicked = true;
    }
  } else if (Platform.OS === "android") {
    clicked = notification.clicked;
  }

  if (forceOpen) {
    clicked = true;
  }

  deepLinkIfNeed(url, { title, content, time, bizType, inApp, clicked });
}
Example #23
Source File: PasswordInput.js    From RRWallet with MIT License 5 votes vote down vote up
componentWillUnmount() {
    Keyboard.removeListener("keyboardDidHide", this._handleKeyboardDidHide);
    AppState.removeEventListener("change", this._handleAppStateChange);
  }
Example #24
Source File: index.js    From Legacy with Mozilla Public License 2.0 5 votes vote down vote up
AppState.addEventListener('change',function(state) {
  if(state==="active") {
    refreshRequests(store);
    startLoop();
  } else {
    stopLoop();
  };
})
Example #25
Source File: index.js    From bluezone-app with GNU General Public License v3.0 5 votes vote down vote up
componentWillUnmount() {
    AppState.removeEventListener('change', this.handleAppStateChange);
    clearTimeout(this.timer);
  }
Example #26
Source File: index.js    From bluezone-app with GNU General Public License v3.0 5 votes vote down vote up
componentDidMount() {
    AppState.addEventListener('change', this.handleAppStateChange);
    this.timer = setTimeout(() => {
      this.setState({showModal: true});
    }, 1000);
  }
Example #27
Source File: index.ios.js    From bluezone-app with GNU General Public License v3.0 5 votes vote down vote up
componentDidMount() {
    // BluetoothStatus
    registerBluetoothStateListener(this.setStatusBluetooth);

    AppState.addEventListener('change', this.handleAppStateChange);

    this.timer = setTimeout(this.checkRequestMultiple, 500);
  }
Example #28
Source File: index.android.js    From bluezone-app with GNU General Public License v3.0 5 votes vote down vote up
componentWillUnmount() {
    this.numberOfCheckLocationPermission = 0;
    AppState.removeEventListener('change', this.handleAppStateChange);
    clearTimeout(this.timer);
  }
Example #29
Source File: Locked.js    From universal-verifier-app with GNU General Public License v3.0 4 votes vote down vote up
function Locked({ navigation, route }) {
  const {authData, signIn} = useContext(AuthContext);

  const isFocused = useIsFocused();
  const {colors, isDark} = useTheme();

  const [isTryingToSignIn, setIsTryingToSignIn] = useState(false);

  const handleBiometricAuthFailure = async (error: string) => {
    switch (error) {
      case 'NOT_ENROLLED':
        Alert.alert(
          `Not Enrolled`,
          'This device does not have biometric login enabled.',
        );
        break;
      case 'NOT_PRESENT':
        Alert.alert('', 'This device does not have the required hardware.');
        return;
      case 'AUTHENTICATION_FAILED':
        Alert.alert('', 'Authentication failed too many times');
        break;
      case 'NOT_AVAILABLE':
        Alert.alert('', 'Authentication is not available.');
        break;
      default:
    }
  };

  const signInBiometricAuth = async () => {
    if (isTryingToSignIn) {
      await LocalAuthentication.cancelAuthenticate();
    }
    
    console.log("Logging in");
    setIsTryingToSignIn(true);
    const authenticateResult = await LocalAuthentication.authenticateAsync({
      promptMessage: 'Login with Biometrics', 
      cancelLabel: 'Cancel',
      disableDeviceFallback: true, 
      fallbackLabel: 'Use PIN'
    });

    console.log("Logged in", authenticateResult);

    if (authenticateResult.success) {
      signIn();
    } else {
      handleBiometricAuthFailure(authenticateResult);
    }
    setIsTryingToSignIn(false);
  }

  const unlock = async () => {
    if (isTryingToSignIn) return;

    if (!authData && !isTryingToSignIn && AppState.currentState === "active") {
      signInBiometricAuth();
    }
  }

  useEffect(() => {
    changeNavigationBarColor(colors.background, !isDark);
  }, [isFocused]);

  return (
    <View style={styles.container} backgroundColor={colors.background}>
        <StatusBar 
          backgroundColor={colors.background}
          barStyle={isDark ? "light-content" : "dark-content"}/>

        <Image
          style={styles.logo}
          color={colors.primary}
          source={{
            uri: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAACXBIWXMAAAsTAAALEwEAmpwYAAANBklEQVR4nO3dTaxd1XXA8b+N4/CwcUFCJDYK2AhEHadtiEKEVEChaVMVBG5GrcSgUdIgpEYKzKJ21CqDQD4qhQH5GKRK0qqTGsWM+mFCkcCuILhqhBSXqsH4uTSSZRdiP55teK+DfSyeEsy99+19zz77rP9P2rL05HPP2vusve75uueAJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEkamg21A9BcbASuA25a03YC27p2+ZoG8Is17fWuvQwcWdOOAis9xa+eWADG4XLgDuBO4OPAHuDSwutYBl4EngJ+BDxNKhiSKvgQ8CXgEHAeWO25ne/W/aUuFklzdjXwEHCY/if8pHa4i+3qufVeCupO4AnqfNOvZ8/giS5mSRnuBp6l/qReb3sGuKv4qEgj9yngBepP4FLtx12fJL2L3cCT1J+w82oHuj5KWmML8DBwjvqTdN7tHPDlrs9SeHcDr1B/YvbdXun6LoX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1UAByn8m2uUgUiig3dwb/UNAWCsDpzOWvKxKFIsrNndzcnbsWCsCJzOU/USQKRZSbO7m5K9ILKnOey36YgT+aWYO0gZQ7Obk3+JertrAH8GLm8h8GPlciEIXyOVLu5MjNXQF7yX87yxJwR9+Bq1l3kHImN+/u7TvwMVoAzlCmCNyPhwO6uA2kHCkx+U8Dl/Yb/ng9Tv4GWXtO4AHgRrxEqJQDN5JyIveYf23b12cnxu7TlNswNlsf7U9oQCu7w1cCLwPbKschTeN1YCdwqnIcE7VwFQDSQD5SOwhpSg/TwOSHdvYAIJ0MfAm4pnYg0rs4Tjqn8EbtQKZxSe0AZvAm8BpeWtGwPQQ8VzuIabW0BwDpkOUZ4NbagUjv4BDw28BK7UCm1VoBANgOPA/sqB2ItMZx4Bbg1dqBzKKVk4BrvQr8IbBcOxCps0zKyaYmP7RZACAdY/1p7SCkzmdJe6XNaekk4C/7CfBfwF3ApsqxKKZl0g0/f1c7kMhuARapf+eXLVZbBD6KBmE7cJD6SWGL0Q4C70eDshH4DO4N2ObXFkk51uq5sxAWgD8n3TRUO2Fs42ivkXJqgZFp8T6AaV1JumtwL/D7wGV1w1FjloB/BH4I7KeRe/tnNeYCsNYC8HvA7wJ7gF3AVcBW4oyB3tkq6eEdJ4CfkR7j9S/AP9PI/fySJEmSJEmSJEmSJEmSJEmSJEmSJEmSJGlc/h+Kp2A9dS96UwAAAABJRU5ErkJggg==',
          }}
        />

        <Text>App Locked</Text>

        <TouchableOpacity
            style={[styles.button, {backgroundColor: colors.primary}]}
            onPress={unlock}
            hitSlop={{top: 20, bottom: 20, left: 20, right: 20}}
            >
              <Text style={[styles.buttonText, { color: '#fff'}]}>Unlock</Text>
        </TouchableOpacity>
    </View>
  );
}