TP-0 | fixes
This commit is contained in:
@@ -404,9 +404,7 @@ const TrackingComponent: React.FC<ITrackingComponent> = ({ children }) => {
|
||||
useEffect(() => {
|
||||
let appStateSubscription: NativeEventSubscription;
|
||||
appStateSubscription = AppState.addEventListener('change', handleAppStateChange);
|
||||
if (AppState.currentState === AppStates.ACTIVE) {
|
||||
CosmosForegroundService.start(tasks);
|
||||
}
|
||||
CosmosForegroundService.start(tasks);
|
||||
return () => {
|
||||
appStateSubscription?.remove();
|
||||
};
|
||||
|
||||
@@ -37,9 +37,6 @@ export const getPermissionsToRequest = async () => {
|
||||
if (!notificationStatus) {
|
||||
permissionsToRequest.push(permission);
|
||||
} else {
|
||||
if (AppState.currentState !== AppStates.ACTIVE) {
|
||||
continue;
|
||||
}
|
||||
const isFGSRunning = await CosmosForegroundService.isRunning();
|
||||
if (!isFGSRunning) {
|
||||
CosmosForegroundService.start();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import ForegroundService from '@supersami/rn-foreground-service';
|
||||
import { logError } from '../../components/utlis/errorUtils';
|
||||
import { GLOBAL } from '../../constants/Global';
|
||||
import { AppState } from 'react-native';
|
||||
import { AppStates } from '@types/appStates';
|
||||
|
||||
export interface IForegroundTask {
|
||||
task: () => void;
|
||||
@@ -34,6 +36,9 @@ class CosmosForegroundService {
|
||||
private constructor() {}
|
||||
|
||||
static async start(tasks?: IForegroundTask[]) {
|
||||
if (AppState.currentState !== AppStates.ACTIVE) {
|
||||
return;
|
||||
}
|
||||
if (GLOBAL.IS_IMPERSONATED) {
|
||||
return;
|
||||
}
|
||||
@@ -60,6 +65,9 @@ class CosmosForegroundService {
|
||||
}
|
||||
|
||||
static async update() {
|
||||
if (AppState.currentState !== AppStates.ACTIVE) {
|
||||
return;
|
||||
}
|
||||
if (GLOBAL.IS_IMPERSONATED) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user