@grouplinknetwork/group-link-ionic-plugin 1.0.3 → 1.0.4

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.
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "GroupLinkPlugin",
3
+ "ios": {
4
+ "type": "spm"
5
+ }
6
+ }
package/Package.swift ADDED
@@ -0,0 +1,28 @@
1
+ // swift-tools-version: 5.9
2
+ import PackageDescription
3
+
4
+ let package = Package(
5
+ name: "GrouplinknetworkGroupLinkIonicPlugin",
6
+ platforms: [.iOS(.v13)],
7
+ products: [
8
+ .library(
9
+ name: "GrouplinknetworkGroupLinkIonicPlugin",
10
+ targets: ["GroupLinkPlugin"])
11
+ ],
12
+ dependencies: [
13
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", branch: "main"),
14
+ .package(url: "https://github.com/Group-Link-Mobile/grouplink-package.git", branch: "main")
15
+ ],
16
+ targets: [
17
+ .target(
18
+ name: "GroupLinkPlugin",
19
+ dependencies: [
20
+ .product(name: "Capacitor", package: "capacitor-swift-pm"),
21
+ .product(name: "Cordova", package: "capacitor-swift-pm"),
22
+ .product(name: "GroupLink", package: "grouplink-package")
23
+ ],
24
+ path: "ios/Plugin",
25
+ exclude: ["Info.plist"],
26
+ sources: ["GroupLinkPlugin.swift"])
27
+ ]
28
+ )
package/README.md CHANGED
@@ -6,9 +6,28 @@ plugin for implementing the company's native sdk group link
6
6
 
7
7
  ```bash
8
8
  npm install group-link
9
+ npm run build
9
10
  npx cap sync
10
11
  ```
11
12
 
13
+ ### Android
14
+ ```bash
15
+ npx cap open android
16
+ ```
17
+
18
+ ### iOS
19
+ ```bash
20
+ npx cap open ios
21
+ ```
22
+
23
+ ## Publish
24
+
25
+ ```bash
26
+ npm run prebuild
27
+ npm run build
28
+ # npm publish
29
+ ```
30
+
12
31
  ## API
13
32
 
14
33
  Access:
@@ -3,6 +3,7 @@ package com.grouplink.plugin;
3
3
  import android.Manifest;
4
4
  import android.content.Context;
5
5
 
6
+ import com.andriod.BuildConfig;
6
7
  import com.getcapacitor.JSObject;
7
8
  import com.getcapacitor.PermissionState;
8
9
  import com.getcapacitor.Plugin;
@@ -13,111 +14,161 @@ import com.getcapacitor.annotation.Permission;
13
14
  import com.getcapacitor.annotation.PermissionCallback;
14
15
  import com.grouplinknetwork.GroupLink;
15
16
 
17
+ import android.util.Log;
18
+
19
+ import java.io.OutputStream;
20
+ import java.io.OutputStreamWriter;
21
+ import java.util.Arrays;
22
+
16
23
  @CapacitorPlugin(
17
- name = "GroupLinkPlugin",
18
- permissions = {
19
- @Permission(
20
- alias = "bluetooth",
21
- strings = {
22
- Manifest.permission.BLUETOOTH_CONNECT,
23
- Manifest.permission.BLUETOOTH_ADVERTISE,
24
- Manifest.permission.BLUETOOTH_SCAN,
25
- Manifest.permission.BLUETOOTH_ADMIN
26
- }
27
- ),
28
- @Permission(
29
- alias = "foreground_service",
30
- strings = {
31
- Manifest.permission.FOREGROUND_SERVICE
32
- }
33
- ),
34
- @Permission(
35
- alias = "location",
36
- strings = {
37
- Manifest.permission.ACCESS_COARSE_LOCATION,
38
- Manifest.permission.ACCESS_FINE_LOCATION,
39
- }
40
- ),
41
- @Permission(
42
- alias = "wifi_state",
43
- strings = {
44
- Manifest.permission.ACCESS_WIFI_STATE
45
- }
46
- ),
47
- @Permission(
48
- alias = "notification",
49
- strings = {
50
- "android.permission.POST_NOTIFICATIONS"
51
- }
52
- )
53
- }
24
+ name = "GroupLinkPlugin",
25
+ permissions = {
26
+ @Permission(
27
+ alias = "bluetooth",
28
+ strings = {
29
+ Manifest.permission.BLUETOOTH_CONNECT,
30
+ Manifest.permission.BLUETOOTH_ADVERTISE,
31
+ Manifest.permission.BLUETOOTH_SCAN,
32
+ Manifest.permission.BLUETOOTH_ADMIN
33
+ }
34
+ ),
35
+ @Permission(
36
+ alias = "foreground_service",
37
+ strings = {
38
+ Manifest.permission.FOREGROUND_SERVICE
39
+ }
40
+ ),
41
+ @Permission(
42
+ alias = "location",
43
+ strings = {
44
+ Manifest.permission.ACCESS_COARSE_LOCATION,
45
+ Manifest.permission.ACCESS_FINE_LOCATION,}
46
+ ),
47
+ @Permission(
48
+ alias = "wifi_state",
49
+ strings = {
50
+ Manifest.permission.ACCESS_WIFI_STATE
51
+ }
52
+ ),
53
+ @Permission(
54
+ alias = "notification",
55
+ strings = {
56
+ "android.permission.POST_NOTIFICATIONS"
57
+ }
58
+ )
59
+ }
54
60
  )
55
61
  public class GroupLinkPlugin extends Plugin {
56
62
 
57
- @PluginMethod()
58
- public void setAndroidNotificationResId(PluginCall call){
59
- Context context = this.getActivity().getApplicationContext();
60
- int notificationResId = call.getInt("notificationResId");
61
-
62
- GroupLink.setNotificationResId(context, notificationResId);
63
- call.resolve();
64
- }
65
-
66
- @PluginMethod()
67
- public void setAndroidFirebaseToken(PluginCall call){
68
- Context context = this.getActivity().getApplicationContext();
69
- String token = call.getString("firebaseToken");
70
-
71
- GroupLink.setFirebaseToken(context, token);
72
- call.resolve();
73
- }
74
-
75
- @PluginMethod()
76
- public void getAndroidUserId(PluginCall call){
77
- Context context = this.getActivity().getApplicationContext();
78
- String userId = GroupLink.getUserId(context);
79
-
80
- JSObject jsonObject = new JSObject();
81
- jsonObject.put("userId", userId);
82
- call.resolve(jsonObject);
83
- }
84
-
85
- @PluginMethod()
86
- public void startAndroid(PluginCall call){
87
- Context context = this.getActivity().getApplicationContext();
88
- String token = call.getString("token");
89
- boolean isDebug = Boolean.TRUE.equals(call.getBoolean("isDebug"));
90
-
91
- GroupLink.register(context, token, isDebug);
92
- call.resolve();
93
- }
94
-
95
- @PluginMethod
96
- public void requestPermissions(PluginCall call){
97
- requestAllPermissions(call, "permissionCallback");
98
- }
99
-
100
- @PermissionCallback
101
- private void permissionCallback(PluginCall call){
102
- permissionIsGranted("bluetooth", call);
103
- permissionIsGranted("foreground_service", call);
104
- permissionIsGranted("location", call);
105
- permissionIsGranted("wifi_state", call);
106
- permissionIsGranted("notification", call);
107
- }
108
-
109
- @PluginMethod
110
- public void setAndroidNotificationName(PluginCall call){
111
- Context context = this.getActivity().getApplicationContext();
112
- String name = call.getString("name");
113
- GroupLink.setNotificationName(context, name);
114
- call.resolve();
115
- }
116
-
117
- private void permissionIsGranted(String alias, PluginCall call){
118
- if (getPermissionState(alias) == PermissionState.GRANTED){
119
- }else {
120
- call.reject("Permission denied");
63
+ @PluginMethod()
64
+ public void setAndroidNotificationResId(PluginCall call) {
65
+ try {
66
+ Context context = this.getActivity().getApplicationContext();
67
+ int notificationResId = call.getInt("notificationResId");
68
+
69
+ GroupLink.setNotificationResId(context, notificationResId);
70
+ call.resolve();
71
+ } catch (Exception error) {
72
+ handleError(error, call);
73
+ }
74
+ }
75
+
76
+ @PluginMethod()
77
+ public void setAndroidFirebaseToken(PluginCall call) {
78
+ try {
79
+ Context context = this.getActivity().getApplicationContext();
80
+ String token = call.getString("firebaseToken");
81
+
82
+ GroupLink.setFirebaseToken(context, token);
83
+ call.resolve();
84
+ } catch (Exception error) {
85
+ handleError(error, call);
86
+ }
87
+ }
88
+
89
+ @PluginMethod()
90
+ public void getAndroidUserId(PluginCall call) {
91
+ try {
92
+ Context context = this.getActivity().getApplicationContext();
93
+ String userId = GroupLink.getUserId(context);
94
+
95
+ JSObject jsonObject = new JSObject();
96
+ jsonObject.put("userId", userId);
97
+ call.resolve(jsonObject);
98
+ } catch (Exception error) {
99
+ handleError(error, call);
100
+ }
101
+ }
102
+
103
+ @PluginMethod()
104
+ public void startAndroid(PluginCall call) {
105
+ try {
106
+ Context context = this.getActivity().getApplicationContext();
107
+ String token = call.getString("token");
108
+ boolean isDebug = Boolean.TRUE.equals(call.getBoolean("isDebug"));
109
+
110
+ GroupLink.register(context, token, isDebug);
111
+ call.resolve();
112
+ } catch (Exception error) {
113
+ handleError(error, call);
114
+ }
115
+ }
116
+
117
+ @PluginMethod
118
+ public void requestPermissions(PluginCall call) {
119
+ try {
120
+ requestAllPermissions(call, "permissionCallback");
121
+ } catch (Exception error) {
122
+ handleError(error, call);
123
+ }
124
+ }
125
+
126
+ @PermissionCallback
127
+ private void permissionCallback(PluginCall call) {
128
+ permissionIsGranted("bluetooth", call);
129
+ permissionIsGranted("foreground_service", call);
130
+ permissionIsGranted("location", call);
131
+ permissionIsGranted("wifi_state", call);
132
+ permissionIsGranted("notification", call);
133
+ }
134
+
135
+ @PluginMethod
136
+ public void setAndroidNotificationName(PluginCall call) {
137
+ try {
138
+ Context context = this.getActivity().getApplicationContext();
139
+ String name = call.getString("name");
140
+ GroupLink.setNotificationName(context, name);
141
+ call.resolve();
142
+ } catch (Exception error) {
143
+ handleError(error, call);
144
+ }
145
+ }
146
+
147
+ private void permissionIsGranted(String alias, PluginCall call) {
148
+ try {
149
+ if (getPermissionState(alias) == PermissionState.GRANTED) {
150
+ } else {
151
+ call.reject("Permission denied");
152
+ }
153
+ } catch (Exception error) {
154
+ handleError(error, call);
155
+ }
156
+ }
157
+
158
+ private void handleError(Exception error, PluginCall call) {
159
+ Context context = this.getActivity().getApplicationContext();
160
+ java.io.StringWriter sw = new java.io.StringWriter();
161
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
162
+ error.printStackTrace(pw);
163
+
164
+ String stack = sw.toString();
165
+ String methodName = Thread.currentThread().getStackTrace()[3].getMethodName();
166
+ String sdkVersion = BuildConfig.VERSION_NAME;
167
+ String mm = GroupLink.getUserId(context);
168
+ String errorMessage = error.getMessage();
169
+ String message = String.format("\nGLError(%s) - mm: %s - %s - %s \n-> Stack Trace: %s", sdkVersion, mm, methodName, errorMessage, stack);
170
+
171
+ Log.e("GLError", message);
172
+ call.reject(message);
121
173
  }
122
- }
123
174
  }
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface GroupLinkPlugin {\n startAndroid(options: { token: string; isDebug: boolean }): void;\n setAndroidNotificationResId(options: { notificationResId: number }): void;\n setAndroidNotificationName(options: { name: string }): void;\n setAndroidFirebaseToken(options: { firebaseToken: string }): void;\n getAndroidUserId(): Promise<{ userId: string }>;\n requestPermissions(): void;\n // iOS Functions\n startiOS(options: { token: string }): void;\n setNotificationTokeniOS(options: { token: string }): void;\n setIOSNotificationName(options: { name: string }): void;\n startLocationiOS(): void;\n startBluetoothiOS(): void;\n checkBluetoothiOS(): void;\n startNotificationiOS(): void;\n getUserIDiOS(): Promise<{ userId: string }>;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface GroupLinkPlugin {\n startAndroid(options: { token: string; isDebug: boolean }): void;\n setAndroidNotificationResId(options: { notificationResId: number }): void;\n setAndroidNotificationName(options: { name: string }): void;\n setAndroidFirebaseToken(options: { firebaseToken: string }): void;\n getAndroidUserId(): Promise<{ userId: string }>;\n requestPermissions(): void;\n \n // iOS Functions\n startiOS(options: { token: string }): void;\n setNotificationTokeniOS(options: { token: string }): void;\n setIOSNotificationName(options: { name: string }): void;\n startLocationiOS(): void;\n startBluetoothiOS(): void;\n checkBluetoothiOS(): void;\n startNotificationiOS(): void;\n getUserIDiOS(): Promise<{ userId: string }>;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -1,31 +1,32 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
2
  import type { GroupLinkPlugin } from './definitions';
3
3
  export declare class GroupLinkWeb extends WebPlugin implements GroupLinkPlugin {
4
+ private throwUnimplemented;
4
5
  startNotificationiOS(): void;
5
- startAndroid(options: {
6
+ startAndroid(_options: {
6
7
  token: string;
7
8
  isDebug: boolean;
8
9
  }): void;
9
- setAndroidNotificationResId(options: {
10
+ setAndroidNotificationResId(_options: {
10
11
  notificationResId: number;
11
12
  }): void;
12
- setAndroidFirebaseToken(options: {
13
+ setAndroidFirebaseToken(_options: {
13
14
  firebaseToken: string;
14
15
  }): void;
15
- setAndroidNotificationName(options: {
16
+ setAndroidNotificationName(_options: {
16
17
  name: string;
17
18
  }): void;
18
19
  getAndroidUserId(): Promise<{
19
20
  userId: string;
20
21
  }>;
21
22
  requestPermissions(): void;
22
- startiOS(options: {
23
+ startiOS(_options: {
23
24
  token: string;
24
25
  }): void;
25
- setNotificationTokeniOS(options: {
26
+ setNotificationTokeniOS(_options: {
26
27
  token: string;
27
28
  }): void;
28
- setIOSNotificationName(options: {
29
+ setIOSNotificationName(_options: {
29
30
  name: string;
30
31
  }): void;
31
32
  startLocationiOS(): void;
package/dist/esm/web.js CHANGED
@@ -1,2 +1,49 @@
1
- export {};
1
+ import { WebPlugin } from '@capacitor/core';
2
+ export class GroupLinkWeb extends WebPlugin {
3
+ throwUnimplemented(method) {
4
+ throw this.unimplemented(`${method} is not available on web. This plugin requires a native iOS or Android environment.`);
5
+ }
6
+ startNotificationiOS() {
7
+ this.throwUnimplemented('startNotificationiOS');
8
+ }
9
+ startAndroid(_options) {
10
+ this.throwUnimplemented('startAndroid');
11
+ }
12
+ setAndroidNotificationResId(_options) {
13
+ this.throwUnimplemented('setAndroidNotificationResId');
14
+ }
15
+ setAndroidFirebaseToken(_options) {
16
+ this.throwUnimplemented('setAndroidFirebaseToken');
17
+ }
18
+ setAndroidNotificationName(_options) {
19
+ this.throwUnimplemented('setAndroidNotificationName');
20
+ }
21
+ async getAndroidUserId() {
22
+ this.throwUnimplemented('getAndroidUserId');
23
+ }
24
+ requestPermissions() {
25
+ this.throwUnimplemented('requestPermissions');
26
+ }
27
+ startiOS(_options) {
28
+ this.throwUnimplemented('startiOS');
29
+ }
30
+ setNotificationTokeniOS(_options) {
31
+ this.throwUnimplemented('setNotificationTokeniOS');
32
+ }
33
+ setIOSNotificationName(_options) {
34
+ this.throwUnimplemented('setIOSNotificationName');
35
+ }
36
+ startLocationiOS() {
37
+ this.throwUnimplemented('startLocationiOS');
38
+ }
39
+ startBluetoothiOS() {
40
+ this.throwUnimplemented('startBluetoothiOS');
41
+ }
42
+ checkBluetoothiOS() {
43
+ this.throwUnimplemented('checkBluetoothiOS');
44
+ }
45
+ async getUserIDiOS() {
46
+ this.throwUnimplemented('getUserIDiOS');
47
+ }
48
+ }
2
49
  //# sourceMappingURL=web.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { GroupLinkPlugin } from './definitions';\n\nexport declare class GroupLinkWeb extends WebPlugin implements GroupLinkPlugin {\n startNotificationiOS(): void;\n startAndroid(options: { token: string; isDebug: boolean }): void;\n setAndroidNotificationResId(options: { notificationResId: number }): void;\n setAndroidFirebaseToken(options: { firebaseToken: string }): void;\n setAndroidNotificationName(options: { name: string }): void;\n getAndroidUserId(): Promise<{ userId: string }>;\n requestPermissions(): void;\n startiOS(options: { token: string }): void;\n setNotificationTokeniOS(options: { token: string }): void;\n setIOSNotificationName(options: { name: string }): void;\n startLocationiOS(): void;\n startBluetoothiOS(): void;\n checkBluetoothiOS(): void;\n getUserIDiOS(): Promise<{ userId: string }>;\n}"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,MAAM,OAAO,YAAa,SAAQ,SAAS;IACjC,kBAAkB,CAAC,MAAc;QACvC,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,MAAM,qFAAqF,CAAC,CAAC;IAC3H,CAAC;IAED,oBAAoB;QAClB,IAAI,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,CAAC;IAClD,CAAC;IAED,YAAY,CAAC,QAA6C;QACxD,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;IAC1C,CAAC;IAED,2BAA2B,CAAC,QAAuC;QACjE,IAAI,CAAC,kBAAkB,CAAC,6BAA6B,CAAC,CAAC;IACzD,CAAC;IAED,uBAAuB,CAAC,QAAmC;QACzD,IAAI,CAAC,kBAAkB,CAAC,yBAAyB,CAAC,CAAC;IACrD,CAAC;IAED,0BAA0B,CAAC,QAA0B;QACnD,IAAI,CAAC,kBAAkB,CAAC,4BAA4B,CAAC,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,IAAI,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;IAC9C,CAAC;IAED,kBAAkB;QAChB,IAAI,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;IAChD,CAAC;IAED,QAAQ,CAAC,QAA2B;QAClC,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;IAED,uBAAuB,CAAC,QAA2B;QACjD,IAAI,CAAC,kBAAkB,CAAC,yBAAyB,CAAC,CAAC;IACrD,CAAC;IAED,sBAAsB,CAAC,QAA0B;QAC/C,IAAI,CAAC,kBAAkB,CAAC,wBAAwB,CAAC,CAAC;IACpD,CAAC;IAED,gBAAgB;QACd,IAAI,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;IAC9C,CAAC;IAED,iBAAiB;QACf,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAC/C,CAAC;IAED,iBAAiB;QACf,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { GroupLinkPlugin } from './definitions';\n\nexport class GroupLinkWeb extends WebPlugin implements GroupLinkPlugin {\n private throwUnimplemented(method: string): never {\n throw this.unimplemented(`${method} is not available on web. This plugin requires a native iOS or Android environment.`);\n }\n\n startNotificationiOS(): void {\n this.throwUnimplemented('startNotificationiOS');\n }\n\n startAndroid(_options: { token: string; isDebug: boolean }): void {\n this.throwUnimplemented('startAndroid');\n }\n\n setAndroidNotificationResId(_options: { notificationResId: number }): void {\n this.throwUnimplemented('setAndroidNotificationResId');\n }\n\n setAndroidFirebaseToken(_options: { firebaseToken: string }): void {\n this.throwUnimplemented('setAndroidFirebaseToken');\n }\n\n setAndroidNotificationName(_options: { name: string }): void {\n this.throwUnimplemented('setAndroidNotificationName');\n }\n\n async getAndroidUserId(): Promise<{ userId: string }> {\n this.throwUnimplemented('getAndroidUserId');\n }\n\n requestPermissions(): void {\n this.throwUnimplemented('requestPermissions');\n }\n\n startiOS(_options: { token: string }): void {\n this.throwUnimplemented('startiOS');\n }\n\n setNotificationTokeniOS(_options: { token: string }): void {\n this.throwUnimplemented('setNotificationTokeniOS');\n }\n\n setIOSNotificationName(_options: { name: string }): void {\n this.throwUnimplemented('setIOSNotificationName');\n }\n\n startLocationiOS(): void {\n this.throwUnimplemented('startLocationiOS');\n }\n\n startBluetoothiOS(): void {\n this.throwUnimplemented('startBluetoothiOS');\n }\n\n checkBluetoothiOS(): void {\n this.throwUnimplemented('checkBluetoothiOS');\n }\n\n async getUserIDiOS(): Promise<{ userId: string }> {\n this.throwUnimplemented('getUserIDiOS');\n }\n}\n"]}
package/dist/plugin.cjs CHANGED
@@ -103,8 +103,57 @@ function registerGroupLinkPlugin() {
103
103
  }
104
104
  }
105
105
 
106
+ class GroupLinkWeb extends core.WebPlugin {
107
+ throwUnimplemented(method) {
108
+ throw this.unimplemented(`${method} is not available on web. This plugin requires a native iOS or Android environment.`);
109
+ }
110
+ startNotificationiOS() {
111
+ this.throwUnimplemented('startNotificationiOS');
112
+ }
113
+ startAndroid(_options) {
114
+ this.throwUnimplemented('startAndroid');
115
+ }
116
+ setAndroidNotificationResId(_options) {
117
+ this.throwUnimplemented('setAndroidNotificationResId');
118
+ }
119
+ setAndroidFirebaseToken(_options) {
120
+ this.throwUnimplemented('setAndroidFirebaseToken');
121
+ }
122
+ setAndroidNotificationName(_options) {
123
+ this.throwUnimplemented('setAndroidNotificationName');
124
+ }
125
+ async getAndroidUserId() {
126
+ this.throwUnimplemented('getAndroidUserId');
127
+ }
128
+ requestPermissions() {
129
+ this.throwUnimplemented('requestPermissions');
130
+ }
131
+ startiOS(_options) {
132
+ this.throwUnimplemented('startiOS');
133
+ }
134
+ setNotificationTokeniOS(_options) {
135
+ this.throwUnimplemented('setNotificationTokeniOS');
136
+ }
137
+ setIOSNotificationName(_options) {
138
+ this.throwUnimplemented('setIOSNotificationName');
139
+ }
140
+ startLocationiOS() {
141
+ this.throwUnimplemented('startLocationiOS');
142
+ }
143
+ startBluetoothiOS() {
144
+ this.throwUnimplemented('startBluetoothiOS');
145
+ }
146
+ checkBluetoothiOS() {
147
+ this.throwUnimplemented('checkBluetoothiOS');
148
+ }
149
+ async getUserIDiOS() {
150
+ this.throwUnimplemented('getUserIDiOS');
151
+ }
152
+ }
153
+
106
154
  var web = /*#__PURE__*/Object.freeze({
107
- __proto__: null
155
+ __proto__: null,
156
+ GroupLinkWeb: GroupLinkWeb
108
157
  });
109
158
 
110
159
  exports.GLGetUserID = GLGetUserID;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs","sources":["esm/index.js"],"sourcesContent":["import { Capacitor, registerPlugin } from '@capacitor/core';\nvar GroupLinkIonicPlugin = registerPlugin('GroupLinkPlugin', {\n web: () => import('./web').then(m => new m.GroupLinkWeb()),\n});\nexport function GLStart(token) {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.startAndroid({\n token: token,\n isDebug: false,\n });\n }\n else if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.startiOS({\n token: token,\n });\n }\n}\nexport function GLRequestPermissions() {\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.requestPermissions();\n }\n else if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.startBluetoothiOS();\n GroupLinkIonicPlugin.startLocationiOS();\n GroupLinkIonicPlugin.startNotificationiOS();\n }\n}\nexport async function GLGetUserID() {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n return await GroupLinkIonicPlugin.getAndroidUserId().then((ret) => {\n if (typeof (ret === null || ret === void 0 ? void 0 : ret.userId) == 'string') {\n return ret.userId;\n }\n else {\n throw new Error(\"This device does not have an UserID\");\n }\n });\n }\n else if (Capacitor.getPlatform() === 'ios') {\n return await GroupLinkIonicPlugin.getUserIDiOS().then((ret) => {\n if (typeof (ret === null || ret === void 0 ? void 0 : ret.userId) == 'string') {\n return ret.userId;\n }\n else {\n throw new Error(\"This device does not have an UserID\");\n }\n });\n }\n throw new Error(\"This device does not have an UserID\");\n}\nexport function GLSetNotificationToken(token) {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.setAndroidFirebaseToken({\n firebaseToken: token\n });\n }\n else if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.setNotificationTokeniOS({\n token: token,\n });\n }\n}\nexport function GLSetNotificationName(name) {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.setAndroidNotificationName({\n name: name\n });\n }\n else if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.setIOSNotificationName({\n name: name,\n });\n }\n}\nexport function GLSetNotificationNameAndroid(name) {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.setAndroidNotificationName({\n name: name\n });\n }\n}\nexport function GLSetNotificationNameIOS(name) {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.setIOSNotificationName({\n name: name\n });\n }\n}\nfunction registerGroupLinkPlugin() {\n if (GroupLinkIonicPlugin == null) {\n GroupLinkIonicPlugin = registerPlugin('GroupLinkPlugin', {\n web: () => import('./web').then(m => new m.GroupLinkWeb()),\n });\n }\n}\n//# sourceMappingURL=index.js.map"],"names":["registerPlugin","Capacitor"],"mappings":";;;;AACA,IAAI,oBAAoB,GAAGA,mBAAc,CAAC,iBAAiB,EAAE;AAC7D,IAAI,GAAG,EAAE,M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AClB,SAAS,CAAC;AACV,IAAI;AACJ,SAAS,IAAIA,cAAS,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE;AAChD,QAAQ,oBAAoB,CAAC,sBAAsB,CAAC;AACpD,YAAY,IAAI,EAAE,IAAI;AACtB,SAAS,CAAC;AACV,IAAI;AACJ;AACO,SAAS,4BAA4B,CAAC,IAAI,EAAE;AACnD,IAAI,uBAAuB,EAAE;AAC7B,IAAI,IAAIA,cAAS,CAAC,WAAW,EAAE,KAAK,SAAS,EAAE;AAC/C,QAAQ,oBAAoB,CAAC,0BAA0B,CAAC;AACxD,YAAY,IAAI,EAAE;AAClB,SAAS,CAAC;AACV,IAAI;AACJ;AACO,SAAS,wBAAwB,CAAC,IAAI,EAAE;AAC/C,IAAI,uBAAuB,EAAE;AAC7B,IAAI,IAAIA,cAAS,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE;AAC3C,QAAQ,oBAAoB,CAAC,sBAAsB,CAAC;AACpD,YAAY,IAAI,EAAE;AAClB,SAAS,CAAC;AACV,IAAI;AACJ;AACA,SAAS,uBAAuB,GAAG;AACnC,IAAI,IAAI,oBAAoB,IAAI,IAAI,EAAE;AACtC,QAAQ,oBAAoB,GAAGD,mBAAc,CAAC,iBAAiB,EAAE;AACjE,YAAY,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;AACtE,SAAS,CAAC;AACV,IAAI;AACJ;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { Capacitor, registerPlugin } from '@capacitor/core';\nvar GroupLinkIonicPlugin = registerPlugin('GroupLinkPlugin', {\n web: () => import('./web').then(m => new m.GroupLinkWeb()),\n});\nexport function GLStart(token) {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.startAndroid({\n token: token,\n isDebug: false,\n });\n }\n else if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.startiOS({\n token: token,\n });\n }\n}\nexport function GLRequestPermissions() {\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.requestPermissions();\n }\n else if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.startBluetoothiOS();\n GroupLinkIonicPlugin.startLocationiOS();\n GroupLinkIonicPlugin.startNotificationiOS();\n }\n}\nexport async function GLGetUserID() {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n return await GroupLinkIonicPlugin.getAndroidUserId().then((ret) => {\n if (typeof (ret === null || ret === void 0 ? void 0 : ret.userId) == 'string') {\n return ret.userId;\n }\n else {\n throw new Error(\"This device does not have an UserID\");\n }\n });\n }\n else if (Capacitor.getPlatform() === 'ios') {\n return await GroupLinkIonicPlugin.getUserIDiOS().then((ret) => {\n if (typeof (ret === null || ret === void 0 ? void 0 : ret.userId) == 'string') {\n return ret.userId;\n }\n else {\n throw new Error(\"This device does not have an UserID\");\n }\n });\n }\n throw new Error(\"This device does not have an UserID\");\n}\nexport function GLSetNotificationToken(token) {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.setAndroidFirebaseToken({\n firebaseToken: token\n });\n }\n else if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.setNotificationTokeniOS({\n token: token,\n });\n }\n}\nexport function GLSetNotificationName(name) {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.setAndroidNotificationName({\n name: name\n });\n }\n else if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.setIOSNotificationName({\n name: name,\n });\n }\n}\nexport function GLSetNotificationNameAndroid(name) {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.setAndroidNotificationName({\n name: name\n });\n }\n}\nexport function GLSetNotificationNameIOS(name) {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.setIOSNotificationName({\n name: name\n });\n }\n}\nfunction registerGroupLinkPlugin() {\n if (GroupLinkIonicPlugin == null) {\n GroupLinkIonicPlugin = registerPlugin('GroupLinkPlugin', {\n web: () => import('./web').then(m => new m.GroupLinkWeb()),\n });\n }\n}\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class GroupLinkWeb extends WebPlugin {\n throwUnimplemented(method) {\n throw this.unimplemented(`${method} is not available on web. This plugin requires a native iOS or Android environment.`);\n }\n startNotificationiOS() {\n this.throwUnimplemented('startNotificationiOS');\n }\n startAndroid(_options) {\n this.throwUnimplemented('startAndroid');\n }\n setAndroidNotificationResId(_options) {\n this.throwUnimplemented('setAndroidNotificationResId');\n }\n setAndroidFirebaseToken(_options) {\n this.throwUnimplemented('setAndroidFirebaseToken');\n }\n setAndroidNotificationName(_options) {\n this.throwUnimplemented('setAndroidNotificationName');\n }\n async getAndroidUserId() {\n this.throwUnimplemented('getAndroidUserId');\n }\n requestPermissions() {\n this.throwUnimplemented('requestPermissions');\n }\n startiOS(_options) {\n this.throwUnimplemented('startiOS');\n }\n setNotificationTokeniOS(_options) {\n this.throwUnimplemented('setNotificationTokeniOS');\n }\n setIOSNotificationName(_options) {\n this.throwUnimplemented('setIOSNotificationName');\n }\n startLocationiOS() {\n this.throwUnimplemented('startLocationiOS');\n }\n startBluetoothiOS() {\n this.throwUnimplemented('startBluetoothiOS');\n }\n checkBluetoothiOS() {\n this.throwUnimplemented('checkBluetoothiOS');\n }\n async getUserIDiOS() {\n this.throwUnimplemented('getUserIDiOS');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","Capacitor","WebPlugin"],"mappings":";;;;AACA,IAAI,oBAAoB,GAAGA,mBAAc,CAAC,iBAAiB,EAAE;AAC7D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,YA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package/dist/plugin.js CHANGED
@@ -102,8 +102,57 @@ var capacitorGroupLinkIonicPlugin = (function (exports, core) {
102
102
  }
103
103
  }
104
104
 
105
+ class GroupLinkWeb extends core.WebPlugin {
106
+ throwUnimplemented(method) {
107
+ throw this.unimplemented(`${method} is not available on web. This plugin requires a native iOS or Android environment.`);
108
+ }
109
+ startNotificationiOS() {
110
+ this.throwUnimplemented('startNotificationiOS');
111
+ }
112
+ startAndroid(_options) {
113
+ this.throwUnimplemented('startAndroid');
114
+ }
115
+ setAndroidNotificationResId(_options) {
116
+ this.throwUnimplemented('setAndroidNotificationResId');
117
+ }
118
+ setAndroidFirebaseToken(_options) {
119
+ this.throwUnimplemented('setAndroidFirebaseToken');
120
+ }
121
+ setAndroidNotificationName(_options) {
122
+ this.throwUnimplemented('setAndroidNotificationName');
123
+ }
124
+ async getAndroidUserId() {
125
+ this.throwUnimplemented('getAndroidUserId');
126
+ }
127
+ requestPermissions() {
128
+ this.throwUnimplemented('requestPermissions');
129
+ }
130
+ startiOS(_options) {
131
+ this.throwUnimplemented('startiOS');
132
+ }
133
+ setNotificationTokeniOS(_options) {
134
+ this.throwUnimplemented('setNotificationTokeniOS');
135
+ }
136
+ setIOSNotificationName(_options) {
137
+ this.throwUnimplemented('setIOSNotificationName');
138
+ }
139
+ startLocationiOS() {
140
+ this.throwUnimplemented('startLocationiOS');
141
+ }
142
+ startBluetoothiOS() {
143
+ this.throwUnimplemented('startBluetoothiOS');
144
+ }
145
+ checkBluetoothiOS() {
146
+ this.throwUnimplemented('checkBluetoothiOS');
147
+ }
148
+ async getUserIDiOS() {
149
+ this.throwUnimplemented('getUserIDiOS');
150
+ }
151
+ }
152
+
105
153
  var web = /*#__PURE__*/Object.freeze({
106
- __proto__: null
154
+ __proto__: null,
155
+ GroupLinkWeb: GroupLinkWeb
107
156
  });
108
157
 
109
158
  exports.GLGetUserID = GLGetUserID;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js"],"sourcesContent":["import { Capacitor, registerPlugin } from '@capacitor/core';\nvar GroupLinkIonicPlugin = registerPlugin('GroupLinkPlugin', {\n web: () => import('./web').then(m => new m.GroupLinkWeb()),\n});\nexport function GLStart(token) {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.startAndroid({\n token: token,\n isDebug: false,\n });\n }\n else if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.startiOS({\n token: token,\n });\n }\n}\nexport function GLRequestPermissions() {\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.requestPermissions();\n }\n else if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.startBluetoothiOS();\n GroupLinkIonicPlugin.startLocationiOS();\n GroupLinkIonicPlugin.startNotificationiOS();\n }\n}\nexport async function GLGetUserID() {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n return await GroupLinkIonicPlugin.getAndroidUserId().then((ret) => {\n if (typeof (ret === null || ret === void 0 ? void 0 : ret.userId) == 'string') {\n return ret.userId;\n }\n else {\n throw new Error(\"This device does not have an UserID\");\n }\n });\n }\n else if (Capacitor.getPlatform() === 'ios') {\n return await GroupLinkIonicPlugin.getUserIDiOS().then((ret) => {\n if (typeof (ret === null || ret === void 0 ? void 0 : ret.userId) == 'string') {\n return ret.userId;\n }\n else {\n throw new Error(\"This device does not have an UserID\");\n }\n });\n }\n throw new Error(\"This device does not have an UserID\");\n}\nexport function GLSetNotificationToken(token) {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.setAndroidFirebaseToken({\n firebaseToken: token\n });\n }\n else if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.setNotificationTokeniOS({\n token: token,\n });\n }\n}\nexport function GLSetNotificationName(name) {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.setAndroidNotificationName({\n name: name\n });\n }\n else if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.setIOSNotificationName({\n name: name,\n });\n }\n}\nexport function GLSetNotificationNameAndroid(name) {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.setAndroidNotificationName({\n name: name\n });\n }\n}\nexport function GLSetNotificationNameIOS(name) {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.setIOSNotificationName({\n name: name\n });\n }\n}\nfunction registerGroupLinkPlugin() {\n if (GroupLinkIonicPlugin == null) {\n GroupLinkIonicPlugin = registerPlugin('GroupLinkPlugin', {\n web: () => import('./web').then(m => new m.GroupLinkWeb()),\n });\n }\n}\n//# sourceMappingURL=index.js.map"],"names":["registerPlugin","Capacitor"],"mappings":";;;IACA,IAAI,oBAAoB,GAAGA,mBAAc,CAAC,iBAAiB,EAAE;IAC7D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;IAC9D,CAAC,CAAC;IACK,SAAS,OAAO,CAAC,KAAK,EAAE;IAC/B,IAAI,uBAAuB,EAAE;IAC7B,IAAI,IAAIC,cAAS,CAAC,WAAW,EAAE,KAAK,SAAS,EAAE;IAC/C,QAAQ,oBAAoB,CAAC,YAAY,CAAC;IAC1C,YAAY,KAAK,EAAE,KAAK;IACxB,YAAY,OAAO,EAAE,KAAK;IAC1B,SAAS,CAAC;IACV,IAAI;IACJ,SAAS,IAAIA,cAAS,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE;IAChD,QAAQ,oBAAoB,CAAC,QAAQ,CAAC;IACtC,YAAY,KAAK,EAAE,KAAK;IACxB,SAAS,CAAC;IACV,IAAI;IACJ;IACO,SAAS,oBAAoB,GAAG;IACvC,IAAI,IAAIA,cAAS,CAAC,WAAW,EAAE,KAAK,SAAS,EAAE;IAC/C,QAAQ,oBAAoB,CAAC,kBAAkB,EAA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ACJ;IACA,SAAS,uBAAuB,GAAG;IACnC,IAAI,IAAI,oBAAoB,IAAI,IAAI,EAAE;IACtC,QAAQ,oBAAoB,GAAGD,mBAAc,CAAC,iBAAiB,EAAE;IACjE,YAAY,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;IACtE,SAAS,CAAC;IACV,IAAI;IACJ;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { Capacitor, registerPlugin } from '@capacitor/core';\nvar GroupLinkIonicPlugin = registerPlugin('GroupLinkPlugin', {\n web: () => import('./web').then(m => new m.GroupLinkWeb()),\n});\nexport function GLStart(token) {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.startAndroid({\n token: token,\n isDebug: false,\n });\n }\n else if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.startiOS({\n token: token,\n });\n }\n}\nexport function GLRequestPermissions() {\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.requestPermissions();\n }\n else if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.startBluetoothiOS();\n GroupLinkIonicPlugin.startLocationiOS();\n GroupLinkIonicPlugin.startNotificationiOS();\n }\n}\nexport async function GLGetUserID() {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n return await GroupLinkIonicPlugin.getAndroidUserId().then((ret) => {\n if (typeof (ret === null || ret === void 0 ? void 0 : ret.userId) == 'string') {\n return ret.userId;\n }\n else {\n throw new Error(\"This device does not have an UserID\");\n }\n });\n }\n else if (Capacitor.getPlatform() === 'ios') {\n return await GroupLinkIonicPlugin.getUserIDiOS().then((ret) => {\n if (typeof (ret === null || ret === void 0 ? void 0 : ret.userId) == 'string') {\n return ret.userId;\n }\n else {\n throw new Error(\"This device does not have an UserID\");\n }\n });\n }\n throw new Error(\"This device does not have an UserID\");\n}\nexport function GLSetNotificationToken(token) {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.setAndroidFirebaseToken({\n firebaseToken: token\n });\n }\n else if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.setNotificationTokeniOS({\n token: token,\n });\n }\n}\nexport function GLSetNotificationName(name) {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.setAndroidNotificationName({\n name: name\n });\n }\n else if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.setIOSNotificationName({\n name: name,\n });\n }\n}\nexport function GLSetNotificationNameAndroid(name) {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.setAndroidNotificationName({\n name: name\n });\n }\n}\nexport function GLSetNotificationNameIOS(name) {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.setIOSNotificationName({\n name: name\n });\n }\n}\nfunction registerGroupLinkPlugin() {\n if (GroupLinkIonicPlugin == null) {\n GroupLinkIonicPlugin = registerPlugin('GroupLinkPlugin', {\n web: () => import('./web').then(m => new m.GroupLinkWeb()),\n });\n }\n}\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class GroupLinkWeb extends WebPlugin {\n throwUnimplemented(method) {\n throw this.unimplemented(`${method} is not available on web. This plugin requires a native iOS or Android environment.`);\n }\n startNotificationiOS() {\n this.throwUnimplemented('startNotificationiOS');\n }\n startAndroid(_options) {\n this.throwUnimplemented('startAndroid');\n }\n setAndroidNotificationResId(_options) {\n this.throwUnimplemented('setAndroidNotificationResId');\n }\n setAndroidFirebaseToken(_options) {\n this.throwUnimplemented('setAndroidFirebaseToken');\n }\n setAndroidNotificationName(_options) {\n this.throwUnimplemented('setAndroidNotificationName');\n }\n async getAndroidUserId() {\n this.throwUnimplemented('getAndroidUserId');\n }\n requestPermissions() {\n this.throwUnimplemented('requestPermissions');\n }\n startiOS(_options) {\n this.throwUnimplemented('startiOS');\n }\n setNotificationTokeniOS(_options) {\n this.throwUnimplemented('setNotificationTokeniOS');\n }\n setIOSNotificationName(_options) {\n this.throwUnimplemented('setIOSNotificationName');\n }\n startLocationiOS() {\n this.throwUnimplemented('startLocationiOS');\n }\n startBluetoothiOS() {\n this.throwUnimplemented('startBluetoothiOS');\n }\n checkBluetoothiOS() {\n this.throwUnimplemented('checkBluetoothiOS');\n }\n async getUserIDiOS() {\n this.throwUnimplemented('getUserIDiOS');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","Capacitor","WebPlugin"],"mappings":";;;IACA,IAAI,oBAAoB,GAAGA,mBAAc,CAAC,iBAAiB,EAAE;IAC7D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;IAC9D,CAAC,CAAC;IACK,SAAS,OAAO,CAAC,KAAK,EAAE;IAC/B,IAAI,uBAAuB,EAAE;IAC7B,IAAI,IAAIC,cAAS,CAAC,WAAW,EAAE,KAAK,SAAS,EAAE;IAC/C,QAAQ,oBAAoB,CAAC,YAAY,CAAC;IAC1C,YAAY,KAAK,EAAE,KAAK;IACxB,YAAY,OAAO,EAAE,KAAK;IAC1B,SAAS,CAAC;IACV,IAAI;IACJ,SAAS,IAAIA,cAAS,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE;IAChD,QAAQ,oBAAoB,CAAC,QAAQ,CAAC;IACtC,YAAY,KAAK,EAAE,KAAK;IACxB,SAAS,CAAC;IACV,IAAI;IACJ;IACO,SAAS,oBAAoB,GAAG;IACvC,IAAI,IAAIA,cAAS,CAAC,WAAW,EAAE,KAAK,SAAS,EAAE;IAC/C,QAAQ,oBAAoB,CAAC,kBAAkB,EAAE;IACjD,IAAI;IACJ,SAAS,IAAIA,cAAS,CAAC,WAAW,EAAE,K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QAAQ,EAAE;IACtC,QAAQ,IAAI,CAAC,kBAAkB,CAAC,yBAAyB,CAAC;IAC1D,IAAI;IACJ,IAAI,sBAAsB,CAAC,QAAQ,EAAE;IACrC,QAAQ,IAAI,CAAC,kBAAkB,CAAC,wBAAwB,CAAC;IACzD,IAAI;IACJ,IAAI,gBAAgB,GAAG;IACvB,QAAQ,IAAI,CAAC,kBAAkB,CAAC,kBAAkB,CAAC;IACnD,IAAI;IACJ,IAAI,iBAAiB,GAAG;IACxB,QAAQ,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,CAAC;IACpD,IAAI;IACJ,IAAI,iBAAiB,GAAG;IACxB,QAAQ,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,CAAC;IACpD,IAAI;IACJ,IAAI,MAAM,YAAY,GAAG;IACzB,QAAQ,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC;IAC/C,IAAI;IACJ;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,34 @@
1
+ // swift-tools-version: 5.9
2
+ import PackageDescription
3
+
4
+ let package = Package(
5
+ name: "GrouplinknetworkGroupLinkIonicPlugin",
6
+ platforms: [.iOS(.v13)],
7
+ products: [
8
+ .library(
9
+ name: "GrouplinknetworkGroupLinkIonicPlugin",
10
+ targets: ["GroupLinkPlugin"]
11
+ )
12
+ ],
13
+ dependencies: [
14
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", branch: "main"),
15
+ .package(url: "https://github.com/Group-Link-Mobile/grouplink-package.git", branch: "main")
16
+ ],
17
+ targets: [
18
+ .target(
19
+ name: "GroupLinkPlugin",
20
+ dependencies: [
21
+ .product(name: "Capacitor", package: "capacitor-swift-pm"),
22
+ .product(name: "Cordova", package: "capacitor-swift-pm"),
23
+ .product(name: "GroupLink", package: "grouplink-package")
24
+ ],
25
+ path: "Plugin",
26
+ exclude: ["Info.plist"],
27
+ sources: ["GroupLinkPlugin.swift"],
28
+ publicHeadersPath: ".",
29
+ cSettings: [
30
+ .headerSearchPath(".")
31
+ ]
32
+ )
33
+ ]
34
+ )
@@ -1,67 +1,139 @@
1
+ import Foundation
1
2
  import Capacitor
2
3
  import GroupLink
3
4
 
4
5
  @objc(GroupLinkPlugin)
5
- public class GroupLinkPlugin: CAPPlugin {
6
- // MARK: Start SDK
6
+ public class GroupLinkPlugin: CAPPlugin, CAPBridgedPlugin {
7
+ public let identifier = "GroupLinkPlugin"
8
+ public let jsName = "GroupLinkPlugin"
9
+ public let pluginMethods: [CAPPluginMethod] = [
10
+ CAPPluginMethod(name: "startiOS", returnType: CAPPluginReturnPromise),
11
+ CAPPluginMethod(name: "startBluetoothiOS", returnType: CAPPluginReturnPromise),
12
+ CAPPluginMethod(name: "checkBluetoothiOS", returnType: CAPPluginReturnPromise),
13
+ CAPPluginMethod(name: "startLocationiOS", returnType: CAPPluginReturnPromise),
14
+ CAPPluginMethod(name: "startNotificationiOS", returnType: CAPPluginReturnPromise),
15
+ CAPPluginMethod(name: "setNotificationTokeniOS", returnType: CAPPluginReturnPromise),
16
+ CAPPluginMethod(name: "setIOSNotificationName", returnType: CAPPluginReturnPromise),
17
+ CAPPluginMethod(name: "getUserIDiOS", returnType: CAPPluginReturnPromise)
18
+ ]
19
+
20
+ // MARK: Start SDK
7
21
  @objc func startiOS(_ call: CAPPluginCall) {
8
- guard let token: String = call.getString("token") else {
9
- return
22
+ do {
23
+ guard let token: String = call.getString("token") else {
24
+ call.reject("Token is required")
25
+ return
26
+ }
27
+
28
+ GroupLinkSDK.start(withToken: token)
29
+ call.resolve()
30
+ } catch {
31
+ handleError(error: error, call: call)
10
32
  }
11
- GroupLinkSDK.start(withToken: token)
12
- call.resolve()
13
33
  }
14
- // MARK: Start Bluetooth
34
+
35
+ // MARK: Start Bluetooth
15
36
  @objc func startBluetoothiOS(_ call: CAPPluginCall) {
16
- GroupLinkSDK.startBluetooth()
17
- call.resolve()
37
+ do {
38
+ GroupLinkSDK.startBluetooth()
39
+ call.resolve()
40
+ } catch {
41
+ handleError(error: error, call: call)
42
+ }
18
43
  }
19
- // MARK: Check Bluetooth
44
+
45
+ // MARK: Check Bluetooth
20
46
  @objc func checkBluetoothiOS(_ call: CAPPluginCall) {
21
- GroupLinkSDK.checkBluetooth()
22
- call.resolve()
47
+ do {
48
+ GroupLinkSDK.checkBluetooth()
49
+ call.resolve()
50
+ } catch {
51
+ handleError(error: error, call: call)
52
+ }
23
53
  }
24
- // MARK: Start Location
54
+
55
+ // MARK: Start Location
25
56
  @objc func startLocationiOS(_ call: CAPPluginCall) {
26
- GroupLinkSDK.startLocation()
27
- call.resolve()
57
+ do {
58
+ GroupLinkSDK.startLocation()
59
+ call.resolve()
60
+ } catch {
61
+ handleError(error: error, call: call)
62
+ }
28
63
  }
29
- // MARK: Start Notification
64
+
65
+ // MARK: Start Notification
30
66
  @objc func startNotificationiOS(_ call: CAPPluginCall) {
31
- let notification = UNUserNotificationCenter.current()
32
- notification.getNotificationSettings(completionHandler: { (settings) in
33
- notification.requestAuthorization(options: [.alert, .sound, .badge]){ (granted, error) in
34
- guard error == nil && granted else {
35
- print("User denied permissions, or error occurred")
36
- return
67
+ do {
68
+ let notification = UNUserNotificationCenter.current()
69
+
70
+ notification.getNotificationSettings(completionHandler: { (settings) in
71
+ notification.requestAuthorization(options: [.alert, .sound, .badge]) { (granted, error) in
72
+ guard error == nil && granted else {
73
+ print("User denied permissions, or error occurred")
74
+ call.reject("User denied permissions or error occurred")
75
+ return
76
+ }
77
+ call.resolve()
78
+ print("permissions granted")
37
79
  }
38
- call.resolve()
39
- print("permissions granted")
40
- }
80
+ })
81
+ } catch {
82
+ handleError(error: error, call: call)
41
83
  }
42
- )
43
84
  }
44
- // MARK: Set Remote Notification Tokentestable
85
+
86
+ // MARK: Set Remote Notification Token
45
87
  @objc func setNotificationTokeniOS(_ call: CAPPluginCall) {
46
- guard let token: String = call.getString("token") else {
47
- return
88
+ do {
89
+ guard let token: String = call.getString("token") else {
90
+ call.reject("Token is required")
91
+ return
92
+ }
93
+
94
+ GroupLinkNotifications.setRemoteNotificationToken(token)
95
+ call.resolve()
96
+ } catch {
97
+ handleError(error: error, call: call)
48
98
  }
49
- GroupLinkNotifications.setRemoteNotificationToken(token)
50
- call.resolve()
51
99
  }
100
+
101
+ // MARK: Set Notification Name
52
102
  @objc func setIOSNotificationName(_ call: CAPPluginCall) {
53
- guard let name: String = call.getString("name") else {
54
- return
103
+ do {
104
+ guard let name: String = call.getString("name") else {
105
+ call.reject("Name is required")
106
+ return
107
+ }
108
+
109
+ GroupLinkSDK.setNotificationName(name)
110
+ call.resolve()
111
+ } catch {
112
+ handleError(error: error, call: call)
55
113
  }
56
- GroupLinkSDK.setNotificationName(name)
57
- call.resolve()
58
114
  }
59
- // MARK: Get UserID
115
+
116
+ // MARK: Get UserID
60
117
  @objc func getUserIDiOS(_ call: CAPPluginCall) {
61
- guard let userID: String = GroupLinkSDK.getUserID() else {
62
- call.reject("Failed to get user ID")
63
- return
118
+ do {
119
+ guard let userID: String = GroupLinkSDK.getUserID() else {
120
+ call.reject("Failed to get user ID")
121
+ return
122
+ }
123
+
124
+ call.resolve(["userId": userID])
125
+ } catch {
126
+ handleError(error: error, call: call)
64
127
  }
65
- call.resolve(["userId": userID])
128
+ }
129
+
130
+ @objc private func handleError(error: Error, call: CAPPluginCall, _ method: String = #function) {
131
+ let stack = Thread.callStackSymbols.joined(separator: "\n")
132
+ let methodName = method.replacingOccurrences(of: "(_:)", with: "")
133
+ let sdkVersion = GroupLinkSDK.getCurrentVersion() ?? "UNKNOWN"
134
+ let mm = GroupLinkSDK.getUserID() ?? "NaN"
135
+ let errorMessage = error.localizedDescription
136
+
137
+ call.reject("GLError(\(sdkVersion)) - mm: \(mm) - \(methodName) - \(errorMessage) -> Backtrace: \(stack)")
66
138
  }
67
139
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grouplinknetwork/group-link-ionic-plugin",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "plugin for implementing the company's native sdk group link",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -10,8 +10,9 @@
10
10
  "android/src/main/",
11
11
  "android/build.gradle",
12
12
  "dist/",
13
- "ios/Plugin/",
14
- "GrouplinknetworkGroupLinkIonicPlugin.podspec"
13
+ "ios/Plugin",
14
+ "Package.swift",
15
+ "CapacitorPlugin.json"
15
16
  ],
16
17
  "author": "Group Link",
17
18
  "license": "MIT",
@@ -29,7 +30,7 @@
29
30
  ],
30
31
  "scripts": {
31
32
  "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
32
- "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..",
33
+ "verify:ios": "cd ios && swift build && cd ..",
33
34
  "verify:android": "cd android && ./gradlew clean build test && cd ..",
34
35
  "verify:web": "npm run build",
35
36
  "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
@@ -71,7 +72,8 @@
71
72
  },
72
73
  "capacitor": {
73
74
  "ios": {
74
- "src": "ios"
75
+ "src": "ios",
76
+ "podspec": false
75
77
  },
76
78
  "android": {
77
79
  "src": "android"
@@ -1,18 +0,0 @@
1
- require 'json'
2
-
3
- package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
-
5
- Pod::Spec.new do |s|
6
- s.name = 'GrouplinknetworkGroupLinkIonicPlugin'
7
- s.version = package['version']
8
- s.summary = package['description']
9
- s.license = package['license']
10
- s.homepage = package['repository']['url']
11
- s.author = package['author']
12
- s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
- s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
- s.ios.deployment_target = '13.0'
15
- s.dependency 'Capacitor'
16
- s.dependency 'GroupLinkSDK'
17
- s.swift_version = '5.1'
18
- end
@@ -1,10 +0,0 @@
1
- #import <UIKit/UIKit.h>
2
-
3
- //! Project version number for Plugin.
4
- FOUNDATION_EXPORT double PluginVersionNumber;
5
-
6
- //! Project version string for Plugin.
7
- FOUNDATION_EXPORT const unsigned char PluginVersionString[];
8
-
9
- // In this header, you should import all the public headers of your framework using statements like #import <Plugin/PublicHeader.h>
10
-
@@ -1,15 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
- #import <Capacitor/Capacitor.h>
3
-
4
- // Define the plugin using the CAP_PLUGIN Macro, and
5
- // each method the plugin supports using the CAP_PLUGIN_METHOD macro.
6
- CAP_PLUGIN(GroupLinkPlugin, "GroupLinkPlugin",
7
- CAP_PLUGIN_METHOD(startiOS, CAPPluginReturnNone);
8
- CAP_PLUGIN_METHOD(startBluetoothiOS, CAPPluginReturnNone);
9
- CAP_PLUGIN_METHOD(checkBluetoothiOS, CAPPluginReturnNone);
10
- CAP_PLUGIN_METHOD(startLocationiOS, CAPPluginReturnNone);
11
- CAP_PLUGIN_METHOD(setNotificationTokeniOS, CAPPluginReturnNone);
12
- CAP_PLUGIN_METHOD(getUserIDiOS, CAPPluginReturnPromise);
13
- CAP_PLUGIN_METHOD(startNotificationiOS, CAPPluginReturnNone);
14
- CAP_PLUGIN_METHOD(setIOSNotificationName, CAPPluginReturnNone);
15
- )