2018-07-07 00:48:14 +00:00
|
|
|
/* global Whisper, storage, i18n, ConversationController */
|
|
|
|
|
|
|
|
/* eslint-disable more/no-then */
|
|
|
|
|
|
|
|
// eslint-disable-next-line func-names
|
2018-04-27 21:25:04 +00:00
|
|
|
(function() {
|
2017-08-08 00:24:59 +00:00
|
|
|
'use strict';
|
2018-07-07 00:48:14 +00:00
|
|
|
|
2017-08-08 00:24:59 +00:00
|
|
|
window.Whisper = window.Whisper || {};
|
|
|
|
|
2018-07-07 00:48:14 +00:00
|
|
|
const State = {
|
2017-08-08 00:24:59 +00:00
|
|
|
IMPORTING: 1,
|
New design for import/install, 'light' import (#2053)
- A new design for the import flow. It features:
- Icons at the top of every screen
- Gray background, blue buttons, thinner text
- Simpler copy
- A new design for the install flow. It features:
- Immediate entry into the QR code screen
- Animated dots to show that we're loading the QR code from the server
- Fewer screens: 1) QR 2) device name 3) sync-in-progress
- When not set up, the app opens directly into the install screen, which has been streamlined. The `--import` command-line argument will cause the app to open directly into the import flow.
- Support for two different flavors of builds - the normal build will open into the standard registration flow, and the import flavor will be exactly the same except during setup it will open directly into the import flow.
- A new design for the (dev-only) standalone registration view
- When these install sequences are active, the OS File menu has entries to allow you to switch the method of setup you'd like to use. These go away as soon as the first step is taken in any of these flows.
- The device name (chosen on initial setup) is now shown in the settings panel
- At the end of a light import, we hand off to the normal device link screen, starting at the QR code. On a full import, we remove the sensitive encryption information in the export to prevent conflicts on multiple imports.
- `Whisper.Backup.exportToDirectory()` takes an options object so you can tell it to do a light export.
- `Whisper.Backup.importFromDirectory()` takes an options object so you can force it to load only the light components found on disk. It also returns an object so you can tell whether a given import was a full import or light import.
- On start of import, we build a list of all the ids present in the messages, conversations, and groups stores in IndexedDB. This can take some time if a lot of data is in the database already, but it makes the subsequent deduplicated import very fast.
- Disappearing messages are now excluded when exporting
- Remove some TODOs in the tests
2018-02-22 18:40:32 +00:00
|
|
|
COMPLETE: 2,
|
|
|
|
LIGHT_COMPLETE: 3,
|
2017-08-08 00:24:59 +00:00
|
|
|
};
|
|
|
|
|
2018-07-07 00:48:14 +00:00
|
|
|
const IMPORT_STARTED = 'importStarted';
|
|
|
|
const IMPORT_COMPLETE = 'importComplete';
|
|
|
|
const IMPORT_LOCATION = 'importLocation';
|
2017-08-08 00:24:59 +00:00
|
|
|
|
|
|
|
Whisper.Import = {
|
2018-07-07 00:48:14 +00:00
|
|
|
isStarted() {
|
2017-08-08 00:24:59 +00:00
|
|
|
return Boolean(storage.get(IMPORT_STARTED));
|
|
|
|
},
|
2018-07-07 00:48:14 +00:00
|
|
|
isComplete() {
|
2017-08-08 00:24:59 +00:00
|
|
|
return Boolean(storage.get(IMPORT_COMPLETE));
|
|
|
|
},
|
2018-07-07 00:48:14 +00:00
|
|
|
isIncomplete() {
|
2017-08-08 00:24:59 +00:00
|
|
|
return this.isStarted() && !this.isComplete();
|
|
|
|
},
|
2018-07-07 00:48:14 +00:00
|
|
|
start() {
|
2017-08-30 16:32:16 +00:00
|
|
|
return storage.put(IMPORT_STARTED, true);
|
2017-08-08 00:24:59 +00:00
|
|
|
},
|
2018-07-07 00:48:14 +00:00
|
|
|
complete() {
|
2017-08-30 16:32:16 +00:00
|
|
|
return storage.put(IMPORT_COMPLETE, true);
|
2017-08-08 00:24:59 +00:00
|
|
|
},
|
2018-07-07 00:48:14 +00:00
|
|
|
saveLocation(location) {
|
2017-08-30 16:32:16 +00:00
|
|
|
return storage.put(IMPORT_LOCATION, location);
|
2017-08-08 00:24:59 +00:00
|
|
|
},
|
2018-07-07 00:48:14 +00:00
|
|
|
reset() {
|
2018-03-08 00:16:03 +00:00
|
|
|
return Whisper.Database.clear();
|
2018-04-27 21:25:04 +00:00
|
|
|
},
|
2017-08-08 00:24:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Whisper.ImportView = Whisper.View.extend({
|
New design for import/install, 'light' import (#2053)
- A new design for the import flow. It features:
- Icons at the top of every screen
- Gray background, blue buttons, thinner text
- Simpler copy
- A new design for the install flow. It features:
- Immediate entry into the QR code screen
- Animated dots to show that we're loading the QR code from the server
- Fewer screens: 1) QR 2) device name 3) sync-in-progress
- When not set up, the app opens directly into the install screen, which has been streamlined. The `--import` command-line argument will cause the app to open directly into the import flow.
- Support for two different flavors of builds - the normal build will open into the standard registration flow, and the import flavor will be exactly the same except during setup it will open directly into the import flow.
- A new design for the (dev-only) standalone registration view
- When these install sequences are active, the OS File menu has entries to allow you to switch the method of setup you'd like to use. These go away as soon as the first step is taken in any of these flows.
- The device name (chosen on initial setup) is now shown in the settings panel
- At the end of a light import, we hand off to the normal device link screen, starting at the QR code. On a full import, we remove the sensitive encryption information in the export to prevent conflicts on multiple imports.
- `Whisper.Backup.exportToDirectory()` takes an options object so you can tell it to do a light export.
- `Whisper.Backup.importFromDirectory()` takes an options object so you can force it to load only the light components found on disk. It also returns an object so you can tell whether a given import was a full import or light import.
- On start of import, we build a list of all the ids present in the messages, conversations, and groups stores in IndexedDB. This can take some time if a lot of data is in the database already, but it makes the subsequent deduplicated import very fast.
- Disappearing messages are now excluded when exporting
- Remove some TODOs in the tests
2018-02-22 18:40:32 +00:00
|
|
|
templateName: 'import-flow-template',
|
|
|
|
className: 'full-screen-flow',
|
2017-08-08 00:24:59 +00:00
|
|
|
events: {
|
New design for import/install, 'light' import (#2053)
- A new design for the import flow. It features:
- Icons at the top of every screen
- Gray background, blue buttons, thinner text
- Simpler copy
- A new design for the install flow. It features:
- Immediate entry into the QR code screen
- Animated dots to show that we're loading the QR code from the server
- Fewer screens: 1) QR 2) device name 3) sync-in-progress
- When not set up, the app opens directly into the install screen, which has been streamlined. The `--import` command-line argument will cause the app to open directly into the import flow.
- Support for two different flavors of builds - the normal build will open into the standard registration flow, and the import flavor will be exactly the same except during setup it will open directly into the import flow.
- A new design for the (dev-only) standalone registration view
- When these install sequences are active, the OS File menu has entries to allow you to switch the method of setup you'd like to use. These go away as soon as the first step is taken in any of these flows.
- The device name (chosen on initial setup) is now shown in the settings panel
- At the end of a light import, we hand off to the normal device link screen, starting at the QR code. On a full import, we remove the sensitive encryption information in the export to prevent conflicts on multiple imports.
- `Whisper.Backup.exportToDirectory()` takes an options object so you can tell it to do a light export.
- `Whisper.Backup.importFromDirectory()` takes an options object so you can force it to load only the light components found on disk. It also returns an object so you can tell whether a given import was a full import or light import.
- On start of import, we build a list of all the ids present in the messages, conversations, and groups stores in IndexedDB. This can take some time if a lot of data is in the database already, but it makes the subsequent deduplicated import very fast.
- Disappearing messages are now excluded when exporting
- Remove some TODOs in the tests
2018-02-22 18:40:32 +00:00
|
|
|
'click .choose': 'onImport',
|
2017-08-08 00:24:59 +00:00
|
|
|
'click .restart': 'onRestart',
|
|
|
|
'click .cancel': 'onCancel',
|
New design for import/install, 'light' import (#2053)
- A new design for the import flow. It features:
- Icons at the top of every screen
- Gray background, blue buttons, thinner text
- Simpler copy
- A new design for the install flow. It features:
- Immediate entry into the QR code screen
- Animated dots to show that we're loading the QR code from the server
- Fewer screens: 1) QR 2) device name 3) sync-in-progress
- When not set up, the app opens directly into the install screen, which has been streamlined. The `--import` command-line argument will cause the app to open directly into the import flow.
- Support for two different flavors of builds - the normal build will open into the standard registration flow, and the import flavor will be exactly the same except during setup it will open directly into the import flow.
- A new design for the (dev-only) standalone registration view
- When these install sequences are active, the OS File menu has entries to allow you to switch the method of setup you'd like to use. These go away as soon as the first step is taken in any of these flows.
- The device name (chosen on initial setup) is now shown in the settings panel
- At the end of a light import, we hand off to the normal device link screen, starting at the QR code. On a full import, we remove the sensitive encryption information in the export to prevent conflicts on multiple imports.
- `Whisper.Backup.exportToDirectory()` takes an options object so you can tell it to do a light export.
- `Whisper.Backup.importFromDirectory()` takes an options object so you can force it to load only the light components found on disk. It also returns an object so you can tell whether a given import was a full import or light import.
- On start of import, we build a list of all the ids present in the messages, conversations, and groups stores in IndexedDB. This can take some time if a lot of data is in the database already, but it makes the subsequent deduplicated import very fast.
- Disappearing messages are now excluded when exporting
- Remove some TODOs in the tests
2018-02-22 18:40:32 +00:00
|
|
|
'click .register': 'onRegister',
|
2017-08-08 00:24:59 +00:00
|
|
|
},
|
2018-07-07 00:48:14 +00:00
|
|
|
initialize() {
|
2017-08-08 00:24:59 +00:00
|
|
|
if (Whisper.Import.isIncomplete()) {
|
|
|
|
this.error = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.render();
|
|
|
|
this.pending = Promise.resolve();
|
|
|
|
},
|
2018-07-07 00:48:14 +00:00
|
|
|
render_attributes() {
|
2017-08-08 00:24:59 +00:00
|
|
|
if (this.error) {
|
|
|
|
return {
|
New design for import/install, 'light' import (#2053)
- A new design for the import flow. It features:
- Icons at the top of every screen
- Gray background, blue buttons, thinner text
- Simpler copy
- A new design for the install flow. It features:
- Immediate entry into the QR code screen
- Animated dots to show that we're loading the QR code from the server
- Fewer screens: 1) QR 2) device name 3) sync-in-progress
- When not set up, the app opens directly into the install screen, which has been streamlined. The `--import` command-line argument will cause the app to open directly into the import flow.
- Support for two different flavors of builds - the normal build will open into the standard registration flow, and the import flavor will be exactly the same except during setup it will open directly into the import flow.
- A new design for the (dev-only) standalone registration view
- When these install sequences are active, the OS File menu has entries to allow you to switch the method of setup you'd like to use. These go away as soon as the first step is taken in any of these flows.
- The device name (chosen on initial setup) is now shown in the settings panel
- At the end of a light import, we hand off to the normal device link screen, starting at the QR code. On a full import, we remove the sensitive encryption information in the export to prevent conflicts on multiple imports.
- `Whisper.Backup.exportToDirectory()` takes an options object so you can tell it to do a light export.
- `Whisper.Backup.importFromDirectory()` takes an options object so you can force it to load only the light components found on disk. It also returns an object so you can tell whether a given import was a full import or light import.
- On start of import, we build a list of all the ids present in the messages, conversations, and groups stores in IndexedDB. This can take some time if a lot of data is in the database already, but it makes the subsequent deduplicated import very fast.
- Disappearing messages are now excluded when exporting
- Remove some TODOs in the tests
2018-02-22 18:40:32 +00:00
|
|
|
isError: true,
|
|
|
|
errorHeader: i18n('importErrorHeader'),
|
2018-05-21 18:57:40 +00:00
|
|
|
errorMessageFirst: i18n('importErrorFirst'),
|
|
|
|
errorMessageSecond: i18n('importErrorSecond'),
|
New design for import/install, 'light' import (#2053)
- A new design for the import flow. It features:
- Icons at the top of every screen
- Gray background, blue buttons, thinner text
- Simpler copy
- A new design for the install flow. It features:
- Immediate entry into the QR code screen
- Animated dots to show that we're loading the QR code from the server
- Fewer screens: 1) QR 2) device name 3) sync-in-progress
- When not set up, the app opens directly into the install screen, which has been streamlined. The `--import` command-line argument will cause the app to open directly into the import flow.
- Support for two different flavors of builds - the normal build will open into the standard registration flow, and the import flavor will be exactly the same except during setup it will open directly into the import flow.
- A new design for the (dev-only) standalone registration view
- When these install sequences are active, the OS File menu has entries to allow you to switch the method of setup you'd like to use. These go away as soon as the first step is taken in any of these flows.
- The device name (chosen on initial setup) is now shown in the settings panel
- At the end of a light import, we hand off to the normal device link screen, starting at the QR code. On a full import, we remove the sensitive encryption information in the export to prevent conflicts on multiple imports.
- `Whisper.Backup.exportToDirectory()` takes an options object so you can tell it to do a light export.
- `Whisper.Backup.importFromDirectory()` takes an options object so you can force it to load only the light components found on disk. It also returns an object so you can tell whether a given import was a full import or light import.
- On start of import, we build a list of all the ids present in the messages, conversations, and groups stores in IndexedDB. This can take some time if a lot of data is in the database already, but it makes the subsequent deduplicated import very fast.
- Disappearing messages are now excluded when exporting
- Remove some TODOs in the tests
2018-02-22 18:40:32 +00:00
|
|
|
chooseButton: i18n('importAgain'),
|
2017-08-08 00:24:59 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-07-07 00:48:14 +00:00
|
|
|
let restartButton = i18n('importCompleteStartButton');
|
|
|
|
let registerButton = i18n('importCompleteLinkButton');
|
|
|
|
let step = 'step2';
|
New design for import/install, 'light' import (#2053)
- A new design for the import flow. It features:
- Icons at the top of every screen
- Gray background, blue buttons, thinner text
- Simpler copy
- A new design for the install flow. It features:
- Immediate entry into the QR code screen
- Animated dots to show that we're loading the QR code from the server
- Fewer screens: 1) QR 2) device name 3) sync-in-progress
- When not set up, the app opens directly into the install screen, which has been streamlined. The `--import` command-line argument will cause the app to open directly into the import flow.
- Support for two different flavors of builds - the normal build will open into the standard registration flow, and the import flavor will be exactly the same except during setup it will open directly into the import flow.
- A new design for the (dev-only) standalone registration view
- When these install sequences are active, the OS File menu has entries to allow you to switch the method of setup you'd like to use. These go away as soon as the first step is taken in any of these flows.
- The device name (chosen on initial setup) is now shown in the settings panel
- At the end of a light import, we hand off to the normal device link screen, starting at the QR code. On a full import, we remove the sensitive encryption information in the export to prevent conflicts on multiple imports.
- `Whisper.Backup.exportToDirectory()` takes an options object so you can tell it to do a light export.
- `Whisper.Backup.importFromDirectory()` takes an options object so you can force it to load only the light components found on disk. It also returns an object so you can tell whether a given import was a full import or light import.
- On start of import, we build a list of all the ids present in the messages, conversations, and groups stores in IndexedDB. This can take some time if a lot of data is in the database already, but it makes the subsequent deduplicated import very fast.
- Disappearing messages are now excluded when exporting
- Remove some TODOs in the tests
2018-02-22 18:40:32 +00:00
|
|
|
|
|
|
|
if (this.state === State.IMPORTING) {
|
|
|
|
step = 'step3';
|
|
|
|
} else if (this.state === State.COMPLETE) {
|
|
|
|
registerButton = null;
|
|
|
|
step = 'step4';
|
|
|
|
} else if (this.state === State.LIGHT_COMPLETE) {
|
|
|
|
restartButton = null;
|
|
|
|
step = 'step4';
|
2017-08-08 00:24:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
New design for import/install, 'light' import (#2053)
- A new design for the import flow. It features:
- Icons at the top of every screen
- Gray background, blue buttons, thinner text
- Simpler copy
- A new design for the install flow. It features:
- Immediate entry into the QR code screen
- Animated dots to show that we're loading the QR code from the server
- Fewer screens: 1) QR 2) device name 3) sync-in-progress
- When not set up, the app opens directly into the install screen, which has been streamlined. The `--import` command-line argument will cause the app to open directly into the import flow.
- Support for two different flavors of builds - the normal build will open into the standard registration flow, and the import flavor will be exactly the same except during setup it will open directly into the import flow.
- A new design for the (dev-only) standalone registration view
- When these install sequences are active, the OS File menu has entries to allow you to switch the method of setup you'd like to use. These go away as soon as the first step is taken in any of these flows.
- The device name (chosen on initial setup) is now shown in the settings panel
- At the end of a light import, we hand off to the normal device link screen, starting at the QR code. On a full import, we remove the sensitive encryption information in the export to prevent conflicts on multiple imports.
- `Whisper.Backup.exportToDirectory()` takes an options object so you can tell it to do a light export.
- `Whisper.Backup.importFromDirectory()` takes an options object so you can force it to load only the light components found on disk. It also returns an object so you can tell whether a given import was a full import or light import.
- On start of import, we build a list of all the ids present in the messages, conversations, and groups stores in IndexedDB. This can take some time if a lot of data is in the database already, but it makes the subsequent deduplicated import very fast.
- Disappearing messages are now excluded when exporting
- Remove some TODOs in the tests
2018-02-22 18:40:32 +00:00
|
|
|
isStep2: step === 'step2',
|
|
|
|
chooseHeader: i18n('loadDataHeader'),
|
|
|
|
choose: i18n('loadDataDescription'),
|
|
|
|
chooseButton: i18n('chooseDirectory'),
|
|
|
|
|
|
|
|
isStep3: step === 'step3',
|
|
|
|
importingHeader: i18n('importingHeader'),
|
|
|
|
|
|
|
|
isStep4: step === 'step4',
|
|
|
|
completeHeader: i18n('importCompleteHeader'),
|
2018-07-07 00:48:14 +00:00
|
|
|
restartButton,
|
|
|
|
registerButton,
|
2017-08-08 00:24:59 +00:00
|
|
|
};
|
|
|
|
},
|
2018-07-07 00:48:14 +00:00
|
|
|
onRestart() {
|
2017-08-08 00:24:59 +00:00
|
|
|
return window.restart();
|
|
|
|
},
|
2018-07-07 00:48:14 +00:00
|
|
|
onCancel() {
|
2017-08-08 00:24:59 +00:00
|
|
|
this.trigger('cancel');
|
|
|
|
},
|
2018-07-07 00:48:14 +00:00
|
|
|
onImport() {
|
2018-04-27 21:25:04 +00:00
|
|
|
window.Signal.Backup.getDirectoryForImport().then(
|
2018-07-07 00:48:14 +00:00
|
|
|
directory => {
|
2018-04-27 21:25:04 +00:00
|
|
|
this.doImport(directory);
|
2018-07-07 00:48:14 +00:00
|
|
|
},
|
|
|
|
error => {
|
2018-04-27 21:25:04 +00:00
|
|
|
if (error.name !== 'ChooseError') {
|
2018-07-21 19:00:08 +00:00
|
|
|
window.log.error(
|
2018-04-27 21:25:04 +00:00
|
|
|
'Error choosing directory:',
|
|
|
|
error && error.stack ? error.stack : error
|
|
|
|
);
|
|
|
|
}
|
2017-08-08 01:34:33 +00:00
|
|
|
}
|
2018-04-27 21:25:04 +00:00
|
|
|
);
|
2017-08-08 01:34:33 +00:00
|
|
|
},
|
2018-07-07 00:48:14 +00:00
|
|
|
onRegister() {
|
New design for import/install, 'light' import (#2053)
- A new design for the import flow. It features:
- Icons at the top of every screen
- Gray background, blue buttons, thinner text
- Simpler copy
- A new design for the install flow. It features:
- Immediate entry into the QR code screen
- Animated dots to show that we're loading the QR code from the server
- Fewer screens: 1) QR 2) device name 3) sync-in-progress
- When not set up, the app opens directly into the install screen, which has been streamlined. The `--import` command-line argument will cause the app to open directly into the import flow.
- Support for two different flavors of builds - the normal build will open into the standard registration flow, and the import flavor will be exactly the same except during setup it will open directly into the import flow.
- A new design for the (dev-only) standalone registration view
- When these install sequences are active, the OS File menu has entries to allow you to switch the method of setup you'd like to use. These go away as soon as the first step is taken in any of these flows.
- The device name (chosen on initial setup) is now shown in the settings panel
- At the end of a light import, we hand off to the normal device link screen, starting at the QR code. On a full import, we remove the sensitive encryption information in the export to prevent conflicts on multiple imports.
- `Whisper.Backup.exportToDirectory()` takes an options object so you can tell it to do a light export.
- `Whisper.Backup.importFromDirectory()` takes an options object so you can force it to load only the light components found on disk. It also returns an object so you can tell whether a given import was a full import or light import.
- On start of import, we build a list of all the ids present in the messages, conversations, and groups stores in IndexedDB. This can take some time if a lot of data is in the database already, but it makes the subsequent deduplicated import very fast.
- Disappearing messages are now excluded when exporting
- Remove some TODOs in the tests
2018-02-22 18:40:32 +00:00
|
|
|
// AppView listens for this, and opens up InstallView to the QR code step to
|
|
|
|
// finish setting this device up.
|
|
|
|
this.trigger('light-import');
|
|
|
|
},
|
|
|
|
|
2018-07-07 00:48:14 +00:00
|
|
|
doImport(directory) {
|
New design for import/install, 'light' import (#2053)
- A new design for the import flow. It features:
- Icons at the top of every screen
- Gray background, blue buttons, thinner text
- Simpler copy
- A new design for the install flow. It features:
- Immediate entry into the QR code screen
- Animated dots to show that we're loading the QR code from the server
- Fewer screens: 1) QR 2) device name 3) sync-in-progress
- When not set up, the app opens directly into the install screen, which has been streamlined. The `--import` command-line argument will cause the app to open directly into the import flow.
- Support for two different flavors of builds - the normal build will open into the standard registration flow, and the import flavor will be exactly the same except during setup it will open directly into the import flow.
- A new design for the (dev-only) standalone registration view
- When these install sequences are active, the OS File menu has entries to allow you to switch the method of setup you'd like to use. These go away as soon as the first step is taken in any of these flows.
- The device name (chosen on initial setup) is now shown in the settings panel
- At the end of a light import, we hand off to the normal device link screen, starting at the QR code. On a full import, we remove the sensitive encryption information in the export to prevent conflicts on multiple imports.
- `Whisper.Backup.exportToDirectory()` takes an options object so you can tell it to do a light export.
- `Whisper.Backup.importFromDirectory()` takes an options object so you can force it to load only the light components found on disk. It also returns an object so you can tell whether a given import was a full import or light import.
- On start of import, we build a list of all the ids present in the messages, conversations, and groups stores in IndexedDB. This can take some time if a lot of data is in the database already, but it makes the subsequent deduplicated import very fast.
- Disappearing messages are now excluded when exporting
- Remove some TODOs in the tests
2018-02-22 18:40:32 +00:00
|
|
|
window.removeSetupMenuItems();
|
2017-08-08 00:24:59 +00:00
|
|
|
|
New design for import/install, 'light' import (#2053)
- A new design for the import flow. It features:
- Icons at the top of every screen
- Gray background, blue buttons, thinner text
- Simpler copy
- A new design for the install flow. It features:
- Immediate entry into the QR code screen
- Animated dots to show that we're loading the QR code from the server
- Fewer screens: 1) QR 2) device name 3) sync-in-progress
- When not set up, the app opens directly into the install screen, which has been streamlined. The `--import` command-line argument will cause the app to open directly into the import flow.
- Support for two different flavors of builds - the normal build will open into the standard registration flow, and the import flavor will be exactly the same except during setup it will open directly into the import flow.
- A new design for the (dev-only) standalone registration view
- When these install sequences are active, the OS File menu has entries to allow you to switch the method of setup you'd like to use. These go away as soon as the first step is taken in any of these flows.
- The device name (chosen on initial setup) is now shown in the settings panel
- At the end of a light import, we hand off to the normal device link screen, starting at the QR code. On a full import, we remove the sensitive encryption information in the export to prevent conflicts on multiple imports.
- `Whisper.Backup.exportToDirectory()` takes an options object so you can tell it to do a light export.
- `Whisper.Backup.importFromDirectory()` takes an options object so you can force it to load only the light components found on disk. It also returns an object so you can tell whether a given import was a full import or light import.
- On start of import, we build a list of all the ids present in the messages, conversations, and groups stores in IndexedDB. This can take some time if a lot of data is in the database already, but it makes the subsequent deduplicated import very fast.
- Disappearing messages are now excluded when exporting
- Remove some TODOs in the tests
2018-02-22 18:40:32 +00:00
|
|
|
this.error = null;
|
2017-08-08 00:24:59 +00:00
|
|
|
this.state = State.IMPORTING;
|
|
|
|
this.render();
|
|
|
|
|
|
|
|
// Wait for prior database interaction to complete
|
2018-04-27 21:25:04 +00:00
|
|
|
this.pending = this.pending
|
2018-07-07 00:48:14 +00:00
|
|
|
.then(() =>
|
2018-04-27 21:25:04 +00:00
|
|
|
// For resilience to interruption, clear database both before and on failure
|
2018-07-07 00:48:14 +00:00
|
|
|
Whisper.Import.reset()
|
|
|
|
)
|
|
|
|
.then(() =>
|
|
|
|
Promise.all([
|
2018-04-27 21:25:04 +00:00
|
|
|
Whisper.Import.start(),
|
|
|
|
window.Signal.Backup.importFromDirectory(directory),
|
2018-07-07 00:48:14 +00:00
|
|
|
])
|
2018-04-27 21:25:04 +00:00
|
|
|
)
|
2018-07-07 00:48:14 +00:00
|
|
|
.then(results => {
|
|
|
|
const importResult = results[1];
|
2018-04-27 21:25:04 +00:00
|
|
|
|
2018-07-07 00:48:14 +00:00
|
|
|
// A full import changes so much we need a restart of the app
|
|
|
|
if (importResult.fullImport) {
|
|
|
|
return this.finishFullImport(directory);
|
|
|
|
}
|
|
|
|
|
|
|
|
// A light import just brings in contacts, groups, and messages. And we need a
|
|
|
|
// normal link to finish the process.
|
|
|
|
return this.finishLightImport(directory);
|
|
|
|
})
|
|
|
|
.catch(error => {
|
2018-07-21 19:00:08 +00:00
|
|
|
window.log.error(
|
2018-07-07 00:48:14 +00:00
|
|
|
'Error importing:',
|
|
|
|
error && error.stack ? error.stack : error
|
|
|
|
);
|
2018-04-27 21:25:04 +00:00
|
|
|
|
2018-07-07 00:48:14 +00:00
|
|
|
this.error = error || new Error('Something went wrong!');
|
|
|
|
this.state = null;
|
|
|
|
this.render();
|
|
|
|
|
|
|
|
return Whisper.Import.reset();
|
|
|
|
});
|
New design for import/install, 'light' import (#2053)
- A new design for the import flow. It features:
- Icons at the top of every screen
- Gray background, blue buttons, thinner text
- Simpler copy
- A new design for the install flow. It features:
- Immediate entry into the QR code screen
- Animated dots to show that we're loading the QR code from the server
- Fewer screens: 1) QR 2) device name 3) sync-in-progress
- When not set up, the app opens directly into the install screen, which has been streamlined. The `--import` command-line argument will cause the app to open directly into the import flow.
- Support for two different flavors of builds - the normal build will open into the standard registration flow, and the import flavor will be exactly the same except during setup it will open directly into the import flow.
- A new design for the (dev-only) standalone registration view
- When these install sequences are active, the OS File menu has entries to allow you to switch the method of setup you'd like to use. These go away as soon as the first step is taken in any of these flows.
- The device name (chosen on initial setup) is now shown in the settings panel
- At the end of a light import, we hand off to the normal device link screen, starting at the QR code. On a full import, we remove the sensitive encryption information in the export to prevent conflicts on multiple imports.
- `Whisper.Backup.exportToDirectory()` takes an options object so you can tell it to do a light export.
- `Whisper.Backup.importFromDirectory()` takes an options object so you can force it to load only the light components found on disk. It also returns an object so you can tell whether a given import was a full import or light import.
- On start of import, we build a list of all the ids present in the messages, conversations, and groups stores in IndexedDB. This can take some time if a lot of data is in the database already, but it makes the subsequent deduplicated import very fast.
- Disappearing messages are now excluded when exporting
- Remove some TODOs in the tests
2018-02-22 18:40:32 +00:00
|
|
|
},
|
2018-07-07 00:48:14 +00:00
|
|
|
finishLightImport(directory) {
|
New design for import/install, 'light' import (#2053)
- A new design for the import flow. It features:
- Icons at the top of every screen
- Gray background, blue buttons, thinner text
- Simpler copy
- A new design for the install flow. It features:
- Immediate entry into the QR code screen
- Animated dots to show that we're loading the QR code from the server
- Fewer screens: 1) QR 2) device name 3) sync-in-progress
- When not set up, the app opens directly into the install screen, which has been streamlined. The `--import` command-line argument will cause the app to open directly into the import flow.
- Support for two different flavors of builds - the normal build will open into the standard registration flow, and the import flavor will be exactly the same except during setup it will open directly into the import flow.
- A new design for the (dev-only) standalone registration view
- When these install sequences are active, the OS File menu has entries to allow you to switch the method of setup you'd like to use. These go away as soon as the first step is taken in any of these flows.
- The device name (chosen on initial setup) is now shown in the settings panel
- At the end of a light import, we hand off to the normal device link screen, starting at the QR code. On a full import, we remove the sensitive encryption information in the export to prevent conflicts on multiple imports.
- `Whisper.Backup.exportToDirectory()` takes an options object so you can tell it to do a light export.
- `Whisper.Backup.importFromDirectory()` takes an options object so you can force it to load only the light components found on disk. It also returns an object so you can tell whether a given import was a full import or light import.
- On start of import, we build a list of all the ids present in the messages, conversations, and groups stores in IndexedDB. This can take some time if a lot of data is in the database already, but it makes the subsequent deduplicated import very fast.
- Disappearing messages are now excluded when exporting
- Remove some TODOs in the tests
2018-02-22 18:40:32 +00:00
|
|
|
ConversationController.reset();
|
|
|
|
|
2018-04-27 21:25:04 +00:00
|
|
|
return ConversationController.load()
|
2018-07-07 00:48:14 +00:00
|
|
|
.then(() =>
|
|
|
|
Promise.all([
|
New design for import/install, 'light' import (#2053)
- A new design for the import flow. It features:
- Icons at the top of every screen
- Gray background, blue buttons, thinner text
- Simpler copy
- A new design for the install flow. It features:
- Immediate entry into the QR code screen
- Animated dots to show that we're loading the QR code from the server
- Fewer screens: 1) QR 2) device name 3) sync-in-progress
- When not set up, the app opens directly into the install screen, which has been streamlined. The `--import` command-line argument will cause the app to open directly into the import flow.
- Support for two different flavors of builds - the normal build will open into the standard registration flow, and the import flavor will be exactly the same except during setup it will open directly into the import flow.
- A new design for the (dev-only) standalone registration view
- When these install sequences are active, the OS File menu has entries to allow you to switch the method of setup you'd like to use. These go away as soon as the first step is taken in any of these flows.
- The device name (chosen on initial setup) is now shown in the settings panel
- At the end of a light import, we hand off to the normal device link screen, starting at the QR code. On a full import, we remove the sensitive encryption information in the export to prevent conflicts on multiple imports.
- `Whisper.Backup.exportToDirectory()` takes an options object so you can tell it to do a light export.
- `Whisper.Backup.importFromDirectory()` takes an options object so you can force it to load only the light components found on disk. It also returns an object so you can tell whether a given import was a full import or light import.
- On start of import, we build a list of all the ids present in the messages, conversations, and groups stores in IndexedDB. This can take some time if a lot of data is in the database already, but it makes the subsequent deduplicated import very fast.
- Disappearing messages are now excluded when exporting
- Remove some TODOs in the tests
2018-02-22 18:40:32 +00:00
|
|
|
Whisper.Import.saveLocation(directory),
|
|
|
|
Whisper.Import.complete(),
|
2018-07-07 00:48:14 +00:00
|
|
|
])
|
|
|
|
)
|
|
|
|
.then(() => {
|
|
|
|
this.state = State.LIGHT_COMPLETE;
|
|
|
|
this.render();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
finishFullImport(directory) {
|
New design for import/install, 'light' import (#2053)
- A new design for the import flow. It features:
- Icons at the top of every screen
- Gray background, blue buttons, thinner text
- Simpler copy
- A new design for the install flow. It features:
- Immediate entry into the QR code screen
- Animated dots to show that we're loading the QR code from the server
- Fewer screens: 1) QR 2) device name 3) sync-in-progress
- When not set up, the app opens directly into the install screen, which has been streamlined. The `--import` command-line argument will cause the app to open directly into the import flow.
- Support for two different flavors of builds - the normal build will open into the standard registration flow, and the import flavor will be exactly the same except during setup it will open directly into the import flow.
- A new design for the (dev-only) standalone registration view
- When these install sequences are active, the OS File menu has entries to allow you to switch the method of setup you'd like to use. These go away as soon as the first step is taken in any of these flows.
- The device name (chosen on initial setup) is now shown in the settings panel
- At the end of a light import, we hand off to the normal device link screen, starting at the QR code. On a full import, we remove the sensitive encryption information in the export to prevent conflicts on multiple imports.
- `Whisper.Backup.exportToDirectory()` takes an options object so you can tell it to do a light export.
- `Whisper.Backup.importFromDirectory()` takes an options object so you can force it to load only the light components found on disk. It also returns an object so you can tell whether a given import was a full import or light import.
- On start of import, we build a list of all the ids present in the messages, conversations, and groups stores in IndexedDB. This can take some time if a lot of data is in the database already, but it makes the subsequent deduplicated import very fast.
- Disappearing messages are now excluded when exporting
- Remove some TODOs in the tests
2018-02-22 18:40:32 +00:00
|
|
|
// Catching in-memory cache up with what's in indexeddb now...
|
|
|
|
// NOTE: this fires storage.onready, listened to across the app. We'll restart
|
|
|
|
// to complete the install to start up cleanly with everything now in the DB.
|
2018-04-27 21:25:04 +00:00
|
|
|
return storage
|
|
|
|
.fetch()
|
2018-07-07 00:48:14 +00:00
|
|
|
.then(() =>
|
|
|
|
Promise.all([
|
New design for import/install, 'light' import (#2053)
- A new design for the import flow. It features:
- Icons at the top of every screen
- Gray background, blue buttons, thinner text
- Simpler copy
- A new design for the install flow. It features:
- Immediate entry into the QR code screen
- Animated dots to show that we're loading the QR code from the server
- Fewer screens: 1) QR 2) device name 3) sync-in-progress
- When not set up, the app opens directly into the install screen, which has been streamlined. The `--import` command-line argument will cause the app to open directly into the import flow.
- Support for two different flavors of builds - the normal build will open into the standard registration flow, and the import flavor will be exactly the same except during setup it will open directly into the import flow.
- A new design for the (dev-only) standalone registration view
- When these install sequences are active, the OS File menu has entries to allow you to switch the method of setup you'd like to use. These go away as soon as the first step is taken in any of these flows.
- The device name (chosen on initial setup) is now shown in the settings panel
- At the end of a light import, we hand off to the normal device link screen, starting at the QR code. On a full import, we remove the sensitive encryption information in the export to prevent conflicts on multiple imports.
- `Whisper.Backup.exportToDirectory()` takes an options object so you can tell it to do a light export.
- `Whisper.Backup.importFromDirectory()` takes an options object so you can force it to load only the light components found on disk. It also returns an object so you can tell whether a given import was a full import or light import.
- On start of import, we build a list of all the ids present in the messages, conversations, and groups stores in IndexedDB. This can take some time if a lot of data is in the database already, but it makes the subsequent deduplicated import very fast.
- Disappearing messages are now excluded when exporting
- Remove some TODOs in the tests
2018-02-22 18:40:32 +00:00
|
|
|
// Clearing any migration-related state inherited from the Chrome App
|
|
|
|
storage.remove('migrationState'),
|
|
|
|
storage.remove('migrationEnabled'),
|
|
|
|
storage.remove('migrationEverCompleted'),
|
|
|
|
storage.remove('migrationStorageLocation'),
|
|
|
|
|
|
|
|
Whisper.Import.saveLocation(directory),
|
2018-04-27 21:25:04 +00:00
|
|
|
Whisper.Import.complete(),
|
2018-07-07 00:48:14 +00:00
|
|
|
])
|
|
|
|
)
|
|
|
|
.then(() => {
|
|
|
|
this.state = State.COMPLETE;
|
|
|
|
this.render();
|
|
|
|
});
|
2018-04-27 21:25:04 +00:00
|
|
|
},
|
2017-08-08 00:24:59 +00:00
|
|
|
});
|
|
|
|
})();
|