(null);
const LabelTab = () => {
const { appConfig, loading } = useAppConfig();
const { t } = useTranslation();
+ const { colors } = useTheme();
const [surveyOpt, setSurveyOpt] = useState(null);
const [labelOptions, setLabelOptions] = useState(null);
@@ -48,6 +51,8 @@ const LabelTab = () => {
const CommHelper = getAngularService('CommHelper');
const enbs = getAngularService('EnketoNotesButtonService');
+ const [permissionVis, setPermissionVis] = useState(false);
+
// initialization, once the appConfig is loaded
useEffect(() => {
if (loading) return;
@@ -216,19 +221,7 @@ const LabelTab = () => {
function checkPermissionsStatus() {
$rootScope.$broadcast("recomputeAppStatus", (status) => {
if (!status) {
- $ionicPopup.show({
- title: t('control.incorrect-app-status'),
- template: t('control.fix-app-status'),
- scope: $rootScope,
- buttons: [{
- text: t('control.fix'),
- type: 'button-assertive',
- onTap: function (e) {
- $state.go('root.main.control', { launchAppStatusModal: 1 });
- return false;
- }
- }]
- });
+ setPermissionVis(true); //if the status is false, popup modal
}
});
}
@@ -286,6 +279,10 @@ const LabelTab = () => {
This is what `detachPreviousScreen:false` does. */
options={{detachPreviousScreen: false}} />
+
);
diff --git a/www/js/intro.js b/www/js/intro.js
index 5d74e7a5d..0bc7fa01d 100644
--- a/www/js/intro.js
+++ b/www/js/intro.js
@@ -164,6 +164,7 @@ angular.module('emission.intro', ['emission.splash.startprefs',
var prepopulateQRMessage = {};
prepopulateQRMessage.files = [pngFile];
prepopulateQRMessage.url = $scope.currentToken;
+ prepopulateQRMessage.message = $scope.currentToken;
window.plugins.socialsharing.shareWithOptions(prepopulateQRMessage, function(result) {
console.log("Share completed? " + result.completed); // On Android apps mostly return false even while it's true
diff --git a/www/js/main.js b/www/js/main.js
index 652d46054..79bfdee0d 100644
--- a/www/js/main.js
+++ b/www/js/main.js
@@ -37,7 +37,7 @@ angular.module('emission.main', ['emission.main.diary',
},
views: {
'main-control': {
- templateUrl: 'templates/control/main-control.html',
+ template: ``,
controller: 'ControlCtrl'
}
}
diff --git a/www/js/useAppStateChange.ts b/www/js/useAppStateChange.ts
new file mode 100644
index 000000000..8b9c6497c
--- /dev/null
+++ b/www/js/useAppStateChange.ts
@@ -0,0 +1,29 @@
+//this is a custom hook that listens for change in app state
+//detects when the app changed to active from inactive (ios) or background (android)
+//the executes "onResume" function that is passed in
+//https://reactnative.dev/docs/appstate based on react's example of detecting becoming active
+
+import { useEffect, useRef } from 'react';
+import { AppState } from 'react-native';
+
+const useAppStateChange = (onResume) => {
+
+ const appState = useRef(AppState.currentState);
+
+ useEffect(() => {
+ const subscription = AppState.addEventListener('change', nextAppState => {
+ if ( appState.current != 'active' && nextAppState === 'active') {
+ onResume();
+ }
+
+ appState.current = nextAppState;
+ console.log('AppState', appState.current);
+ });
+
+ }, []);
+
+ return {};
+ }
+
+ export default useAppStateChange;
+
\ No newline at end of file
diff --git a/www/templates/control/main-control.html b/www/templates/control/main-control.html
deleted file mode 100644
index 665eaf7e3..000000000
--- a/www/templates/control/main-control.html
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/www/templates/main-metrics.html b/www/templates/main-metrics.html
index 40e731d91..d3c8b7ce3 100644
--- a/www/templates/main-metrics.html
+++ b/www/templates/main-metrics.html
@@ -100,7 +100,7 @@ {{'main-metrics.how-it-compares'}}
- {{'main-metrics.calibrate'}}
+