From 5fc3ed5aad45a7e7e184477a7777206bfd370d32 Mon Sep 17 00:00:00 2001 From: Karim94 Date: Mon, 10 Dec 2018 21:19:44 -0500 Subject: [PATCH] Chore remove file migration dialogs (#399) * chore: removed file migration dialogs [branch ch17681] * chore: remove unused * chore: updated icebear branch * chore: revert to icebear dev --- app/components/routes/router-main.js | 35 +------------ app/components/shared/popups.js | 76 +--------------------------- 2 files changed, 2 insertions(+), 109 deletions(-) diff --git a/app/components/routes/router-main.js b/app/components/routes/router-main.js index e95c4b086..d60d67ab7 100644 --- a/app/components/routes/router-main.js +++ b/app/components/routes/router-main.js @@ -1,6 +1,5 @@ import React from 'react'; -import { observable, reaction, action, when, extendObservable } from 'mobx'; -import RNKeepAwake from 'react-native-keep-awake'; +import { observable, reaction, action, extendObservable } from 'mobx'; import Router from './router'; import uiState from '../layout/ui-state'; import WelcomeZeroState from '../layout/welcome-zero-state'; @@ -26,11 +25,7 @@ import { } from '../states'; // import { enablePushNotifications } from '../../lib/push'; import routes from './routes'; -import snackbarState from '../snackbars/snackbar-state'; -import { tx } from '../utils/translator'; -import popupState from '../layout/popup-state'; import { fileStore } from '../../lib/icebear'; -import { popupUpgradeNotification, popupUpgradeProgress } from '../shared/popups'; import preferenceStore from '../settings/preference-store'; import whiteLabelComponents from '../../components/whitelabel/white-label-components'; import { timeoutWithAction } from '../utils/timeouts'; @@ -87,14 +82,6 @@ class RouterMain extends Router { this.add('accountUpgradeMonthly', [], accountUpgradeState); this.add('accountUpgradeAnnual', [], accountUpgradeState); - reaction( - () => fileStore.migration.pending, - migration => { - if (migration) this.filesystemUpgrade(); - }, - { fireImmediately: true } - ); - reaction( () => this.current || this.currentIndex, () => { @@ -141,26 +128,6 @@ class RouterMain extends Router { if (whiteLabelComponents.extendRoutes) whiteLabelComponents.extendRoutes(this); } - @action - async filesystemUpgrade() { - if (fileStore.migration.pending) { - if (!(fileStore.migration.started || fileStore.migration.performedByAnotherClient)) { - await popupUpgradeNotification(); - fileStore.migration.confirmMigration(); - } - popupUpgradeProgress(); - when( - () => !fileStore.migration.pending, - () => { - popupState.discardPopup(); - snackbarState.pushTemporary(tx('title_fileUpdateComplete')); - RNKeepAwake.deactivate(); - } - ); - RNKeepAwake.activate(); - } - } - add(key, components, routeState) { const route = super.add(key, null); extendObservable(route, { components }, { components: observable.ref }); diff --git a/app/components/shared/popups.js b/app/components/shared/popups.js index 34b6110c7..2f4c3b685 100644 --- a/app/components/shared/popups.js +++ b/app/components/shared/popups.js @@ -1,6 +1,4 @@ import React from 'react'; -import RNFS from 'react-native-fs'; -import FileOpener from 'react-native-file-opener'; import { WebView, Image, View, Platform } from 'react-native'; import { observable } from 'mobx'; import Text from '../controls/custom-text'; @@ -10,28 +8,14 @@ import popupState from '../layout/popup-state'; import locales from '../../lib/locales'; import CheckBox from './checkbox'; import { vars } from '../../styles/styles'; -import { fileStore, User, config, telemetry } from '../../lib/icebear'; +import { User, config, telemetry } from '../../lib/icebear'; import testLabel from '../helpers/test-label'; import FilePreview from '../files/file-preview'; -import PopupMigration from '../controls/popup-migration'; import TwoFactorAuthPrompt from '../settings/two-factor-auth-prompt'; import tm from '../../telemetry'; const { S } = telemetry; -const titleStyle = { - color: vars.lighterBlackText, - fontSize: vars.font.size20 -}; -const textStyle = { - color: vars.lighterBlackText, - fontSize: vars.font.size14 -}; -const textDownloadStyle = { - textDecorationLine: 'underline', - color: vars.linkColor -}; - function textControl(str, style) { const text = { color: '#000000AA', @@ -610,62 +594,6 @@ function popupMoveToSharedFolder() { }); } -function popupUpgradeNotification() { - return new Promise(resolve => { - const viewFileMigrationList = async () => { - const directory = - Platform.OS === 'ios' ? RNFS.CachesDirectoryPath : RNFS.ExternalDirectoryPath; - const path = `${directory}/${User.current.username}-Peerio-shared-files-list.txt`; - const content = await fileStore.migration.getLegacySharedFilesText(); - RNFS.writeFile(path, content, 'utf8') - .then(() => FileOpener.open(path, 'text/*', path)) - .catch(err => console.log(err.message)); - }; - const download = text => { - return ( - - {text} - - ); - }; - const resolveButtonText = fileStore.hasLegacySharedFiles ? 'update' : 'ok'; - popupState.showPopup({ - type: 'systemUpgrade', - title: textControl(tx('title_upgradeFileSystem'), titleStyle), - contents: ( - - {textControl(tx('title_upgradeFileSystemDescription1'), textStyle)} - {textControl(tx('title_upgradeFileSystemDescription2'), textStyle)} - {fileStore.migration.hasLegacySharedFiles - ? textControl( - tx('title_upgradeFileSystemDescription3', { download }), - textStyle - ) - : null} - - ), - buttons: [ - { - id: resolveButtonText, - text: tu(`button_${resolveButtonText}`), - action: () => resolve(true) - } - ] - }); - }); -} - -function popupUpgradeProgress() { - return popupState.showPopup({ - type: 'systemUpgrade', - title: textControl(tx('title_fileUpdateProgress'), titleStyle), - contents: - }); -} - locales.loadAssetFile('terms.txt').then(s => { tos = s; }); @@ -698,8 +626,6 @@ export { popupSignOutAutologin, popupCancelConfirm, popupSetupVideo, - popupUpgradeNotification, - popupUpgradeProgress, popupFileRename, popupFolderDelete, popupMoveToSharedFolder,