Skip to content

Commit 4e0ccb8

Browse files
authored
Merge pull request #454 from BranchMetrics/no-prefix-for-custom-link-domains
No prefix for custom link domains
2 parents 1f7ec5a + 84e6fbf commit 4e0ccb8

16 files changed

+183
-269
lines changed

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@
8585
]
8686
},
8787
"devDependencies": {
88-
"@commitlint/cli": "^6.1.3",
88+
"@commitlint/cli": "^6.2.0",
8989
"@commitlint/config-conventional": "^6.1.3",
90-
"@semantic-release/changelog": "^2.0.1",
91-
"@semantic-release/exec": "^2.2.3",
92-
"@semantic-release/git": "^4.0.2",
93-
"@semantic-release/github": "^4.2.11",
94-
"@semantic-release/npm": "^3.2.4",
90+
"@semantic-release/changelog": "^2.0.2",
91+
"@semantic-release/exec": "^2.2.4",
92+
"@semantic-release/git": "^4.0.3",
93+
"@semantic-release/github": "^4.2.15",
94+
"@semantic-release/npm": "^3.2.5",
9595
"eslint": "^4.19.1",
9696
"eslint-config-airbnb-base": "^12.1.0",
9797
"eslint-config-prettier": "^2.9.0",
@@ -100,7 +100,7 @@
100100
"husky": "^0.14.3",
101101
"lint-staged": "^7.0.5",
102102
"prettier": "^1.12.1",
103-
"semantic-release": "^15.1.7",
104-
"travis-deploy-once": "^4.4.1"
103+
"semantic-release": "^15.2.0",
104+
"travis-deploy-once": "^5.0.0"
105105
}
106106
}

src/scripts/android/updateAndroidManifest.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
(function() {
22
// properties
3-
4-
53

64
const path = require("path");
75
const xmlHelper = require("../lib/xmlHelper.js");
@@ -67,7 +65,7 @@
6765
);
6866
manifest = xmlHelper.readXmlAsJson(pathToManifest);
6967
} catch (e) {
70-
throw new Error(`BRANCH SDK: Cannot read AndroidManfiest.xml ${ e}`);
68+
throw new Error(`BRANCH SDK: Cannot read AndroidManfiest.xml ${e}`);
7169
}
7270
}
7371
const mainActivityIndex = getMainLaunchActivityIndex(
@@ -91,7 +89,10 @@
9189
let metadatas = manifest.manifest.application[0]["meta-data"] || [];
9290
const metadata = [];
9391
const keys = ["io.branch.sdk.BranchKey", "io.branch.sdk.TestMode"];
94-
const vals = [preferences.branchKey, preferences.androidTestMode || "false"];
92+
const vals = [
93+
preferences.branchKey,
94+
preferences.androidTestMode || "false"
95+
];
9596

9697
// remove old
9798
for (var i = 0; i < keys.length; i++) {
@@ -109,9 +110,7 @@
109110
}
110111
});
111112
}
112-
manifest.manifest.application[0]["meta-data"] = metadatas.concat(
113-
metadata
114-
);
113+
manifest.manifest.application[0]["meta-data"] = metadatas.concat(metadata);
115114

116115
return manifest;
117116
}
@@ -298,13 +297,16 @@
298297
.split(".")
299298
.slice(1)
300299
.join(".");
301-
const alternate = `${first }-alternate` + `.${ rest}`;
300+
const alternate = `${first}-alternate` + `.${rest}`;
302301

303302
intentFilterData.push(getAppLinkIntentFilterDictionary(linkDomain));
304303
intentFilterData.push(getAppLinkIntentFilterDictionary(alternate));
305304
} else {
306-
// bnc.lt and custom domains
307-
if (preferences.androidPrefix === null) {
305+
// bnc.lt
306+
if (
307+
linkDomain.indexOf("bnc.lt") !== -1 &&
308+
preferences.androidPrefix === null
309+
) {
308310
throw new Error(
309311
'BRANCH SDK: Invalid "android-prefix" in <branch-config> in your config.xml. Docs https://goo.gl/GijGKP'
310312
);
@@ -343,10 +345,7 @@
343345
const without = [];
344346
for (let i = 0; i < items.length; i++) {
345347
const item = items[i];
346-
if (
347-
item.hasOwnProperty("$") &&
348-
item.$.hasOwnProperty("android:name")
349-
) {
348+
if (item.hasOwnProperty("$") && item.$.hasOwnProperty("android:name")) {
350349
const key = item.$["android:name"];
351350
if (key === androidName) {
352351
continue;
@@ -383,7 +382,7 @@
383382
return false;
384383
}
385384

386-
isLauncher = intentFilters.some((intentFilter) => {
385+
isLauncher = intentFilters.some(intentFilter => {
387386
const action = intentFilter.action;
388387
const category = intentFilter.category;
389388

src/scripts/hooks/afterPrepare.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
(function() {
22
// properties
3-
4-
53

64
const configPreferences = require("../npm/processConfigXml.js");
75
const iosDevelopmentTeam = require("../ios/updateDevelopmentTeam.js");
@@ -17,7 +15,7 @@
1715
const preferences = configPreferences.read(context);
1816
const platforms = context.opts.cordova.platforms;
1917

20-
platforms.forEach((platform) => {
18+
platforms.forEach(platform => {
2119
if (platform === ANDROID) {
2220
androidManifest.writePreferences(context, preferences);
2321
}

src/scripts/hooks/beforePluginInstall.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
(function() {
22
// properties
3-
4-
53

64
const nodeDependencies = require("../npm/downloadNpmDependencies.js");
75

src/scripts/hooks/beforePrepare.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
(function() {
22
// properties
3-
4-
53

64
const configPreferences = require("../npm/processConfigXml.js");
75
const iosPlist = require("../ios/updatePlist.js");
@@ -17,7 +15,7 @@
1715
const preferences = configPreferences.read(context);
1816
const platforms = context.opts.cordova.platforms;
1917

20-
platforms.forEach((platform) => {
18+
platforms.forEach(platform => {
2119
if (platform === IOS) {
2220
iosPlist.addBranchSettings(preferences);
2321
iosCapabilities.enableAssociatedDomains(preferences);

src/scripts/ios/enableEntitlements.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
(function() {
22
// properties
3-
4-
53

64
const path = require("path");
75
const compare = require("node-version-compare");
@@ -22,7 +20,7 @@
2220
"ios",
2321
preferences.projectName,
2422
"Resources",
25-
`${preferences.projectName }.entitlements`
23+
`${preferences.projectName}.entitlements`
2624
);
2725

2826
activateAssociativeDomains(
@@ -43,8 +41,8 @@
4341

4442
for (config in configurations) {
4543
buildSettings = configurations[config].buildSettings;
46-
buildSettings.CODE_SIGN_IDENTITY = `"${ CODESIGNIDENTITY }"`;
47-
buildSettings.CODE_SIGN_ENTITLEMENTS = `"${ entitlementsFile }"`;
44+
buildSettings.CODE_SIGN_IDENTITY = `"${CODESIGNIDENTITY}"`;
45+
buildSettings.CODE_SIGN_ENTITLEMENTS = `"${entitlementsFile}"`;
4846

4947
// if deployment target is less then the required one - increase it
5048
if (buildSettings.IPHONEOS_DEPLOYMENT_TARGET) {

src/scripts/ios/updateAssociatedDomains.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
(function() {
22
// properties
3-
4-
53

64
const path = require("path");
75
const fs = require("fs");
@@ -37,15 +35,15 @@
3735
"ios",
3836
preferences.projectName,
3937
"Resources",
40-
`${preferences.projectName }.entitlements`
38+
`${preferences.projectName}.entitlements`
4139
);
4240
files.push(
4341
path.join(
4442
preferences.projectRoot,
4543
"platforms",
4644
"ios",
4745
preferences.projectName,
48-
`${preferences.projectName }.entitlements`
46+
`${preferences.projectName}.entitlements`
4947
)
5048
);
5149
files.push(entitlements);
@@ -57,7 +55,7 @@
5755
"platforms",
5856
"ios",
5957
preferences.projectName,
60-
`Entitlements-${ buildType }.plist`
58+
`Entitlements-${buildType}.plist`
6159
);
6260
files.push(plist);
6361
}
@@ -117,11 +115,11 @@
117115
if (domain.indexOf("applinks:") === 0) {
118116
domain = domain.replace("applinks:", "");
119117
if (isBranchAssociatedDomains(domain, linkDomains)) {
120-
output.push(`applinks:${ domain}`);
118+
output.push(`applinks:${domain}`);
121119
}
122120
} else if (isBranchAssociatedDomains(domain, linkDomains)) {
123-
output.push(domain);
124-
}
121+
output.push(domain);
122+
}
125123
}
126124

127125
return output;
@@ -156,9 +154,9 @@
156154
.split(".")
157155
.slice(2)
158156
.join(".");
159-
const alternate = `${first }-alternate`;
157+
const alternate = `${first}-alternate`;
160158

161-
domainList.push(`${prefix + alternate }.${ second }.${ rest}`);
159+
domainList.push(`${prefix + alternate}.${second}.${rest}`);
162160
}
163161
}
164162

src/scripts/ios/updateDevelopmentTeam.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
(function() {
22
// properties
3-
4-
53

64
const fs = require("fs");
75
const path = require("path");

src/scripts/ios/updatePlist.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
(function() {
22
// properties
3-
4-
53

64
const fs = require("fs");
75
const plist = require("plist");
@@ -14,12 +12,9 @@
1412

1513
// updates the platforms/ios/app.plist file with branch settings within app/config.xml
1614
function addBranchSettings(preferences) {
17-
const filePath =
18-
`platforms/ios/${
19-
preferences.projectName
20-
}/${
21-
preferences.projectName
22-
}-Info.plist`;
15+
const filePath = `platforms/ios/${preferences.projectName}/${
16+
preferences.projectName
17+
}-Info.plist`;
2318
let xml = readPlist(filePath);
2419
let obj = convertXmlToObject(xml);
2520

src/scripts/lib/fileHelper.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
(function() {
22
// properties
3-
4-
53

64
const fs = require("fs");
75

@@ -17,7 +15,7 @@
1715
try {
1816
return fs.accessSync(file);
1917
} catch (err) {
20-
throw new Error(`BRANCH SDK: Cannot access file ${ file}`);
18+
throw new Error(`BRANCH SDK: Cannot access file ${file}`);
2119
}
2220
}
2321

@@ -26,7 +24,7 @@
2624
try {
2725
return fs.readFileSync(file, "utf8");
2826
} catch (err) {
29-
throw new Error(`BRANCH SDK: Cannot read file ${ file}`);
27+
throw new Error(`BRANCH SDK: Cannot read file ${file}`);
3028
}
3129
}
3230

@@ -36,7 +34,7 @@
3634
fs.writeFileSync(file, content, "utf8");
3735
} catch (err) {
3836
throw new Error(
39-
`BRANCH SDK: Cannot write file ${ file } with content ${ content}`
37+
`BRANCH SDK: Cannot write file ${file} with content ${content}`
4038
);
4139
}
4240
}

0 commit comments

Comments
 (0)