Merge pull request #394 from bitjson/feature/launch-so-fast-and-so-clean

launch so fast and so clean
This commit is contained in:
Matias Alejo Garcia 2016-10-12 15:05:03 -03:00 committed by GitHub
commit 43aeaae7a2
10 changed files with 71 additions and 74 deletions

3
.gitignore vendored
View File

@ -84,6 +84,9 @@ Session.vim
.netrwhist
*~
.tags
.tags1
# SASS
src/sass/*.css
.sass-cache

View File

@ -16,18 +16,21 @@
<preference name="iosPersistentFileLocation" value="Library" />
<preference name="DisallowOverscroll" value="true"/>
<preference name="HideKeyboardFormAccessoryBar" value="true"/>
<preference name="SplashScreen" value="copayscreen" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="FadeSplashScreen" value="true" />
<preference name="FadeSplashScreenDuration" value="1" />
<preference name="KeyboardDisplayRequiresUserAction" value="false" />
<preference name="StatusBarOverlaysWebView" value="true" />
<preference name="StatusBarBackgroundColor" value="#1e3186" />
<preference name="StatusBarStyle" value="lightcontent" />
<preference name="BackupWebStorage" value="none"/>
<preference name="windows-target-version" value="8.1"/>
<preference name="Orientation" value="default" />
<preference name="cordova-custom-config-stoponerror" value="true" />
<preference name="StatusBarOverlaysWebView" value="true" />
<preference name="StatusBarStyle" value="lightcontent" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="FadeSplashScreen" value="true" />
<preference name="FadeSplashScreenDuration" value="100" />
<preference name="SplashMaintainAspectRatio" value="true" />
<!-- Plugins -->
<plugin name="cordova-plugin-device" spec="~1.1.3"/>
@ -57,8 +60,9 @@
<variable name="URL_SCHEME" value="UNUSED" />
</plugin>
<plugin name="phonegap-plugin-push" spec="~1.8.2">
<variable name="SENDER_ID" value="*PUSHSENDERID*"/>
</plugin>
<variable name="SENDER_ID" value="*PUSHSENDERID*"/>
</plugin>
<plugin name="cordova-custom-config" spec="~3.0.5" />
<!-- Supported Platforms -->
<engine name="ios" spec="~4.2.1" />
@ -67,9 +71,8 @@
<!-- Platform Specific Settings -->
<platform name="ios">
<!-- <hook type="after_prepare" src="util/hooks/ios/add-custom-urls-to-plist.js" />
<hook type="after_prepare" src="util/hooks/ios/add-uistatusbarhidden-to-plist.js" /> -->
<config-file platform="ios" target="*-Info.plist" parent="UIStatusBarHidden"><true/></config-file>
<config-file platform="ios" target="*-Info.plist" parent="UIViewControllerBasedStatusBarAppearance"><false/></config-file>
<icon src="resources/*PACKAGENAME*/ios/icon/icon-60@3x.png" width="180" height="180" />
<icon src="resources/*PACKAGENAME*/ios/icon/icon-60.png" width="60" height="60" />
<icon src="resources/*PACKAGENAME*/ios/icon/icon-60@2x.png" width="120" height="120" />
@ -87,7 +90,6 @@
<icon src="resources/*PACKAGENAME*/ios/icon/icon-50.png" width="50" height="50" />
<icon src="resources/*PACKAGENAME*/ios/icon/icon-50@2x.png" width="100" height="100" />
<splash src="resources/*PACKAGENAME*/ios/splash/Default~iphone.png" width="320" height="480"/>
<splash src="resources/*PACKAGENAME*/ios/splash/Default@2x~iphone.png" width="640" height="960"/>
<splash src="resources/*PACKAGENAME*/ios/splash/Default-Portrait~ipad.png" width="768" height="1024"/>
@ -101,8 +103,7 @@
</platform>
<platform name="android">
<hook type="after_prepare" src="util/hooks/android/add-custom-urls-to-android-manifest.js" />
<hook type="after_prepare" src="util/hooks/android/prohibit-cloud-backups-in-android-manifest.js" />
<preference name="android-manifest/application/@android:allowBackup" value="false" />
<icon src="resources/*PACKAGENAME*/android/icon/drawable-ldpi-icon.png" density="ldpi" />
<icon src="resources/*PACKAGENAME*/android/icon/drawable-mdpi-icon.png" density="mdpi" />

View File

@ -27,8 +27,8 @@
"bitcore-wallet-client": "4.3.1",
"bower": "^1.7.9",
"chai": "^3.5.0",
"cordova": "5.4.1",
"cordova-android": "5.1.1",
"cordova-custom-config": "^3.0.5",
"cordova-plugin-qrscanner": "^2.3.1",
"coveralls": "^2.11.9",
"express": "^4.11.2",
@ -89,12 +89,10 @@
"clean-all": "git clean -dfx && npm install"
},
"devDependencies": {
"androidmanifest": "^2.0.0",
"cordova": "^5.4.1",
"globby": "^6.0.0",
"cordova": "^6.3.1",
"grunt": "^1.0.1",
"ionic": "^2.1.0",
"plist": "^2.0.1",
"trash-cli": "^1.4.0",
"xcode": "^0.8.2"
"lodash": "^4.3.0"
}
}

View File

@ -1,6 +1,11 @@
'use strict';
angular.module('copayApp.controllers').controller('disclaimerController', function($scope, $timeout, $state, $log, $ionicModal, profileService, uxLanguage, externalLinkService, storageService, $stateParams) {
angular.module('copayApp.controllers').controller('disclaimerController', function($scope, $timeout, $state, $log, $ionicModal, profileService, uxLanguage, externalLinkService, storageService, $stateParams, startupService) {
$scope.$on("$ionicView.afterEnter", function() {
startupService.ready();
});
$scope.init = function() {
$scope.lang = uxLanguage.currentLanguage;
$scope.terms = {};

View File

@ -1,9 +1,13 @@
'use strict';
angular.module('copayApp.controllers').controller('welcomeController', function($scope, $state, $timeout, $ionicConfig, $log, profileService) {
angular.module('copayApp.controllers').controller('welcomeController', function($scope, $state, $timeout, $ionicConfig, $log, profileService, startupService) {
$ionicConfig.views.swipeBackEnabled(false);
$scope.$parent.$on("$ionicView.afterEnter", function() {
startupService.ready();
});
$scope.goImport = function(code) {
$state.go('onboarding.import', {
fromOnboarding: true,

View File

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('tabHomeController',
function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, gettextCatalog, lodash, popupService, ongoingProcess, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, $window, bitpayCardService) {
function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, gettextCatalog, lodash, popupService, ongoingProcess, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, $window, bitpayCardService, startupService) {
var wallet;
var listeners = [];
var notifications = [];
@ -13,6 +13,10 @@ angular.module('copayApp.controllers').controller('tabHomeController',
$scope.homeTip = $stateParams.fromOnboarding;
$scope.isCordova = platformInfo.isCordova;
$scope.$on("$ionicView.afterEnter", function() {
startupService.ready();
});
if (!$scope.homeTip) {
storageService.getHomeTipAccepted(function(error, value) {
$scope.homeTip = (value == 'false') ? false : true;

View File

@ -947,22 +947,21 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
});
$ionicPlatform.on('resume', function() {
// Nothing tot do
// Nothing to do
});
$ionicPlatform.on('menubutton', function() {
window.location = '#/preferences';
});
setTimeout(function() {
navigator.splashscreen.hide();
}, 500);
}
$log.info('Init profile...');
// Try to open local profile
profileService.loadAndBindProfile(function(err) {
$ionicHistory.nextViewOptions({
disableAnimate: true
});
if (err) {
if (err.message && err.message.match('NOPROFILE')) {
$log.debug('No profile... redirecting');

View File

@ -0,0 +1,28 @@
'use strict';
angular.module('copayApp.services').service('startupService', function($log, $timeout) {
var splashscreenVisible = true;
var statusBarVisible = false;
function _hideSplash(){
if(typeof navigator.splashscreen !== "undefined" && splashscreenVisible){
$log.debug('startupService is hiding the splashscreen...');
$timeout(function(){
navigator.splashscreen.hide();
}, 20);
splashscreenVisible = false;
}
}
function _showStatusBar(){
if(typeof StatusBar !== "undefined" && !statusBarVisible){
$log.debug('startupService is showing the StatusBar...');
StatusBar.show();
statusBarVisible = true;
}
}
this.ready = function() {
_showStatusBar();
_hideSplash();
};
});

View File

@ -1,27 +0,0 @@
'use strict';
var AndroidManifest = require('androidmanifest');
var FILEPATH = 'platforms/android/AndroidManifest.xml';
var manifest = new AndroidManifest().readFile(FILEPATH);
var mainActivity = manifest.activity('MainActivity');
var customUrls = ['copay', 'bitcoin', 'bitauth'];
customUrls.forEach(function(url){
var selector = 'intent-filter > data[android\\:scheme=' + url + ']';
if(mainActivity.find(selector).length > 0){
return;
}
var intentFilter = manifest.$('<intent-filter>');
intentFilter.append('<data android:scheme="' + url + '" />');
intentFilter.append('<action android:name="android.intent.action.VIEW" />');
intentFilter.append('<category android:name="android.intent.category.DEFAULT" />');
intentFilter.append('<category android:name="android.intent.category.BROWSABLE" />');
mainActivity.append(intentFilter);
});
manifest.writeFile(FILEPATH);
console.log('custome uri schemes written to AndroidManifest');

View File

@ -1,18 +0,0 @@
module.exports = function(ctx) {
var fs = ctx.requireCordovaModule('fs'),
path = ctx.requireCordovaModule('path'),
xml = ctx.requireCordovaModule('cordova-common').xmlHelpers;
var manifestPath = path.join(ctx.opts.projectRoot, '/platforms/android/AndroidManifest.xml');
var doc = xml.parseElementtreeSync(manifestPath);
if (doc.getroot().tag !== 'manifest') {
throw new Error(manifestPath + ' has incorrect root node name (expected "manifest")');
}
doc.getroot().find('./application').attrib['android:allowBackup'] = "false";
//write the manifest file
fs.writeFileSync(manifestPath, doc.write({
indent: 4
}), 'utf-8');
};