diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 6615b9be0..feb587152 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -145,10 +145,6 @@ "message": "Set Up with Import", "description": "When the application is not yet set up, menu option to start up the import sequence" }, - "menuSetupAsNewDevice": { - "message": "Set Up as New Device", - "description": "When the application is not yet set up, menu option to start up the set up as fresh device" - }, "menuSetupAsStandalone": { "message": "Set Up as Standalone Device", "description": "Only available on development modes, menu option to open up the standalone device setup sequence" @@ -1070,47 +1066,12 @@ } } }, - "linkYourPhone": { - "message": "Link your phone to Session", - "description": "Shown on the front page when the application first starst, above the QR code" - }, - "signalSettings": { - "message": "Session Settings", - "description": "Used in the guidance to help people find the 'link new device' area of their Signal mobile app" - }, - "linkedDevices": { - "message": "Linked Devices", - "description": "Used in the guidance to help people find the 'link new device' area of their Signal mobile app" - }, - "plusButton": { - "message": "'+' Button", - "description": "The button used in Signal Android to add a new linked device" - }, "linkNewDevice": { "message": "Link New Device", "description": "The menu option shown in Signal iOS to add a new linked device" }, - "chooseDeviceName": { - "message": "Choose this device's name", - "description": "The header shown on the 'choose device name' screen in the device linking process" - }, - "finishLinkingPhone": { - "message": "Finish linking phone", - "description": "The text on the button to finish the linking process, after choosing the device name" - }, - "initialSync": { - "message": "Syncing contacts and groups", - "description": "Shown during initial link while contacts and groups are being pulled from mobile device" - }, - "installConnectionFailed": { - "message": "Failed to connect to server.", - "description": "Displayed when we can't connect to the server." - }, - "installTooManyDevices": { - "message": "Sorry, you have too many devices linked already. Try removing some." - }, - "message": "Permissions", "permissions": { + "message": "Permissions", "description": "Header for permissions section of settings" }, "general": { diff --git a/app/menu.js b/app/menu.js index 5996a9598..60aa1f49f 100644 --- a/app/menu.js +++ b/app/menu.js @@ -11,7 +11,6 @@ exports.createTemplate = (options, messages) => { openReleaseNotes, openSupportPage, platform, - setupAsNewDevice, setupAsStandalone, setupWithImport, showAbout, @@ -164,10 +163,6 @@ exports.createTemplate = (options, messages) => { fileMenu.submenu.unshift({ type: 'separator', }); - fileMenu.submenu.unshift({ - label: messages.menuSetupAsNewDevice.message, - click: setupAsNewDevice, - }); fileMenu.submenu.unshift({ label: messages.menuSetupWithImport.message, click: setupWithImport, @@ -184,7 +179,6 @@ exports.createTemplate = (options, messages) => { function updateForMac(template, messages, options) { const { includeSetup, - setupAsNewDevice, setupAsStandalone, setupWithImport, showAbout, @@ -208,10 +202,6 @@ function updateForMac(template, messages, options) { label: messages.menuSetupWithImport.message, click: setupWithImport, }, - { - label: messages.menuSetupAsNewDevice.message, - click: setupAsNewDevice, - }, ], }; diff --git a/background.html b/background.html index 589f85826..89ad637d9 100644 --- a/background.html +++ b/background.html @@ -345,101 +345,6 @@ {{/isError}} - - - @@ -494,7 +399,6 @@ - diff --git a/background_test.html b/background_test.html index 21a5881dd..46b076122 100644 --- a/background_test.html +++ b/background_test.html @@ -345,101 +345,6 @@ {{/isError}} - - - @@ -494,7 +399,6 @@ - diff --git a/js/background.js b/js/background.js index bece78657..9ddcf9ae7 100644 --- a/js/background.js +++ b/js/background.js @@ -532,13 +532,6 @@ } ); - Whisper.events.on('setupAsNewDevice', () => { - const { appView } = window.owsDesktopApp; - if (appView) { - appView.openInstaller(); - } - }); - Whisper.events.on('setupAsStandalone', () => { const { appView } = window.owsDesktopApp; if (appView) { @@ -665,11 +658,6 @@ Whisper.events.on('reconnectTimer', () => { appView.inboxView.networkStatusView.setSocketReconnectInterval(60000); }); - Whisper.events.on('contactsync', () => { - if (appView.installView) { - appView.openInbox(); - } - }); window.addEventListener('focus', () => Whisper.Notifications.clear()); window.addEventListener('unload', () => Whisper.Notifications.fastClear()); diff --git a/js/views/app_view.js b/js/views/app_view.js index 062e12cd3..227813039 100644 --- a/js/views/app_view.js +++ b/js/views/app_view.js @@ -11,7 +11,6 @@ Whisper.AppView = Backbone.View.extend({ initialize() { this.inboxView = null; - this.installView = null; this.applyTheme(); this.applyHideMenu(); @@ -72,39 +71,12 @@ ); this.openView(this.importView); }, - finishLightImport() { - const options = { - hasExistingData: true, - }; - this.openInstaller(options); - }, closeImporter() { if (this.importView) { this.importView.remove(); this.importView = null; } }, - openInstaller(options = {}) { - // If we're in the middle of import, we don't want to show the menu options - // allowing the user to switch to other ways to set up the app. If they - // switched back and forth in the middle of a light import, they'd lose all - // that imported data. - if (!options.hasExistingData) { - window.addSetupMenuItems(); - } - - this.resetViews(); - const installView = new Whisper.InstallView(options); - this.installView = installView; - - this.openView(this.installView); - }, - closeInstaller() { - if (this.installView) { - this.installView.remove(); - this.installView = null; - } - }, openStandalone() { window.addSetupMenuItems(); this.resetViews(); @@ -118,7 +90,6 @@ } }, resetViews() { - this.closeInstaller(); this.closeImporter(); this.closeStandalone(); }, @@ -138,7 +109,6 @@ _.defaults(options, { initialLoadComplete: this.initialLoadComplete }); // window.log.info('open inbox'); - this.closeInstaller(); if (!this.inboxView) { // We create the inbox immediately so we don't miss an update to diff --git a/js/views/install_view.js b/js/views/install_view.js deleted file mode 100644 index b45257f40..000000000 --- a/js/views/install_view.js +++ /dev/null @@ -1,202 +0,0 @@ -/* global Whisper, i18n, getAccountManager, $, textsecure, QRCode */ - -/* eslint-disable more/no-then */ - -// eslint-disable-next-line func-names -(function() { - 'use strict'; - - window.Whisper = window.Whisper || {}; - - const Steps = { - INSTALL_SIGNAL: 2, - SCAN_QR_CODE: 3, - ENTER_NAME: 4, - PROGRESS_BAR: 5, - TOO_MANY_DEVICES: 'TooManyDevices', - NETWORK_ERROR: 'NetworkError', - }; - - const DEVICE_NAME_SELECTOR = 'input.device-name'; - const CONNECTION_ERROR = -1; - const TOO_MANY_DEVICES = 411; - - Whisper.InstallView = Whisper.View.extend({ - templateName: 'link-flow-template', - className: 'main full-screen-flow', - events: { - 'click .try-again': 'connect', - 'click .finish': 'finishLinking', - // the actual next step happens in confirmNumber() on submit form #link-phone - }, - initialize(options = {}) { - this.selectStep(Steps.SCAN_QR_CODE); - this.connect(); - this.on('disconnected', this.reconnect); - - // Keep data around if it's a re-link, or the middle of a light import - this.shouldRetainData = - Whisper.Registration.everDone() || options.hasExistingData; - }, - render_attributes() { - let errorMessage; - - if (this.error) { - if ( - this.error.name === 'HTTPError' && - this.error.code === TOO_MANY_DEVICES - ) { - errorMessage = i18n('installTooManyDevices'); - } else if ( - this.error.name === 'HTTPError' && - this.error.code === CONNECTION_ERROR - ) { - errorMessage = i18n('installConnectionFailed'); - } else if (this.error.message === 'websocket closed') { - // AccountManager.registerSecondDevice uses this specific - // 'websocket closed' error message - errorMessage = i18n('installConnectionFailed'); - } - - return { - isError: true, - errorHeader: 'Something went wrong!', - errorMessage, - errorButton: 'Try again', - }; - } - - return { - isStep3: this.step === Steps.SCAN_QR_CODE, - linkYourPhone: i18n('linkYourPhone'), - signalSettings: i18n('signalSettings'), - linkedDevices: i18n('linkedDevices'), - androidFinalStep: i18n('plusButton'), - appleFinalStep: i18n('linkNewDevice'), - - isStep4: this.step === Steps.ENTER_NAME, - chooseName: i18n('chooseDeviceName'), - finishLinkingPhoneButton: i18n('finishLinkingPhone'), - - isStep5: this.step === Steps.PROGRESS_BAR, - syncing: i18n('initialSync'), - }; - }, - selectStep(step) { - this.step = step; - this.render(); - }, - connect() { - this.error = null; - this.selectStep(Steps.SCAN_QR_CODE); - this.clearQR(); - if (this.timeout) { - clearTimeout(this.timeout); - this.timeout = null; - } - - const accountManager = getAccountManager(); - - accountManager - .registerSecondDevice( - this.setProvisioningUrl.bind(this), - this.confirmNumber.bind(this) - ) - .catch(this.handleDisconnect.bind(this)); - }, - handleDisconnect(error) { - window.log.error( - 'provisioning failed', - error && error.stack ? error.stack : error - ); - - this.error = error; - this.render(); - - if (error.message === 'websocket closed') { - this.trigger('disconnected'); - } else if ( - error.name !== 'HTTPError' || - (error.code !== CONNECTION_ERROR && error.code !== TOO_MANY_DEVICES) - ) { - throw error; - } - }, - reconnect() { - if (this.timeout) { - clearTimeout(this.timeout); - this.timeout = null; - } - this.timeout = setTimeout(this.connect.bind(this), 10000); - }, - clearQR() { - this.$('#qr img').remove(); - this.$('#qr canvas').remove(); - this.$('#qr .container').show(); - this.$('#qr').removeClass('ready'); - }, - setProvisioningUrl(url) { - if ($('#qr').length === 0) { - window.log.error('Did not find #qr element in the DOM!'); - return; - } - - this.$('#qr .container').hide(); - this.qr = new QRCode(this.$('#qr')[0]).makeCode(url); - this.$('#qr').removeAttr('title'); - this.$('#qr').addClass('ready'); - }, - setDeviceNameDefault() { - const deviceName = textsecure.storage.user.getDeviceName(); - - this.$(DEVICE_NAME_SELECTOR).val(deviceName || window.getHostName()); - this.$(DEVICE_NAME_SELECTOR).focus(); - }, - finishLinking() { - // We use a form so we get submit-on-enter behavior - this.$('#link-phone').submit(); - }, - confirmNumber() { - const tsp = textsecure.storage.protocol; - - window.removeSetupMenuItems(); - this.selectStep(Steps.ENTER_NAME); - this.setDeviceNameDefault(); - - return new Promise(resolve => { - this.$('#link-phone').submit(e => { - e.stopPropagation(); - e.preventDefault(); - - let name = this.$(DEVICE_NAME_SELECTOR).val(); - name = name.replace(/\0/g, ''); // strip unicode null - if (name.trim().length === 0) { - this.$(DEVICE_NAME_SELECTOR).focus(); - return null; - } - - this.selectStep(Steps.PROGRESS_BAR); - - const finish = () => resolve(name); - - // Delete all data from database unless we're in the middle - // of a re-link, or we are finishing a light import. Without this, - // app restarts at certain times can cause weird things to happen, - // like data from a previous incomplete light import showing up - // after a new install. - if (this.shouldRetainData) { - return finish(); - } - - return tsp.removeAllData().then(finish, error => { - window.log.error( - 'confirmNumber: error clearing database', - error && error.stack ? error.stack : error - ); - finish(); - }); - }); - }); - }, - }); -})(); diff --git a/main.js b/main.js index c804782c5..4bebeafc9 100644 --- a/main.js +++ b/main.js @@ -513,12 +513,6 @@ function setupWithImport() { } } -function setupAsNewDevice() { - if (mainWindow) { - mainWindow.webContents.send('set-up-as-new-device'); - } -} - function setupAsStandalone() { if (mainWindow) { mainWindow.webContents.send('set-up-as-standalone'); @@ -874,7 +868,6 @@ function setupMenu(options) { openSupportPage, platform, setupWithImport, - setupAsNewDevice, setupAsStandalone, }); const template = createTemplate(menuOptions, locale.messages); diff --git a/preload.js b/preload.js index d2f8bb5a6..ea0ea7a7b 100644 --- a/preload.js +++ b/preload.js @@ -231,10 +231,6 @@ ipc.on('set-up-with-import', () => { Whisper.events.trigger('setupWithImport'); }); -ipc.on('set-up-as-new-device', () => { - Whisper.events.trigger('setupAsNewDevice'); -}); - ipc.on('set-up-as-standalone', () => { Whisper.events.trigger('setupAsStandalone'); }); diff --git a/test/app/menu_test.js b/test/app/menu_test.js index e84f8f115..f6ebf31ce 100644 --- a/test/app/menu_test.js +++ b/test/app/menu_test.js @@ -51,7 +51,6 @@ describe('SignalMenu', () => { openSupportPage: null, platform, includeSetup, - setupAsNewDevice: null, setupAsStandalone: null, setupWithImport: null, showAbout: null, diff --git a/test/index.html b/test/index.html index a84932bd8..7c3e0124d 100644 --- a/test/index.html +++ b/test/index.html @@ -363,100 +363,6 @@ {{/isError}} - - - diff --git a/ts/util/lint/exceptions.json b/ts/util/lint/exceptions.json index 562ccbc94..4ff8f304f 100644 --- a/ts/util/lint/exceptions.json +++ b/ts/util/lint/exceptions.json @@ -641,105 +641,6 @@ "updated": "2019-03-08T23:49:08.796Z", "reasonDetail": "Protected from arbitrary input" }, - { - "rule": "jQuery-$(", - "path": "js/views/install_view.js", - "line": " this.$('#qr img').remove();", - "lineNumber": 133, - "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/install_view.js", - "line": " this.$('#qr .container').show();", - "lineNumber": 135, - "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/install_view.js", - "line": " if ($('#qr').length === 0) {", - "lineNumber": 139, - "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/install_view.js", - "line": " this.$('#qr .container').hide();", - "lineNumber": 144, - "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/install_view.js", - "line": " this.qr = new QRCode(this.$('#qr')[0]).makeCode(url);", - "lineNumber": 145, - "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/install_view.js", - "line": " this.$('#qr').addClass('ready');", - "lineNumber": 147, - "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/install_view.js", - "line": " this.$(DEVICE_NAME_SELECTOR).val(deviceName || window.getHostName());", - "lineNumber": 152, - "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/install_view.js", - "line": " this.$('#link-phone').submit();", - "lineNumber": 157, - "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/install_view.js", - "line": " this.$('#link-phone').submit(e => {", - "lineNumber": 167, - "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/install_view.js", - "line": " let name = this.$(DEVICE_NAME_SELECTOR).val();", - "lineNumber": 171, - "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/install_view.js", - "line": " this.$(DEVICE_NAME_SELECTOR).focus();", - "lineNumber": 174, - "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", - "reasonDetail": "Protected from arbitrary input" - }, { "rule": "jQuery-$(", "path": "js/views/key_verification_view.js",