@traqio/react-native 0.1.3 → 0.2.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 +6 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/io/khufu/traqio/expo/TraqioModule.kt +30 -0
- package/build/native.d.ts.map +1 -1
- package/build/native.js +12 -0
- package/build/native.js.map +1 -1
- package/ios/TraqioModule.swift +11 -0
- package/package.json +2 -2
- package/src/native.ts +11 -0
package/README.md
CHANGED
|
@@ -109,6 +109,12 @@ Traqio.init({ sdkKey: "SDK_KEY", endpoint: "https://api.traqio.app", collectAdve
|
|
|
109
109
|
|
|
110
110
|
It is sent with the install only, matched hashed, and never used as the user's identity.
|
|
111
111
|
|
|
112
|
+
## Debug builds
|
|
113
|
+
|
|
114
|
+
Traffic from development builds is flagged as debug traffic. The SDK turns it on by itself under `__DEV__` (a Metro dev bundle), and when the native module reports a debuggable app (Android), a DEBUG build (iOS) or a simulator / emulator. `Traqio.init({ ..., debug: true })` or `debug: false` overrides the detection; `Traqio.isDebug` tells which mode is on. The install is remembered per mode, so a release build installed over a debug build on the same device still reports its own install.
|
|
115
|
+
|
|
116
|
+
Debug traffic shows in the console's **Live events › Debug** view, but it is never counted in a report, attributed, sent to an ad network or a webhook, or billed.
|
|
117
|
+
|
|
112
118
|
## Requirements
|
|
113
119
|
|
|
114
120
|
- React Native 0.74+, with Expo Modules installed.
|
package/android/build.gradle
CHANGED
|
@@ -6,7 +6,7 @@ apply plugin: 'kotlin-android'
|
|
|
6
6
|
apply plugin: 'maven-publish'
|
|
7
7
|
|
|
8
8
|
group = 'io.khufu.traqio'
|
|
9
|
-
version = '0.
|
|
9
|
+
version = '0.2.0'
|
|
10
10
|
|
|
11
11
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
12
12
|
apply from: expoModulesCorePlugin
|
|
@@ -28,7 +28,7 @@ android {
|
|
|
28
28
|
defaultConfig {
|
|
29
29
|
minSdk safeExtGet("minSdkVersion", 24)
|
|
30
30
|
versionCode 1
|
|
31
|
-
versionName "0.
|
|
31
|
+
versionName "0.2.0"
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
compileOptions {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
package io.khufu.traqio.expo
|
|
2
2
|
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.content.pm.ApplicationInfo
|
|
5
|
+
import android.os.Build
|
|
3
6
|
import expo.modules.kotlin.Promise
|
|
4
7
|
import expo.modules.kotlin.modules.Module
|
|
5
8
|
import expo.modules.kotlin.modules.ModuleDefinition
|
|
@@ -34,6 +37,12 @@ class TraqioModule : Module() {
|
|
|
34
37
|
)
|
|
35
38
|
}
|
|
36
39
|
|
|
40
|
+
// Whether the host app is a development build, for the JS core's `debug`
|
|
41
|
+
// auto-detection. False when there is no context to read it from.
|
|
42
|
+
AsyncFunction("isDebugBuild") { ->
|
|
43
|
+
appContext.reactContext?.applicationContext?.let(::isDebugBuild) ?: false
|
|
44
|
+
}
|
|
45
|
+
|
|
37
46
|
// SKAN is iOS-only. Present so the shared JS bridge can call it
|
|
38
47
|
// unconditionally instead of branching on platform at every call site.
|
|
39
48
|
Function("updateConversionValue") { _: Int, _: String?, _: Boolean? -> }
|
|
@@ -66,3 +75,24 @@ private fun toRecord(result: ReferrerResult): Map<String, Any?> = mapOf(
|
|
|
66
75
|
"installBeginTs" to result.details?.installBeginTimestampSeconds,
|
|
67
76
|
"googlePlayInstant" to result.details?.googlePlayInstantParam,
|
|
68
77
|
)
|
|
78
|
+
|
|
79
|
+
// True for a development build: the HOST app is debuggable — its ApplicationInfo,
|
|
80
|
+
// not this library's BuildConfig.DEBUG, which is always false in a release AAR — or
|
|
81
|
+
// it runs on an emulator. Conservative: a false positive drops real users from the
|
|
82
|
+
// stats, so only signals no shipping device carries count as an emulator.
|
|
83
|
+
private fun isDebugBuild(context: Context): Boolean =
|
|
84
|
+
(context.applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE) != 0 || isEmulator()
|
|
85
|
+
|
|
86
|
+
private fun isEmulator(): Boolean =
|
|
87
|
+
Build.FINGERPRINT.startsWith("generic") ||
|
|
88
|
+
Build.FINGERPRINT.contains("emulator") ||
|
|
89
|
+
Build.FINGERPRINT.contains("sdk_gphone") ||
|
|
90
|
+
Build.MODEL.contains("Emulator") ||
|
|
91
|
+
Build.MODEL.contains("Android SDK built for") ||
|
|
92
|
+
Build.HARDWARE == "goldfish" ||
|
|
93
|
+
Build.HARDWARE == "ranchu" ||
|
|
94
|
+
Build.PRODUCT == "sdk" ||
|
|
95
|
+
Build.PRODUCT == "google_sdk" ||
|
|
96
|
+
Build.PRODUCT.startsWith("sdk_") ||
|
|
97
|
+
Build.PRODUCT.contains("emulator") ||
|
|
98
|
+
Build.PRODUCT.contains("simulator")
|
package/build/native.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EAErB,YAAY,EACb,MAAM,cAAc,CAAC;AAUtB;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,GAAG,qBAAqB,CAe5E;AAQD,wBAAgB,eAAe,IAAI,YAAY,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EAErB,YAAY,EACb,MAAM,cAAc,CAAC;AAUtB;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,GAAG,qBAAqB,CAe5E;AAQD,wBAAgB,eAAe,IAAI,YAAY,GAAG,SAAS,CAiE1D;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,WAAW,EACpB,UAAU,UAAQ,GACjB,IAAI,CAQN"}
|
package/build/native.js
CHANGED
|
@@ -86,6 +86,18 @@ function getNativeBridge() {
|
|
|
86
86
|
return null;
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
|
+
// Debug mode (InitOptions.debug): the host app is debuggable / DEBUG, or runs
|
|
90
|
+
// on an emulator / simulator. `__DEV__` already covers a Metro dev bundle; this
|
|
91
|
+
// catches a release bundle in a debug native build or on a simulator. False on
|
|
92
|
+
// a native build that predates the method — production, as before the flag.
|
|
93
|
+
isDebugBuild: async () => {
|
|
94
|
+
try {
|
|
95
|
+
return (await m.isDebugBuild?.()) === true;
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
},
|
|
89
101
|
};
|
|
90
102
|
}
|
|
91
103
|
catch {
|
package/build/native.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.js","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":";;AAoBA,4DAeC;AAQD,
|
|
1
|
+
{"version":3,"file":"native.js","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":";;AAoBA,4DAeC;AAQD,0CAiEC;AAYD,8DAYC;AAzHD,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9F,CAAC;AAED;;;;GAIG;AACH,SAAgB,wBAAwB,CAAC,GAAY;IACnD,MAAM,CAAC,GAAG,GAAiD,CAAC;IAC5D,IAAI,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QACvC,sEAAsE;QACtE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,K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IAAI,CAAC;oBACH,OAAO,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,KAAK,IAAI,CAAC;gBAC7C,CAAC;gBAAC,MAAM,CAAC;oBACP,OAAO,KAAK,CAAC;gBACf,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC,CAAC,+CAA+C;IACnE,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,yBAAyB,CACvC,SAAiB,EACjB,MAAoB,EACpB,UAAU,GAAG,KAAK;IAElB,IAAI,CAAC;QACH,8DAA8D;QAC9D,MAAM,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;QAC7D,mBAAmB,CAAC,QAAQ,CAAC,CAAC,qBAAqB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;IACvF,CAAC;IAAC,MAAM,CAAC;QACP,sBAAsB;IACxB,CAAC;AACH,CAAC"}
|
package/ios/TraqioModule.swift
CHANGED
|
@@ -33,6 +33,17 @@ public class TraqioModule: Module {
|
|
|
33
33
|
return ["deviceModel": machine, "osVersion": UIDevice.current.systemVersion]
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
// Whether the host app is a development build, for the JS core's `debug`
|
|
37
|
+
// auto-detection: compiled with DEBUG (Xcode's Debug configuration), or
|
|
38
|
+
// running on the simulator.
|
|
39
|
+
AsyncFunction("isDebugBuild") { () -> Bool in
|
|
40
|
+
#if DEBUG || targetEnvironment(simulator)
|
|
41
|
+
return true
|
|
42
|
+
#else
|
|
43
|
+
return false
|
|
44
|
+
#endif
|
|
45
|
+
}
|
|
46
|
+
|
|
36
47
|
// The JS core computes fine + coarse from the mapping it fetched from
|
|
37
48
|
// GET /skan/mapping/<sdkKey>; the native side only talks to SKAdNetwork.
|
|
38
49
|
// `coarse` is "low" | "medium" | "high"; anything else falls back to a tier
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@traqio/react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Traqio SDK for React Native / Expo — deterministic install attribution (Play Install Referrer) + SKAN. No IDFA, no fingerprinting.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"README.md"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@traqio/core": "0.
|
|
47
|
+
"@traqio/core": "0.3.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@react-native-async-storage/async-storage": ">=1.21.0",
|
package/src/native.ts
CHANGED
|
@@ -91,6 +91,17 @@ export function getNativeBridge(): NativeBridge | undefined {
|
|
|
91
91
|
return null;
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
|
+
// Debug mode (InitOptions.debug): the host app is debuggable / DEBUG, or runs
|
|
95
|
+
// on an emulator / simulator. `__DEV__` already covers a Metro dev bundle; this
|
|
96
|
+
// catches a release bundle in a debug native build or on a simulator. False on
|
|
97
|
+
// a native build that predates the method — production, as before the flag.
|
|
98
|
+
isDebugBuild: async () => {
|
|
99
|
+
try {
|
|
100
|
+
return (await m.isDebugBuild?.()) === true;
|
|
101
|
+
} catch {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
},
|
|
94
105
|
};
|
|
95
106
|
} catch {
|
|
96
107
|
return undefined; // native module not present (e.g. tests / web)
|