@thathoff/cordova-plugin-universal-links 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -12,7 +12,6 @@ var ConfigXmlHelper = require('../configXmlHelper.js');
|
|
|
12
12
|
const xcode = require('xcode');
|
|
13
13
|
const fileSystem = require('fs');
|
|
14
14
|
const glob = require('glob');
|
|
15
|
-
const shelljs = require('shelljs');
|
|
16
15
|
var IOS_DEPLOYMENT_TARGET = '8.0';
|
|
17
16
|
var COMMENT_KEY = /_comment$/;
|
|
18
17
|
var context;
|
|
@@ -186,7 +185,7 @@ function loadProjectFile() {
|
|
|
186
185
|
fs.writeFileSync(pbxPath, xcodeproj.writeSync());
|
|
187
186
|
if (Object.keys(frameworks).length === 0) {
|
|
188
187
|
// If there is no framework references remain in the project, just remove this file
|
|
189
|
-
|
|
188
|
+
fs.rmSync(frameworks_file, { recursive: true, force: true });
|
|
190
189
|
return;
|
|
191
190
|
}
|
|
192
191
|
fs.writeFileSync(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thathoff/cordova-plugin-universal-links",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Cordova plugin to add in your application support for Universal Links (iOS 9) and Deep Links (Android). Basically, open application through the link in the browser.",
|
|
5
5
|
"cordova": {
|
|
6
6
|
"id": "cordova-plugin-universal-links",
|
package/plugin.xml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
|
|
3
|
-
<plugin id="cordova-plugin-universal-links" version="0.3.
|
|
3
|
+
<plugin id="cordova-plugin-universal-links" version="0.3.3" xmlns="http://apache.org/cordova/ns/plugins/1.0">
|
|
4
4
|
|
|
5
5
|
<name>Universal Links Plugin</name>
|
|
6
6
|
<description>
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
<hook src="hooks/beforePluginInstallHook.js" type="before_plugin_install" />
|
|
29
29
|
|
|
30
30
|
<platform name="ios">
|
|
31
|
-
<hook src="hooks/iosBeforePrepareHook.js" type="before_prepare" />
|
|
32
31
|
|
|
33
32
|
<!-- Plugin inclusion in Cordova config.xml -->
|
|
34
33
|
<config-file parent="/*" target="config.xml">
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Hook executed before the 'prepare' stage. Only for iOS project.
|
|
3
|
-
It will check if project name has changed. If so - it will change the name of the .entitlements file to remove that file duplicates.
|
|
4
|
-
If file name has no changed - hook will do nothing.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
var path = require('path');
|
|
8
|
-
var fs = require('fs');
|
|
9
|
-
var ConfigXmlHelper = require('./lib/configXmlHelper.js');
|
|
10
|
-
|
|
11
|
-
module.exports = function(ctx) {
|
|
12
|
-
run(ctx);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Run the hook logic.
|
|
17
|
-
*
|
|
18
|
-
* @param {Object} ctx - cordova context object
|
|
19
|
-
*/
|
|
20
|
-
function run(ctx) {
|
|
21
|
-
var projectRoot = ctx.opts.projectRoot;
|
|
22
|
-
var iosProjectFilePath = path.join(projectRoot, 'platforms', 'ios');
|
|
23
|
-
var configXmlHelper = new ConfigXmlHelper(ctx);
|
|
24
|
-
var newProjectName = configXmlHelper.getProjectName();
|
|
25
|
-
|
|
26
|
-
var oldProjectName = getOldProjectName(iosProjectFilePath);
|
|
27
|
-
|
|
28
|
-
// if name has not changed - do nothing
|
|
29
|
-
if (oldProjectName.length && oldProjectName === newProjectName) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
console.log('Project name has changed. Renaming .entitlements file.');
|
|
34
|
-
|
|
35
|
-
// if it does - rename it
|
|
36
|
-
var oldEntitlementsFilePath = path.join(iosProjectFilePath, oldProjectName, 'Resources', oldProjectName + '.entitlements');
|
|
37
|
-
var newEntitlementsFilePath = path.join(iosProjectFilePath, oldProjectName, 'Resources', newProjectName + '.entitlements');
|
|
38
|
-
|
|
39
|
-
try {
|
|
40
|
-
fs.renameSync(oldEntitlementsFilePath, newEntitlementsFilePath);
|
|
41
|
-
} catch (err) {
|
|
42
|
-
console.warn('Failed to rename .entitlements file.');
|
|
43
|
-
console.warn(err);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// region Private API
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Get old name of the project.
|
|
51
|
-
* Name is detected by the name of the .xcodeproj file.
|
|
52
|
-
*
|
|
53
|
-
* @param {String} projectDir absolute path to ios project directory
|
|
54
|
-
* @return {String} old project name
|
|
55
|
-
*/
|
|
56
|
-
function getOldProjectName(projectDir) {
|
|
57
|
-
var files = [];
|
|
58
|
-
try {
|
|
59
|
-
files = fs.readdirSync(projectDir);
|
|
60
|
-
} catch (err) {
|
|
61
|
-
return '';
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
var projectFile = '';
|
|
65
|
-
files.forEach(function(fileName) {
|
|
66
|
-
if (path.extname(fileName) === '.xcodeproj') {
|
|
67
|
-
projectFile = path.basename(fileName, '.xcodeproj');
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
return projectFile;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// endregion
|