leap-capacitor 2.0.7 → 2.0.8

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.
@@ -15,5 +15,5 @@ Pod::Spec.new do |s|
15
15
  s.dependency 'Capacitor'
16
16
  s.swift_version = '5.1'
17
17
 
18
- s.dependency "LeapSDK", "2.0.6"
18
+ s.dependency "LeapSDK", "2.0.7"
19
19
  end
package/README.md CHANGED
@@ -14,7 +14,7 @@ npx cap sync
14
14
  <docgen-index>
15
15
 
16
16
  * [`start(...)`](#start)
17
- * [`startWithSelfHostedURL(...)`](#startwithselfhostedurl)
17
+ * [`startWithSelfHostingEnabled(...)`](#startwithselfhostingenabled)
18
18
  * [`flushProperties(...)`](#flushproperties)
19
19
  * [`setUniqueUserId(...)`](#setuniqueuserid)
20
20
  * [`startProject(...)`](#startproject)
@@ -45,15 +45,15 @@ start(options: { apiKey: string; }) => Promise<void>
45
45
  --------------------
46
46
 
47
47
 
48
- ### startWithSelfHostedURL(...)
48
+ ### startWithSelfHostingEnabled(...)
49
49
 
50
50
  ```typescript
51
- startWithSelfHostedURL(options: { baseURL: string; }) => Promise<void>
51
+ startWithSelfHostingEnabled(options: { apiKey: string; baseUrl: string; }) => Promise<void>
52
52
  ```
53
53
 
54
- | Param | Type |
55
- | ------------- | --------------------------------- |
56
- | **`options`** | <code>{ baseURL: string; }</code> |
54
+ | Param | Type |
55
+ | ------------- | ------------------------------------------------- |
56
+ | **`options`** | <code>{ apiKey: string; baseUrl: string; }</code> |
57
57
 
58
58
  --------------------
59
59
 
@@ -52,7 +52,7 @@ repositories {
52
52
  dependencies {
53
53
  implementation fileTree(dir: 'libs', include: ['*.jar'])
54
54
  implementation project(':capacitor-android')
55
- implementation 'is.leap.android:sdk:2.0.9'
55
+ implementation 'is.leap.android:sdk:2.0.10'
56
56
  implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
57
57
  testImplementation "junit:junit:$junitVersion"
58
58
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
@@ -43,7 +43,7 @@ import is.leap.android.core.LeapElementActionCallbacks;
43
43
  public class LeapPlugin extends Plugin {
44
44
 
45
45
  public static final String API_KEY = "apiKey";
46
- public static final String SELF_HOSTING_BASE_URL = "baseURL";
46
+ public static final String SELF_HOSTING_BASE_URL = "baseUrl";
47
47
  public static final String PROPERTIES = "properties";
48
48
  public static final String DATE_TYPE_PREFIX = "Date:";
49
49
  public static final String PROJECT_IDS = "projectIds";
@@ -73,77 +73,15 @@ public class LeapPlugin extends Plugin {
73
73
  }
74
74
 
75
75
  @PluginMethod
76
- public void startWithSelfHostedURL(PluginCall call) {
76
+ public void startWithSelfHostingEnabled(PluginCall call) {
77
+ String apiKey = call.getString(API_KEY);
77
78
  String baseURL = call.getString(SELF_HOSTING_BASE_URL);
78
79
  Leap.withSelfHostedBuilder()
79
80
  .setBaseUrl(baseURL)
80
- .start();
81
+ .start(apiKey);
81
82
  call.resolve();
82
83
  }
83
84
 
84
- // @PluginMethod
85
- // public void startWithSelfHostedURLAndProperties(PluginCall call) {
86
- // String baseURL = call.getString(SELF_HOSTING_BASE_URL);
87
- // JSObject propsObj = call.getObject(PROPERTIES);
88
- // Leap.Builder builder = Leap.withSelfHostedBuilder()
89
- // .setBaseUrl(baseURL);
90
- //
91
- // if(propsObj == null) {
92
- // builder.start();
93
- // call.resolve();
94
- // return;
95
- // }
96
- //
97
- // startWithProperties(propsObj, builder);
98
- // call.resolve();
99
- // }
100
-
101
-
102
-
103
- // @PluginMethod
104
- // public void startWithProperties(PluginCall call) {
105
- // String apiKey = call.getString(API_KEY);
106
- // JSObject propsObj = call.getObject(PROPERTIES);
107
- // if(propsObj == null) {
108
- // Leap.start(apiKey);
109
- // call.resolve();
110
- // return;
111
- // }
112
- // Leap.Builder leapBuilder = Leap.withBuilder(apiKey);
113
- // startWithProperties(propsObj, leapBuilder);
114
- // call.resolve();
115
- // }
116
-
117
- // private void startWithProperties(JSObject propsObj, Leap.Builder leapBuilder) {
118
- // Iterator<String> iterator = propsObj.keys();
119
- //
120
- // while (iterator.hasNext()) {
121
- // String key = iterator.next();
122
- // Object propValue = null;
123
- // try {
124
- // propValue = propsObj.get(key);
125
- // } catch (JSONException e) {
126
- //
127
- // }
128
- // if(propValue instanceof String) {
129
- // String valueStr = (String) propValue;
130
- // if (valueStr.startsWith(DATE_TYPE_PREFIX)) {
131
- // String[] split = valueStr.split(DATE_TYPE_PREFIX);
132
- // if (split.length != 2) continue;
133
- // String dateValue = split[1];
134
- // Date date = getDate(dateValue);
135
- // if(date != null) leapBuilder.addProperty(key, date);
136
- // continue;
137
- // }
138
- // leapBuilder.addProperty(key, String.valueOf(propValue));
139
- // } else if (propValue instanceof Number) {
140
- // leapBuilder.addProperty(key, (long) propValue);
141
- // }
142
- //
143
- // }
144
- // leapBuilder.start();
145
- // }
146
-
147
85
  @PluginMethod
148
86
  public void flushProperties(PluginCall call) {
149
87
  JSObject propsObj = call.getObject(PROPERTIES);
package/dist/docs.json CHANGED
@@ -22,20 +22,20 @@
22
22
  "slug": "start"
23
23
  },
24
24
  {
25
- "name": "startWithSelfHostedURL",
26
- "signature": "(options: { baseURL: string; }) => Promise<void>",
25
+ "name": "startWithSelfHostingEnabled",
26
+ "signature": "(options: { apiKey: string; baseUrl: string; }) => Promise<void>",
27
27
  "parameters": [
28
28
  {
29
29
  "name": "options",
30
30
  "docs": "",
31
- "type": "{ baseURL: string; }"
31
+ "type": "{ apiKey: string; baseUrl: string; }"
32
32
  }
33
33
  ],
34
34
  "returns": "Promise<void>",
35
35
  "tags": [],
36
36
  "docs": "",
37
37
  "complexTypes": [],
38
- "slug": "startwithselfhostedurl"
38
+ "slug": "startwithselfhostingenabled"
39
39
  },
40
40
  {
41
41
  "name": "flushProperties",
@@ -12,8 +12,9 @@ export interface LeapPluginInterface {
12
12
  start(options: {
13
13
  apiKey: string;
14
14
  }): Promise<void>;
15
- startWithSelfHostedURL(options: {
16
- baseURL: string;
15
+ startWithSelfHostingEnabled(options: {
16
+ apiKey: string;
17
+ baseUrl: string;
17
18
  }): Promise<void>;
18
19
  flushProperties(options: {
19
20
  properties: UserProperty;
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["\nimport type { PluginListenerHandle } from '@capacitor/core';\n\nexport interface UserProperty {\n [key: string]: string | number\n}\n\nexport interface LeapCallbacks {\n [key: string]: string\n}\n\nexport interface LeapElementActionCallbacks {\n [key: string]: any\n}\n\nexport interface LeapPluginInterface {\n start(options: { apiKey: string }): Promise<void>;\n // startWithProperties(options: { apiKey: string, properties: UserProperty }): Promise<void>;\n startWithSelfHostedURL(options:{baseURL: string}):Promise<void>;\n // startWithSelfHostedURLAndProperties(options:{baseURL:string, properties: UserProperty}):Promise<void>;\n flushProperties(options: { properties: UserProperty }): Promise<void>;\n setUniqueUserId(options: { uniqueUserId: string }): Promise<void>;\n startProject(options: { projectId: string, resetProject?: boolean }): Promise<void>;\n embedProject(options: { projectId: string }): Promise<void>;\n offlineSync(options: { projectIds: Array<string> }): Promise<void>;\n disable(): Promise<void>;\n logout(): Promise<void>;\n setAppLocale(options: {localeCode: string}): Promise<void>;\n\n addListener(\n eventName: 'leapCallbacks',\n listenerFunc: (event: LeapCallbacks) => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle\n\n addListener(\n eventName: 'leapElementActionCallbacks',\n listenerFunc: (event: LeapElementActionCallbacks) => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle\n\n\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["\nimport type { PluginListenerHandle } from '@capacitor/core';\n\nexport interface UserProperty {\n [key: string]: string | number\n}\n\nexport interface LeapCallbacks {\n [key: string]: string\n}\n\nexport interface LeapElementActionCallbacks {\n [key: string]: any\n}\n\nexport interface LeapPluginInterface {\n start(options: { apiKey: string }): Promise<void>;\n startWithSelfHostingEnabled(options:{apiKey: string,baseUrl: string}):Promise<void>;\n flushProperties(options: { properties: UserProperty }): Promise<void>;\n setUniqueUserId(options: { uniqueUserId: string }): Promise<void>;\n startProject(options: { projectId: string, resetProject?: boolean }): Promise<void>;\n embedProject(options: { projectId: string }): Promise<void>;\n offlineSync(options: { projectIds: Array<string> }): Promise<void>;\n disable(): Promise<void>;\n logout(): Promise<void>;\n setAppLocale(options: {localeCode: string}): Promise<void>;\n\n addListener(\n eventName: 'leapCallbacks',\n listenerFunc: (event: LeapCallbacks) => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle\n\n addListener(\n eventName: 'leapElementActionCallbacks',\n listenerFunc: (event: LeapElementActionCallbacks) => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle\n\n\n}\n"]}
@@ -5,9 +5,7 @@
5
5
  // each method the plugin supports using the CAP_PLUGIN_METHOD macro.
6
6
  CAP_PLUGIN(LeapPlugin, "LeapPlugin",
7
7
  CAP_PLUGIN_METHOD(start, CAPPluginReturnPromise);
8
- CAP_PLUGIN_METHOD(startWithProperties, CAPPluginReturnPromise);
9
- CAP_PLUGIN_METHOD(startWithSelfHostedURL, CAPPluginReturnPromise);
10
- CAP_PLUGIN_METHOD(startWithSelfHostedURLAndProperties, CAPPluginReturnPromise);
8
+ CAP_PLUGIN_METHOD(startWithSelfHostingEnabled, CAPPluginReturnPromise);
11
9
  CAP_PLUGIN_METHOD(flushProperties, CAPPluginReturnPromise);
12
10
  CAP_PLUGIN_METHOD(startProject, CAPPluginReturnPromise);
13
11
  CAP_PLUGIN_METHOD(embedProject, CAPPluginReturnPromise);
@@ -5,7 +5,7 @@ import LeapSDK
5
5
  let API_KEY = "apiKey"
6
6
  let PROPERTIES = "properties"
7
7
  let DATE_PREFIX = "Date:"
8
- let BASE_URL = "baseURL"
8
+ let BASE_URL = "baseUrl"
9
9
  let UNIQUE_USER_ID = "uniqueUserId"
10
10
  let LOCALE_CODE = "localeCode"
11
11
  let PROJECT_ID = "projectId"
@@ -32,38 +32,16 @@ public class LeapPlugin: CAPPlugin {
32
32
  call.resolve()
33
33
  }
34
34
 
35
- @objc public func startWithProperties(_ call: CAPPluginCall) {
36
- let apiKey = call.getString(API_KEY) ?? ""
37
- let properties:[String:AnyHashable] = call.getObject(PROPERTIES) as? [String:AnyHashable] ?? [:]
38
- DispatchQueue.main.async {[weak self] in
39
- let leapShared = Leap.shared.withBuilder(apiKey)
40
- self?.addProperties(properties: properties)
41
- leapShared?.start()
42
- }
43
- call.resolve()
44
- }
45
-
46
- @objc public func startWithSelfHostedURL(_ call:CAPPluginCall) {
47
- if let baseUrl = call.getString(BASE_URL) {
35
+ @objc public func startWithSelfHostingEnabled(_ call:CAPPluginCall) {
36
+ if let apiKey = call.getString(API_KEY),
37
+ let baseUrl = call.getString(BASE_URL) {
48
38
  DispatchQueue.main.async {
49
- Leap.shared.withSelfHostedBuilder()?.setBaseUrl(baseUrl)?.start()
39
+ Leap.shared.withSelfHostedBuilder()?.setBaseUrl(baseUrl)?.start(apiKey)
50
40
  }
51
41
  }
52
42
  call.resolve()
53
43
  }
54
-
55
- @objc public func startWithSelfHostedURLAndProperties(_ call:CAPPluginCall) {
56
- if let baseUrl = call.getString(BASE_URL) {
57
- let properties = call.getObject(PROPERTIES) as? [String:AnyHashable] ?? [:]
58
- DispatchQueue.main.async {[weak self] in
59
- Leap.shared.withSelfHostedBuilder()?.setBaseUrl(baseUrl)
60
- self?.addProperties(properties: properties)
61
- Leap.shared.start()
62
- }
63
- }
64
- call.resolve()
65
- }
66
-
44
+
67
45
  @objc public func flushProperties(_ call: CAPPluginCall) {
68
46
  let properties:[String:AnyHashable] = call.getObject(PROPERTIES) as? [String:AnyHashable] ?? [:]
69
47
  DispatchQueue.main.async {[weak self] in
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leap-capacitor",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "Plugin for Leap",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",