cordova-plugin-repro 6.8.0 → 6.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-plugin-repro",
3
- "version": "6.8.0",
3
+ "version": "6.9.0",
4
4
  "description": "Repro Cordova Plugin",
5
5
  "cordova": {
6
6
  "id": "cordova-plugin-repro",
package/plugin.xml CHANGED
@@ -1,6 +1,6 @@
1
1
  <?xml version='1.0' encoding='UTF-8'?>
2
2
 
3
- <plugin xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-repro" version="6.8.0" xmlns="http://apache.org/cordova/ns/plugins/1.0">
3
+ <plugin xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-repro" version="6.9.0" xmlns="http://apache.org/cordova/ns/plugins/1.0">
4
4
  <name>Repro</name>
5
5
  <description>Repro Cordova Plugin</description>
6
6
  <license>Commercial</license>
@@ -75,3 +75,4 @@
75
75
 
76
76
 
77
77
 
78
+
@@ -1,5 +1,5 @@
1
1
  {
2
- "ios-sdk": "5.8.1",
3
- "android-sdk": "5.6.2",
4
- "bridge": "6.8.0"
2
+ "ios-sdk": "5.8.3",
3
+ "android-sdk": "5.6.3",
4
+ "bridge": "6.9.0"
5
5
  }
@@ -1,11 +1,14 @@
1
1
  package io.repro.cordova;
2
2
 
3
+ import android.app.AppOpsManager;
3
4
  import android.content.Context;
4
5
  import android.graphics.Point;
5
6
  import android.graphics.Rect;
6
7
  import android.view.Display;
7
8
  import android.view.WindowManager;
8
9
 
10
+ import java.lang.reflect.Field;
11
+ import java.lang.reflect.Method;
9
12
  import java.text.SimpleDateFormat;
10
13
  import java.util.EnumSet;
11
14
  import java.util.Date;
@@ -20,6 +23,8 @@ import java.util.TimeZone;
20
23
  import org.apache.cordova.CallbackContext;
21
24
  import org.apache.cordova.CordovaArgs;
22
25
 
26
+ import org.apache.cordova.CordovaWebView;
27
+ import org.apache.cordova.LOG;
23
28
  import org.json.JSONArray;
24
29
  import org.json.JSONException;
25
30
  import org.json.JSONObject;
@@ -35,6 +40,8 @@ import io.repro.android.newsfeed.NewsFeedCampaignType;
35
40
  */
36
41
  public final class CordovaPlugin extends org.apache.cordova.CordovaPlugin {
37
42
 
43
+ private static final String REPRO_CORDOVA_BRIDGE_VERSION = "6.9.0";
44
+
38
45
  private static SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.US);
39
46
 
40
47
  static {
@@ -152,6 +159,28 @@ public final class CordovaPlugin extends org.apache.cordova.CordovaPlugin {
152
159
  return false;
153
160
  }
154
161
 
162
+ private void passPlatformValues() {
163
+ final Map<String, Object> platformValues = new HashMap<>();
164
+ platformValues.put("sub_sdk_platform", "cordova");
165
+ platformValues.put("sub_sdk_bridge_version", REPRO_CORDOVA_BRIDGE_VERSION);
166
+
167
+ try {
168
+ Class cordovaKlass = Class.forName("org.apache.cordova.CordovaWebView");
169
+ Field verField = cordovaKlass.getDeclaredField("CORDOVA_VERSION");
170
+ platformValues.put("sub_sdk_platform_version", (String)verField.get(null)); // null because static field
171
+ } catch (Throwable t) {
172
+ t.printStackTrace();
173
+ }
174
+
175
+ try {
176
+ Method method = Repro.class.getDeclaredMethod("_passRuntimeValues", Map.class);
177
+ method.setAccessible(true);
178
+ method.invoke(null, platformValues);
179
+ } catch (Throwable t) {
180
+ t.printStackTrace();
181
+ }
182
+ }
183
+
155
184
  // API implementation
156
185
  // CordovaArgs: https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaArgs.java
157
186
 
@@ -160,6 +189,7 @@ public final class CordovaPlugin extends org.apache.cordova.CordovaPlugin {
160
189
 
161
190
  callAPI(new API(callbackContext) {
162
191
  Void api() {
192
+ passPlatformValues();
163
193
  CordovaBridge.startSession(token);
164
194
  return null;
165
195
  }
Binary file
@@ -7,6 +7,8 @@
7
7
 
8
8
  #import <Cordova/CDV.h>
9
9
 
10
+ #define REPRO_CORDOVA_BRIDGE_VERSION "6.9.0"
11
+
10
12
  @interface CDVRepro : CDVPlugin
11
13
 
12
14
  @end
@@ -13,12 +13,38 @@
13
13
  #import "CDVRepro.h"
14
14
  #import "CDVReproEventPropertiesFactory.h"
15
15
 
16
+
17
+ #if __has_include(<Cordova/CDVAvailability.h>)
18
+ #import <Cordova/CDVAvailability.h>
19
+ #elif __has_include("CDVAvailability.h")
20
+ #import "CDVAvailability.h"
21
+ #elif __has_include("Cordova/CDVAvailability.h")
22
+ #import "Cordova/CDVAvailability.h"
23
+ #endif
24
+
25
+
16
26
  #define isNSNumber(OBJECT) ([OBJECT isKindOfClass:NSNumber.class])
17
27
 
28
+
29
+ @interface Repro (NonPublicApi)
30
+ + (void)_passRuntimeValues:(nonnull NSDictionary<NSString *, NSString *> *)values;
31
+ @end
32
+
33
+
18
34
  @implementation CDVRepro
19
35
 
20
36
  - (void)setup:(CDVInvokedUrlCommand*)command
21
37
  {
38
+ if ([Repro respondsToSelector:@selector(_passRuntimeValues:)]) {
39
+ [Repro _passRuntimeValues:@{
40
+ @"sub_sdk_platform": @"cordova",
41
+ #ifdef CDV_VERSION
42
+ @"sub_sdk_platform_version": CDV_VERSION,
43
+ #endif
44
+ @"sub_sdk_bridge_version": [NSString stringWithUTF8String:REPRO_CORDOVA_BRIDGE_VERSION],
45
+ }];
46
+ }
47
+
22
48
  NSString *key = [command.arguments objectAtIndex:0];
23
49
  [Repro setup:key];
24
50
  }