@metrixorg/react-native-plugin 1.2.0-beta03 → 1.2.0-beta08
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/android/build.gradle +3 -3
- package/index.js +85 -22
- package/ios/RNMetrix.xcodeproj/project.pbxproj +350 -0
- package/ios/RNMetrixModule.m +130 -0
- package/package.json +3 -3
- package/react-native-metrix.podspec +20 -0
- package/react-native.config.js +13 -0
package/android/build.gradle
CHANGED
|
@@ -8,8 +8,8 @@ android {
|
|
|
8
8
|
defaultConfig {
|
|
9
9
|
minSdkVersion 16
|
|
10
10
|
targetSdkVersion 28
|
|
11
|
-
versionCode
|
|
12
|
-
versionName "1.2.0-
|
|
11
|
+
versionCode 100200057
|
|
12
|
+
versionName "1.2.0-beta07"
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
buildTypes {
|
|
@@ -29,6 +29,6 @@ rootProject.allprojects {
|
|
|
29
29
|
|
|
30
30
|
dependencies {
|
|
31
31
|
implementation 'com.facebook.react:react-native:+'
|
|
32
|
-
implementation 'ir.metrix:reactnative:1.2.0-
|
|
32
|
+
implementation 'ir.metrix:metrix-reactnative:1.2.0-beta5'
|
|
33
33
|
|
|
34
34
|
}
|
package/index.js
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
NativeEventEmitter,
|
|
3
|
+
NativeModules,
|
|
4
|
+
Platform,
|
|
3
5
|
} from 'react-native';
|
|
4
6
|
|
|
5
7
|
let module_metrix = NativeModules.Metrix;
|
|
6
|
-
|
|
8
|
+
const eventEmitter = new NativeEventEmitter(module_metrix);
|
|
9
|
+
|
|
7
10
|
var Metrix = {};
|
|
8
11
|
|
|
9
12
|
Metrix.shouldLaunchDeeplink = true
|
|
10
13
|
|
|
14
|
+
// not used in android
|
|
15
|
+
Metrix.initialize = function(appId) {
|
|
16
|
+
if (Platform.OS === "ios") {
|
|
17
|
+
module_metrix.initialize(appId)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
11
21
|
Metrix.setPushToken = function(token) {
|
|
12
22
|
module_metrix.setPushToken(token);
|
|
13
23
|
};
|
|
@@ -21,15 +31,30 @@ Metrix.getSessionId = function(callback) {
|
|
|
21
31
|
};
|
|
22
32
|
|
|
23
33
|
Metrix.setOnAttributionChangedListener = function(callback) {
|
|
24
|
-
|
|
34
|
+
if (Platform.OS === "android") {
|
|
35
|
+
module_metrix.setOnAttributionChangedListener(callback);
|
|
36
|
+
} else {
|
|
37
|
+
eventEmitter.addListener('onAttributionChangedListener', callback);
|
|
38
|
+
module_metrix.setOnAttributionChangedListener();
|
|
39
|
+
}
|
|
25
40
|
};
|
|
26
41
|
|
|
27
42
|
Metrix.setOnDeeplinkResponseListener = function(callback) {
|
|
28
|
-
|
|
43
|
+
if (Platform.OS === "android") {
|
|
44
|
+
module_metrix.setOnDeeplinkResponseListener(this.shouldLaunchDeeplink, callback);
|
|
45
|
+
} else {
|
|
46
|
+
eventEmitter.addListener('onDeeplinkResponseListener', callback);
|
|
47
|
+
module_metrix.setOnDeeplinkResponseListener(this.shouldLaunchDeeplink);
|
|
48
|
+
}
|
|
29
49
|
};
|
|
30
50
|
|
|
31
51
|
Metrix.setUserIdListener = function(callback) {
|
|
32
|
-
|
|
52
|
+
if (Platform.OS === "android") {
|
|
53
|
+
module_metrix.setUserIdListener(callback);
|
|
54
|
+
} else {
|
|
55
|
+
eventEmitter.addListener('onUserIdListener', callback);
|
|
56
|
+
module_metrix.setUserIdListener();
|
|
57
|
+
}
|
|
33
58
|
};
|
|
34
59
|
|
|
35
60
|
Metrix.newEvent = function(eventName, customAttributes) {
|
|
@@ -40,24 +65,19 @@ Metrix.newEvent = function(eventName, customAttributes) {
|
|
|
40
65
|
}
|
|
41
66
|
};
|
|
42
67
|
|
|
43
|
-
Metrix.newRevenue = function(slug, revenue,
|
|
44
|
-
|
|
45
|
-
if (currency === 0) {
|
|
46
|
-
cr = "IRR";
|
|
47
|
-
} else if (currency === 1) {
|
|
48
|
-
cr = "USD";
|
|
49
|
-
} else if (currency == 2) {
|
|
50
|
-
cr = "EUR";
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (cr == null && orderId == null) {
|
|
68
|
+
Metrix.newRevenue = function(slug, revenue, currencyOrderId, orderId) {
|
|
69
|
+
if (currencyOrderId == null && orderId == null) {
|
|
54
70
|
module_metrix.newRevenueSimple(slug, revenue);
|
|
55
|
-
} else if (
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
71
|
+
} else if (currencyOrderId != null && orderId == null) {
|
|
72
|
+
if (typeof currencyOrderId === 'string') {
|
|
73
|
+
module_metrix.newRevenueOrderId(slug, revenue, currencyOrderId);
|
|
74
|
+
} else {
|
|
75
|
+
let currency = getCurrency(currencyOrderId)
|
|
76
|
+
module_metrix.newRevenueCurrency(slug, revenue, currency);
|
|
77
|
+
}
|
|
59
78
|
} else {
|
|
60
|
-
|
|
79
|
+
let currency = getCurrency(currencyOrderId)
|
|
80
|
+
module_metrix.newRevenueFull(slug, revenue, currency, orderId);
|
|
61
81
|
}
|
|
62
82
|
};
|
|
63
83
|
|
|
@@ -65,4 +85,47 @@ Metrix.addUserAttributes = function(userAttributes) {
|
|
|
65
85
|
module_metrix.addUserAttributes(userAttributes);
|
|
66
86
|
};
|
|
67
87
|
|
|
68
|
-
|
|
88
|
+
// not used in android
|
|
89
|
+
Metrix.setStore = function(storeName) {
|
|
90
|
+
if (Platform.OS === "ios") {
|
|
91
|
+
module_metrix.setStore(storeName);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// not used in android
|
|
96
|
+
Metrix.setAppSecret = function(secretId, info1, info2, info3, info4) {
|
|
97
|
+
if (Platform.OS === "ios") {
|
|
98
|
+
module_metrix.setAppSecret(secretId, info1, info2, info3, info4);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// not used in android
|
|
103
|
+
Metrix.setDefaultTracker = function(trackerToken) {
|
|
104
|
+
if (Platform.OS === "ios") {
|
|
105
|
+
module_metrix.setDefaultTracker(trackerToken);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
module.exports = { Metrix }
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
function getCurrency(currency) {
|
|
113
|
+
let cr = null;
|
|
114
|
+
if (Platform.OS === "android") {
|
|
115
|
+
if (currency === 2) {
|
|
116
|
+
cr = "EUR";
|
|
117
|
+
} else if (currency === 1) {
|
|
118
|
+
cr = "USD";
|
|
119
|
+
} else {
|
|
120
|
+
cr = "IRR";
|
|
121
|
+
}
|
|
122
|
+
} else {
|
|
123
|
+
if (currency === 2 || currency === 1) {
|
|
124
|
+
cr = currency;
|
|
125
|
+
} else {
|
|
126
|
+
cr = 0;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return cr;
|
|
131
|
+
}
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
// !$*UTF8*$!
|
|
2
|
+
{
|
|
3
|
+
archiveVersion = 1;
|
|
4
|
+
classes = {
|
|
5
|
+
};
|
|
6
|
+
objectVersion = 46;
|
|
7
|
+
objects = {
|
|
8
|
+
|
|
9
|
+
/* Begin PBXBuildFile section */
|
|
10
|
+
5CE4D20FB53AC2E273901184 /* Pods_RNMetrix.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 396AD0BDC7C59D09908A512D /* Pods_RNMetrix.framework */; };
|
|
11
|
+
88E5019526D6FC9C00A4382A /* RNMetrixModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 88E5019426D6FC9C00A4382A /* RNMetrixModule.m */; };
|
|
12
|
+
/* End PBXBuildFile section */
|
|
13
|
+
|
|
14
|
+
/* Begin PBXCopyFilesBuildPhase section */
|
|
15
|
+
88E5018926D6FC6F00A4382A /* CopyFiles */ = {
|
|
16
|
+
isa = PBXCopyFilesBuildPhase;
|
|
17
|
+
buildActionMask = 2147483647;
|
|
18
|
+
dstPath = "include/$(PRODUCT_NAME)";
|
|
19
|
+
dstSubfolderSpec = 16;
|
|
20
|
+
files = (
|
|
21
|
+
);
|
|
22
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
23
|
+
};
|
|
24
|
+
/* End PBXCopyFilesBuildPhase section */
|
|
25
|
+
|
|
26
|
+
/* Begin PBXFileReference section */
|
|
27
|
+
01187F795E8C8A56931C2CF9 /* Pods-RNMetrix.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNMetrix.release.xcconfig"; path = "Target Support Files/Pods-RNMetrix/Pods-RNMetrix.release.xcconfig"; sourceTree = "<group>"; };
|
|
28
|
+
396AD0BDC7C59D09908A512D /* Pods_RNMetrix.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RNMetrix.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
29
|
+
88E5019426D6FC9C00A4382A /* RNMetrixModule.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNMetrixModule.m; sourceTree = "<group>"; };
|
|
30
|
+
88E5049626DBC5A300A4382A /* libRNMetrix.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNMetrix.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
31
|
+
AB6E03D7E4997CD136F8B4BD /* Pods-RNMetrix.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNMetrix.debug.xcconfig"; path = "Target Support Files/Pods-RNMetrix/Pods-RNMetrix.debug.xcconfig"; sourceTree = "<group>"; };
|
|
32
|
+
/* End PBXFileReference section */
|
|
33
|
+
|
|
34
|
+
/* Begin PBXFrameworksBuildPhase section */
|
|
35
|
+
88E5018826D6FC6F00A4382A /* Frameworks */ = {
|
|
36
|
+
isa = PBXFrameworksBuildPhase;
|
|
37
|
+
buildActionMask = 2147483647;
|
|
38
|
+
files = (
|
|
39
|
+
5CE4D20FB53AC2E273901184 /* Pods_RNMetrix.framework in Frameworks */,
|
|
40
|
+
);
|
|
41
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
42
|
+
};
|
|
43
|
+
/* End PBXFrameworksBuildPhase section */
|
|
44
|
+
|
|
45
|
+
/* Begin PBXGroup section */
|
|
46
|
+
58B511D21A9E6C8500147676 = {
|
|
47
|
+
isa = PBXGroup;
|
|
48
|
+
children = (
|
|
49
|
+
88E5019426D6FC9C00A4382A /* RNMetrixModule.m */,
|
|
50
|
+
88E5049626DBC5A300A4382A /* libRNMetrix.a */,
|
|
51
|
+
9C62864DFB6F58794B642066 /* Pods */,
|
|
52
|
+
AAB9D0D406C93BDA68F773BE /* Frameworks */,
|
|
53
|
+
);
|
|
54
|
+
sourceTree = "<group>";
|
|
55
|
+
};
|
|
56
|
+
9C62864DFB6F58794B642066 /* Pods */ = {
|
|
57
|
+
isa = PBXGroup;
|
|
58
|
+
children = (
|
|
59
|
+
AB6E03D7E4997CD136F8B4BD /* Pods-RNMetrix.debug.xcconfig */,
|
|
60
|
+
01187F795E8C8A56931C2CF9 /* Pods-RNMetrix.release.xcconfig */,
|
|
61
|
+
);
|
|
62
|
+
name = Pods;
|
|
63
|
+
path = Pods;
|
|
64
|
+
sourceTree = "<group>";
|
|
65
|
+
};
|
|
66
|
+
AAB9D0D406C93BDA68F773BE /* Frameworks */ = {
|
|
67
|
+
isa = PBXGroup;
|
|
68
|
+
children = (
|
|
69
|
+
396AD0BDC7C59D09908A512D /* Pods_RNMetrix.framework */,
|
|
70
|
+
);
|
|
71
|
+
name = Frameworks;
|
|
72
|
+
sourceTree = "<group>";
|
|
73
|
+
};
|
|
74
|
+
/* End PBXGroup section */
|
|
75
|
+
|
|
76
|
+
/* Begin PBXNativeTarget section */
|
|
77
|
+
88E5018A26D6FC6F00A4382A /* RNMetrix */ = {
|
|
78
|
+
isa = PBXNativeTarget;
|
|
79
|
+
buildConfigurationList = 88E5018F26D6FC6F00A4382A /* Build configuration list for PBXNativeTarget "RNMetrix" */;
|
|
80
|
+
buildPhases = (
|
|
81
|
+
31D3EE88B49F9296153A0592 /* [CP] Check Pods Manifest.lock */,
|
|
82
|
+
88E5018726D6FC6F00A4382A /* Sources */,
|
|
83
|
+
88E5018826D6FC6F00A4382A /* Frameworks */,
|
|
84
|
+
88E5018926D6FC6F00A4382A /* CopyFiles */,
|
|
85
|
+
);
|
|
86
|
+
buildRules = (
|
|
87
|
+
);
|
|
88
|
+
dependencies = (
|
|
89
|
+
);
|
|
90
|
+
name = RNMetrix;
|
|
91
|
+
productName = RNMetrix;
|
|
92
|
+
productReference = 88E5049626DBC5A300A4382A /* libRNMetrix.a */;
|
|
93
|
+
productType = "com.apple.product-type.library.static";
|
|
94
|
+
};
|
|
95
|
+
/* End PBXNativeTarget section */
|
|
96
|
+
|
|
97
|
+
/* Begin PBXProject section */
|
|
98
|
+
58B511D31A9E6C8500147676 /* Project object */ = {
|
|
99
|
+
isa = PBXProject;
|
|
100
|
+
attributes = {
|
|
101
|
+
LastSwiftUpdateCheck = 1240;
|
|
102
|
+
LastUpgradeCheck = 0610;
|
|
103
|
+
ORGANIZATIONNAME = Facebook;
|
|
104
|
+
TargetAttributes = {
|
|
105
|
+
88E5018A26D6FC6F00A4382A = {
|
|
106
|
+
CreatedOnToolsVersion = 12.4;
|
|
107
|
+
DevelopmentTeam = 97723978W3;
|
|
108
|
+
LastSwiftMigration = 1240;
|
|
109
|
+
ProvisioningStyle = Automatic;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNMetrix" */;
|
|
114
|
+
compatibilityVersion = "Xcode 3.2";
|
|
115
|
+
developmentRegion = English;
|
|
116
|
+
hasScannedForEncodings = 0;
|
|
117
|
+
knownRegions = (
|
|
118
|
+
English,
|
|
119
|
+
en,
|
|
120
|
+
);
|
|
121
|
+
mainGroup = 58B511D21A9E6C8500147676;
|
|
122
|
+
productRefGroup = 58B511D21A9E6C8500147676;
|
|
123
|
+
projectDirPath = "";
|
|
124
|
+
projectRoot = "";
|
|
125
|
+
targets = (
|
|
126
|
+
88E5018A26D6FC6F00A4382A /* RNMetrix */,
|
|
127
|
+
);
|
|
128
|
+
};
|
|
129
|
+
/* End PBXProject section */
|
|
130
|
+
|
|
131
|
+
/* Begin PBXShellScriptBuildPhase section */
|
|
132
|
+
31D3EE88B49F9296153A0592 /* [CP] Check Pods Manifest.lock */ = {
|
|
133
|
+
isa = PBXShellScriptBuildPhase;
|
|
134
|
+
buildActionMask = 2147483647;
|
|
135
|
+
files = (
|
|
136
|
+
);
|
|
137
|
+
inputFileListPaths = (
|
|
138
|
+
);
|
|
139
|
+
inputPaths = (
|
|
140
|
+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
|
141
|
+
"${PODS_ROOT}/Manifest.lock",
|
|
142
|
+
);
|
|
143
|
+
name = "[CP] Check Pods Manifest.lock";
|
|
144
|
+
outputFileListPaths = (
|
|
145
|
+
);
|
|
146
|
+
outputPaths = (
|
|
147
|
+
"$(DERIVED_FILE_DIR)/Pods-RNMetrix-checkManifestLockResult.txt",
|
|
148
|
+
);
|
|
149
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
150
|
+
shellPath = /bin/sh;
|
|
151
|
+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
|
152
|
+
showEnvVarsInLog = 0;
|
|
153
|
+
};
|
|
154
|
+
/* End PBXShellScriptBuildPhase section */
|
|
155
|
+
|
|
156
|
+
/* Begin PBXSourcesBuildPhase section */
|
|
157
|
+
88E5018726D6FC6F00A4382A /* Sources */ = {
|
|
158
|
+
isa = PBXSourcesBuildPhase;
|
|
159
|
+
buildActionMask = 2147483647;
|
|
160
|
+
files = (
|
|
161
|
+
88E5019526D6FC9C00A4382A /* RNMetrixModule.m in Sources */,
|
|
162
|
+
);
|
|
163
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
164
|
+
};
|
|
165
|
+
/* End PBXSourcesBuildPhase section */
|
|
166
|
+
|
|
167
|
+
/* Begin XCBuildConfiguration section */
|
|
168
|
+
58B511ED1A9E6C8500147676 /* Debug */ = {
|
|
169
|
+
isa = XCBuildConfiguration;
|
|
170
|
+
buildSettings = {
|
|
171
|
+
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
172
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
173
|
+
CLANG_CXX_LIBRARY = "libc++";
|
|
174
|
+
CLANG_ENABLE_MODULES = YES;
|
|
175
|
+
CLANG_ENABLE_OBJC_ARC = YES;
|
|
176
|
+
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
177
|
+
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
178
|
+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
179
|
+
CLANG_WARN_EMPTY_BODY = YES;
|
|
180
|
+
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
181
|
+
CLANG_WARN_INT_CONVERSION = YES;
|
|
182
|
+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
183
|
+
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
184
|
+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
185
|
+
COPY_PHASE_STRIP = NO;
|
|
186
|
+
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
187
|
+
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
188
|
+
GCC_DYNAMIC_NO_PIC = NO;
|
|
189
|
+
GCC_OPTIMIZATION_LEVEL = 0;
|
|
190
|
+
GCC_PREPROCESSOR_DEFINITIONS = (
|
|
191
|
+
"DEBUG=1",
|
|
192
|
+
"$(inherited)",
|
|
193
|
+
);
|
|
194
|
+
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
|
195
|
+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
196
|
+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
197
|
+
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
198
|
+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
199
|
+
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
200
|
+
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
201
|
+
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
|
202
|
+
MTL_ENABLE_DEBUG_INFO = YES;
|
|
203
|
+
ONLY_ACTIVE_ARCH = YES;
|
|
204
|
+
SDKROOT = iphoneos;
|
|
205
|
+
};
|
|
206
|
+
name = Debug;
|
|
207
|
+
};
|
|
208
|
+
58B511EE1A9E6C8500147676 /* Release */ = {
|
|
209
|
+
isa = XCBuildConfiguration;
|
|
210
|
+
buildSettings = {
|
|
211
|
+
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
212
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
213
|
+
CLANG_CXX_LIBRARY = "libc++";
|
|
214
|
+
CLANG_ENABLE_MODULES = YES;
|
|
215
|
+
CLANG_ENABLE_OBJC_ARC = YES;
|
|
216
|
+
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
217
|
+
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
218
|
+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
219
|
+
CLANG_WARN_EMPTY_BODY = YES;
|
|
220
|
+
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
221
|
+
CLANG_WARN_INT_CONVERSION = YES;
|
|
222
|
+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
223
|
+
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
224
|
+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
225
|
+
COPY_PHASE_STRIP = YES;
|
|
226
|
+
ENABLE_NS_ASSERTIONS = NO;
|
|
227
|
+
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
228
|
+
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
229
|
+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
230
|
+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
231
|
+
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
232
|
+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
233
|
+
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
234
|
+
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
235
|
+
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
|
236
|
+
MTL_ENABLE_DEBUG_INFO = NO;
|
|
237
|
+
SDKROOT = iphoneos;
|
|
238
|
+
VALIDATE_PRODUCT = YES;
|
|
239
|
+
};
|
|
240
|
+
name = Release;
|
|
241
|
+
};
|
|
242
|
+
88E5019026D6FC6F00A4382A /* Debug */ = {
|
|
243
|
+
isa = XCBuildConfiguration;
|
|
244
|
+
baseConfigurationReference = AB6E03D7E4997CD136F8B4BD /* Pods-RNMetrix.debug.xcconfig */;
|
|
245
|
+
buildSettings = {
|
|
246
|
+
CLANG_ANALYZER_NONNULL = YES;
|
|
247
|
+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
|
248
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
|
249
|
+
CLANG_ENABLE_MODULES = YES;
|
|
250
|
+
CLANG_ENABLE_OBJC_WEAK = YES;
|
|
251
|
+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
252
|
+
CLANG_WARN_COMMA = YES;
|
|
253
|
+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
|
254
|
+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
|
255
|
+
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
256
|
+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
257
|
+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
|
258
|
+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
259
|
+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
|
260
|
+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
261
|
+
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
262
|
+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
263
|
+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
|
264
|
+
CODE_SIGN_STYLE = Automatic;
|
|
265
|
+
DEBUG_INFORMATION_FORMAT = dwarf;
|
|
266
|
+
DEVELOPMENT_TEAM = 97723978W3;
|
|
267
|
+
ENABLE_TESTABILITY = YES;
|
|
268
|
+
GCC_C_LANGUAGE_STANDARD = gnu11;
|
|
269
|
+
GCC_NO_COMMON_BLOCKS = YES;
|
|
270
|
+
IPHONEOS_DEPLOYMENT_TARGET = 14.4;
|
|
271
|
+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
|
272
|
+
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
|
273
|
+
MTL_FAST_MATH = YES;
|
|
274
|
+
OTHER_LDFLAGS = "-ObjC";
|
|
275
|
+
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
276
|
+
SKIP_INSTALL = YES;
|
|
277
|
+
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
|
278
|
+
SWIFT_OBJC_BRIDGING_HEADER = "RNMetrix-Bridging-Header.h";
|
|
279
|
+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
|
280
|
+
SWIFT_VERSION = 5.0;
|
|
281
|
+
TARGETED_DEVICE_FAMILY = "1,2";
|
|
282
|
+
};
|
|
283
|
+
name = Debug;
|
|
284
|
+
};
|
|
285
|
+
88E5019126D6FC6F00A4382A /* Release */ = {
|
|
286
|
+
isa = XCBuildConfiguration;
|
|
287
|
+
baseConfigurationReference = 01187F795E8C8A56931C2CF9 /* Pods-RNMetrix.release.xcconfig */;
|
|
288
|
+
buildSettings = {
|
|
289
|
+
CLANG_ANALYZER_NONNULL = YES;
|
|
290
|
+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
|
291
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
|
292
|
+
CLANG_ENABLE_MODULES = YES;
|
|
293
|
+
CLANG_ENABLE_OBJC_WEAK = YES;
|
|
294
|
+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
295
|
+
CLANG_WARN_COMMA = YES;
|
|
296
|
+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
|
297
|
+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
|
298
|
+
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
299
|
+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
300
|
+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
|
301
|
+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
302
|
+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
|
303
|
+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
304
|
+
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
305
|
+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
306
|
+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
|
307
|
+
CODE_SIGN_STYLE = Automatic;
|
|
308
|
+
COPY_PHASE_STRIP = NO;
|
|
309
|
+
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
|
310
|
+
DEVELOPMENT_TEAM = 97723978W3;
|
|
311
|
+
GCC_C_LANGUAGE_STANDARD = gnu11;
|
|
312
|
+
GCC_NO_COMMON_BLOCKS = YES;
|
|
313
|
+
IPHONEOS_DEPLOYMENT_TARGET = 14.4;
|
|
314
|
+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
|
315
|
+
MTL_FAST_MATH = YES;
|
|
316
|
+
OTHER_LDFLAGS = "-ObjC";
|
|
317
|
+
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
318
|
+
SKIP_INSTALL = YES;
|
|
319
|
+
SWIFT_OBJC_BRIDGING_HEADER = "RNMetrix-Bridging-Header.h";
|
|
320
|
+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
|
321
|
+
SWIFT_VERSION = 5.0;
|
|
322
|
+
TARGETED_DEVICE_FAMILY = "1,2";
|
|
323
|
+
};
|
|
324
|
+
name = Release;
|
|
325
|
+
};
|
|
326
|
+
/* End XCBuildConfiguration section */
|
|
327
|
+
|
|
328
|
+
/* Begin XCConfigurationList section */
|
|
329
|
+
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNMetrix" */ = {
|
|
330
|
+
isa = XCConfigurationList;
|
|
331
|
+
buildConfigurations = (
|
|
332
|
+
58B511ED1A9E6C8500147676 /* Debug */,
|
|
333
|
+
58B511EE1A9E6C8500147676 /* Release */,
|
|
334
|
+
);
|
|
335
|
+
defaultConfigurationIsVisible = 0;
|
|
336
|
+
defaultConfigurationName = Release;
|
|
337
|
+
};
|
|
338
|
+
88E5018F26D6FC6F00A4382A /* Build configuration list for PBXNativeTarget "RNMetrix" */ = {
|
|
339
|
+
isa = XCConfigurationList;
|
|
340
|
+
buildConfigurations = (
|
|
341
|
+
88E5019026D6FC6F00A4382A /* Debug */,
|
|
342
|
+
88E5019126D6FC6F00A4382A /* Release */,
|
|
343
|
+
);
|
|
344
|
+
defaultConfigurationIsVisible = 0;
|
|
345
|
+
defaultConfigurationName = Release;
|
|
346
|
+
};
|
|
347
|
+
/* End XCConfigurationList section */
|
|
348
|
+
};
|
|
349
|
+
rootObject = 58B511D31A9E6C8500147676 /* Project object */;
|
|
350
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
//
|
|
2
|
+
// MetrixModule.m
|
|
3
|
+
// metrix
|
|
4
|
+
//
|
|
5
|
+
// Created by Matin on 8/25/21.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@import Metrix;
|
|
10
|
+
|
|
11
|
+
#import <Foundation/Foundation.h>
|
|
12
|
+
|
|
13
|
+
#import "React/RCTBridgeModule.h"
|
|
14
|
+
#import <React/RCTEventEmitter.h>
|
|
15
|
+
|
|
16
|
+
@interface RCTMetrixReactNative : RCTEventEmitter <RCTBridgeModule>
|
|
17
|
+
|
|
18
|
+
@end
|
|
19
|
+
|
|
20
|
+
@implementation RCTMetrixReactNative
|
|
21
|
+
|
|
22
|
+
RCT_EXPORT_MODULE(Metrix);
|
|
23
|
+
|
|
24
|
+
BOOL hasAttributionListener;
|
|
25
|
+
|
|
26
|
+
- (NSArray<NSString *> *)supportedEvents
|
|
27
|
+
{
|
|
28
|
+
return @[@"onAttributionChangedListener", @"onUserIdListener", @"onDeeplinkResponseListener"];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
RCT_EXPORT_METHOD(initialize:(NSString *)appId) {
|
|
32
|
+
[Metrix initializeWithMetrixAppId:appId];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
RCT_EXPORT_METHOD(setPushToken:(NSString *)token) {
|
|
36
|
+
[Metrix setPushTokenWithPushToken:token];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
RCT_EXPORT_METHOD(getSessionNum:(RCTResponseSenderBlock)callback) {
|
|
40
|
+
NSInteger sessionNum = [Metrix getSessionNum];
|
|
41
|
+
callback(@[@(sessionNum)]);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
RCT_EXPORT_METHOD(getSessionId:(RCTResponseSenderBlock)callback) {
|
|
45
|
+
NSString *sessionId = [Metrix getSessionId];
|
|
46
|
+
callback(@[sessionId]);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
RCT_EXPORT_METHOD(newCustomEvent:(NSString *)eventName attributes:(NSDictionary *)attributes) {
|
|
50
|
+
[Metrix newEventWithSlug:eventName attributes:attributes];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
RCT_EXPORT_METHOD(newEvent:(NSString *)eventName) {
|
|
54
|
+
[Metrix newEventWithSlug:eventName];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
RCT_EXPORT_METHOD(newRevenueSimple:(NSString *)eventName revenue:(double)revenue) {
|
|
58
|
+
[Metrix newRevenueWithSlug:eventName revenue:revenue];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
RCT_EXPORT_METHOD(newRevenueOrderId:(NSString *)eventName revenue:(double)revenue orderId:(NSString *)orderId) {
|
|
62
|
+
[Metrix newRevenueWithSlug:eventName revenue:revenue orderId:orderId];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
RCT_EXPORT_METHOD(newRevenueCurrency:(NSString *)eventName revenue:(double)revenue currency:(int)currency) {
|
|
66
|
+
[Metrix newRevenueWithSlug:eventName revenue:revenue currency:currency];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
RCT_EXPORT_METHOD(newRevenueFull:(NSString *)eventName revenue:(double)revenue currency:(int)currency orderId:(NSString *)orderId) {
|
|
70
|
+
[Metrix newRevenueWithSlug:eventName revenue:revenue currency:currency orderId:orderId];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
RCT_EXPORT_METHOD(addUserAttributes:(NSDictionary *)attributes) {
|
|
74
|
+
[Metrix addUserAttributesWithUserAttrs:attributes];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
RCT_EXPORT_METHOD(setStore:(NSString *)storeName) {
|
|
78
|
+
[Metrix setStoreWithStoreName:storeName];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
RCT_EXPORT_METHOD(setAppSecret:(int)secretId info1:(NSInteger)info1 info2:(NSInteger)info2 info3:(NSInteger)info3 info4:(NSInteger)info4) {
|
|
82
|
+
[Metrix setAppSecretWithSecretId:secretId info1:info1 info2:info2 info3:info3 info4:info4];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
RCT_EXPORT_METHOD(setDefaultTracker:(NSString *)trackerToken) {
|
|
86
|
+
[Metrix setDefaultTrackerWithTrackerToken:trackerToken];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
RCT_EXPORT_METHOD(setOnAttributionChangedListener) {
|
|
90
|
+
[Metrix setOnAttributionChangedListener:^(AttributionData *data) {
|
|
91
|
+
[self sendEventWithName:@"onAttributionChangedListener" body:[self getAttributionInfoObject:data]];
|
|
92
|
+
}];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
RCT_EXPORT_METHOD(setUserIdListener) {
|
|
96
|
+
[Metrix setUserIdListener:^(NSString *userId) {
|
|
97
|
+
[self sendEventWithName:@"onUserIdListener" body:userId];
|
|
98
|
+
}];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
RCT_EXPORT_METHOD(setOnDeeplinkResponseListener:(BOOL)shouldLaunchDeferredDeeplink) {
|
|
102
|
+
[Metrix setOnDeeplinkResponseListener:^BOOL(NSString *deeplink) {
|
|
103
|
+
[self sendEventWithName:@"onDeeplinkResponseListener" body:deeplink];
|
|
104
|
+
return shouldLaunchDeferredDeeplink;
|
|
105
|
+
}];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
- (NSDictionary *)getAttributionInfoObject:(AttributionData *)data {
|
|
109
|
+
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
|
|
110
|
+
[self addValueOrEmpty:dictionary key:@"trackerToken" value:data.trackerToken];
|
|
111
|
+
[self addValueOrEmpty:dictionary key:@"acquisitionAd" value:data.acquisitionAd];
|
|
112
|
+
[self addValueOrEmpty:dictionary key:@"acquisitionAdSet" value:data.acquisitionAdSet];
|
|
113
|
+
[self addValueOrEmpty:dictionary key:@"acquisitionCampaign" value:data.acquisitionCampaign];
|
|
114
|
+
[self addValueOrEmpty:dictionary key:@"acquisitionSource" value:data.acquisitionSource];
|
|
115
|
+
[self addValueOrEmpty:dictionary key:@"attributionStatus" value:data.attributionStatusRaw];
|
|
116
|
+
|
|
117
|
+
return dictionary;;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
- (void)addValueOrEmpty:(NSMutableDictionary *)dictionary
|
|
121
|
+
key:(NSString *)key
|
|
122
|
+
value:(NSObject *)value {
|
|
123
|
+
if (nil != value) {
|
|
124
|
+
[dictionary setObject:[NSString stringWithFormat:@"%@", value] forKey:key];
|
|
125
|
+
} else {
|
|
126
|
+
[dictionary setObject:@"" forKey:key];
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metrixorg/react-native-plugin",
|
|
3
|
-
"version": "1.2.0-
|
|
3
|
+
"version": "1.2.0-beta08",
|
|
4
4
|
"description": "Metrix React native plugin",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
],
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
|
-
"url": "git+https://github.com/metrixorg/
|
|
21
|
+
"url": "git+https://github.com/metrixorg/reactnative-sample"
|
|
22
22
|
},
|
|
23
23
|
"bugs": {
|
|
24
|
-
"url": "https://github.com/metrixorg/
|
|
24
|
+
"url": "https://github.com/metrixorg/reactnative-sample/issues"
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://metrix.ir"
|
|
27
27
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
pkg = JSON.parse(File.read("package.json"))
|
|
3
|
+
|
|
4
|
+
Pod::Spec.new do |s|
|
|
5
|
+
s.name = "react-native-metrix"
|
|
6
|
+
s.version = pkg["version"]
|
|
7
|
+
s.summary = pkg["description"]
|
|
8
|
+
s.requires_arc = true
|
|
9
|
+
s.license = pkg["license"]
|
|
10
|
+
s.homepage = pkg["homepage"]
|
|
11
|
+
s.author = pkg["author"]
|
|
12
|
+
s.source = { :http => 'file:' + __dir__ + 'ios' }
|
|
13
|
+
s.source_files = "**/*.{h,m,swift}"
|
|
14
|
+
s.platform = :ios, "10.0"
|
|
15
|
+
s.static_framework = true
|
|
16
|
+
s.dependency 'React'
|
|
17
|
+
|
|
18
|
+
# MetrixFramework
|
|
19
|
+
s.dependency 'Metrix/reactnative', '2.0.0-beta07'
|
|
20
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
dependency: {
|
|
5
|
+
platforms: {
|
|
6
|
+
ios: { podspecPath: path.join(__dirname, 'react-native-metrix.podspec') },
|
|
7
|
+
android: {
|
|
8
|
+
packageImportPath: 'import ir.metrix.reactnative.MetrixReactNativePackage;',
|
|
9
|
+
packageInstance: 'new MetrixReactNativePackage()',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|