rn-linkrunner 0.7.1 → 0.8.0
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.
- package/README.md +11 -4
- package/lib/commonjs/helper.js +45 -20
- package/lib/commonjs/helper.js.map +1 -1
- package/lib/module/helper.js +45 -20
- package/lib/module/helper.js.map +1 -1
- package/lib/typescript/helper.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/helper.ts +48 -21
package/README.md
CHANGED
|
@@ -6,19 +6,26 @@ React Native Package for [linkrunner.io](https://www.linkrunner.io)
|
|
|
6
6
|
|
|
7
7
|
### Step 1: Prerequisites
|
|
8
8
|
|
|
9
|
-
rn-linkrunner also uses `react-native-device-info`, `@react-native-community/netinfo`, `@react-native-async-storage/async-storage
|
|
9
|
+
rn-linkrunner also uses `react-native-device-info`, `@react-native-community/netinfo`, `@react-native-async-storage/async-storage`, `react-native-play-install-referrer` and `@sparkfabrik/react-native-idfa-aaid`. You can install these packages with the following command:
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
npm install react-native-device-info @react-native-community/netinfo @react-native-async-storage/async-storage react-native-play-install-referrer
|
|
12
|
+
npm install react-native-device-info @react-native-community/netinfo @react-native-async-storage/async-storage react-native-play-install-referrer @sparkfabrik/react-native-idfa-aaid
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
or
|
|
16
16
|
|
|
17
17
|
```sh
|
|
18
|
-
yarn add react-native-device-info @react-native-community/netinfo @react-native-async-storage/async-storage react-native-play-install-referrer
|
|
18
|
+
yarn add react-native-device-info @react-native-community/netinfo @react-native-async-storage/async-storage react-native-play-install-referrer @sparkfabrik/react-native-idfa-aaid
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
**IOS Configuration**:
|
|
22
|
+
|
|
23
|
+
- Run `cd ios && pod install` to install pods for the package.
|
|
24
|
+
- Add the below code in `info.plist`:
|
|
25
|
+
```plist
|
|
26
|
+
<key>NSUserTrackingUsageDescription</key>
|
|
27
|
+
<string>This identifier will be used to deliver personalized ads and improve your app experience.</string>
|
|
28
|
+
```
|
|
22
29
|
|
|
23
30
|
### Step 2: Installing rn-linkrunner
|
|
24
31
|
|
package/lib/commonjs/helper.js
CHANGED
|
@@ -10,6 +10,7 @@ var _netinfo = require("@react-native-community/netinfo");
|
|
|
10
10
|
var _reactNativePlayInstallReferrer = require("react-native-play-install-referrer");
|
|
11
11
|
var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
|
|
12
12
|
var _reactNative = require("react-native");
|
|
13
|
+
var _reactNativeIdfaAaid = _interopRequireDefault(require("@sparkfabrik/react-native-idfa-aaid"));
|
|
13
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -20,39 +21,63 @@ const device_data = async () => {
|
|
|
20
21
|
resolve({});
|
|
21
22
|
return;
|
|
22
23
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
|
|
25
|
+
// Add a timeout to ensure the promise resolves even if the callback never fires
|
|
26
|
+
const timeoutId = setTimeout(() => {
|
|
27
|
+
resolve({});
|
|
28
|
+
}, 2000);
|
|
29
|
+
try {
|
|
30
|
+
_reactNativePlayInstallReferrer.PlayInstallReferrer.getInstallReferrerInfo((installReferrerInfo, error) => {
|
|
31
|
+
// Clear the timeout since callback fired
|
|
32
|
+
clearTimeout(timeoutId);
|
|
33
|
+
if (!error && !!installReferrerInfo) {
|
|
34
|
+
resolve(installReferrerInfo);
|
|
35
|
+
} else {
|
|
36
|
+
resolve({});
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
} catch (e) {
|
|
40
|
+
// Clear the timeout since we caught an exception
|
|
41
|
+
clearTimeout(timeoutId);
|
|
42
|
+
resolve({});
|
|
43
|
+
}
|
|
30
44
|
});
|
|
31
45
|
};
|
|
46
|
+
const getAdvertisingIdentifier = async () => {
|
|
47
|
+
const identifier = await _reactNativeIdfaAaid.default.getAdvertisingInfo();
|
|
48
|
+
if (!identifier.isAdTrackingLimited && identifier.id) {
|
|
49
|
+
return identifier.id;
|
|
50
|
+
} else {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
32
54
|
const [installReferrerInfo, connectivity, manufacturer, systemVersion] = await Promise.all([getInstallReferrerInfo(), (0, _netinfo.fetch)(), (0, _reactNativeDeviceInfo.getManufacturer)(), (0, _reactNativeDeviceInfo.getSystemVersion)()]);
|
|
33
55
|
return {
|
|
34
|
-
android_id: _reactNativeDeviceInfo.default.getAndroidId(),
|
|
35
|
-
api_level: _reactNativeDeviceInfo.default.getApiLevel(),
|
|
56
|
+
android_id: await _reactNativeDeviceInfo.default.getAndroidId(),
|
|
57
|
+
api_level: await _reactNativeDeviceInfo.default.getApiLevel(),
|
|
36
58
|
application_name: _reactNativeDeviceInfo.default.getApplicationName(),
|
|
37
|
-
base_os: _reactNativeDeviceInfo.default.getBaseOs(),
|
|
38
|
-
build_id: _reactNativeDeviceInfo.default.getBuildId(),
|
|
59
|
+
base_os: await _reactNativeDeviceInfo.default.getBaseOs(),
|
|
60
|
+
build_id: await _reactNativeDeviceInfo.default.getBuildId(),
|
|
39
61
|
brand: _reactNativeDeviceInfo.default.getBrand(),
|
|
40
62
|
build_number: _reactNativeDeviceInfo.default.getBuildNumber(),
|
|
41
63
|
bundle_id: _reactNativeDeviceInfo.default.getBundleId(),
|
|
42
|
-
carrier: [_reactNativeDeviceInfo.default.getCarrier()],
|
|
43
|
-
device: _reactNativeDeviceInfo.default.getDevice(),
|
|
44
|
-
device_id: _reactNativeDeviceInfo.default.getDeviceId(),
|
|
45
|
-
device_display: _reactNativeDeviceInfo.default.getDisplay(),
|
|
46
|
-
device_type: _reactNativeDeviceInfo.default.getDeviceType(),
|
|
47
|
-
device_name: _reactNativeDeviceInfo.default.getDeviceName(),
|
|
48
|
-
device_token: _reactNativeDeviceInfo.default.getDeviceToken(),
|
|
49
|
-
device_ip: _reactNativeDeviceInfo.default.getIpAddress(),
|
|
64
|
+
carrier: [await _reactNativeDeviceInfo.default.getCarrier()],
|
|
65
|
+
device: await _reactNativeDeviceInfo.default.getDevice(),
|
|
66
|
+
device_id: await _reactNativeDeviceInfo.default.getDeviceId(),
|
|
67
|
+
device_display: await _reactNativeDeviceInfo.default.getDisplay(),
|
|
68
|
+
device_type: await _reactNativeDeviceInfo.default.getDeviceType(),
|
|
69
|
+
device_name: await _reactNativeDeviceInfo.default.getDeviceName(),
|
|
70
|
+
device_token: await _reactNativeDeviceInfo.default.getDeviceToken(),
|
|
71
|
+
device_ip: await _reactNativeDeviceInfo.default.getIpAddress(),
|
|
50
72
|
install_ref: await _reactNativeDeviceInfo.default.getInstallReferrer(),
|
|
51
73
|
manufacturer,
|
|
52
74
|
system_version: systemVersion,
|
|
53
75
|
version: _reactNativeDeviceInfo.default.getVersion(),
|
|
54
76
|
connectivity: connectivity.type,
|
|
55
|
-
user_agent: _reactNativeDeviceInfo.default.getUserAgent(),
|
|
77
|
+
user_agent: await _reactNativeDeviceInfo.default.getUserAgent(),
|
|
78
|
+
gaid: _reactNative.Platform.OS === 'android' ? await getAdvertisingIdentifier() : null,
|
|
79
|
+
idfa: _reactNative.Platform.OS === 'ios' ? await getAdvertisingIdentifier() : null,
|
|
80
|
+
idfv: _reactNative.Platform.OS === 'ios' ? await _reactNativeDeviceInfo.default.getUniqueId() : null,
|
|
56
81
|
...installReferrerInfo
|
|
57
82
|
};
|
|
58
83
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeDeviceInfo","_interopRequireWildcard","require","_netinfo","_reactNativePlayInstallReferrer","_asyncStorage","_interopRequireDefault","_reactNative","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","device_data","getInstallReferrerInfo","Promise","resolve","Platform","OS","PlayInstallReferrer","installReferrerInfo","error","connectivity","manufacturer","systemVersion","all","netinfoFetch","getManufacturer","getSystemVersion","android_id","DeviceInfo","getAndroidId","api_level","getApiLevel","application_name","getApplicationName","base_os","getBaseOs","build_id","getBuildId","brand","getBrand","build_number","getBuildNumber","bundle_id","getBundleId","carrier","getCarrier","device","getDevice","device_id","getDeviceId","device_display","getDisplay","device_type","getDeviceType","device_name","getDeviceName","device_token","getDeviceToken","device_ip","getIpAddress","install_ref","getInstallReferrer","system_version","version","getVersion","type","user_agent","getUserAgent","exports","STORAGE_KEY","ID_LENGTH","getLinkRunnerInstallInstanceId","installInstanceId","AsyncStorage","getItem","generateRandomString","setItem","console","length","chars","Array","fill","map","charAt","Math","floor","random","join"],"sourceRoot":"../../src","sources":["helper.ts"],"mappings":";;;;;;;AAAA,IAAAA,sBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAIA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,+BAAA,GAAAF,OAAA;AAIA,IAAAG,aAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;
|
|
1
|
+
{"version":3,"names":["_reactNativeDeviceInfo","_interopRequireWildcard","require","_netinfo","_reactNativePlayInstallReferrer","_asyncStorage","_interopRequireDefault","_reactNative","_reactNativeIdfaAaid","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","device_data","getInstallReferrerInfo","Promise","resolve","Platform","OS","timeoutId","setTimeout","PlayInstallReferrer","installReferrerInfo","error","clearTimeout","getAdvertisingIdentifier","identifier","ReactNativeIdfaAaid","getAdvertisingInfo","isAdTrackingLimited","id","connectivity","manufacturer","systemVersion","all","netinfoFetch","getManufacturer","getSystemVersion","android_id","DeviceInfo","getAndroidId","api_level","getApiLevel","application_name","getApplicationName","base_os","getBaseOs","build_id","getBuildId","brand","getBrand","build_number","getBuildNumber","bundle_id","getBundleId","carrier","getCarrier","device","getDevice","device_id","getDeviceId","device_display","getDisplay","device_type","getDeviceType","device_name","getDeviceName","device_token","getDeviceToken","device_ip","getIpAddress","install_ref","getInstallReferrer","system_version","version","getVersion","type","user_agent","getUserAgent","gaid","idfa","idfv","getUniqueId","exports","STORAGE_KEY","ID_LENGTH","getLinkRunnerInstallInstanceId","installInstanceId","AsyncStorage","getItem","generateRandomString","setItem","console","length","chars","Array","fill","map","charAt","Math","floor","random","join"],"sourceRoot":"../../src","sources":["helper.ts"],"mappings":";;;;;;;AAAA,IAAAA,sBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAIA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,+BAAA,GAAAF,OAAA;AAIA,IAAAG,aAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,oBAAA,GAAAF,sBAAA,CAAAJ,OAAA;AAAsE,SAAAI,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IA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AE,KAAK,KAAK,GAAG,MAAMO,wBAAwB,CAAC,CAAC,GAAG,IAAI;IACrEwD,IAAI,EAAEhE,qBAAQ,CAACC,EAAE,KAAK,KAAK,GAAG,MAAMqB,8BAAU,CAAC2C,WAAW,CAAC,CAAC,GAAG,IAAI;IACnE,GAAG5D;EACL,CAAC;AACH,CAAC;AAAC6D,OAAA,CAAAtE,WAAA,GAAAA,WAAA;AAEF,MAAMuE,WAAW,GAAG,gCAAgC;AACpD,MAAMC,SAAS,GAAG,EAAE;AAEpB,eAAeC,8BAA8BA,CAAA,EAAoB;EAC/D,IAAI;IACF;IACA,IAAIC,iBAAiB,GAAG,MAAMC,qBAAY,CAACC,OAAO,CAACL,WAAW,CAAC;;IAE/D;IACA,IAAIG,iBAAiB,KAAK,IAAI,EAAE;MAC9BA,iBAAiB,GAAGG,oBAAoB,CAACL,SAAS,CAAC;MACnD,MAAMG,qBAAY,CAACG,OAAO,CAACP,WAAW,EAAEG,iBAAiB,CAAC;IAC5D;IAEA,OAAOA,iBAAiB;EAC1B,CAAC,CAAC,OAAOhE,KAAK,EAAE;IACdqE,OAAO,CAACrE,KAAK,CAAC,+BAA+B,EAAEA,KAAK,CAAC;IACrD,OAAO,qCAAqC;EAC9C;AACF;AAEA,SAASmE,oBAAoBA,CAACG,MAAc,EAAU;EACpD,MAAMC,KAAK,GACT,gEAAgE;EAClE,OAAOC,KAAK,CAACF,MAAM,CAAC,CACjBG,IAAI,CAAC,IAAI,CAAC,CACVC,GAAG,CAAC,MAAMH,KAAK,CAACI,MAAM,CAACC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,MAAM,CAAC,CAAC,GAAGP,KAAK,CAACD,MAAM,CAAC,CAAC,CAAC,CACjES,IAAI,CAAC,EAAE,CAAC;AACb"}
|
package/lib/module/helper.js
CHANGED
|
@@ -3,6 +3,7 @@ import { fetch as netinfoFetch } from '@react-native-community/netinfo';
|
|
|
3
3
|
import { PlayInstallReferrer } from 'react-native-play-install-referrer';
|
|
4
4
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
5
5
|
import { Platform } from 'react-native';
|
|
6
|
+
import ReactNativeIdfaAaid from '@sparkfabrik/react-native-idfa-aaid';
|
|
6
7
|
const device_data = async () => {
|
|
7
8
|
const getInstallReferrerInfo = () => {
|
|
8
9
|
return new Promise(resolve => {
|
|
@@ -10,39 +11,63 @@ const device_data = async () => {
|
|
|
10
11
|
resolve({});
|
|
11
12
|
return;
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
|
|
15
|
+
// Add a timeout to ensure the promise resolves even if the callback never fires
|
|
16
|
+
const timeoutId = setTimeout(() => {
|
|
17
|
+
resolve({});
|
|
18
|
+
}, 2000);
|
|
19
|
+
try {
|
|
20
|
+
PlayInstallReferrer.getInstallReferrerInfo((installReferrerInfo, error) => {
|
|
21
|
+
// Clear the timeout since callback fired
|
|
22
|
+
clearTimeout(timeoutId);
|
|
23
|
+
if (!error && !!installReferrerInfo) {
|
|
24
|
+
resolve(installReferrerInfo);
|
|
25
|
+
} else {
|
|
26
|
+
resolve({});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
} catch (e) {
|
|
30
|
+
// Clear the timeout since we caught an exception
|
|
31
|
+
clearTimeout(timeoutId);
|
|
32
|
+
resolve({});
|
|
33
|
+
}
|
|
20
34
|
});
|
|
21
35
|
};
|
|
36
|
+
const getAdvertisingIdentifier = async () => {
|
|
37
|
+
const identifier = await ReactNativeIdfaAaid.getAdvertisingInfo();
|
|
38
|
+
if (!identifier.isAdTrackingLimited && identifier.id) {
|
|
39
|
+
return identifier.id;
|
|
40
|
+
} else {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
22
44
|
const [installReferrerInfo, connectivity, manufacturer, systemVersion] = await Promise.all([getInstallReferrerInfo(), netinfoFetch(), getManufacturer(), getSystemVersion()]);
|
|
23
45
|
return {
|
|
24
|
-
android_id: DeviceInfo.getAndroidId(),
|
|
25
|
-
api_level: DeviceInfo.getApiLevel(),
|
|
46
|
+
android_id: await DeviceInfo.getAndroidId(),
|
|
47
|
+
api_level: await DeviceInfo.getApiLevel(),
|
|
26
48
|
application_name: DeviceInfo.getApplicationName(),
|
|
27
|
-
base_os: DeviceInfo.getBaseOs(),
|
|
28
|
-
build_id: DeviceInfo.getBuildId(),
|
|
49
|
+
base_os: await DeviceInfo.getBaseOs(),
|
|
50
|
+
build_id: await DeviceInfo.getBuildId(),
|
|
29
51
|
brand: DeviceInfo.getBrand(),
|
|
30
52
|
build_number: DeviceInfo.getBuildNumber(),
|
|
31
53
|
bundle_id: DeviceInfo.getBundleId(),
|
|
32
|
-
carrier: [DeviceInfo.getCarrier()],
|
|
33
|
-
device: DeviceInfo.getDevice(),
|
|
34
|
-
device_id: DeviceInfo.getDeviceId(),
|
|
35
|
-
device_display: DeviceInfo.getDisplay(),
|
|
36
|
-
device_type: DeviceInfo.getDeviceType(),
|
|
37
|
-
device_name: DeviceInfo.getDeviceName(),
|
|
38
|
-
device_token: DeviceInfo.getDeviceToken(),
|
|
39
|
-
device_ip: DeviceInfo.getIpAddress(),
|
|
54
|
+
carrier: [await DeviceInfo.getCarrier()],
|
|
55
|
+
device: await DeviceInfo.getDevice(),
|
|
56
|
+
device_id: await DeviceInfo.getDeviceId(),
|
|
57
|
+
device_display: await DeviceInfo.getDisplay(),
|
|
58
|
+
device_type: await DeviceInfo.getDeviceType(),
|
|
59
|
+
device_name: await DeviceInfo.getDeviceName(),
|
|
60
|
+
device_token: await DeviceInfo.getDeviceToken(),
|
|
61
|
+
device_ip: await DeviceInfo.getIpAddress(),
|
|
40
62
|
install_ref: await DeviceInfo.getInstallReferrer(),
|
|
41
63
|
manufacturer,
|
|
42
64
|
system_version: systemVersion,
|
|
43
65
|
version: DeviceInfo.getVersion(),
|
|
44
66
|
connectivity: connectivity.type,
|
|
45
|
-
user_agent: DeviceInfo.getUserAgent(),
|
|
67
|
+
user_agent: await DeviceInfo.getUserAgent(),
|
|
68
|
+
gaid: Platform.OS === 'android' ? await getAdvertisingIdentifier() : null,
|
|
69
|
+
idfa: Platform.OS === 'ios' ? await getAdvertisingIdentifier() : null,
|
|
70
|
+
idfv: Platform.OS === 'ios' ? await DeviceInfo.getUniqueId() : null,
|
|
46
71
|
...installReferrerInfo
|
|
47
72
|
};
|
|
48
73
|
};
|
package/lib/module/helper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DeviceInfo","getManufacturer","getSystemVersion","fetch","netinfoFetch","PlayInstallReferrer","AsyncStorage","Platform","device_data","getInstallReferrerInfo","Promise","resolve","OS","installReferrerInfo","error","connectivity","manufacturer","systemVersion","all","android_id","getAndroidId","api_level","getApiLevel","application_name","getApplicationName","base_os","getBaseOs","build_id","getBuildId","brand","getBrand","build_number","getBuildNumber","bundle_id","getBundleId","carrier","getCarrier","device","getDevice","device_id","getDeviceId","device_display","getDisplay","device_type","getDeviceType","device_name","getDeviceName","device_token","getDeviceToken","device_ip","getIpAddress","install_ref","getInstallReferrer","system_version","version","getVersion","type","user_agent","getUserAgent","STORAGE_KEY","ID_LENGTH","getLinkRunnerInstallInstanceId","installInstanceId","getItem","generateRandomString","setItem","console","length","chars","Array","fill","map","charAt","Math","floor","random","join"],"sourceRoot":"../../src","sources":["helper.ts"],"mappings":"AAAA,OAAOA,UAAU,IACfC,eAAe,EACfC,gBAAgB,QACX,0BAA0B;AACjC,SAASC,KAAK,IAAIC,YAAY,QAAQ,iCAAiC;AACvE,SACEC,mBAAmB,QAEd,oCAAoC;AAC3C,OAAOC,YAAY,MAAM,2CAA2C;AACpE,SAASC,QAAQ,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"names":["DeviceInfo","getManufacturer","getSystemVersion","fetch","netinfoFetch","PlayInstallReferrer","AsyncStorage","Platform","ReactNativeIdfaAaid","device_data","getInstallReferrerInfo","Promise","resolve","OS","timeoutId","setTimeout","installReferrerInfo","error","clearTimeout","e","getAdvertisingIdentifier","identifier","getAdvertisingInfo","isAdTrackingLimited","id","connectivity","manufacturer","systemVersion","all","android_id","getAndroidId","api_level","getApiLevel","application_name","getApplicationName","base_os","getBaseOs","build_id","getBuildId","brand","getBrand","build_number","getBuildNumber","bundle_id","getBundleId","carrier","getCarrier","device","getDevice","device_id","getDeviceId","device_display","getDisplay","device_type","getDeviceType","device_name","getDeviceName","device_token","getDeviceToken","device_ip","getIpAddress","install_ref","getInstallReferrer","system_version","version","getVersion","type","user_agent","getUserAgent","gaid","idfa","idfv","getUniqueId","STORAGE_KEY","ID_LENGTH","getLinkRunnerInstallInstanceId","installInstanceId","getItem","generateRandomString","setItem","console","length","chars","Array","fill","map","charAt","Math","floor","random","join"],"sourceRoot":"../../src","sources":["helper.ts"],"mappings":"AAAA,OAAOA,UAAU,IACfC,eAAe,EACfC,gBAAgB,QACX,0BAA0B;AACjC,SAASC,KAAK,IAAIC,YAAY,QAAQ,iCAAiC;AACvE,SACEC,mBAAmB,QAEd,oCAAoC;AAC3C,OAAOC,YAAY,MAAM,2CAA2C;AACpE,SAASC,QAAQ,QAAQ,cAAc;AACvC,OAAOC,mBAAmB,MAAM,qCAAqC;AAErE,MAAMC,WAAW,GAAG,MAAAA,CAAA,KAA0C;EAC5D,MAAMC,sBAAsB,GAAGA,CAAA,KAA6C;IAC1E,OAAO,IAAIC,OAAO,CAAEC,OAAO,IAAK;MAC9B,IAAIL,QAAQ,CAACM,EAAE,KAAK,KAAK,EAAE;QACzBD,OAAO,CAAC,CAAC,CAAC,CAAC;QACX;MACF;;MAEA;MACA,MAAME,SAAS,GAAGC,UAAU,CAAC,MAAM;QACjCH,OAAO,CAAC,CAAC,CAAC,CAAC;MACb,CAAC,EAAE,IAAI,CAAC;MAER,IAAI;QACFP,mBAAmB,CAACK,sBAAsB,CACxC,CAACM,mBAAmB,EAAEC,KAAK,KAAK;UAC9B;UACAC,YAAY,CAACJ,SAAS,C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C,8BAA8BA,CAAA,EAAoB;EAC/D,IAAI;IACF;IACA,IAAIC,iBAAiB,GAAG,MAAMtE,YAAY,CAACuE,OAAO,CAACJ,WAAW,CAAC;;IAE/D;IACA,IAAIG,iBAAiB,KAAK,IAAI,EAAE;MAC9BA,iBAAiB,GAAGE,oBAAoB,CAACJ,SAAS,CAAC;MACnD,MAAMpE,YAAY,CAACyE,OAAO,CAACN,WAAW,EAAEG,iBAAiB,CAAC;IAC5D;IAEA,OAAOA,iBAAiB;EAC1B,CAAC,CAAC,OAAO3D,KAAK,EAAE;IACd+D,OAAO,CAAC/D,KAAK,CAAC,+BAA+B,EAAEA,KAAK,CAAC;IACrD,OAAO,qCAAqC;EAC9C;AACF;AAEA,SAAS6D,oBAAoBA,CAACG,MAAc,EAAU;EACpD,MAAMC,KAAK,GACT,gEAAgE;EAClE,OAAOC,KAAK,CAACF,MAAM,CAAC,CACjBG,IAAI,CAAC,IAAI,CAAC,CACVC,GAAG,CAAC,MAAMH,KAAK,CAACI,MAAM,CAACC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,MAAM,CAAC,CAAC,GAAGP,KAAK,CAACD,MAAM,CAAC,CAAC,CAAC,CACjES,IAAI,CAAC,EAAE,CAAC;AACb;AAEA,SAASjF,WAAW,EAAEkE,8BAA8B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../src/helper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../src/helper.ts"],"names":[],"mappings":"AAaA,QAAA,MAAM,WAAW,QAAa,QAAQ,OAAO,MAAM,EAAE,GAAG,CAAC,CA+ExD,CAAC;AAKF,iBAAe,8BAA8B,IAAI,OAAO,CAAC,MAAM,CAAC,CAgB/D;AAWD,OAAO,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rn-linkrunner",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "React Native Package for linkrunner",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -140,6 +140,7 @@
|
|
|
140
140
|
"dependencies": {
|
|
141
141
|
"@react-native-async-storage/async-storage": "^2.0.0",
|
|
142
142
|
"@react-native-community/netinfo": "^11.3.2",
|
|
143
|
+
"@sparkfabrik/react-native-idfa-aaid": "^1.2.0",
|
|
143
144
|
"react-native-device-info": "^10.12.0",
|
|
144
145
|
"react-native-play-install-referrer": "^1.1.8"
|
|
145
146
|
}
|
package/src/helper.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from 'react-native-play-install-referrer';
|
|
10
10
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
11
11
|
import { Platform } from 'react-native';
|
|
12
|
+
import ReactNativeIdfaAaid from '@sparkfabrik/react-native-idfa-aaid';
|
|
12
13
|
|
|
13
14
|
const device_data = async (): Promise<Record<string, any>> => {
|
|
14
15
|
const getInstallReferrerInfo = (): Promise<PlayInstallReferrerInfo | {}> => {
|
|
@@ -18,18 +19,41 @@ const device_data = async (): Promise<Record<string, any>> => {
|
|
|
18
19
|
return;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
// Add a timeout to ensure the promise resolves even if the callback never fires
|
|
23
|
+
const timeoutId = setTimeout(() => {
|
|
24
|
+
resolve({});
|
|
25
|
+
}, 2000);
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
PlayInstallReferrer.getInstallReferrerInfo(
|
|
29
|
+
(installReferrerInfo, error) => {
|
|
30
|
+
// Clear the timeout since callback fired
|
|
31
|
+
clearTimeout(timeoutId);
|
|
32
|
+
|
|
33
|
+
if (!error && !!installReferrerInfo) {
|
|
34
|
+
resolve(installReferrerInfo);
|
|
35
|
+
} else {
|
|
36
|
+
resolve({});
|
|
37
|
+
}
|
|
27
38
|
}
|
|
28
|
-
|
|
29
|
-
)
|
|
39
|
+
);
|
|
40
|
+
} catch (e) {
|
|
41
|
+
// Clear the timeout since we caught an exception
|
|
42
|
+
clearTimeout(timeoutId);
|
|
43
|
+
resolve({});
|
|
44
|
+
}
|
|
30
45
|
});
|
|
31
46
|
};
|
|
32
47
|
|
|
48
|
+
const getAdvertisingIdentifier = async () => {
|
|
49
|
+
const identifier = await ReactNativeIdfaAaid.getAdvertisingInfo();
|
|
50
|
+
if (!identifier.isAdTrackingLimited && identifier.id) {
|
|
51
|
+
return identifier.id;
|
|
52
|
+
} else {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
33
57
|
const [installReferrerInfo, connectivity, manufacturer, systemVersion] =
|
|
34
58
|
await Promise.all([
|
|
35
59
|
getInstallReferrerInfo(),
|
|
@@ -39,28 +63,31 @@ const device_data = async (): Promise<Record<string, any>> => {
|
|
|
39
63
|
]);
|
|
40
64
|
|
|
41
65
|
return {
|
|
42
|
-
android_id: DeviceInfo.getAndroidId(),
|
|
43
|
-
api_level: DeviceInfo.getApiLevel(),
|
|
66
|
+
android_id: await DeviceInfo.getAndroidId(),
|
|
67
|
+
api_level: await DeviceInfo.getApiLevel(),
|
|
44
68
|
application_name: DeviceInfo.getApplicationName(),
|
|
45
|
-
base_os: DeviceInfo.getBaseOs(),
|
|
46
|
-
build_id: DeviceInfo.getBuildId(),
|
|
69
|
+
base_os: await DeviceInfo.getBaseOs(),
|
|
70
|
+
build_id: await DeviceInfo.getBuildId(),
|
|
47
71
|
brand: DeviceInfo.getBrand(),
|
|
48
72
|
build_number: DeviceInfo.getBuildNumber(),
|
|
49
73
|
bundle_id: DeviceInfo.getBundleId(),
|
|
50
|
-
carrier: [DeviceInfo.getCarrier()],
|
|
51
|
-
device: DeviceInfo.getDevice(),
|
|
52
|
-
device_id: DeviceInfo.getDeviceId(),
|
|
53
|
-
device_display: DeviceInfo.getDisplay(),
|
|
54
|
-
device_type: DeviceInfo.getDeviceType(),
|
|
55
|
-
device_name: DeviceInfo.getDeviceName(),
|
|
56
|
-
device_token: DeviceInfo.getDeviceToken(),
|
|
57
|
-
device_ip: DeviceInfo.getIpAddress(),
|
|
74
|
+
carrier: [await DeviceInfo.getCarrier()],
|
|
75
|
+
device: await DeviceInfo.getDevice(),
|
|
76
|
+
device_id: await DeviceInfo.getDeviceId(),
|
|
77
|
+
device_display: await DeviceInfo.getDisplay(),
|
|
78
|
+
device_type: await DeviceInfo.getDeviceType(),
|
|
79
|
+
device_name: await DeviceInfo.getDeviceName(),
|
|
80
|
+
device_token: await DeviceInfo.getDeviceToken(),
|
|
81
|
+
device_ip: await DeviceInfo.getIpAddress(),
|
|
58
82
|
install_ref: await DeviceInfo.getInstallReferrer(),
|
|
59
83
|
manufacturer,
|
|
60
84
|
system_version: systemVersion,
|
|
61
85
|
version: DeviceInfo.getVersion(),
|
|
62
86
|
connectivity: connectivity.type,
|
|
63
|
-
user_agent: DeviceInfo.getUserAgent(),
|
|
87
|
+
user_agent: await DeviceInfo.getUserAgent(),
|
|
88
|
+
gaid: Platform.OS === 'android' ? await getAdvertisingIdentifier() : null,
|
|
89
|
+
idfa: Platform.OS === 'ios' ? await getAdvertisingIdentifier() : null,
|
|
90
|
+
idfv: Platform.OS === 'ios' ? await DeviceInfo.getUniqueId() : null,
|
|
64
91
|
...installReferrerInfo,
|
|
65
92
|
};
|
|
66
93
|
};
|