diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 31681bb6d..b988aa9af 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -20,8 +20,6 @@ "editMenuPasteAndMatchStyle": "Paste and Match Style", "editMenuDelete": "Delete", "editMenuSelectAll": "Select all", - "editMenuStartSpeaking": "Start speaking", - "editMenuStopSpeaking": "Stop speaking", "windowMenuClose": "Close Window", "windowMenuMinimize": "Minimize", "windowMenuZoom": "Zoom", @@ -31,7 +29,6 @@ "viewMenuZoomOut": "Zoom Out", "viewMenuToggleFullScreen": "Toggle Full Screen", "viewMenuToggleDevTools": "Toggle Developer Tools", - "menuSetupWithImport": "Set Up with Import", "contextMenuNoSuggestions": "No Suggestions", "openGroupInvitation": "Open group invitation", "joinOpenGroupAfterInvitationConfirmationTitle": "Join $roomName$?", @@ -39,19 +36,7 @@ "enterSessionIDOrONSName": "Enter Session ID or ONS name", "loading": "Loading...", "optimizingApplication": "Optimizing application...", - "chooseDirectory": "Choose folder", "done": "Done", - "loadDataHeader": "Load your data", - "loadDataDescription": "You've just gone through the export process, and your contacts and messages are waiting patiently on your computer. Select the folder that contains your saved Session data.", - "importChooserTitle": "Choose directory with exported data", - "importErrorHeader": "Something went wrong!", - "importingHeader": "Loading contacts and messages", - "importErrorFirst": "Make sure you have chosen the correct directory that contains your saved Session data. Its name should begin with 'Session Export.' You can also save a new copy of your data from the Chrome App.", - "importErrorSecond": "If these steps don't work for you, please submit a debug log (View -> Debug Log) so that we can help you get migrated!", - "importAgain": "Choose folder and try again", - "importCompleteHeader": "Success!", - "importCompleteStartButton": "Start using Session", - "importCompleteLinkButton": "Link this device to your phone", "me": "Me", "view": "View", "youLeftTheGroup": "You have left the group.", diff --git a/app/menu.js b/app/menu.js index c2cc340a6..5db95c1dd 100644 --- a/app/menu.js +++ b/app/menu.js @@ -231,27 +231,6 @@ function updateForMac(template, messages, options) { ], }); - // Add to Edit menu - const editIndex = includeSetup ? 2 : 1; - template[editIndex].submenu.push( - { - type: 'separator', - }, - { - label: messages.speech, - submenu: [ - { - role: 'startspeaking', - label: messages.editMenuStartSpeaking, - }, - { - role: 'stopspeaking', - label: messages.editMenuStopSpeaking, - }, - ], - } - ); - // Replace Window menu const windowMenuTemplateIndex = includeSetup ? 4 : 3; // eslint-disable-next-line no-param-reassign diff --git a/background.html b/background.html index c2cf73253..e3c066453 100644 --- a/background.html +++ b/background.html @@ -40,77 +40,6 @@ - - @@ -136,7 +65,6 @@ - diff --git a/background_test.html b/background_test.html index c3998cde4..c14598ded 100644 --- a/background_test.html +++ b/background_test.html @@ -40,82 +40,6 @@ - - @@ -142,12 +66,7 @@ - - - - - diff --git a/js/background.js b/js/background.js index a2ed9e8c7..a96323cef 100644 --- a/js/background.js +++ b/js/background.js @@ -205,13 +205,6 @@ } }); - Whisper.events.on('setupWithImport', () => { - const { appView } = window.owsDesktopApp; - if (appView) { - appView.openImporter(); - } - }); - Whisper.events.on('deleteLocalPublicMessages', async ({ messageServerIds, conversationId }) => { if (!Array.isArray(messageServerIds)) { return; @@ -288,19 +281,11 @@ Whisper.WallClockListener.init(Whisper.events); Whisper.ExpiringMessagesListener.init(Whisper.events); - if (Whisper.Import.isIncomplete()) { - window.log.info('Import was interrupted, showing import error screen'); - appView.openImporter(); - } else if ( - Whisper.Registration.isDone() && - !window.textsecure.storage.user.isSignInByLinking() - ) { + if (Whisper.Registration.isDone() && !window.textsecure.storage.user.isSignInByLinking()) { connect(); appView.openInbox({ initialLoadComplete, }); - } else if (window.isImportMode()) { - appView.openImporter(); } else { appView.openStandalone(); } @@ -457,9 +442,6 @@ if (!Whisper.Registration.everDone()) { return; } - if (Whisper.Import.isIncomplete()) { - return; - } connectCount += 1; Whisper.Notifications.disable(); // avoid notification flood until empty diff --git a/js/modules/backup.js b/js/modules/backup.js index 58b8ad155..35e75cb4d 100644 --- a/js/modules/backup.js +++ b/js/modules/backup.js @@ -1,6 +1,5 @@ /* global Signal: false */ /* global _: false */ -/* global i18n: false */ /* eslint-env browser */ /* eslint-env node */ @@ -24,7 +23,6 @@ const { dialog, BrowserWindow } = electronRemote; module.exports = { getDirectoryForExport, exportToDirectory, - getDirectoryForImport, importFromDirectory, // for testing _sanitizeFileName, @@ -1172,13 +1170,6 @@ async function exportToDirectory(directory, options) { } } -function getDirectoryForImport() { - const options = { - title: i18n('importChooserTitle'), - }; - return getDirectory(options); -} - async function importFromDirectory(directory, options) { options = options || {}; diff --git a/js/views/app_view.js b/js/views/app_view.js index dfffd21df..ba1432b43 100644 --- a/js/views/app_view.js +++ b/js/views/app_view.js @@ -55,21 +55,6 @@ this.debugLogView = null; } }, - openImporter() { - window.addSetupMenuItems(); - this.resetViews(); - - const importView = new Whisper.ImportView(); - this.importView = importView; - - this.openView(this.importView); - }, - closeImporter() { - if (this.importView) { - this.importView.remove(); - this.importView = null; - } - }, openStandalone() { window.addSetupMenuItems(); this.resetViews(); @@ -83,7 +68,6 @@ } }, resetViews() { - this.closeImporter(); this.closeStandalone(); }, openInbox(options = {}) { diff --git a/js/views/import_view.js b/js/views/import_view.js deleted file mode 100644 index e5f0e5c56..000000000 --- a/js/views/import_view.js +++ /dev/null @@ -1,205 +0,0 @@ -/* global Whisper, storage, i18n */ - -/* eslint-disable more/no-then */ - -// eslint-disable-next-line func-names -(function() { - 'use strict'; - - window.Whisper = window.Whisper || {}; - - const State = { - IMPORTING: 1, - COMPLETE: 2, - LIGHT_COMPLETE: 3, - }; - - const IMPORT_STARTED = 'importStarted'; - const IMPORT_COMPLETE = 'importComplete'; - const IMPORT_LOCATION = 'importLocation'; - - Whisper.Import = { - isStarted() { - return Boolean(storage.get(IMPORT_STARTED)); - }, - isComplete() { - return Boolean(storage.get(IMPORT_COMPLETE)); - }, - isIncomplete() { - return this.isStarted() && !this.isComplete(); - }, - start() { - return storage.put(IMPORT_STARTED, true); - }, - complete() { - return storage.put(IMPORT_COMPLETE, true); - }, - saveLocation(location) { - return storage.put(IMPORT_LOCATION, location); - }, - reset() { - return window.Signal.Data.removeAll(); - }, - }; - - Whisper.ImportView = Whisper.View.extend({ - templateName: 'import-flow-template', - // className: 'full-screen-flow', - events: { - 'click .choose': 'onImport', - 'click .restart': 'onRestart', - 'click .cancel': 'onCancel', - 'click .register': 'onRegister', - }, - initialize() { - if (Whisper.Import.isIncomplete()) { - this.error = true; - } - - this.render(); - this.pending = Promise.resolve(); - }, - render_attributes() { - if (this.error) { - return { - isError: true, - errorHeader: i18n('importErrorHeader'), - errorMessageFirst: i18n('importErrorFirst'), - errorMessageSecond: i18n('importErrorSecond'), - chooseButton: i18n('importAgain'), - }; - } - - let restartButton = i18n('importCompleteStartButton'); - let registerButton = i18n('importCompleteLinkButton'); - let step = 'step2'; - - 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'; - } - - return { - isStep2: step === 'step2', - chooseHeader: i18n('loadDataHeader'), - choose: i18n('loadDataDescription'), - chooseButton: i18n('chooseDirectory'), - - isStep3: step === 'step3', - importingHeader: i18n('importingHeader'), - - isStep4: step === 'step4', - completeHeader: i18n('importCompleteHeader'), - restartButton, - registerButton, - }; - }, - onRestart() { - return window.restart(); - }, - onCancel() { - this.trigger('cancel'); - }, - onImport() { - window.Signal.Backup.getDirectoryForImport().then( - directory => { - this.doImport(directory); - }, - error => { - if (error.name !== 'ChooseError') { - window.log.error( - 'Error choosing directory:', - error && error.stack ? error.stack : error - ); - } - } - ); - }, - onRegister() { - // AppView listens for this, and opens up InstallView to the QR code step to - // finish setting this device up. - this.trigger('light-import'); - }, - - doImport(directory) { - window.removeSetupMenuItems(); - - this.error = null; - this.state = State.IMPORTING; - this.render(); - - // Wait for prior database interaction to complete - this.pending = this.pending - .then(() => - // For resilience to interruption, clear database both before and on failure - Whisper.Import.reset() - ) - .then(() => - Promise.all([Whisper.Import.start(), window.Signal.Backup.importFromDirectory(directory)]) - ) - .then(results => { - const importResult = results[1]; - - // 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 => { - window.log.error('Error importing:', error && error.stack ? error.stack : error); - - this.error = error || new Error('Something went wrong!'); - this.state = null; - this.render(); - - return Whisper.Import.reset(); - }); - }, - finishLightImport(directory) { - window.getConversationController().reset(); - - return window - .getConversationController() - .load() - .then(() => - Promise.all([Whisper.Import.saveLocation(directory), Whisper.Import.complete()]) - ) - .then(() => { - this.state = State.LIGHT_COMPLETE; - this.render(); - }); - }, - finishFullImport(directory) { - // 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. - return storage - .fetch() - .then(() => - Promise.all([ - // 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), - Whisper.Import.complete(), - ]) - ) - .then(() => { - this.state = State.COMPLETE; - this.render(); - }); - }, - }); -})(); diff --git a/main.js b/main.js index 9a55877f8..b336732b9 100644 --- a/main.js +++ b/main.js @@ -55,8 +55,6 @@ const config = require('./app/config'); const userConfig = require('./app/user_config'); const passwordUtil = require('./ts/util/passwordUtils'); -const importMode = process.argv.some(arg => arg === '--import') || config.get('import'); - const development = config.environment === 'development'; const appInstance = config.util.getEnv('NODE_APP_INSTANCE') || 0; @@ -177,7 +175,6 @@ function prepareURL(pathSegments, moreKeys) { appInstance: process.env.NODE_APP_INSTANCE, proxyUrl: process.env.HTTPS_PROXY || process.env.https_proxy, contentProxyUrl: config.contentProxyUrl, - importMode: importMode ? true : undefined, // for stringify() serverTrustRoot: config.get('serverTrustRoot'), appStartInitialSpellcheckSetting, defaultFileServer: config.get('defaultFileServer'), @@ -462,12 +459,6 @@ function openSupportPage() { shell.openExternal('https://docs.oxen.io/products-built-on-oxen/session'); } -function setupWithImport() { - if (mainWindow) { - mainWindow.webContents.send('set-up-with-import'); - } -} - let passwordWindow; function showPasswordWindow() { if (passwordWindow) { @@ -736,7 +727,6 @@ function setupMenu(options) { openNewBugForm, openSupportPage, platform, - setupWithImport, }); const template = createTemplate(menuOptions, locale.messages); const menu = Menu.buildFromTemplate(template); diff --git a/preload.js b/preload.js index 5774038da..a272d1ecc 100644 --- a/preload.js +++ b/preload.js @@ -38,7 +38,6 @@ window.getEnvironment = () => config.environment; window.isDev = () => config.environment === 'development'; window.getAppInstance = () => config.appInstance; window.getVersion = () => config.version; -window.isImportMode = () => config.importMode; window.getExpiration = () => config.buildExpiration; window.getCommitHash = () => config.commitHash; window.getNodeVersion = () => config.node_version; @@ -193,10 +192,6 @@ window.readyForUpdates = () => ipc.send('ready-for-updates'); window.updateTrayIcon = unreadCount => ipc.send('update-tray-icon', unreadCount); -ipc.on('set-up-with-import', () => { - Whisper.events.trigger('setupWithImport'); -}); - ipc.on('get-theme-setting', () => { const theme = window.Events.getThemeSetting(); ipc.send('get-success-theme-setting', theme); diff --git a/test/app/menu_test.js b/test/app/menu_test.js index 97f6395a7..c93e32000 100644 --- a/test/app/menu_test.js +++ b/test/app/menu_test.js @@ -51,7 +51,6 @@ describe('SignalMenu', () => { openSupportPage: null, platform, includeSetup, - setupWithImport: null, showAbout: null, showDebugLog: null, showSettings: null, diff --git a/test/index.html b/test/index.html index f16fc98d1..da7027e38 100644 --- a/test/index.html +++ b/test/index.html @@ -46,14 +46,9 @@ - - - - -