Add isFirstSession property to context

This commit is contained in:
Quincy Morgan
2020-03-31 15:45:52 -07:00
parent 5afb2ce11c
commit 170cf0beea
3 changed files with 11 additions and 4 deletions
+1
View File
@@ -55,6 +55,7 @@ export function coreContext() {
/* eslint-enable no-console */
}
};
context.isFirstSession = !context.storage('sawSplash') && !context.storage('sawPrivacyVersion');
/* User interface and keybinding */
+3 -2
View File
@@ -14,12 +14,13 @@ export function uiSplash(context) {
// If user has not seen this version of the privacy policy, show the splash again.
let updateMessage = '';
const sawPrivacyVersion = context.storage('sawPrivacyVersion');
let showSplash = !context.storage('sawSplash');
if (sawPrivacyVersion !== context.privacyVersion) {
updateMessage = t('splash.privacy_update');
context.storage('sawSplash', null);
showSplash = true;
}
if (context.storage('sawSplash')) return;
if (!showSplash) return;
context.storage('sawSplash', true);
context.storage('sawPrivacyVersion', context.privacyVersion);
+7 -2
View File
@@ -15,8 +15,13 @@ export function uiVersion(context) {
var matchedVersion = currVersion.match(/\d+\.\d+\.\d+.*/);
if (sawVersion === null && matchedVersion !== null) {
isNewVersion = (context.storage('sawVersion') !== currVersion);
isNewUser = !context.storage('sawSplash');
if (context.storage('sawVersion')) {
isNewUser = false;
isNewVersion = context.storage('sawVersion') !== currVersion;
} else {
isNewUser = true;
isNewVersion = true;
}
context.storage('sawVersion', currVersion);
sawVersion = currVersion;
}