Remove migration-related functionality, leaving export stuff

FREEBIE
This commit is contained in:
Scott Nonnenberg 2017-08-08 11:15:38 -07:00
parent 413fba80af
commit 7f8ade7747
No known key found for this signature in database
GPG Key ID: A4931C09644C654B
6 changed files with 0 additions and 244 deletions

View File

@ -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"

View File

@ -122,12 +122,6 @@
</a>
{{ expiredWarning }}
</script>
<script type='text/x-tmpl-mustache' id='migration_alert'>
<button class='migrate'>{{ migrate }}</button>
<div class='message'>
{{ migrationWarning }}
</div>
</script>
<script type='text/x-tmpl-mustache' id='banner'>
<div class='body'>
<span class='icon warning'></span>
@ -823,7 +817,6 @@
<script type='text/javascript' src='js/views/install_view.js'></script>
<script type='text/javascript' src='js/views/banner_view.js'></script>
<script type='text/javascript' src='js/views/identity_key_send_error_view.js'></script>
<script type='text/javascript' src='js/views/migration_view.js'></script>
<script type="text/javascript" src="js/views/phone-input-view.js"></script>
<script type='text/javascript' src='js/views/standalone_registration_view.js'></script>
<script type='text/javascript' src='js/views/app_view.js'></script>

View File

@ -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(); }

View File

@ -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'),
};
}
});
})();

View File

@ -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();
}
});
}());

View File

@ -629,7 +629,6 @@
<script type='text/javascript' src='../js/views/scroll_down_button_view.js' data-cover></script>
<script type='text/javascript' src='../js/views/banner_view.js' data-cover></script>
<script type="text/javascript" src='../js/views/identity_key_send_error_view.js' data-cover></script>
<script type='text/javascript' src='../js/views/migration_view.js'></script>
<script type="text/javascript" src="views/whisper_view_test.js"></script>
<script type="text/javascript" src="views/group_update_view_test.js"></script>