Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧹 Profile cleanup #1028

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion www/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@
"name": "Unused apps disabled",
"description": {
"android-disable-lt-12": "On the app settings page, go to 'Permissions' and ensure that the app permissions will not be automatically reset.",
"android-disable-gte-12": "On the app settings page, turn off 'Remove permissions and free up space.'",
"android-disable-12": "On the app settings page, turn off 'Remove permissions and free up space.'",
"android-disable-gte-13": "On the app settings page, turn off 'Pause app activity if unused.'",
"ios": "Please allow."
}
},
Expand Down
7 changes: 5 additions & 2 deletions www/js/appstatus/permissioncheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,11 @@ controller("PermissionCheckControl", function($scope, $element, $attrs,
return checkOrFix(ignoreBatteryOptCheck, $window.cordova.plugins.BEMDataCollection.isIgnoreBatteryOptimizations,
$scope.recomputeBackgroundRestrictionStatus, false);
};
var androidUnusedDescTag = "intro.appstatus.unusedapprestrict.description.android-disable-gte-12";
if ($scope.osver < 12) {
var androidUnusedDescTag = "intro.appstatus.unusedapprestrict.description.android-disable-gte-13";
if ($scope.osver == 12) {
androidUnusedDescTag= "intro.appstatus.unusedapprestrict.description.android-disable-12";
}
else if ($scope.osver < 12) {
androidUnusedDescTag= "intro.appstatus.unusedapprestrict.description.android-disable-lt-12";
}
let unusedAppsUnrestrictedCheck = {
Expand Down
19 changes: 7 additions & 12 deletions www/js/control/AppStatusModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ const AppStatusModal = ({permitVis, setPermitVis, dialogStyle, settingsScope}) =

const [explainVis, setExplainVis] = useState<boolean>(false);

const [backgroundRestricted, setBackgroundRestricted] = useState<boolean>(false);
const [allowBackgroundInstructions, setAllowBackgroundInstructions] = useState<Array<any>>([]);

const [checkList, setCheckList] = useState([]);
const [explanationList, setExplanationList] = useState<Array<any>>([]);
const [haveSetText, setHaveSetText] = useState<boolean>(false);
Expand Down Expand Up @@ -272,8 +269,11 @@ const AppStatusModal = ({permitVis, setPermitVis, dialogStyle, settingsScope}) =
return checkOrFix(ignoreBatteryOptCheck, window['cordova'].plugins.BEMDataCollection.isIgnoreBatteryOptimizations,
false);
};
var androidUnusedDescTag = "intro.appstatus.unusedapprestrict.description.android-disable-gte-12";
if (osver < 12) {
var androidUnusedDescTag = "intro.appstatus.unusedapprestrict.description.android-disable-gte-13";
if (osver == 12) {
androidUnusedDescTag= "intro.appstatus.unusedapprestrict.description.android-disable-12";
}
else if (osver < 12) {
androidUnusedDescTag= "intro.appstatus.unusedapprestrict.description.android-disable-lt-12";
}
let unusedAppsUnrestrictedCheck = {
Expand Down Expand Up @@ -313,13 +313,8 @@ const AppStatusModal = ({permitVis, setPermitVis, dialogStyle, settingsScope}) =

setExplanationList(tempExplanations);

//waiting on samsung feedback, need more information
setBackgroundRestricted(false);
if(window['device'].manufacturer.toLowerCase() == "samsung") {
setBackgroundRestricted(true);
setAllowBackgroundInstructions(t("intro.allow_background.samsung"));
}

//TODO - update samsung handling based on feedback

console.log("Explanation = "+explanationList);
}

Expand Down
3 changes: 1 addition & 2 deletions www/js/control/DataDatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { DatePickerModal } from 'react-native-paper-dates';
import { useTranslation } from "react-i18next";
import { getAngularService } from "../angular-react-helper";

const DataDatePicker = ({date, setDate, open, setOpen}) => {
const DataDatePicker = ({date, setDate, open, setOpen, minDate}) => {
const { t, i18n } = useTranslation(); //able to pull lang from this
const ControlHelper = getAngularService("ControlHelper");

Expand All @@ -23,7 +23,6 @@ const DataDatePicker = ({date, setDate, open, setOpen}) => {
[setOpen, setDate]
);

const minDate = new Date(2015, 1, 1);
const maxDate = new Date();

return (
Expand Down
8 changes: 2 additions & 6 deletions www/js/control/PopOpCode.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useTranslation } from "react-i18next";
import QrCode from "../components/QrCode";
import AlertBar from "./AlertBar";

const PopOpCode = ({visibilityValue, tokenURL, action, setVis}) => {
const PopOpCode = ({visibilityValue, tokenURL, action, setVis, dialogStyle}) => {
const { t } = useTranslation();
const { colors } = useTheme();

Expand All @@ -31,7 +31,7 @@ const PopOpCode = ({visibilityValue, tokenURL, action, setVis}) => {
transparent={true}>
<Dialog visible={visibilityValue}
onDismiss={() => setVis(false)}
style={styles.dialog(colors.elevation.level3)}>
style={dialogStyle}>
<Dialog.Title>{t("general-settings.qrcode")}</Dialog.Title>
<Dialog.Content style={styles.content}>
<Text style={styles.text}>{t("general-settings.qrcode-share-title")}</Text>
Expand All @@ -51,10 +51,6 @@ const PopOpCode = ({visibilityValue, tokenURL, action, setVis}) => {
)
}
const styles = StyleSheet.create({
dialog: (surfaceColor) => ({
backgroundColor: surfaceColor,
margin: 1,
}),
title:
{
alignItems: 'center',
Expand Down
15 changes: 11 additions & 4 deletions www/js/control/ProfileSettings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const ProfileSettings = () => {
const [syncSettings, setSyncSettings] = useState({});
const [cacheResult, setCacheResult] = useState("");
const [connectSettings, setConnectSettings] = useState({});
const [appVersion, setAppVersion] = useState({});
const [appVersion, setAppVersion] = useState("");
const [uiConfig, setUiConfig] = useState({});
const [consentDoc, setConsentDoc] = useState({});
const [dumpDate, setDumpDate] = useState(new Date());
Expand Down Expand Up @@ -111,6 +111,11 @@ const ProfileSettings = () => {
setAppVersion(ClientStats.getAppVersion());
}

//previously not loaded on regular refresh, this ensures it stays caught up
useEffect(() => {
refreshNotificationSettings();
}, [uiConfig])

const whenReady = function(newAppConfig){
var tempUiConfig = newAppConfig;

Expand Down Expand Up @@ -507,8 +512,8 @@ const ProfileSettings = () => {
<ControlDataTable controlData={collectSettings.config}></ControlDataTable>
<SettingRow textKey="control.sync" iconName="pencil" action={editSyncConfig}></SettingRow>
<ControlDataTable controlData={syncSettings.show_config}></ControlDataTable>
<SettingRow textKey="control.app-version" iconName="application" action={()=>console.log("")} desc={appVersion}></SettingRow>
</ExpansionSection>
<SettingRow textKey="control.app-version" iconName="application" action={()=>console.log("")} desc={appVersion}></SettingRow>
</ScrollView>

{/* menu for "nuke data" */}
Expand Down Expand Up @@ -594,7 +599,7 @@ const ProfileSettings = () => {
</Modal>

{/* opcode viewing popup */}
<PopOpCode visibilityValue = {opCodeVis} setVis = {setOpCodeVis} tokenURL = {"emission://login_token?token="+authSettings.opcode} action={shareQR}></PopOpCode>
<PopOpCode visibilityValue = {opCodeVis} setVis = {setOpCodeVis} tokenURL = {"emission://login_token?token="+authSettings.opcode} action={shareQR} dialogStyle={styles.dialog(colors.elevation.level3)}></PopOpCode>

{/* {view permissions} */}
<AppStatusModal permitVis={permitVis} setPermitVis={setPermitVis} settingsScope={settingsScope} dialogStyle={styles.dialog(colors.elevation.level3)}></AppStatusModal>
Expand Down Expand Up @@ -683,7 +688,9 @@ const ProfileSettings = () => {
</Dialog>
</Modal>

<DataDatePicker date={dumpDate} setDate={setDumpDate} open={dateDumpVis} setOpen={setDateDumpVis}></DataDatePicker>
<DataDatePicker date={dumpDate} setDate={setDumpDate} open={dateDumpVis} setOpen={setDateDumpVis}
minDate={new Date(appConfig?.intro?.start_year, appConfig?.intro?.start_month - 1, 1)}>
</DataDatePicker>

<AlertBar visible={dataPushedVis} setVisible={setDataPushedVis} messageKey='all data pushed!'></AlertBar>
<AlertBar visible={invalidateSuccessVis} setVisible={setInvalidateSuccessVis} messageKey='success -> ' messageAddition={cacheResult}></AlertBar>
Expand Down
41 changes: 21 additions & 20 deletions www/js/splash/notifScheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,17 @@ angular.module('emission.splash.notifscheduler',
return true;
}

const setUpActions = () => {
const action = {
id: 'action',
title: 'Change Time',
launch: true
};
return new Promise((rs) => {
cordova.plugins.notification.local.addActions('reminder-actions', [action], rs);
});
}
/* remove notif actions as they do not work, can restore post routing migration */
// const setUpActions = () => {
// const action = {
// id: 'action',
// title: 'Change Time',
// launch: true
// };
// return new Promise((rs) => {
// cordova.plugins.notification.local.addActions('reminder-actions', [action], rs);
// });
// }

function debugGetScheduled(prefix) {
cordova.plugins.notification.local.getScheduled((notifs) => {
Expand Down Expand Up @@ -141,15 +142,15 @@ angular.module('emission.splash.notifscheduler',
title: scheme.title[localeCode],
text: scheme.text[localeCode],
trigger: {at: nDate},
actions: 'reminder-actions',
data: {
action: {
redirectTo: 'root.main.control',
redirectParams: {
openTimeOfDayPicker: true
}
}
}
// actions: 'reminder-actions',
// data: {
// action: {
// redirectTo: 'root.main.control',
// redirectParams: {
// openTimeOfDayPicker: true
// }
// }
// }
}
});
cordova.plugins.notification.local.cancelAll(() => {
Expand Down Expand Up @@ -262,7 +263,7 @@ angular.module('emission.splash.notifscheduler',
Logger.log("No reminder schemes found in config, not scheduling notifications");
return;
}
setUpActions();
//setUpActions();
update();
});

Expand Down