From 7f8ade7747d4c2e38aed6297d981bf54a23fc28e Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Tue, 8 Aug 2017 11:15:38 -0700 Subject: [PATCH] Remove migration-related functionality, leaving export stuff FREEBIE --- _locales/en/messages.json | 16 ---- background.html | 7 -- js/background.js | 1 - js/views/inbox_view.js | 29 ------ js/views/migration_view.js | 190 ------------------------------------- test/index.html | 1 - 6 files changed, 244 deletions(-) delete mode 100644 js/views/migration_view.js diff --git a/_locales/en/messages.json b/_locales/en/messages.json index baa5a7794..c6f434671 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -3,18 +3,10 @@ "message": "Loading...", "description": "Message shown on the loading screen before we've loaded any messages" }, - "migrationWarning": { - "message": "The Signal Desktop Chrome app has been deprecated. Would you like to migrate to the new Signal Desktop now?", - "description": "Warning notification that this version of the app has been deprecated and the user must migrate" - }, "exportInstructions": { "message": "The first step is to choose a directory to store this application's exported data. It will contain your message history and sensitive cryptographic data, so be sure to save it somewhere private.", "description": "Description of the export process" }, - "migrate": { - "message": "Migrate", - "description": "Button label to begin migrating this client to Electron" - }, "chooseDirectory": { "message": "Choose directory", "description": "Button to allow the user to export all data from app as part of migration process" @@ -35,14 +27,6 @@ "message": "Unfortunately, something went wrong during the export. First, double-check your target empty directory for write access and enough space. Then, please submit a debug log so we can help you get migrated!", "description": "Helper text if the user went forward on migrating the app, but ran into an error" }, - "confirmMigration": { - "message": "Start migration process? You will not be able to send or receive Signal messages from this application while the migration is in progress.", - "description": "Confirmation dialogue when beginning migration" - }, - "migrationDisconnecting": { - "message": "Disconnecting...", - "description": "Displayed while we wait for pending incoming messages to process" - }, "exporting": { "message": "Please wait while we export your data. It may take several minutes. You can still use Signal on your phone and other devices during this time.", "description": "Message shown on the migration screen while we export data" diff --git a/background.html b/background.html index 11d2a46f8..78cc9fba3 100644 --- a/background.html +++ b/background.html @@ -122,12 +122,6 @@ {{ expiredWarning }} - - diff --git a/js/background.js b/js/background.js index c09001ceb..cd5e4028d 100644 --- a/js/background.js +++ b/js/background.js @@ -161,7 +161,6 @@ window.removeEventListener('online', connect); if (!Whisper.Registration.isDone()) { return; } - if (Whisper.Migration.inProgress()) { return; } if (Whisper.Import.isIncomplete()) { return; } if (messageReceiver) { messageReceiver.close(); } diff --git a/js/views/inbox_view.js b/js/views/inbox_view.js index 8c47ae2d1..0518f5643 100644 --- a/js/views/inbox_view.js +++ b/js/views/inbox_view.js @@ -149,15 +149,6 @@ var banner = new Whisper.ExpiredAlertBanner().render(); banner.$el.prependTo(this.$el); this.$el.addClass('expired'); - } else if (Whisper.Migration.inProgress()) { - if (this.appLoadingScreen) { - this.appLoadingScreen.remove(); - this.appLoadingScreen = null; - } - this.showMigrationScreen(); - } else if (storage.get('migrationEnabled')) { - var migrationBanner = new Whisper.MigrationAlertBanner().render(); - migrationBanner.$el.prependTo(this.$el); } }, render_attributes: { @@ -178,15 +169,6 @@ 'input input.search': 'filterContacts', 'click .restart-signal': window.restart, 'show .lightbox': 'showLightbox', - 'click .migrate': 'confirmMigration' - }, - confirmMigration: function() { - this.confirm(i18n('confirmMigration'), i18n('migrate')).then(this.showMigrationScreen.bind(this)); - }, - showMigrationScreen: function() { - this.migrationScreen = new Whisper.MigrationView(); - this.migrationScreen.render(); - this.migrationScreen.$el.prependTo(this.el); }, startConnectionListener: function() { this.interval = setInterval(function() { @@ -301,15 +283,4 @@ }; } }); - - Whisper.MigrationAlertBanner = Whisper.View.extend({ - templateName: 'migration_alert', - className: 'expiredAlert clearfix', - render_attributes: function() { - return { - migrationWarning: i18n('migrationWarning'), - migrate: i18n('migrate'), - }; - } - }); })(); diff --git a/js/views/migration_view.js b/js/views/migration_view.js deleted file mode 100644 index fd9a13c6d..000000000 --- a/js/views/migration_view.js +++ /dev/null @@ -1,190 +0,0 @@ -;(function () { - 'use strict'; - window.Whisper = window.Whisper || {}; - - var State = { - DISCONNECTING: 1, - EXPORTING: 2, - COMPLETE: 3 - }; - - Whisper.Migration = { - isComplete: function() { - return storage.get('migrationState') === State.COMPLETE; - }, - inProgress: function() { - return storage.get('migrationState') > 0 || this.everComplete(); - }, - markComplete: function(target) { - storage.put('migrationState', State.COMPLETE); - storage.put('migrationEverCompleted', true); - if (target) { - storage.put('migrationStorageLocation', target); - } - }, - cancel: function() { - storage.remove('migrationState'); - }, - beginExport: function() { - storage.put('migrationState', State.EXPORTING); - return Whisper.Backup.backupToDirectory(); - }, - init: function() { - storage.put('migrationState', State.DISCONNECTING); - Whisper.events.trigger('start-shutdown'); - }, - everComplete: function() { - return Boolean(storage.get('migrationEverCompleted')); - }, - getExportLocation: function() { - return storage.get('migrationStorageLocation'); - } - }; - - Whisper.MigrationView = Whisper.View.extend({ - templateName: 'app-migration-screen', - className: 'app-loading-screen', - events: { - 'click .install': 'onClickInstall', - 'click .export': 'onClickExport', - 'click .debug-log': 'onClickDebugLog', - }, - initialize: function() { - if (!Whisper.Migration.inProgress()) { - return; - } - - // We could be wedged in an 'in progress' state, the migration was started then the - // app restarted in the middle. - if (Whisper.Migration.everComplete()) { - // If the user has ever successfully exported before, we'll show the 'finished' - // screen with the 'Export again' button. - Whisper.Migration.markComplete(); - } else if (!Whisper.Migration.isComplete()) { - // This takes the user back to the very beginning of the process. - Whisper.Migration.cancel(); - } - }, - render_attributes: function() { - var message; - var exportButton; - var hideProgress = Whisper.Migration.isComplete(); - var debugLogButton = i18n('submitDebugLog'); - var installButton = i18n('installNewSignal'); - - if (this.error) { - return { - message: i18n('exportError'), - hideProgress: true, - exportButton: i18n('exportAgain'), - debugLogButton: i18n('submitDebugLog'), - }; - } - - switch (storage.get('migrationState')) { - case State.COMPLETE: - var location = Whisper.Migration.getExportLocation() || i18n('selectedLocation'); - message = i18n('exportComplete', location); - exportButton = i18n('exportAgain'); - debugLogButton = null; - break; - case State.EXPORTING: - message = i18n('exporting'); - break; - case State.DISCONNECTING: - message = i18n('migrationDisconnecting'); - installButton = null; - break; - default: - hideProgress = true; - message = i18n('exportInstructions'); - exportButton = i18n('export'); - debugLogButton = null; - installButton = null; - } - - return { - hideProgress: hideProgress, - message: message, - exportButton: exportButton, - debugLogButton: debugLogButton, - installButton: installButton, - }; - }, - onClickInstall: function() { - var url = 'https://support.whispersystems.org/hc/en-us/articles/214507138'; - window.open(url, '_blank'); - }, - onClickDebugLog: function() { - this.openDebugLog(); - }, - openDebugLog: function() { - this.closeDebugLog(); - this.debugLogView = new Whisper.DebugLogView(); - this.debugLogView.$el.appendTo(this.el); - }, - closeDebugLog: function() { - if (this.debugLogView) { - this.debugLogView.remove(); - this.debugLogView = null; - } - }, - onClickExport: function() { - this.error = null; - - if (!Whisper.Migration.everComplete()) { - return this.beginMigration(); - } - - // Different behavior for the user's second time through - Whisper.Migration.beginExport() - .then(this.completeMigration.bind(this)) - .catch(function(error) { - if (error.name !== 'ChooseError') { - this.error = error.message; - } - // Even if we run into an error, we call this complete because the user has - // completed the process once before. - Whisper.Migration.markComplete(); - this.render(); - }.bind(this)); - this.render(); - }, - beginMigration: function() { - Whisper.events.once('shutdown-complete', function() { - Whisper.Migration.beginExport() - .then(this.completeMigration.bind(this)) - .catch(this.onError.bind(this)); - - // Rendering because we're now in the 'exporting' state - this.render(); - }.bind(this)); - - // tells MessageReceiver to disconnect and drain its queue, will fire - // 'shutdown-complete' event when that is done. Might result in a synchronous - // event, so call it after we register our callback. - Whisper.Migration.init(); - - // Rendering because we're now in the 'disconnected' state - this.render(); - }, - completeMigration: function(target) { - // This will prevent connection to the server on future app launches - Whisper.Migration.markComplete(target); - this.render(); - }, - onError: function(error) { - if (error.name === 'ChooseError') { - this.cancelMigration(); - } else { - Whisper.Migration.cancel(); - this.error = error.message; - this.render(); - } - }, - cancelMigration: function() { - Whisper.Migration.cancel(); - this.render(); - } - }); -}()); diff --git a/test/index.html b/test/index.html index 0baa87c9d..3217171a6 100644 --- a/test/index.html +++ b/test/index.html @@ -629,7 +629,6 @@ -