diff --git a/android/app/src/main/java/com/avapp/MainApplication.java b/android/app/src/main/java/com/avapp/MainApplication.java index 2c486e7b..b9d9e593 100644 --- a/android/app/src/main/java/com/avapp/MainApplication.java +++ b/android/app/src/main/java/com/avapp/MainApplication.java @@ -74,7 +74,6 @@ public class MainApplication extends Application implements ReactApplication { if (BuildConfig.DEBUG) { e.printStackTrace(); } - } } /** diff --git a/src/common/TrackingComponent.tsx b/src/common/TrackingComponent.tsx index 678e1738..f1ec50f4 100644 --- a/src/common/TrackingComponent.tsx +++ b/src/common/TrackingComponent.tsx @@ -53,7 +53,6 @@ const TrackingComponent: React.FC = ({ children }) => { const dispatch = useAppDispatch(); const appState = useRef(AppState.currentState); const user = useAppSelector((state) => state.user); - const isActive = useAppSelector((state) => state?.user?.user?.isActive); const { referenceId, @@ -132,6 +131,10 @@ const TrackingComponent: React.FC = ({ children }) => { }; const handleUpdateActiveness = async () => { + if (AppState.currentState === AppStates.ACTIVE) { + await setItem(StorageKeys.IS_USER_ACTIVE, 'true'); + return; + } const foregroundTimestamp = await getItem(StorageKeys.APP_FOREGROUND_TIMESTAMP); const backgroundTimestamp = await getItem(StorageKeys.APP_BACKGROUND_TIMESTAMP); const foregroundTime = dayjs(foregroundTimestamp); @@ -145,13 +148,7 @@ const TrackingComponent: React.FC = ({ children }) => { const isForegroundTimeWithInRange = diffBetweenCurrentTimeAndForegroundTime <= ACTIVITY_TIME_WINDOW; const isForegroundTimeAfterBackground = dayjs(foregroundTimestamp).isAfter(backgroundTimestamp); - console.log({ - diffBetweenBackgroundAndForegroundTime, - diffBetweenCurrentTimeAndForegroundTime, - isForegroundTimeWithInRange, - isForegroundTimeAfterBackground, - dayjs: dayjs().toString(), - }); + if (isForegroundTimeWithInRange) { if ( isForegroundTimeAfterBackground ||