Protocol upgrading WIP

This commit is contained in:
Mo Bitar
2020-03-15 18:29:01 -05:00
parent 5a6a41933a
commit 148e840757
15 changed files with 956 additions and 403 deletions

View File

@@ -38,9 +38,7 @@ class FooterCtrl extends PureCtrl {
this.rooms = [];
this.themesWithIcons = [];
this.showSyncResolution = false;
this.addRootScopeListeners();
this.statusManager.addStatusObserver((string) => {
this.$timeout(() => {
this.arbitraryStatusMessage = string;
@@ -48,6 +46,14 @@ class FooterCtrl extends PureCtrl {
});
}
reloadUpgradeStatus() {
this.godService.checkForSecurityUpdate().then((available) => {
this.setState({
dataUpgradeAvailable: available
});
});
}
onAppLaunch() {
super.onAppLaunch();
const hasPasscode = this.application.hasPasscode();
@@ -55,9 +61,7 @@ class FooterCtrl extends PureCtrl {
hasPasscode: hasPasscode
});
this.godService.checkForSecurityUpdate().then((available) => {
this.securityUpdateAvailable = available;
});
this.reloadUpgradeStatus();
this.user = this.application.getUser();
this.updateOfflineStatus();
this.findErrors();
@@ -66,9 +70,6 @@ class FooterCtrl extends PureCtrl {
}
addRootScopeListeners() {
this.$rootScope.$on("security-update-status-changed", () => {
this.securityUpdateAvailable = this.godService.securityUpdateAvailable;
});
this.$rootScope.$on("reload-ext-data", () => {
this.reloadExtendedData();
});
@@ -110,7 +111,9 @@ class FooterCtrl extends PureCtrl {
/** @override */
onAppEvent(eventName) {
if (eventName === ApplicationEvents.EnteredOutOfSync) {
if (eventName === ApplicationEvents.KeyStatusChanged) {
this.reloadUpgradeStatus();
} else if (eventName === ApplicationEvents.EnteredOutOfSync) {
this.setState({
outOfSync: true
});
@@ -220,7 +223,7 @@ class FooterCtrl extends PureCtrl {
}
openSecurityUpdate() {
this.godService.presentPasswordWizard('upgrade-security');
this.godService.performProtocolUpgrade();
}
findErrors() {

View File

@@ -67,10 +67,7 @@ class RootCtrl extends PureCtrl {
async watchLockscreenValue() {
return new Promise((resolve) => {
const onLockscreenValue = (value) => {
const response = new ChallengeResponse({
challenge: Challenges.LocalPasscode,
value: value
});
const response = new ChallengeResponse(Challenges.LocalPasscode, value);
resolve([response]);
};
this.setState({ onLockscreenValue });
@@ -86,7 +83,7 @@ class RootCtrl extends PureCtrl {
}
return this.watchLockscreenValue();
},
handleChallengeFailures: (responses) => {
handleFailedChallengeResponses: (responses) => {
for (const response of responses) {
if (response.challenge === Challenges.LocalPasscode) {
this.application.alertService.alert({