Skip to content
Open
4 changes: 2 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ module.exports = function(grunt) {
command: 'cordova prepare android && cordova build android --release',
},
build_ios_debug: {
command: 'cordova prepare ios && cordova build ios --debug --buildFlag="-UseModernBuildSystem=0"',
command: 'cordova prepare ios && cordova build ios --debug --buildFlag="-UseModernBuildSystem=0" --buildFlag="-scheme BETA"',
options: {
maxBuffer: 3200 * 1024
}
},
build_ios_release: {
command: 'cordova prepare ios && cordova build ios --release --buildFlag="-UseModernBuildSystem=0"',
command: 'cordova prepare ios && cordova build ios --release --buildFlag="-UseModernBuildSystem=0" --buildFlag="-scheme Bitcoin.com Wallet"',
options: {
maxBuffer: 3200 * 1024
}
Expand Down
79 changes: 79 additions & 0 deletions app-template/annotate_icon.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/usr/bin/env bash

#usage: ./annotate_icon.sh beta BETA 003eaa

# Required command line parameters
FOLDER_NAME=$1
#DEST_FOLDER_RELATIVE=../resources/bitcoin.com/ios/icon/$FOLDER_NAME
DEST_FOLDER_RELATIVE=../resources/bitcoin.com/ios/icon
DEST_ICON_MASTER=$DEST_FOLDER_RELATIVE/icon-1024.png
SOURCE_ICON='resources/ios/icon/icon-1024.png'

mkdir $DEST_FOLDER_RELATIVE

if [ -z "$3" ]; then
cp $SOURCE_ICON $DEST_ICON_MASTER
else
ICON_TEXT=$2
HEX_COLOR=$3
convert $SOURCE_ICON -gravity center -pointsize 144 -draw "fill '#$HEX_COLOR' rotate -45 rectangle -500,1035,500,1200" -draw "fill white font 'bitcoincom/fonts/ProximaNova-ExtraBold.otf' rotate -45 text 0,400 '$ICON_TEXT'" $DEST_ICON_MASTER
fi

# iPhone Notifications
convert $DEST_FOLDER_RELATIVE/icon-1024.png -resize 40x40 $DEST_FOLDER_RELATIVE/icon-40.png
convert $DEST_FOLDER_RELATIVE/icon-1024.png -resize 60x60 $DEST_FOLDER_RELATIVE/icon-60.png

# iPhone Settings
convert $DEST_FOLDER_RELATIVE/icon-1024.png -resize 29x29 $DEST_FOLDER_RELATIVE/icon-29.png
convert $DEST_FOLDER_RELATIVE/icon-1024.png -resize 58x58 $DEST_FOLDER_RELATIVE/icon-58.png
convert $DEST_FOLDER_RELATIVE/icon-1024.png -resize 87x87 $DEST_FOLDER_RELATIVE/icon-87.png

# iPhone Spotlight
# 40 - already done
convert $DEST_FOLDER_RELATIVE/icon-1024.png -resize 80x80 $DEST_FOLDER_RELATIVE/icon-80.png

# iPhone App, iOS 5, 6
convert $DEST_FOLDER_RELATIVE/icon-1024.png -resize 57x57 $DEST_FOLDER_RELATIVE/icon-57.png
convert $DEST_FOLDER_RELATIVE/icon-1024.png -resize 114x114 $DEST_FOLDER_RELATIVE/icon-114.png

# iPhone App, iOS 7+
convert $DEST_FOLDER_RELATIVE/icon-1024.png -resize 120x120 $DEST_FOLDER_RELATIVE/icon-120.png
convert $DEST_FOLDER_RELATIVE/icon-1024.png -resize 180x180 $DEST_FOLDER_RELATIVE/icon-180.png

# iPad Notifications
convert $DEST_FOLDER_RELATIVE/icon-1024.png -resize 20x20 $DEST_FOLDER_RELATIVE/icon-20.png
# 40 - already done

# iPad Settings
# 29 - already done
# 58 - already done

# iPad Spotlight, iOS 7+
# 40 - already done
# 80 - already done

# iPad Spotlight, iOS 5, 6
convert $DEST_FOLDER_RELATIVE/icon-1024.png -resize 50x50 $DEST_FOLDER_RELATIVE/icon-50.png
convert $DEST_FOLDER_RELATIVE/icon-1024.png -resize 100x100 $DEST_FOLDER_RELATIVE/icon-100.png

# iPad App, iOS 5, 6
convert $DEST_FOLDER_RELATIVE/icon-1024.png -resize 72x72 $DEST_FOLDER_RELATIVE/icon-72.png
convert $DEST_FOLDER_RELATIVE/icon-1024.png -resize 144x144 $DEST_FOLDER_RELATIVE/icon-144.png

# iPad App, iOS 7+
convert $DEST_FOLDER_RELATIVE/icon-1024.png -resize 76x76 $DEST_FOLDER_RELATIVE/icon-76.png
convert $DEST_FOLDER_RELATIVE/icon-1024.png -resize 152x152 $DEST_FOLDER_RELATIVE/icon-152.png

# iPad Pro App
convert $DEST_FOLDER_RELATIVE/icon-1024.png -resize 167x167 $DEST_FOLDER_RELATIVE/icon-167.png

# Apple Watch Notification Centre
convert $DEST_FOLDER_RELATIVE/icon-1024.png -resize 48x48 $DEST_FOLDER_RELATIVE/icon-48.png
convert $DEST_FOLDER_RELATIVE/icon-1024.png -resize 55x55 $DEST_FOLDER_RELATIVE/icon-55.png

# Apple Watch Companion Settings Notification Centre
# 58 - already done
# 87 - already done

# Apple Watch
convert $DEST_FOLDER_RELATIVE/icon-1024.png -resize 88x88 $DEST_FOLDER_RELATIVE/icon-88.png
91 changes: 91 additions & 0 deletions app-template/bitcoincom/BETA.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
BuildableName = "Bitcoin.com Wallet.app"
BlueprintName = "Bitcoin.com Wallet"
ReferencedContainer = "container:Bitcoin.com Wallet.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
BuildableName = "Bitcoin.com Wallet.app"
BlueprintName = "Bitcoin.com Wallet"
ReferencedContainer = "container:Bitcoin.com Wallet.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
BuildableName = "Bitcoin.com Wallet.app"
BlueprintName = "Bitcoin.com Wallet"
ReferencedContainer = "container:Bitcoin.com Wallet.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
BuildableName = "Bitcoin.com Wallet.app"
BlueprintName = "Bitcoin.com Wallet"
ReferencedContainer = "container:Bitcoin.com Wallet.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
21 changes: 21 additions & 0 deletions app-template/bitcoincom/import_scheme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# Set to your project and scheme

export PROJECT_FILE='../../platforms/ios/Bitcoin.com Wallet.xcodeproj'
export SCHEME='BETA.xcscheme'

# Generate path to shared schemes folder

export SCHEMES="$PROJECT_FILE"/xcshareddata/xcschemes

cd "$(dirname "$0")"

if [ ! -f "$SCHEMES/$SCHEME" ]; then

# Create folder if necessary
mkdir -p "$SCHEMES"

# Copy scheme
cp $SCHEME "$SCHEMES/$SCHEME"
fi
1 change: 1 addition & 0 deletions app-template/config-template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@

<!-- Platform Specific Settings -->
<platform name="ios">
<hook type="after_platform_add" src="app-template/bitcoincom/import_scheme.sh" />
<config-file platform="ios" target="*-Info.plist" parent="UIStatusBarHidden"><true/></config-file>
<config-file platform="ios" target="*-Info.plist" parent="UIViewControllerBasedStatusBarAppearance"><false/></config-file>
<config-file target="*-Info.plist" parent="ITSAppUsesNonExemptEncryption"><false/></config-file>
Expand Down
164 changes: 164 additions & 0 deletions app-template/create-ios-build-configurations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
'use strict';

const assert = require('assert');
const fs = require('fs');

console.log('******');

fs.readFile(__dirname + '/../platforms/ios/Bitcoin.com\ Wallet.xcodeproj/project.pbxproj', function onReadFile(err, data) {
if (err) {
throw err;
}
//console.log(data.toString());
var contents = data.toString();
//console.log('File was read.');
getDebugConfigurations(contents);
});


function addConfiguration(contents) {

}

function getBuildConfig(contents, idAndName) {
const idIndex = contents.indexOf(idAndName);
assert(idIndex);

const buildConfigOpeningBracketIndex = contents.indexOf('{', idIndex);
const buildSettingsClosingBracketIndex = contents.indexOf('};', buildConfigOpeningBracketIndex + 1);
const buildConfigClosingBracketIndex = contents.indexOf('};', buildSettingsClosingBracketIndex + 1);

const buildConfig = contents.substring(
buildConfigOpeningBracketIndex,
buildConfigClosingBracketIndex + 2 // To include trailing semicolon
);

return buildConfig;
}

function insertBuildConfiguration(contents, buildConfiguration, idAndName) {
const buildConfigsEndDelimiter = '/* End XCBuildConfiguration section */';
const buildConfigEndIndex = contents.indexOf(buildConfigsEndDelimiter);
assert(buildConfigEndIndex >= 0);

const newConfig = ' ' + idAndName + ' = ' + buildConfiguration + '\n' + buildConfigsEndDelimiter;
const newContents = contents.replace(buildConfigsEndDelimiter, newConfig);

/*
fs.writeFile(__dirname + '/../platforms/ios/Bitcoin.com\ Wallet.xcodeproj/project2.pbxproj', newContents, function onWriteFile(err) {
if(err) {
return console.log(err);
}

console.log('project2.pbxproj was written');
});
*/

try {
fs.writeFileSync(__dirname + '/../platforms/ios/Bitcoin.com\ Wallet.xcodeproj/project2.pbxproj', newContents);
} catch (e) {
console.log(e);
return;
}
return newContents;
}

function renamedBuildConfig(buildConfig, newName) {
return buildConfig.replace('name = Debug', 'name = ' + newName);
}

function getDebugConfiguration(contents, configContents, start, newName) {

const buildConfigId = getDebugConfigurationId(contents, configContents, start);
assert(buildConfigId);
const buildConfig = getBuildConfig(contents, buildConfigId);
assert(buildConfig)

const renamed = renamedBuildConfig(buildConfig, newName);
assert(renamed);

return renamed;
}

function getDebugConfigurationId(contents, configContents, start) {
//console.log('getDebugConfiguration() starting at: ' + start);
const subContents = configContents.substring(start);
//console.log('subContents: "' + subContents.substring(0, 200) + '"');

//const buildConfigsRegex = /[\s\S]+buildConfigurations = \(\s*([^\)]+)/;
const buildConfigsRegex = /.+buildConfigurations = \(\s*([^\)]+)/;
const buildConfigsExec = buildConfigsRegex.exec(subContents);
assert(buildConfigsExec.length === 2);

const buildConfigsText = buildConfigsExec[1];
//console.log('buildConfigsText: "' + buildConfigsText + '"');

const buildConfigLines = buildConfigsText.split(',');
let debugIdAndName = '';
buildConfigLines.forEach(function onLine(line) {
if (line.indexOf(' Debug ') >= 0) {
debugIdAndName = line.trim();
}
});

assert(debugIdAndName);
console.log('Debug build config ID:', debugIdAndName);

//const PBXNativeTargetExistingBuildConfig = getBuildConfig(contents, PBXNativeTargetDebugIdAndName);
//console.log('PBXNativeTargetExistingBuildConfig:', PBXNativeTargetExistingBuildConfig);
return debugIdAndName;
}


function getDebugConfigurations(contents) {


//buildConfigurations = (
// 1D6058940D05DD3E006BFB54 /* Debug */,
// DAD7F4DA21EEE6DC00135531 /* Task */,
// 1D6058950D05DD3E006BFB54 /* Release */,
//);

const PBXNativeTargetConfigListBeginDelimiter = '/* Build configuration list for PBXNativeTarget';
const PBXProjectConfigListBeginDelimiter = '/* Build configuration list for PBXProject';
const XCConfigurationListBeginDelimiter = '/* Begin XCConfigurationList section */';

const newName = 'Dev';
const PBXNativeTargetId = 'AAAAAAAAAAAAAAAAAAAAAAA1';
const PBXProjectId = 'AAAAAAAAAAAAAAAAAAAAAAA2';
const PBXNativeTargetIdAndName = PBXNativeTargetId + ' /* ' + newName + ' */';
const PBXProjectIdAndName = PBXProjectId + ' /* ' + newName + ' */';

const configListIndex = contents.indexOf(XCConfigurationListBeginDelimiter);
const configContents = contents.substring(configListIndex);

const PBXNativeTargetBuildConfigsIndex = configContents.indexOf(PBXNativeTargetConfigListBeginDelimiter);
const PBXProjectBuildConfigsIndex = configContents.indexOf(PBXProjectConfigListBeginDelimiter);

const PBXNativeTargetBuildConfig = getDebugConfiguration(contents, configContents, PBXNativeTargetBuildConfigsIndex, newName);
const PBXProjectBuildConfig = getDebugConfiguration(contents, configContents, PBXProjectBuildConfigsIndex, newName);

let newContents = insertBuildConfiguration(contents, PBXNativeTargetBuildConfig, PBXNativeTargetIdAndName);
newContents = insertBuildConfiguration(newContents, PBXProjectBuildConfig, PBXProjectIdAndName);

const newConfigListIndex = newContents.indexOf(XCConfigurationListBeginDelimiter);

const newPBXNativeTargetBuildConfigsIndex = newContents.indexOf(PBXNativeTargetConfigListBeginDelimiter, newConfigListIndex);
let configListEndIndex = newContents.indexOf(')', newPBXNativeTargetBuildConfigsIndex);
assert(configListEndIndex >= 0);
newContents = newContents.slice(0, configListEndIndex) + PBXNativeTargetIdAndName + ',\n ' + newContents.slice(configListEndIndex);

const newPBXProjectBuildConfigsIndex = newContents.indexOf(PBXProjectConfigListBeginDelimiter, newConfigListIndex);
configListEndIndex = newContents.indexOf(')', newPBXProjectBuildConfigsIndex);
assert(configListEndIndex >= 0);
newContents = newContents.slice(0, configListEndIndex) + PBXProjectIdAndName + ',\n ' + newContents.slice(configListEndIndex);

try {
fs.writeFileSync(__dirname + '/../platforms/ios/Bitcoin.com\ Wallet.xcodeproj/project2.pbxproj', newContents);
} catch (e) {
console.log(e);
return;
}


}
Loading