Skip to content

Commit

Permalink
Merge branch '7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
petmongrels committed Feb 26, 2024
2 parents 0490adc + 93de021 commit cc67434
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion packages/openchs-android/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ android {
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode System.getenv("versionCode") ? 4 * 1048576 + System.getenv("versionCode").toInteger() : 1
versionCode System.getenv("versionCode") ? 8 * 1048576 + System.getenv("versionCode").toInteger() : 1
//Our convention of versionCode from now in is to form the number from digits in versionName. E.g. for versionName 2.6.1, the versionCode should be 261. This is to avoid conflicts of versionCodes between different branches.
// Major.Minor.Patch. We should not change major version every release, just change the minor. Each number allows for two digits
// https://medium.com/@maxirosson/versioning-android-apps-d6ec171cfd82
Expand Down
1 change: 0 additions & 1 deletion packages/openchs-android/config/beforeSyncMessages.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"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
14 changes: 7 additions & 7 deletions packages/openchs-android/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/openchs-android/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"lodash": "4.17.21",
"moment": "2.29.4",
"native-base": "3.4.9",
"openchs-models": "1.31.38",
"openchs-models": "1.31.40",
"prop-types": "15.8.1",
"react": "18.2.0",
"react-native": "0.72.3",
Expand Down
7 changes: 5 additions & 2 deletions packages/openchs-android/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ import General from "./utility/General";
import EnvironmentConfig from "./framework/EnvironmentConfig";
import Config from './framework/Config';
import JailMonkey from 'jail-monkey';

const {TamperCheckModule} = NativeModules;
import KeepAwake from 'react-native-keep-awake';
import moment from "moment";

class App extends Component {
static childContextTypes = {
Expand Down Expand Up @@ -127,11 +128,13 @@ class App extends Component {
if (!_.isNil(GlobalContext.getInstance().routes) && this.state.isInitialisationDone) {
return GlobalContext.getInstance().routes
}
const message = `Upgrading database. Please do not close the App. May take upto 5 minutes on slow devices. Start Time: ${moment().format("hh:mm")}`
return (
<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>
<KeepAwake/>
<Text>{message}</Text>
</View>);
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/openchs-android/src/GlobalContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class GlobalContext {

async initialiseGlobalContext(appStore, realmFactory) {
this.db = await realmFactory.createRealm();
this.db.realmDb.compact();
this.beanRegistry.init(this.db);
this.reduxStore = appStore.create(this.beanRegistry.beansMap);
this.beanRegistry.setReduxStore(this.reduxStore);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export class IndividualGeneralHistoryActions {
encounters: [],
encounterTypes: [],
displayActionSelector: false,
draftEncounters: []
draftEncounters: [],
editFormRuleResponse: EditFormRuleResponse.createEditAllowedResponse()
};
}

Expand Down Expand Up @@ -66,6 +67,7 @@ export class IndividualGeneralHistoryActions {
programsAvailable: state.programsAvailable,
showCount: state.showCount,
encounterTypes: state.encounterTypes.slice(),
editFormRuleResponse: state.editFormRuleResponse
};
}

Expand Down
5 changes: 2 additions & 3 deletions packages/openchs-android/src/service/BackupRestoreRealm.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import IndividualService from "./IndividualService";
import SubjectMigrationService from "./SubjectMigrationService";
import FormMappingService from "./FormMappingService";
import UserInfoService from './UserInfoService';
import moment from "moment";

const REALM_FILE_NAME = "default.realm";
const REALM_FILE_FULL_PATH = `${fs.DocumentDirectoryPath}/${REALM_FILE_NAME}`;
Expand Down Expand Up @@ -77,8 +78,6 @@ export default class BackupRestoreRealmService extends BaseService {
});
}



restore(cb) {
let settingsService = this.getService(SettingsService);
let mediaService = this.getService(MediaService);
Expand Down Expand Up @@ -125,7 +124,7 @@ export default class BackupRestoreRealmService extends BaseService {
})
.then(() => {
General.logDebug("BackupRestoreRealmService", "Migrating database");
cb(92, "migratingDb");
cb(92, `Upgrading database. May take upto 5 minutes on slow devices. Start Time: ${moment().format("hh:mm")}`);
})
.then(() => this.dumpFileRestoreCompleted())
.then(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ import GeolocationFormElement from "../form/formElement/GeolocationFormElement";
import ProgramEncounterService from "../../service/program/ProgramEncounterService";
import moment from "moment";
import NewVisitPageView from "./NewVisitPageView";
import IndividualEncounterView from "../individual/IndividualEncounterView";
import {AvniAlert} from "../common/AvniAlert";
import {RejectionMessage} from "../approval/RejectionMessage";
import SummaryButton from "../common/SummaryButton";
import ProgramEnrolmentState from "../../state/ProgramEnrolmentState";
import BackgroundTimer from "react-native-background-timer";
import Timer from "../common/Timer";
import RuleEvaluationService from "../../service/RuleEvaluationService";
Expand Down

0 comments on commit cc67434

Please sign in to comment.