Skip to content

Commit

Permalink
#1309 - different message when migrating. display icon on launch screen.
Browse files Browse the repository at this point in the history
  • Loading branch information
petmongrels committed Feb 21, 2024
1 parent e0326c4 commit 133f1e6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
Binary file not shown.
1 change: 1 addition & 0 deletions packages/openchs-android/config/beforeSyncMessages.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"restoreCheckDb": "Finding pre-existing database",
"restoreDownloadPreparedDb": "Downloading prepared database",
"restoringDb": "Restoring database",
"migratingDb": "Restoring database (Updating database to current version)",
"restoreComplete": "Restore complete",
"restoreFailed": "Restore failed, will sync from server",
"restoreFailedTitle": "Fast sync failed",
Expand Down
38 changes: 20 additions & 18 deletions packages/openchs-android/src/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Alert, Clipboard, NativeModules, Text, View, BackHandler} from "react-native";
import {Alert, Clipboard, NativeModules, Text, View, BackHandler, Image} from "react-native";
import PropTypes from 'prop-types';
import React, {Component} from 'react';
import PathRegistry from './framework/routing/PathRegistry';
Expand Down Expand Up @@ -72,15 +72,15 @@ class App extends Component {
const clipboardString = `This is a Rooted Device. Exiting Avni application due to security considerations.`;
General.logError("App", `renderError: ${clipboardString}`);
Alert.alert("App will exit now", clipboardString,
[
{
text: "Ok",
onPress: () => {
BackHandler.exitApp();
}
}
],
{cancelable: false}
[
{
text: "Ok",
onPress: () => {
BackHandler.exitApp();
}
}
],
{cancelable: false}
);
return <View/>;
}
Expand All @@ -92,10 +92,10 @@ class App extends Component {
async componentDidMount() {
General.logDebug("App", "componentDidMount");
try {
if(!_.isNil(TamperCheckModule)) TamperCheckModule.validateAppSignature();
if (!_.isNil(TamperCheckModule)) TamperCheckModule.validateAppSignature();

const isThisProdLFEAppRunningOnRootedDevice = EnvironmentConfig.isProdAndDisallowedOnRootDevices() && JailMonkey.isJailBroken();
if(isThisProdLFEAppRunningOnRootedDevice) {
if (isThisProdLFEAppRunningOnRootedDevice) {
this.setState(state => ({...state, isDeviceRooted: isThisProdLFEAppRunningOnRootedDevice}));
return;
}
Expand All @@ -110,15 +110,15 @@ class App extends Component {
entitySyncStatusService.setup();

RegisterAndScheduleJobs();
this.setState(state => ({...state, isInitialisationDone: true }));
this.setState(state => ({...state, isInitialisationDone: true}));
} catch (e) {
console.log("App", e);
this.setState(state => ({...state, error: e }));
this.setState(state => ({...state, error: e}));
}
}

render() {
if(this.state.isDeviceRooted) {
if (this.state.isDeviceRooted) {
return this.renderRootedDeviceErrorMessageAndExitApplication();
}
if (this.state.error) {
Expand All @@ -128,9 +128,11 @@ class App extends Component {
return GlobalContext.getInstance().routes
}
return (
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
<Text>Upgrading data, Please do not close the App.</Text>
</View>);
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
<Image source={{uri: `asset:/logo.png`}}
style={{height: 120, width: 120, alignSelf: 'center'}} resizeMode={'center'}/>
<Text>Upgrading data, Please do not close the App.</Text>
</View>);
}
}

Expand Down
7 changes: 5 additions & 2 deletions packages/openchs-android/src/service/BackupRestoreRealm.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,11 @@ export default class BackupRestoreRealmService extends BaseService {
return fs.copyFile(fullFilePath, REALM_FILE_FULL_PATH);
})
.then(() => {
General.logDebug("BackupRestoreRealmService", "Refreshing application context");
cb(92, "restoringDb");
cb(91, "restoringDb");
})
.then(() => {
General.logDebug("BackupRestoreRealmService", "Migrating database");
cb(92, "migratingDb");
})
.then(() => this.dumpFileRestoreCompleted())
.then(() => {
Expand Down

0 comments on commit 133f1e6

Please sign in to comment.