From e0e5596bb0b8b443e0e4227c0df83002621a0bf6 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Wed, 26 Nov 2014 12:36:51 -0300 Subject: [PATCH] Config for iOS. URI handler for bitcoin urls. Fix config.xml --- cordova/build.sh | 25 +++++++---- cordova/config.xml | 17 +++++++- cordova/ios/Copay-Info.plist | 83 ++++++++++++++++++++++++++++++++++++ js/init.js | 13 +++++- 4 files changed, 127 insertions(+), 11 deletions(-) create mode 100644 cordova/ios/Copay-Info.plist diff --git a/cordova/build.sh b/cordova/build.sh index 53023e373..ffe2fff2b 100755 --- a/cordova/build.sh +++ b/cordova/build.sh @@ -67,6 +67,9 @@ if [ ! -d $PROJECT ]; then fi echo "${OpenColor}${Green}* Installing plugins... ${CloseColor}" + + cordova plugin add https://github.com/Initsogar/cordova-webintent.git + checkOK cordova plugin add https://github.com/wildabeast/BarcodeScanner.git checkOK @@ -77,6 +80,9 @@ if [ ! -d $PROJECT ]; then cordova plugin add org.apache.cordova.statusbar checkOK + cordova plugin add https://github.com/EddyVerbruggen/LaunchMyApp-PhoneGap-Plugin.git --variable URL_SCHEME=bitcoin + checkOK + fi echo "${OpenColor}${Green}* Generating copay bundle...${CloseColor}" @@ -102,19 +108,22 @@ checkOK cp android/AndroidManifest.xml $PROJECT/platforms/android/AndroidManifest.xml checkOK -#cp android/project.properties $PROJECT/platforms/android/project.properties -#checkOK +cp android/project.properties $PROJECT/platforms/android/project.properties +checkOK cp -R android/res/* $PROJECT/platforms/android/res checkOK -mkdir -p $PROJECT/platforms/ios/Copay/Resources/icons -checkOK - -mkdir -p $PROJECT/platforms/ios/Copay/Resources/splash -checkOK - if [[ !$SKIPIOS ]]; then + cp ios/Copay-Info.plist $PROJECT/platforms/ios/Copay-Info.plist + checkOK + + mkdir -p $PROJECT/platforms/ios/Copay/Resources/icons + checkOK + + mkdir -p $PROJECT/platforms/ios/Copay/Resources/splash + checkOK + cp -R ios/icons/* $PROJECT/platforms/ios/Copay/Resources/icons checkOK diff --git a/cordova/config.xml b/cordova/config.xml index d8949546c..afe78a932 100644 --- a/cordova/config.xml +++ b/cordova/config.xml @@ -18,6 +18,21 @@ - + + + + + + + + + + + + + + + + diff --git a/cordova/ios/Copay-Info.plist b/cordova/ios/Copay-Info.plist new file mode 100644 index 000000000..0f3ddc6f2 --- /dev/null +++ b/cordova/ios/Copay-Info.plist @@ -0,0 +1,83 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + icon.png + CFBundleIcons + + CFBundlePrimaryIcon + + CFBundleIconFiles + + icon-40 + icon-small + icon-60 + icon.png + icon@2x + icon-72 + icon-72@2x + + UIPrerenderedIcon + + + + CFBundleIcons~ipad + + CFBundlePrimaryIcon + + CFBundleIconFiles + + icon-small + icon-40 + icon-50 + icon-76 + icon-60 + icon + icon@2x + icon-72 + icon-72@2x + + UIPrerenderedIcon + + + + CFBundleIdentifier + com.bitpay.copay + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 0.8.2 + CFBundleSignature + ???? + CFBundleVersion + 0.8.2 + LSRequiresIPhoneOS + + NSMainNibFile + + NSMainNibFile~ipad + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeRight + + + diff --git a/js/init.js b/js/init.js index 0c1fd483f..3f4432b38 100644 --- a/js/init.js +++ b/js/init.js @@ -8,9 +8,18 @@ angular.element(document).ready(function() { if (window.cordova !== undefined) { document.addEventListener('deviceready', function() { setTimeout(function(){ navigator.splashscreen.hide(); }, 2000); - + + function handleBitcoinURI(url) { + if (!url) return; + window.location = '#!/uri-payment/' + url; + } + + window.plugins.webintent.getUri(handleBitcoinURI); + window.plugins.webintent.onNewIntent(handleBitcoinURI); + window.handleOpenURL = handleBitcoinURI; + startAngular(); - }); + }, false); } else { startAngular(); }