From 3cce2cd723cd5d12d5fd92e17a8b5cc648adfc8b Mon Sep 17 00:00:00 2001 From: Kshitij Pramod Ghongadi Date: Fri, 12 Apr 2024 17:41:45 +0530 Subject: [PATCH] TP-61032 | Codepush Range error crash fix (#10428) --- App.tsx | 29 ++++++++++++++++++++++++----- package.json | 3 ++- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/App.tsx b/App.tsx index a603b59532..bfb3d4d3f3 100644 --- a/App.tsx +++ b/App.tsx @@ -21,10 +21,29 @@ export default class App extends Component<{}> { getBuildConfigDetails().then((res) => { flavor = res?.baseUrl; }); - codePush.sync({ - installMode: codePush.InstallMode.ON_NEXT_RESUME, - mandatoryInstallMode: codePush.InstallMode.IMMEDIATE, - }); + codePush.sync( + { + installMode: codePush.InstallMode.IMMEDIATE, + mandatoryInstallMode: codePush.InstallMode.IMMEDIATE, + }, + (status) => { + this.onCodepushStatusChange(status); + } + ); + }; + + onCodepushStatusChange = (status: codePush.SyncStatus) => { + switch (status) { + case codePush.SyncStatus.UPDATE_IGNORED: + logToSentry( + `Codepush Ignored | Status: ${status} | MethodName: onCodepushStatusChange` + ); + break; + case codePush.SyncStatus.UNKNOWN_ERROR: + logToSentry( + `Codepush Failed | Status: ${status} | MethodName: onCodepushStatusChange` + ); + } }; getInitialCta = (): CtaData | undefined => { @@ -61,4 +80,4 @@ export default class App extends Component<{}> { // return error screen } } -} \ No newline at end of file +} diff --git a/package.json b/package.json index 44beb737f1..b833d41810 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,8 @@ "react-redux": "^8.1.2", "redux": "^4.2.1", "redux-persist": "^6.0.0", - "redux-thunk": "^2.4.2" + "redux-thunk": "^2.4.2", + "whatwg-fetch": "3.6.2" }, "devDependencies": { "@types/jest": "^29.5.3",