Merge pull request #619 from navi-medici/hotfix/glitchtip-fixes

TP-0 | Glitchtip fixes
This commit is contained in:
Aman Chaturvedi
2023-10-17 17:18:41 +05:30
committed by GitHub
4 changed files with 15 additions and 6 deletions

View File

@@ -16,13 +16,13 @@ export const getVisitedWidgetsNodeList = (
let visitedWidgetsNodeList: string[] = [startingWidgetName];
let nextScreenName = '';
const MAX_WIDGET_SIZE = Object.keys(templateData.widget).length;
const MAX_WIDGET_SIZE = Object.keys(templateData?.widget || {}).length;
let iteration = 0;
while (nextScreenName !== CommonCaseWidgetId.END && iteration++ <= MAX_WIDGET_SIZE) {
const currentScreenName = visitedWidgetsNodeList[visitedWidgetsNodeList.length - 1];
const currentScreenName = visitedWidgetsNodeList?.[visitedWidgetsNodeList?.length - 1];
nextScreenName = getNextWidget(
templateData.widget[currentScreenName].conditionActions,
templateData?.widget?.[currentScreenName]?.conditionActions,
formWidgetContext
);
visitedWidgetsNodeList.push(nextScreenName);

View File

@@ -1,7 +1,8 @@
import { Permission, PermissionsAndroid, Platform } from 'react-native';
import { AppState, Permission, PermissionsAndroid, Platform } from 'react-native';
import { PermissionsToCheck } from '../../common/Constants';
import { checkNotifications } from 'react-native-permissions';
import CosmosForegroundService from '../../services/foregroundServices/foreground.service';
import { AppStates } from '@types/appStates';
let isNotificationPermissionEnabled = true;
@@ -32,6 +33,7 @@ export const getPermissionsToRequest = async () => {
if (permission === PermissionsAndroid.PERMISSIONS.POST_NOTIFICATION) {
const notificationPermission = await checkNotifications();
const notificationStatus = notificationPermission.status === 'granted';
isNotificationPermissionEnabled = notificationStatus;
if (!notificationStatus) {
permissionsToRequest.push(permission);
} else {
@@ -43,7 +45,6 @@ export const getPermissionsToRequest = async () => {
CosmosForegroundService.update();
}
}
isNotificationPermissionEnabled = notificationStatus;
continue;
}
const granted = await PermissionsAndroid.check(permission);

View File

@@ -5,7 +5,7 @@ export const initCrashlytics = async (userState: IUserSlice) => {
if (!userState) return;
await Promise.all([
crashlytics().setUserId(userState.user?.emailId as string),
crashlytics().setUserId((userState.user?.emailId || '') as string),
crashlytics().setAttributes({
deviceId: userState.deviceId,
phoneNumber: userState.user?.phoneNumber as string,

View File

@@ -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;
}