rm importLegacy

This commit is contained in:
Matias Alejo Garcia 2016-06-11 22:29:17 -03:00
commit bf16391085
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
5 changed files with 14 additions and 141 deletions

View file

@ -21,7 +21,7 @@
<div class="create-tab pr small-only-text-center" ng-hide="create.hideTabs">
<div class="row">
<div class="tab-container small-4 medium-4 large-4" ng-class="{'selected': type =='12'}">
<a href ng-click="import.setType('12')" translate>Wallet Recovery Phrase</a>
<a href ng-click="import.setType('12')" translate>Recovery Phrase</a>
</div>
<div class="tab-container small-4 medium-4 large-4" ng-class="{'selected': type=='file'}">
<a href ng-click="import.setType('file')" translate>File/Text Backup</a>
@ -161,14 +161,6 @@
Import backup
</button>
</form>
<div class="text-center text-gray p20v" ng-click="$root.go('importLegacy')">
<p class="text-gray m5b size-14" translate> Have a Backup from Copay v0.9?</p>
<button class=" outline dark-gray tiny round"> <span translate>Import here</span>
<i class="icon-arrow-right3 size-14"></i>
</button>
</div>
</div>
</div>

View file

@ -1,68 +0,0 @@
<div
class="topbar-container"
ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Import legacy wallet'; goBackToState = 'import'; noColor = true">
</div>
<div class="content p20v" ng-controller="importLegacyController as importLegacy">
<div class="row m20t">
<div class="large-12 columns">
<div ng-show="importLegacy.importing">
<h1 class="m20b animated infinite flash" translate>Importing...</h1>
<ul>
<li ng-repeat="m in importLegacy.messages">
<span ng-style="{'opacity':m.opacity}">{{m.message|translate}}</span>
</ul>
</div>
<div class="box-notification" ng-show="importLegacy.error">
<span class="text-warning size-14">
{{importLegacy.error|translate}}
</span>
</div>
<div ng-show="!importLegacy.importing">
<form name="importForm" ng-submit="importLegacy.import(importForm)" novalidate>
<label for="fromCloud" class="line-b oh m20b">
<span translate>Import from the Cloud?</span>
<switch id="fromCloud" name="fromCloud" ng-model="importLegacy.fromCloud" class="green right m5t m10b"></switch>
</label>
<label for="username">
<span ng-show="importLegacy.fromCloud" translate>Email</span>
<span ng-show="!importLegacy.fromCloud" translate>Username</span>
<input type="text" class="form-control"
placeholder="{{importLegacy.fromCloud ? ('Email'|translate): ('Username'|translate)}}"
name="username" ng-model="importLegacy.username" autocapitalize="off" required>
</label>
<label for="password">
<span translate>Password</span>
<input type="password" class="form-control" placeholder="{{'Your profile password'|translate}}"
name="password" ng-model="importLegacy.password" required>
</label>
<label for="server" ng-show="importLegacy.fromCloud">
<span translate>Server</span>
<input type="text" class="form-control" placeholder="{{'Server URL'}}"
name="server" ng-model="importLegacy.server" required>
</label>
<button translate type="submit"
class="button black round expand m0"
ng-disabled="importForm.$invalid">
Import
</button>
</form>
<div class="text-center p20v">
<a class="m20t tiny button outline round light-gray " ng-click="$root.openExternalLink('https://github.com/bitpay/copay/releases/tag/v0.10.0')" translate>
Learn more about Wallet Migration
</a>
</div>
</div>
</div>
</div>
</div>

View file

@ -1,63 +0,0 @@
'use strict';
angular.module('copayApp.controllers').controller('importLegacyController',
function($rootScope, $scope, $log, $timeout, notification, legacyImportService, profileService, go, lodash, bitcore, gettext, gettextCatalog) {
var self = this;
self.messages = [];
self.fromCloud = true;
self.server = "https://insight.bitpay.com:443/api/email";
$rootScope.$on('Local/ImportStatusUpdate', function(event, status) {
$timeout(function() {
$log.debug(status);
self.messages.unshift({
message: status,
});
var op = 1;
lodash.each(self.messages, function(m) {
if (op < 0.1) op = 0.1;
m.opacity = op;
op = op - 0.15;
});
}, 100);
});
self.scan = function(ids) {
$log.debug('### Scanning: ' + ids)
var i = 0;
lodash.each(ids, function(id) {
$rootScope.$emit('Local/WalletImported', id);
if (++i == ids.length) {
go.walletHome();
};
});
};
self.import = function(form) {
var username = form.username.$modelValue;
var password = form.password.$modelValue;
var serverURL = form.server.$modelValue;
var fromCloud = form.fromCloud.$modelValue;
self.error = null;
self.importing = true;
$timeout(function() {
legacyImportService.import(username, password, serverURL, fromCloud, function(err, ids, toScanIds) {
if (err || !ids || !ids.length) {
self.importing = false;
self.error = err || gettext('Failed to import wallets');
return;
}
notification.success( gettextCatalog.getString('{{len}} wallets imported. Funds scanning in progress. Hold on to see updated balance', {len: ids.length}));
self.scan(toScanIds);
});
}, 100);
};
// TODO destroy event...
});

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.services').factory('openURLService', function($ionicHistory, $document, $log, $state, go, platformInfo, lodash) {
angular.module('copayApp.services').factory('openURLService', function($rootScope, $ionicHistory, $document, $log, $state, go, platformInfo, lodash, profileService) {
var root = {};
root.registeredUriHandlers = [{
@ -21,6 +21,15 @@ angular.module('copayApp.services').factory('openURLService', function($ionicHis
var handleOpenURL = function(args) {
$log.info('Handling Open URL: ' + JSON.stringify(args));
if (!profileService.isBound) {
$log.warn('Profile not bound yet. Waiting');
return $rootScope.$on('Local/ProfileBound', function(){
$log.warn('Profile ready, retrying...');
handleOpenURL(args);
});
};
// Stop it from caching the first view as one to return when the app opens
$ionicHistory.nextViewOptions({
historyRoot: true,

View file

@ -169,6 +169,9 @@ angular.module('copayApp.services')
if (!val) {
return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
}
root.isBound = true;
$root.$emit('Local/ProfileBound');
return cb();
});
});