@dynatrace/react-native-plugin 2.279.4 → 2.283.1

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.
Files changed (88) hide show
  1. package/README.md +16 -7
  2. package/android/build.gradle +40 -6
  3. package/android/src/main/java/com/dynatrace/android/agent/{DynatraceRNBridge.java → DynatraceRNBridgeImpl.java} +15 -45
  4. package/android/src/main/java/com/dynatrace/android/agent/DynatraceReactPackage.java +31 -13
  5. package/android/src/new/java/com/dynatrace/android/agent/DynatraceRNBridge.java +187 -0
  6. package/android/src/old/java/com/dynatrace/android/agent/DynatraceRNBridge.java +189 -0
  7. package/files/plugin.gradle +1 -1
  8. package/ios/DynatraceRNBridge.h +9 -1
  9. package/ios/DynatraceRNBridge.m +15 -0
  10. package/ios/lib/Dynatrace.xcframework/Info.plist +16 -8
  11. package/ios/lib/Dynatrace.xcframework/_CodeSignature/CodeDirectory +0 -0
  12. package/ios/lib/Dynatrace.xcframework/_CodeSignature/CodeRequirements +0 -0
  13. package/ios/lib/Dynatrace.xcframework/_CodeSignature/CodeRequirements-1 +0 -0
  14. package/ios/lib/Dynatrace.xcframework/_CodeSignature/CodeResources +1058 -0
  15. package/ios/lib/Dynatrace.xcframework/_CodeSignature/CodeSignature +0 -0
  16. package/ios/lib/Dynatrace.xcframework/ios-arm64/Dynatrace.framework/Dynatrace +0 -0
  17. package/ios/lib/Dynatrace.xcframework/ios-arm64/Dynatrace.framework/Headers/Dynatrace-Swift.h +106 -59
  18. package/ios/lib/Dynatrace.xcframework/ios-arm64/Dynatrace.framework/Headers/Dynatrace.h +1 -1
  19. package/ios/lib/Dynatrace.xcframework/ios-arm64/Dynatrace.framework/Info.plist +0 -0
  20. package/ios/lib/Dynatrace.xcframework/ios-arm64/Dynatrace.framework/Modules/Dynatrace.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  21. package/ios/lib/Dynatrace.xcframework/ios-arm64/Dynatrace.framework/Modules/Dynatrace.swiftmodule/arm64-apple-ios.abi.json +1 -1
  22. package/ios/lib/Dynatrace.xcframework/ios-arm64/Dynatrace.framework/Modules/Dynatrace.swiftmodule/arm64-apple-ios.private.swiftinterface +3 -2
  23. package/ios/lib/Dynatrace.xcframework/ios-arm64/Dynatrace.framework/Modules/Dynatrace.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  24. package/ios/lib/Dynatrace.xcframework/ios-arm64/Dynatrace.framework/Modules/Dynatrace.swiftmodule/arm64-apple-ios.swiftinterface +3 -2
  25. package/ios/lib/Dynatrace.xcframework/ios-arm64/Dynatrace.framework/PrivacyInfo.xcprivacy +100 -0
  26. package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Dynatrace +0 -0
  27. package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Headers/Dynatrace-Swift.h +212 -118
  28. package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Headers/Dynatrace.h +1 -1
  29. package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Info.plist +0 -0
  30. package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  31. package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  32. package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/arm64-apple-ios-simulator.abi.json +1 -1
  33. package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +3 -2
  34. package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  35. package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/arm64-apple-ios-simulator.swiftinterface +3 -2
  36. package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/x86_64-apple-ios-simulator.abi.json +1 -1
  37. package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +3 -2
  38. package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  39. package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +3 -2
  40. package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/PrivacyInfo.xcprivacy +100 -0
  41. package/ios/lib/Dynatrace.xcframework/ios-arm64_x86_64-simulator/Dynatrace.framework/_CodeSignature/CodeResources +40 -29
  42. package/ios/lib/Dynatrace.xcframework/tvos-arm64/Dynatrace.framework/Dynatrace +0 -0
  43. package/ios/lib/Dynatrace.xcframework/tvos-arm64/Dynatrace.framework/Headers/Dynatrace-Swift.h +106 -59
  44. package/ios/lib/Dynatrace.xcframework/tvos-arm64/Dynatrace.framework/Headers/Dynatrace.h +1 -1
  45. package/ios/lib/Dynatrace.xcframework/tvos-arm64/Dynatrace.framework/Info.plist +0 -0
  46. package/ios/lib/Dynatrace.xcframework/tvos-arm64/Dynatrace.framework/Modules/Dynatrace.swiftmodule/Project/arm64-apple-tvos.swiftsourceinfo +0 -0
  47. package/ios/lib/Dynatrace.xcframework/tvos-arm64/Dynatrace.framework/Modules/Dynatrace.swiftmodule/arm64-apple-tvos.private.swiftinterface +3 -2
  48. package/ios/lib/Dynatrace.xcframework/tvos-arm64/Dynatrace.framework/Modules/Dynatrace.swiftmodule/arm64-apple-tvos.swiftdoc +0 -0
  49. package/ios/lib/Dynatrace.xcframework/tvos-arm64/Dynatrace.framework/Modules/Dynatrace.swiftmodule/arm64-apple-tvos.swiftinterface +3 -2
  50. package/ios/lib/Dynatrace.xcframework/tvos-arm64/Dynatrace.framework/PrivacyInfo.xcprivacy +100 -0
  51. package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Dynatrace +0 -0
  52. package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Headers/Dynatrace-Swift.h +212 -118
  53. package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Headers/Dynatrace.h +1 -1
  54. package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Info.plist +0 -0
  55. package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/Project/arm64-apple-tvos-simulator.swiftsourceinfo +0 -0
  56. package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/Project/x86_64-apple-tvos-simulator.swiftsourceinfo +0 -0
  57. package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/arm64-apple-tvos-simulator.private.swiftinterface +3 -2
  58. package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/arm64-apple-tvos-simulator.swiftdoc +0 -0
  59. package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/arm64-apple-tvos-simulator.swiftinterface +3 -2
  60. package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/x86_64-apple-tvos-simulator.private.swiftinterface +3 -2
  61. package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/x86_64-apple-tvos-simulator.swiftdoc +0 -0
  62. package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/Modules/Dynatrace.swiftmodule/x86_64-apple-tvos-simulator.swiftinterface +3 -2
  63. package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/PrivacyInfo.xcprivacy +100 -0
  64. package/ios/lib/Dynatrace.xcframework/tvos-arm64_x86_64-simulator/Dynatrace.framework/_CodeSignature/CodeResources +36 -25
  65. package/lib/instrumentor/DynatraceInstrumentation.js +1 -1
  66. package/lib/instrumentor/base/Dynatrace.js +23 -23
  67. package/lib/instrumentor/base/DynatraceAction.js +7 -7
  68. package/lib/instrumentor/base/DynatraceBridge.js +4 -1
  69. package/lib/instrumentor/base/DynatraceInternal.js +2 -2
  70. package/lib/instrumentor/base/DynatraceRootAction.js +1 -1
  71. package/lib/instrumentor/base/ElementHelper.js +6 -3
  72. package/lib/instrumentor/base/Picker.js +40 -31
  73. package/lib/instrumentor/base/RefreshControl.js +29 -17
  74. package/lib/instrumentor/base/Switch.js +57 -0
  75. package/lib/instrumentor/base/Touchable.js +12 -12
  76. package/lib/instrumentor/base/interface/IDynatraceProperties.js +7 -0
  77. package/lib/instrumentor/base/interface/NativeDynatraceBridge.js +4 -0
  78. package/lib/instrumentor/base/model/DataCollectionLevel.js +21 -5
  79. package/lib/instrumentor/base/model/Platform.js +5 -2
  80. package/lib/instrumentor/model/Types.js +1 -0
  81. package/lib/react-native/Switch.InstrInfo.js +12 -0
  82. package/lib/react-native/Switch.js +15 -0
  83. package/lib/react-native/index.js +3 -1
  84. package/lib/react-native.js +2 -0
  85. package/package.json +175 -1
  86. package/react-native-dynatrace.podspec +25 -0
  87. package/src/lib/instrumentor/base/interface/NativeDynatraceBridge.ts +90 -0
  88. package/lib/instrumentor/base/interface/IDynatraceBridge.js +0 -2
package/README.md CHANGED
@@ -18,19 +18,19 @@ If you want to start using this plugin and are not a Dynatrace customer yet, hea
18
18
 
19
19
  ## Requirements
20
20
  * React v16.8 or newer
21
- * React Native v0.59 or newer
21
+ * React Native v0.60 or newer
22
22
  * For Android users:
23
23
  * SDK version 21+
24
24
  * Gradle version 6.1.1+ ([How to update?](#updating-to-gradle-6))
25
25
  * Android Gradle plugin version 4.0+
26
26
  * Java 11
27
- * For iOS users: Minimum iOS 11
27
+ * For iOS users: Minimum iOS 12
28
28
 
29
29
  ## Agent Versions
30
30
  This agent versions are configured in this plugin:
31
31
 
32
- * Android Agent: 8.279.1.1002
33
- * iOS Agent: 8.279.1.1008
32
+ * Android Agent: 8.283.1.1004
33
+ * iOS Agent: 8.283.1.1004
34
34
 
35
35
  ## Quick Setup
36
36
 
@@ -982,16 +982,19 @@ ios: {
982
982
  * Touchables
983
983
  * dtActionName: Use a custom property called dtActionName
984
984
  * If [actionNamePrivacy](#plugin-startup) is activated anything below will not be detected
985
- * Accessibility label
985
+ * accessibilityLabel property
986
986
  * If both are not set, it will search for an inner text
987
987
  * If it is an Image Button, it will search for a source
988
988
  * Buttons
989
989
  * dtActionName: Use a custom property called dtActionName
990
990
  * If [actionNamePrivacy](#plugin-startup) is activated any below will not be detected
991
- * Button Title
992
- * Accessibility label
991
+ * Button title property
992
+ * accessibilityLabel property
993
993
  * If it is an Image Button, it will search for a source
994
994
  * If it finds nothing, it will search for an inner text
995
+ * Switch, RefreshControl or Picker
996
+ * dtActionName: Use a custom property called dtActionName
997
+ * accessibilityLabel property
995
998
 
996
999
 
997
1000
  >*Attention:* Minification can cause a loss of information.
@@ -1274,6 +1277,12 @@ If you are struggling with a problem, submit a support ticket to Dynatrace (supp
1274
1277
  <br/><br/>
1275
1278
  ## Changelog
1276
1279
 
1280
+ 2.283.1
1281
+ * Added Auto-Instrumentation for React Native Switch
1282
+ * Updated instrumentation of RefreshControl (dtActionIgnore & dtActionName)
1283
+ * Updated instrumentation of Picker (dtActionIgnore & dtActionName)
1284
+ * Minimum Support iOS version raised to 12
1285
+
1277
1286
  2.279.4
1278
1287
  * Updated iOS crash report sending strategy
1279
1288
  * Configuration printed on startup fixed
@@ -1,7 +1,13 @@
1
+ import com.android.Version
2
+
1
3
  def safeExtGet(prop, fallback) {
2
4
  rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
3
5
  }
4
6
 
7
+ def isNewArchitectureEnabled() {
8
+ return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
9
+ }
10
+
5
11
  buildscript {
6
12
  repositories {
7
13
  google()
@@ -9,25 +15,53 @@ buildscript {
9
15
  }
10
16
 
11
17
  dependencies {
12
- classpath 'com.android.tools.build:gradle:3.3.2'
18
+ classpath 'com.android.tools.build:gradle:7.3.1'
13
19
  }
14
20
  }
15
21
 
16
22
  apply plugin: 'com.android.library'
17
23
 
24
+ if (isNewArchitectureEnabled()) {
25
+ apply plugin: 'com.facebook.react'
26
+ }
27
+
18
28
  android {
19
- compileSdkVersion safeExtGet('compileSdkVersion', 27)
20
- buildToolsVersion safeExtGet('buildToolsVersion', '27.0.3')
29
+ compileSdkVersion safeExtGet('compileSdkVersion', 31)
30
+ buildToolsVersion safeExtGet('buildToolsVersion', '31.0.3')
31
+
32
+ if (project.android.hasProperty("namespace")) {
33
+ namespace "com.dynatrace.android.agent"
34
+ }
35
+
36
+ def agpVersion = Version.ANDROID_GRADLE_PLUGIN_VERSION
37
+ if (agpVersion.tokenize('.')[0].toInteger() >= 8) {
38
+ buildFeatures {
39
+ buildConfig = true
40
+ }
41
+ }
21
42
 
22
43
  defaultConfig {
23
- minSdkVersion safeExtGet('minSdkVersion', 15)
24
- targetSdkVersion safeExtGet('targetSdkVersion', 26)
44
+ minSdkVersion safeExtGet('minSdkVersion', 21)
45
+ targetSdkVersion safeExtGet('targetSdkVersion', 31)
25
46
  versionCode 1
26
47
  versionName "1.0"
48
+
49
+ buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
27
50
  }
51
+
28
52
  lintOptions {
29
53
  abortOnError false
30
54
  }
55
+
56
+ sourceSets {
57
+ main {
58
+ if (isNewArchitectureEnabled()) {
59
+ java.srcDirs += ['src/new']
60
+ } else {
61
+ java.srcDirs += ['src/old']
62
+ }
63
+ }
64
+ }
31
65
  }
32
66
 
33
67
  repositories {
@@ -36,7 +70,7 @@ repositories {
36
70
  }
37
71
 
38
72
  dependencies {
39
- implementation 'com.dynatrace.agent:agent-android:8.279.1.1002'
73
+ implementation 'com.dynatrace.agent:agent-android:8.283.1.1004'
40
74
  implementation "com.facebook.react:react-native:${safeExtGet('reactNative', '+')}"
41
75
  }
42
76
 
@@ -25,7 +25,7 @@ import org.json.JSONObject;
25
25
  import com.dynatrace.android.agent.conf.DataCollectionLevel;
26
26
  import com.dynatrace.android.agent.conf.UserPrivacyOptions;
27
27
 
28
- public class DynatraceRNBridge extends ReactContextBaseJavaModule {
28
+ public class DynatraceRNBridgeImpl {
29
29
 
30
30
  private HashMap<String, WebRequestTiming> webTimings;
31
31
  private HashMap<String, DTXAction> actions;
@@ -35,21 +35,18 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
35
35
  private static final String DATA_COLLECTION_PERFORMANCE = "PERFORMANCE";
36
36
  private static final String DATA_COLLECTION_USERBEHAVIOR = "USER_BEHAVIOR";
37
37
 
38
+ public static final String NAME = "DynatraceBridge";
39
+
38
40
  private static PrivateDTBridge _internal;
41
+ private final ReactApplicationContext reactApplicationContext;
39
42
 
40
- public DynatraceRNBridge(ReactApplicationContext reactContext, PrivateDTBridge internal) {
41
- super(reactContext);
43
+ public DynatraceRNBridgeImpl(ReactApplicationContext reactContext, PrivateDTBridge internal) {
42
44
  webTimings = new HashMap<>();
43
45
  actions = new HashMap<>();
44
46
  _internal = internal;
47
+ reactApplicationContext = reactContext;
45
48
  }
46
49
 
47
- @Override
48
- public String getName(){
49
- return "DynatraceBridge";
50
- }
51
-
52
- @Override
53
50
  public Map<String, Object> getConstants() {
54
51
  final Map<String, Object> constants = new HashMap<>();
55
52
  constants.put("PLATFORM_ANDROID", PLATFORM_ANDROID);
@@ -60,13 +57,14 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
60
57
  return constants;
61
58
  }
62
59
 
63
- @ReactMethod
64
- public void start(ReadableMap configuration) throws Exception {
60
+ public void start(ReadableMap configuration, Promise promise) {
65
61
  if (configuration == null) {
66
- throw new Exception("Configuration is empty for manual startup! This is not possible");
62
+ promise.resolve(false);
63
+ return;
67
64
  } else {
68
65
  if(configuration.getString("applicationId") == null || configuration.getString("beaconUrl") == null){
69
- throw new Exception("applicationId and beaconUrl can't be empty!");
66
+ promise.resolve(false);
67
+ return;
70
68
  }
71
69
 
72
70
  DynatraceConfigurationBuilder builder = new DynatraceConfigurationBuilder(configuration.getString("applicationId"),
@@ -77,14 +75,15 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
77
75
  // 0 == Debug / 1 == Info
78
76
  builder.withDebugLogging(configuration.getInt("logLevel") == 0);
79
77
 
80
- Dynatrace.startup(getReactApplicationContext(), builder.buildConfiguration());
78
+ Dynatrace.startup(reactApplicationContext, builder.buildConfiguration());
79
+
80
+ promise.resolve(true);
81
81
  }
82
82
  }
83
83
 
84
84
  //
85
85
  // Expects a key which is generated in JS. This is to circumvent the async callback system.
86
86
  //
87
- @ReactMethod
88
87
  public void enterAction(String name, String key, String platform) {
89
88
  if (this.shouldWorkOnAndroid(platform)) {
90
89
  try {
@@ -94,14 +93,12 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
94
93
  }
95
94
  }
96
95
 
97
- @ReactMethod
98
96
  public void enterManualAction(String name, String key, String platform) {
99
97
  if (this.shouldWorkOnAndroid(platform)) {
100
98
  actions.put(key, Dynatrace.enterAction(name));
101
99
  }
102
100
  }
103
101
 
104
- @ReactMethod
105
102
  public void enterManualActionWithParent(String name, String key, String parentKey, String platform) {
106
103
  if (this.shouldWorkOnAndroid(platform)) {
107
104
  DTXAction parent = actions.get(parentKey);
@@ -114,7 +111,6 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
114
111
  }
115
112
  }
116
113
 
117
- @ReactMethod
118
114
  public void leaveAction(String key, boolean leave, String platform) {
119
115
  if (this.shouldWorkOnAndroid(platform)) {
120
116
  DTXAction action = getAction(key);
@@ -129,7 +125,6 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
129
125
  }
130
126
  }
131
127
 
132
- @ReactMethod
133
128
  public void cancelAction(String key, String platform) {
134
129
  if (this.shouldWorkOnAndroid(platform)) {
135
130
  DTXAction action = getAction(key);
@@ -139,14 +134,12 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
139
134
  }
140
135
  }
141
136
 
142
- @ReactMethod
143
137
  public void endVisit(String platform) {
144
138
  if (this.shouldWorkOnAndroid(platform)) {
145
139
  Dynatrace.endVisit();
146
140
  }
147
141
  }
148
142
 
149
- @ReactMethod
150
143
  public void reportErrorWithoutStacktrace(String errorName, int errorCode, String platform) {
151
144
  if (this.shouldWorkOnAndroid(platform)) {
152
145
  Dynatrace.reportError(errorName, errorCode);
@@ -161,14 +154,12 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
161
154
  * @param stacktrace Whole Stacktrace
162
155
  * @param platform Platform wise or both
163
156
  */
164
- @ReactMethod
165
157
  public void reportError(String errorName, String errorValue, String reason, String stacktrace, String platform){
166
158
  if (this.shouldWorkOnAndroid(platform)) {
167
159
  Dynatrace.reportError(PlatformType.CUSTOM, errorName, errorValue, reason, stacktrace);
168
160
  }
169
161
  }
170
162
 
171
- @ReactMethod
172
163
  public void reportCrash(String errorName, String reason, String stacktrace, boolean isRealError, boolean newSession, String platform){
173
164
  if (this.shouldWorkOnAndroid(platform)) {
174
165
  Dynatrace.reportCrash(isRealError ? PlatformType.JAVA_SCRIPT : PlatformType.CUSTOM, errorName, reason, stacktrace);
@@ -178,7 +169,6 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
178
169
  }
179
170
  }
180
171
 
181
- @ReactMethod
182
172
  public void reportErrorInAction(String key, String errorName, int errorCode, String platform) {
183
173
  if (this.shouldWorkOnAndroid(platform)) {
184
174
  DTXAction action = getAction(key);
@@ -187,7 +177,6 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
187
177
  }
188
178
  }
189
179
 
190
- @ReactMethod
191
180
  public void reportValue(String key, String valueName, String value, String platform) {
192
181
  if (this.shouldWorkOnAndroid(platform)) {
193
182
  DTXAction action = getAction(key);
@@ -196,7 +185,6 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
196
185
  }
197
186
  }
198
187
 
199
- @ReactMethod
200
188
  public void getRequestTag(String key, String url, Promise promise){
201
189
  DTXAction action = getAction(key);
202
190
 
@@ -208,7 +196,6 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
208
196
  promise.resolve(action.getRequestTag());
209
197
  }
210
198
 
211
- @ReactMethod
212
199
  public void startWebRequestTiming(String requestTag, String url) {
213
200
  if (requestTag != null) {
214
201
  WebRequestTiming timing = Dynatrace.getWebRequestTiming(requestTag);
@@ -219,7 +206,6 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
219
206
  }
220
207
  }
221
208
 
222
- @ReactMethod
223
209
  public void stopWebRequestTiming(String requestTag, String url, int responseCode, String responseMessage) {
224
210
  if (requestTag != null) {
225
211
  WebRequestTiming timing = webTimings.get(requestTag);
@@ -234,14 +220,12 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
234
220
  }
235
221
  }
236
222
 
237
- @ReactMethod
238
223
  public void identifyUser(String user, String plaform) {
239
224
  if (this.shouldWorkOnAndroid(plaform)) {
240
225
  Dynatrace.identifyUser(user);
241
226
  }
242
227
  }
243
228
 
244
- @ReactMethod
245
229
  public void reportEventInAction(String actionKey, String name, String platform) {
246
230
  if (this.shouldWorkOnAndroid(platform)) {
247
231
  DTXAction action = getAction(actionKey);
@@ -250,7 +234,6 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
250
234
  }
251
235
  }
252
236
 
253
- @ReactMethod
254
237
  public void reportStringValueInAction(String actionKey, String name, String value, String platform) {
255
238
  if (this.shouldWorkOnAndroid(platform)) {
256
239
  DTXAction action = getAction(actionKey);
@@ -259,7 +242,6 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
259
242
  }
260
243
  }
261
244
 
262
- @ReactMethod
263
245
  public void reportIntValueInAction(String actionKey, String name, int value, String platform) {
264
246
  if (this.shouldWorkOnAndroid(platform)) {
265
247
  DTXAction action = getAction(actionKey);
@@ -268,7 +250,6 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
268
250
  }
269
251
  }
270
252
 
271
- @ReactMethod
272
253
  public void reportDoubleValueInAction(String actionKey, String name, double value, String platform) {
273
254
  if (this.shouldWorkOnAndroid(platform)) {
274
255
  DTXAction action = getAction(actionKey);
@@ -277,21 +258,18 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
277
258
  }
278
259
  }
279
260
 
280
- @ReactMethod
281
261
  public void sendEvent(String name, ReadableMap attributes, String platform) {
282
262
  if(this.shouldWorkOnAndroid(platform)) {
283
263
  Dynatrace.sendEvent(name, new JSONObject(toHashMap(attributes)));
284
264
  }
285
265
  }
286
266
 
287
- @ReactMethod
288
267
  public void sendBizEvent(String type, ReadableMap attributes, String platform) {
289
268
  if(this.shouldWorkOnAndroid(platform)) {
290
269
  Dynatrace.sendBizEvent(type, new JSONObject(toHashMap(attributes)));
291
270
  }
292
271
  }
293
272
 
294
- @ReactMethod
295
273
  public void setGPSLocation(double latitude, double longitude, String platform){
296
274
  if(this.shouldWorkOnAndroid(platform)){
297
275
  Location location = new Location("");
@@ -301,35 +279,30 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
301
279
  }
302
280
  }
303
281
 
304
- @ReactMethod
305
282
  public void flushEvents(String platform){
306
283
  if(this.shouldWorkOnAndroid(platform)){
307
284
  Dynatrace.flushEvents();
308
285
  }
309
286
  }
310
287
 
311
- @ReactMethod
312
288
  public void isCrashReportingOptedIn(String platform, Promise promise){
313
289
  if(this.shouldWorkOnAndroid(platform)){
314
290
  promise.resolve(Dynatrace.isCrashReportingOptedIn());
315
291
  }
316
292
  }
317
293
 
318
- @ReactMethod
319
294
  public void setCrashReportingOptedIn(boolean crashReporting, String platform){
320
295
  if(this.shouldWorkOnAndroid(platform)){
321
296
  Dynatrace.setCrashReportingOptedIn(crashReporting);
322
297
  }
323
298
  }
324
299
 
325
- @ReactMethod
326
300
  public void setDataCollectionLevel(String collectionLevel, String platform){
327
301
  if(this.shouldWorkOnAndroid(platform)){
328
302
  Dynatrace.setDataCollectionLevel(DataCollectionLevel.valueOf(collectionLevel));
329
303
  }
330
304
  }
331
305
 
332
- @ReactMethod
333
306
  public void getDataCollectionLevel(String platform, Promise promise){
334
307
  if(this.shouldWorkOnAndroid(platform)){
335
308
  DataCollectionLevel level = Dynatrace.getDataCollectionLevel();
@@ -337,7 +310,6 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
337
310
  }
338
311
  }
339
312
 
340
- @ReactMethod
341
313
  public void setBeaconHeaders(ReadableMap headers, String platform){
342
314
  if(this.shouldWorkOnAndroid(platform)){
343
315
  if (headers == null) {
@@ -354,7 +326,6 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
354
326
  }
355
327
  }
356
328
 
357
- @ReactMethod
358
329
  public void applyUserPrivacyOptions(ReadableMap userPrivacyOptions, String platform){
359
330
  if(this.shouldWorkOnAndroid(platform)){
360
331
  UserPrivacyOptions.Builder optionsBuilder = UserPrivacyOptions.builder();
@@ -367,12 +338,11 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
367
338
  }
368
339
  }
369
340
 
370
- @ReactMethod
371
341
  public void getUserPrivacyOptions(String platform, Promise promise){
372
342
  if(this.shouldWorkOnAndroid(platform)){
373
343
  UserPrivacyOptions options = Dynatrace.getUserPrivacyOptions();
374
344
  WritableMap privacyMap = Arguments.createMap();
375
- privacyMap.putString("dataCollectionLevel", String.valueOf(options.getDataCollectionLevel()));
345
+ privacyMap.putString("dataCollectionLevel", options.getDataCollectionLevel().name());
376
346
  privacyMap.putBoolean("crashReportingOptedIn", options.isCrashReportingOptedIn());
377
347
  promise.resolve(privacyMap);
378
348
  }
@@ -1,27 +1,45 @@
1
1
  package com.dynatrace.android.agent;
2
2
 
3
- import com.facebook.react.ReactPackage;
4
- import com.facebook.react.bridge.JavaScriptModule;
3
+ import androidx.annotation.Nullable;
4
+ import com.facebook.react.TurboReactPackage;
5
5
  import com.facebook.react.bridge.NativeModule;
6
6
  import com.facebook.react.bridge.ReactApplicationContext;
7
- import com.facebook.react.uimanager.ViewManager;
7
+ import com.facebook.react.module.model.ReactModuleInfo;
8
+ import com.facebook.react.module.model.ReactModuleInfoProvider;
8
9
 
9
- import java.util.Arrays;
10
- import java.util.Collections;
11
- import java.util.List;
10
+ import java.util.HashMap;
11
+ import java.util.Map;
12
12
 
13
- public class DynatraceReactPackage implements ReactPackage {
13
+ public class DynatraceReactPackage extends TurboReactPackage {
14
14
 
15
15
  @Override
16
- public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
17
- return Collections.emptyList();
16
+ public ReactModuleInfoProvider getReactModuleInfoProvider() {
17
+ return () -> {
18
+ final Map<String, ReactModuleInfo> moduleInfos = new HashMap<>();
19
+ boolean isTurboModule = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
20
+ moduleInfos.put(
21
+ DynatraceRNBridgeImpl.NAME,
22
+ new ReactModuleInfo(
23
+ DynatraceRNBridgeImpl.NAME,
24
+ DynatraceRNBridgeImpl.NAME,
25
+ false, // canOverrideExistingModule
26
+ false, // needsEagerInit
27
+ true, // hasConstants
28
+ false, // isCxxModule
29
+ isTurboModule // isTurboModule
30
+ ));
31
+ return moduleInfos;
32
+ };
18
33
  }
19
34
 
35
+ @Nullable
20
36
  @Override
21
- public List<NativeModule> createNativeModules(
22
- ReactApplicationContext reactContext) {
23
- PrivateDTBridge bridge = new PrivateDTBridge(reactContext);
24
- return Arrays.<NativeModule>asList(new DynatraceRNBridge(reactContext, bridge), bridge);
37
+ public NativeModule getModule(String name, ReactApplicationContext reactContext) {
38
+ if (name.equals(DynatraceRNBridgeImpl.NAME)) {
39
+ return new DynatraceRNBridge(reactContext, new PrivateDTBridge(reactContext));
40
+ } else {
41
+ return null;
42
+ }
25
43
  }
26
44
 
27
45
  }
@@ -0,0 +1,187 @@
1
+ package com.dynatrace.android.agent;
2
+
3
+ import com.facebook.react.bridge.Promise;
4
+ import com.facebook.react.bridge.ReadableMap;
5
+ import com.facebook.react.bridge.ReactApplicationContext;
6
+
7
+ import java.util.Map;
8
+
9
+ public class DynatraceRNBridge extends NativeDynatraceBridgeSpec {
10
+
11
+ private final DynatraceRNBridgeImpl impl;
12
+
13
+ public DynatraceRNBridge(ReactApplicationContext reactContext, PrivateDTBridge internal) {
14
+ super(reactContext);
15
+ this.impl = new DynatraceRNBridgeImpl(reactContext, internal);
16
+ }
17
+
18
+ @Override
19
+ public String getName(){
20
+ return DynatraceRNBridgeImpl.NAME;
21
+ }
22
+
23
+ @Override
24
+ public Map<String, Object> getTypedExportedConstants() {
25
+ return this.impl.getConstants();
26
+ }
27
+
28
+ @Override
29
+ public void start(ReadableMap configuration, Promise promise) {
30
+ this.impl.start(configuration, promise);
31
+ }
32
+
33
+ @Override
34
+ public void enterAction(String name, String key, String platform) {
35
+ this.impl.enterAction(name, key, platform);
36
+ }
37
+
38
+ @Override
39
+ public void enterManualAction(String name, String key, String platform) {
40
+ this.impl.enterManualAction(name, key, platform);
41
+ }
42
+
43
+ @Override
44
+ public void enterManualActionWithParent(String name, String key, String parentKey, String platform) {
45
+ this.impl.enterManualActionWithParent(name, key, parentKey, platform);
46
+ }
47
+
48
+ @Override
49
+ public void leaveAction(String key, boolean leave, String platform) {
50
+ this.impl.leaveAction(key, leave, platform);
51
+ }
52
+
53
+ @Override
54
+ public void cancelAction(String key, String platform) {
55
+ this.impl.cancelAction(key, platform);
56
+ }
57
+
58
+ @Override
59
+ public void endVisit(String platform) {
60
+ this.impl.endVisit(platform);
61
+ }
62
+
63
+ @Override
64
+ public void reportErrorWithoutStacktrace(String errorName, double errorCode, String platform) {
65
+ this.impl.reportErrorWithoutStacktrace(errorName, (int) errorCode, platform);
66
+ }
67
+
68
+ @Override
69
+ public void reportError(String errorName, String errorValue, String reason, String stacktrace, String platform){
70
+ this.impl.reportError(errorName, errorValue, reason, stacktrace, platform);
71
+ }
72
+
73
+ @Override
74
+ public void reportCrash(String errorName, String reason, String stacktrace, boolean isRealError, boolean newSession, String platform){
75
+ this.impl.reportCrash(errorName, reason, stacktrace, isRealError, newSession, platform);
76
+ }
77
+
78
+ @Override
79
+ public void storeCrash(String errorName, String reason, String stacktrace, String platform){
80
+ // Empty on Purpose
81
+ }
82
+
83
+ @Override
84
+ public void reportErrorInAction(String key, String errorName, double errorCode, String platform) {
85
+ this.impl.reportErrorInAction(key, errorName, (int) errorCode, platform);
86
+ }
87
+
88
+ @Override
89
+ public void reportValue(String key, String valueName, String value, String platform) {
90
+ this.impl.reportValue(key, valueName, value, platform);
91
+ }
92
+
93
+ @Override
94
+ public void getRequestTag(String key, String url, Promise promise){
95
+ this.impl.getRequestTag(key, url, promise);
96
+ }
97
+
98
+ @Override
99
+ public void startWebRequestTiming(String requestTag, String url) {
100
+ this.impl.startWebRequestTiming(requestTag, url);
101
+ }
102
+
103
+ @Override
104
+ public void stopWebRequestTiming(String requestTag, String url, double responseCode, String responseMessage) {
105
+ this.impl.stopWebRequestTiming(requestTag, url, (int) responseCode, responseMessage);
106
+ }
107
+
108
+ @Override
109
+ public void identifyUser(String user, String platform) {
110
+ this.impl.identifyUser(user, platform);
111
+ }
112
+
113
+ @Override
114
+ public void reportEventInAction(String actionKey, String name, String platform) {
115
+ this.impl.reportEventInAction(actionKey, name, platform);
116
+ }
117
+
118
+ @Override
119
+ public void reportStringValueInAction(String actionKey, String name, String value, String platform) {
120
+ this.impl.reportStringValueInAction(actionKey, name, value, platform);
121
+ }
122
+
123
+ @Override
124
+ public void reportIntValueInAction(String actionKey, String name, double value, String platform) {
125
+ this.impl.reportIntValueInAction(actionKey, name, (int) value, platform);
126
+ }
127
+
128
+ @Override
129
+ public void reportDoubleValueInAction(String actionKey, String name, double value, String platform) {
130
+ this.impl.reportDoubleValueInAction(actionKey, name, value, platform);
131
+ }
132
+
133
+ @Override
134
+ public void sendEvent(String name, ReadableMap attributes, String platform) {
135
+ this.impl.sendEvent(name, attributes, platform);
136
+ }
137
+
138
+ @Override
139
+ public void sendBizEvent(String type, ReadableMap attributes, String platform) {
140
+ this.impl.sendBizEvent(type, attributes, platform);
141
+ }
142
+
143
+ @Override
144
+ public void setGPSLocation(double latitude, double longitude, String platform){
145
+ this.impl.setGPSLocation(latitude, longitude, platform);
146
+ }
147
+
148
+ @Override
149
+ public void flushEvents(String platform){
150
+ this.impl.flushEvents(platform);
151
+ }
152
+
153
+ @Override
154
+ public void isCrashReportingOptedIn(String platform, Promise promise){
155
+ this.impl.isCrashReportingOptedIn(platform, promise);
156
+ }
157
+
158
+ @Override
159
+ public void setCrashReportingOptedIn(boolean crashReporting, String platform){
160
+ this.impl.setCrashReportingOptedIn(crashReporting, platform);
161
+ }
162
+
163
+ @Override
164
+ public void setDataCollectionLevel(String collectionLevel, String platform){
165
+ this.impl.setDataCollectionLevel(collectionLevel, platform);
166
+ }
167
+
168
+ @Override
169
+ public void getDataCollectionLevel(String platform, Promise promise){
170
+ this.impl.getDataCollectionLevel(platform, promise);
171
+ }
172
+
173
+ @Override
174
+ public void setBeaconHeaders(ReadableMap headers, String platform){
175
+ this.impl.setBeaconHeaders(headers, platform);
176
+ }
177
+
178
+ @Override
179
+ public void applyUserPrivacyOptions(ReadableMap userPrivacyOptions, String platform){
180
+ this.impl.applyUserPrivacyOptions(userPrivacyOptions, platform);
181
+ }
182
+
183
+ @Override
184
+ public void getUserPrivacyOptions(String platform, Promise promise){
185
+ this.impl.getUserPrivacyOptions(platform, promise);
186
+ }
187
+ }