2016-08-25 16:31:47 -03:00
'use strict' ;
2016-10-10 17:12:14 -03:00
angular . module ( 'copayApp.controllers' ) . controller ( 'backupRequestController' , function ( $scope , $state , $stateParams , $ionicConfig , popupService , gettextCatalog ) {
2016-08-25 16:31:47 -03:00
2016-09-02 15:42:45 -03:00
$scope . walletId = $stateParams . walletId ;
2016-08-25 16:31:47 -03:00
2017-03-03 10:36:19 -03:00
$scope . $on ( "$ionicView.enter" , function ( ) {
$ionicConfig . views . swipeBackEnabled ( false ) ;
2017-02-23 14:26:05 -05:00
} ) ;
2017-03-03 10:36:19 -03:00
$scope . $on ( "$ionicView.beforeLeave" , function ( ) {
$ionicConfig . views . swipeBackEnabled ( true ) ;
2017-02-23 14:26:05 -05:00
} ) ;
2016-09-09 11:14:04 -03:00
$scope . openPopup = function ( ) {
2016-08-25 16:31:47 -03:00
2016-12-28 16:29:45 -03:00
var title = gettextCatalog . getString ( 'Watch out!' ) ;
2016-10-06 21:12:24 -04:00
var message = gettextCatalog . getString ( 'If this device is replaced or this app is deleted, neither you nor BitPay can recover your funds without a backup.' ) ;
2016-09-09 11:14:04 -03:00
var okText = gettextCatalog . getString ( 'I understand' ) ;
var cancelText = gettextCatalog . getString ( 'Go back' ) ;
popupService . showConfirm ( title , message , okText , cancelText , function ( val ) {
if ( val ) {
2016-12-28 16:29:45 -03:00
var title = gettextCatalog . getString ( 'Are you sure you want to skip it?' ) ;
2016-09-21 14:38:22 -04:00
var message = gettextCatalog . getString ( 'You can create a backup later from your wallet settings.' ) ;
2016-12-28 16:29:45 -03:00
var okText = gettextCatalog . getString ( 'Yes, skip' ) ;
2016-09-09 11:14:04 -03:00
var cancelText = gettextCatalog . getString ( 'Go back' ) ;
popupService . showConfirm ( title , message , okText , cancelText , function ( val ) {
if ( val ) {
2016-10-10 17:12:14 -03:00
$state . go ( 'onboarding.disclaimer' , {
walletId : $scope . walletId ,
backedUp : false
} ) ;
2016-09-09 11:14:04 -03:00
}
} ) ;
}
} ) ;
2016-08-25 16:31:47 -03:00
}
} ) ;