@grouplinknetwork/group-link-ionic-plugin 1.0.2 → 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,103 +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
- private void permissionIsGranted(String alias, PluginCall call){
110
- if (getPermissionState(alias) == PermissionState.GRANTED){
111
- }else {
112
- 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);
113
173
  }
114
- }
115
174
  }
package/dist/docs.json CHANGED
@@ -37,6 +37,22 @@
37
37
  "complexTypes": [],
38
38
  "slug": "setandroidnotificationresid"
39
39
  },
40
+ {
41
+ "name": "setAndroidNotificationName",
42
+ "signature": "(options: { name: string; }) => void",
43
+ "parameters": [
44
+ {
45
+ "name": "options",
46
+ "docs": "",
47
+ "type": "{ name: string; }"
48
+ }
49
+ ],
50
+ "returns": "void",
51
+ "tags": [],
52
+ "docs": "",
53
+ "complexTypes": [],
54
+ "slug": "setandroidnotificationname"
55
+ },
40
56
  {
41
57
  "name": "setAndroidFirebaseToken",
42
58
  "signature": "(options: { firebaseToken: string; }) => void",
@@ -105,6 +121,22 @@
105
121
  "complexTypes": [],
106
122
  "slug": "setnotificationtokenios"
107
123
  },
124
+ {
125
+ "name": "setIOSNotificationName",
126
+ "signature": "(options: { name: string; }) => void",
127
+ "parameters": [
128
+ {
129
+ "name": "options",
130
+ "docs": "",
131
+ "type": "{ name: string; }"
132
+ }
133
+ ],
134
+ "returns": "void",
135
+ "tags": [],
136
+ "docs": "",
137
+ "complexTypes": [],
138
+ "slug": "setiosnotificationname"
139
+ },
108
140
  {
109
141
  "name": "startLocationiOS",
110
142
  "signature": "() => void",
@@ -6,6 +6,9 @@ export interface GroupLinkPlugin {
6
6
  setAndroidNotificationResId(options: {
7
7
  notificationResId: number;
8
8
  }): void;
9
+ setAndroidNotificationName(options: {
10
+ name: string;
11
+ }): void;
9
12
  setAndroidFirebaseToken(options: {
10
13
  firebaseToken: string;
11
14
  }): void;
@@ -19,6 +22,9 @@ export interface GroupLinkPlugin {
19
22
  setNotificationTokeniOS(options: {
20
23
  token: string;
21
24
  }): void;
25
+ setIOSNotificationName(options: {
26
+ name: string;
27
+ }): void;
22
28
  startLocationiOS(): void;
23
29
  startBluetoothiOS(): void;
24
30
  checkBluetoothiOS(): void;
@@ -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 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 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"]}
@@ -2,3 +2,6 @@ export declare function GLStart(token: string): void;
2
2
  export declare function GLRequestPermissions(): void;
3
3
  export declare function GLGetUserID(): Promise<string>;
4
4
  export declare function GLSetNotificationToken(token: string): void;
5
+ export declare function GLSetNotificationName(name: string): void;
6
+ export declare function GLSetNotificationNameAndroid(name: string): void;
7
+ export declare function GLSetNotificationNameIOS(name: string): void;
package/dist/esm/index.js CHANGED
@@ -63,6 +63,35 @@ export function GLSetNotificationToken(token) {
63
63
  });
64
64
  }
65
65
  }
66
+ export function GLSetNotificationName(name) {
67
+ registerGroupLinkPlugin();
68
+ if (Capacitor.getPlatform() === 'android') {
69
+ GroupLinkIonicPlugin.setAndroidNotificationName({
70
+ name: name
71
+ });
72
+ }
73
+ else if (Capacitor.getPlatform() === 'ios') {
74
+ GroupLinkIonicPlugin.setIOSNotificationName({
75
+ name: name,
76
+ });
77
+ }
78
+ }
79
+ export function GLSetNotificationNameAndroid(name) {
80
+ registerGroupLinkPlugin();
81
+ if (Capacitor.getPlatform() === 'android') {
82
+ GroupLinkIonicPlugin.setAndroidNotificationName({
83
+ name: name
84
+ });
85
+ }
86
+ }
87
+ export function GLSetNotificationNameIOS(name) {
88
+ registerGroupLinkPlugin();
89
+ if (Capacitor.getPlatform() === 'ios') {
90
+ GroupLinkIonicPlugin.setIOSNotificationName({
91
+ name: name
92
+ });
93
+ }
94
+ }
66
95
  function registerGroupLinkPlugin() {
67
96
  if (GroupLinkIonicPlugin == null) {
68
97
  GroupLinkIonicPlugin = registerPlugin('GroupLinkPlugin', {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE5D,IAAI,oBAAoB,GAAG,cAAc,CACvC,iBAAiB,EAAE;IACjB,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;CAC3D,CACF,CAAC;AAEF,MAAM,UAAU,OAAO,CAAC,KAAa;IACnC,uBAAuB,EAAE,CAAC;IAC1B,IAAI,SAAS,CAAC,WAAW,EAAE,KAAK,SAAS,EAAE,CAAC;QAC1C,oBAAoB,CAAC,YAAY,CAAC;YAChC,KAAK,EAAE,KAAK;YACZ,OAAO,EAAE,KAAK;SACf,CAAC,CAAC;IACL,CAAC;SAAM,IAAI,SAAS,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE,CAAC;QAC7C,oBAAoB,CAAC,QAAQ,CAAC;YAC5B,KAAK,EAAE,KAAK;SACb,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,MAAM,UAAU,oBAAoB;IAClC,IAAI,SAAS,CAAC,WAAW,EAAE,KAAK,SAAS,EAAE,CAAC;QAC1C,oBAAoB,CAAC,kBAAkB,EAAE,CAAC;IAC5C,CAAC;SAAM,IAAI,SAAS,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE,CAAC;QAC7C,oBAAoB,CAAC,iBAAiB,EAAE,CAAC;QACzC,oBAAoB,CAAC,gBAAgB,EAAE,CAAC;QACxC,oBAAoB,CAAC,oBAAoB,EAAE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AK,EAAE,CAAC;QAC7C,oBAAoB,CAAC,uBAAuB,CAAC;YAC3C,KAAK,EAAE,KAAK;SACb,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,SAAS,uBAAuB;IAC9B,IAAG,oBAAoB,IAAI,IAAI,EAAC,CAAC;QAC/B,oBAAoB,GAAG,cAAc,CACnC,iBAAiB,EAAE;YACjB,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;SAC3D,CACF,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import type { GroupLinkPlugin } from './definitions';\nimport { Capacitor, registerPlugin } from '@capacitor/core';\n\nvar GroupLinkIonicPlugin = registerPlugin<GroupLinkPlugin>(\n 'GroupLinkPlugin', {\n web: () => import('./web').then(m => new m.GroupLinkWeb()),\n },\n);\n\nexport function GLStart(token: string): void {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.startAndroid({\n token: token,\n isDebug: false,\n });\n } else if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.startiOS({\n token: token,\n });\n }\n}\n\nexport function GLRequestPermissions(){\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.requestPermissions();\n } else if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.startBluetoothiOS();\n GroupLinkIonicPlugin.startLocationiOS();\n GroupLinkIonicPlugin.startNotificationiOS();\n }\n}\n\nexport async function GLGetUserID(): Promise<string> {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n return await GroupLinkIonicPlugin.getAndroidUserId().then((ret) => {\n if (typeof ret?.userId == 'string') {\n return ret!.userId;\n } else {\n throw new Error(\"This device does not have an UserID\");\n }\n });\n } else if (Capacitor.getPlatform() === 'ios') {\n return await GroupLinkIonicPlugin.getUserIDiOS().then((ret) => {\n if (typeof ret?.userId == 'string') {\n return ret!.userId;\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}\n\nexport function GLSetNotificationToken(token: string): void {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.setAndroidFirebaseToken({\n firebaseToken: token\n })\n } else if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.setNotificationTokeniOS({\n token: token,\n });\n }\n}\n\nfunction registerGroupLinkPlugin(){\n if(GroupLinkIonicPlugin == null){\n GroupLinkIonicPlugin = registerPlugin<GroupLinkPlugin>(\n 'GroupLinkPlugin', {\n web: () => import('./web').then(m => new m.GroupLinkWeb()),\n },\n );\n }\n}"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE5D,IAAI,oBAAoB,GAAG,cAAc,CACvC,iBAAiB,EAAE;IACjB,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;CAC3D,CACF,CAAC;AAEF,MAAM,UAAU,OAAO,CAAC,KAAa;IACnC,uBAAuB,EAAE,CAAC;IAC1B,IAAI,SAAS,CAAC,WAAW,EAAE,KAAK,SAAS,EAAE,CAAC;QAC1C,oBAAoB,CAAC,YAAY,CAAC;YAChC,KAAK,EAAE,KAAK;YACZ,OAAO,EAAE,KAAK;SACf,CAAC,CAAC;IACL,CAAC;SAAM,IAAI,SAAS,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE,CAAC;QAC7C,oBAAoB,CAAC,QAAQ,CAAC;YAC5B,KAAK,EAAE,KAAK;SACb,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,MAAM,UAAU,oBAAoB;IA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ACD,SAAS,uBAAuB;IAC9B,IAAG,oBAAoB,IAAI,IAAI,EAAC,CAAC;QAC/B,oBAAoB,GAAG,cAAc,CACnC,iBAAiB,EAAE;YACjB,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;SAC3D,CACF,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import type { GroupLinkPlugin } from './definitions';\nimport { Capacitor, registerPlugin } from '@capacitor/core';\n\nvar GroupLinkIonicPlugin = registerPlugin<GroupLinkPlugin>(\n 'GroupLinkPlugin', {\n web: () => import('./web').then(m => new m.GroupLinkWeb()),\n },\n);\n\nexport function GLStart(token: string): void {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.startAndroid({\n token: token,\n isDebug: false,\n });\n } else if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.startiOS({\n token: token,\n });\n }\n}\n\nexport function GLRequestPermissions(){\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.requestPermissions();\n } else if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.startBluetoothiOS();\n GroupLinkIonicPlugin.startLocationiOS();\n GroupLinkIonicPlugin.startNotificationiOS();\n }\n}\n\nexport async function GLGetUserID(): Promise<string> {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n return await GroupLinkIonicPlugin.getAndroidUserId().then((ret) => {\n if (typeof ret?.userId == 'string') {\n return ret!.userId;\n } else {\n throw new Error(\"This device does not have an UserID\");\n }\n });\n } else if (Capacitor.getPlatform() === 'ios') {\n return await GroupLinkIonicPlugin.getUserIDiOS().then((ret) => {\n if (typeof ret?.userId == 'string') {\n return ret!.userId;\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}\n\nexport function GLSetNotificationToken(token: string): void {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.setAndroidFirebaseToken({\n firebaseToken: token\n })\n } else if (Capacitor.getPlatform() === 'ios') {\n GroupLinkIonicPlugin.setNotificationTokeniOS({\n token: token,\n });\n }\n}\nexport function GLSetNotificationName(name: string): void {\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: string): void {\n registerGroupLinkPlugin();\n if (Capacitor.getPlatform() === 'android') {\n GroupLinkIonicPlugin.setAndroidNotificationName({\n name: name\n })\n } \n}\nexport function GLSetNotificationNameIOS(name: string): void {\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 'GroupLinkPlugin', {\n web: () => import('./web').then(m => new m.GroupLinkWeb()),\n },\n );\n }\n}"]}
package/dist/esm/web.d.ts CHANGED
@@ -1,27 +1,34 @@
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;
16
+ setAndroidNotificationName(_options: {
17
+ name: string;
18
+ }): void;
15
19
  getAndroidUserId(): Promise<{
16
20
  userId: string;
17
21
  }>;
18
22
  requestPermissions(): void;
19
- startiOS(options: {
23
+ startiOS(_options: {
20
24
  token: string;
21
25
  }): void;
22
- setNotificationTokeniOS(options: {
26
+ setNotificationTokeniOS(_options: {
23
27
  token: string;
24
28
  }): void;
29
+ setIOSNotificationName(_options: {
30
+ name: string;
31
+ }): void;
25
32
  startLocationiOS(): void;
26
33
  startBluetoothiOS(): void;
27
34
  checkBluetoothiOS(): 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 getAndroidUserId(): Promise<{ userId: string }>;\n requestPermissions(): void;\n startiOS(options: { token: string }): void;\n setNotificationTokeniOS(options: { token: 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
@@ -66,6 +66,35 @@ function GLSetNotificationToken(token) {
66
66
  });
67
67
  }
68
68
  }
69
+ function GLSetNotificationName(name) {
70
+ registerGroupLinkPlugin();
71
+ if (core.Capacitor.getPlatform() === 'android') {
72
+ GroupLinkIonicPlugin.setAndroidNotificationName({
73
+ name: name
74
+ });
75
+ }
76
+ else if (core.Capacitor.getPlatform() === 'ios') {
77
+ GroupLinkIonicPlugin.setIOSNotificationName({
78
+ name: name,
79
+ });
80
+ }
81
+ }
82
+ function GLSetNotificationNameAndroid(name) {
83
+ registerGroupLinkPlugin();
84
+ if (core.Capacitor.getPlatform() === 'android') {
85
+ GroupLinkIonicPlugin.setAndroidNotificationName({
86
+ name: name
87
+ });
88
+ }
89
+ }
90
+ function GLSetNotificationNameIOS(name) {
91
+ registerGroupLinkPlugin();
92
+ if (core.Capacitor.getPlatform() === 'ios') {
93
+ GroupLinkIonicPlugin.setIOSNotificationName({
94
+ name: name
95
+ });
96
+ }
97
+ }
69
98
  function registerGroupLinkPlugin() {
70
99
  if (GroupLinkIonicPlugin == null) {
71
100
  GroupLinkIonicPlugin = core.registerPlugin('GroupLinkPlugin', {
@@ -74,12 +103,64 @@ function registerGroupLinkPlugin() {
74
103
  }
75
104
  }
76
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
+
77
154
  var web = /*#__PURE__*/Object.freeze({
78
- __proto__: null
155
+ __proto__: null,
156
+ GroupLinkWeb: GroupLinkWeb
79
157
  });
80
158
 
81
159
  exports.GLGetUserID = GLGetUserID;
82
160
  exports.GLRequestPermissions = GLRequestPermissions;
161
+ exports.GLSetNotificationName = GLSetNotificationName;
162
+ exports.GLSetNotificationNameAndroid = GLSetNotificationNameAndroid;
163
+ exports.GLSetNotificationNameIOS = GLSetNotificationNameIOS;
83
164
  exports.GLSetNotificationToken = GLSetNotificationToken;
84
165
  exports.GLStart = GLStart;
85
166
  //# sourceMappingURL=plugin.cjs.map
@@ -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}\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,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;AAC9D,CAAC,CAAC;AACK,SAAS,OAAO,CAAC,KAAK,EAAE;AAC/B,IAAI,uBAAuB,EAAE;AAC7B,IAAI,IAAIC,cAAS,CAAC,WAAW,EAAE,KAAK,SAAS,EAAE;AAC/C,QAAQ,oBAAoB,CAAC,YAAY,CAAC;AAC1C,YAAY,KAAK,EAAE,KAAK;AACxB,YAAY,OAAO,EAAE,KAAK;AAC1B,SAAS,CAAC;AACV,IAAI;AACJ,SAAS,IAAIA,cAAS,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE;AAChD,QAAQ,oBAAoB,CAAC,QAAQ,CAAC;AACtC,YAAY,KAAK,EAAE,KAAK;AACxB,SAAS,CAAC;AACV,IAAI;AACJ;AACO,SAAS,oBAAoB,GAAG;AACvC,IAAI,IAAIA,cAAS,CAAC,WAAW,EAAE,KAAK,SAAS,EAAE;AAC/C,QAAQ,oBAAoB,CAAC,kBAAkB,EAAE;AACjD,IAAI;AACJ,SAAS,IAAIA,cAAS,CAAC,WAAW,EAAE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;AAC7B,IAAI,IAAIA,cAAS,CAAC,WAAW,EAAE,KAAK,SAAS,EAAE;AAC/C,QAAQ,oBAAoB,CAAC,uBAAuB,CAAC;AACrD,YAAY,aAAa,EAAE;AAC3B,SAAS,CAAC;AACV,IAAI;AACJ,SAAS,IAAIA,cAAS,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE;AAChD,QAAQ,oBAAoB,CAAC,uBAAuB,CAAC;AACrD,YAAY,KAAK,EAAE,KAAK;AACxB,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,YAAY,EAAE,CAAC;AAC9D,CAAC,CAAC;AACK,SAAS,OAAO,CAAC,KAAK,EAAE;AAC/B,IAAI,uBAAuB,EAAE;AAC7B,IAAI,IAAIC,cAAS,CAAC,WAAW,EAAE,KAAK,SAAS,EAAE;AAC/C,QAAQ,oBAAoB,CAAC,YAAY,CAAC;AAC1C,YAAY,KAAK,EAAE,KAAK;AACxB,YAAY,OAAO,EAAE,KAAK;AAC1B,SAAS,CAAC;AACV,IAAI;AACJ,SAAS,IAAIA,cAAS,CAAC,WAAW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,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,IAAI,CAAC,kBAAkB,CAAC,kBAAkB,CAAC;AACnD,IAAI;AACJ,IAAI,kBAAkB,GAAG;AACzB,QAAQ,IAAI,CAAC,kBAAkB,CAAC,oBAAoB,CAAC;AACrD,IAAI;AACJ,IAAI,QAAQ,CAAC,QAAQ,EAAE;AACvB,QAAQ,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC;AAC3C,IAAI;AACJ,IAAI,uBAAuB,CAAC,QAAQ,EAAE;AACtC,QAAQ,IAAI,CAAC,kBAAkB,CAAC,yBAAyB,CAAC;AAC1D,IAAI;AACJ,IAAI,sBAAsB,CAAC,QAAQ,EAAE;AACrC,QAAQ,IAAI,CAAC,kBAAkB,CAAC,wBAAwB,CAAC;AACzD,IAAI;AACJ,IAAI,gBAAgB,GAAG;AACvB,QAAQ,IAAI,CAAC,kBAAkB,CAAC,kBAAkB,CAAC;AACnD,IAAI;AACJ,IAAI,iBAAiB,GAAG;AACxB,QAAQ,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,CAAC;AACpD,IAAI;AACJ,IAAI,iBAAiB,GAAG;AACxB,QAAQ,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,CAAC;AACpD,IAAI;AACJ,IAAI,MAAM,YAAY,GAAG;AACzB,QAAQ,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC;AAC/C,IAAI;AACJ;;;;;;;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -65,6 +65,35 @@ var capacitorGroupLinkIonicPlugin = (function (exports, core) {
65
65
  });
66
66
  }
67
67
  }
68
+ function GLSetNotificationName(name) {
69
+ registerGroupLinkPlugin();
70
+ if (core.Capacitor.getPlatform() === 'android') {
71
+ GroupLinkIonicPlugin.setAndroidNotificationName({
72
+ name: name
73
+ });
74
+ }
75
+ else if (core.Capacitor.getPlatform() === 'ios') {
76
+ GroupLinkIonicPlugin.setIOSNotificationName({
77
+ name: name,
78
+ });
79
+ }
80
+ }
81
+ function GLSetNotificationNameAndroid(name) {
82
+ registerGroupLinkPlugin();
83
+ if (core.Capacitor.getPlatform() === 'android') {
84
+ GroupLinkIonicPlugin.setAndroidNotificationName({
85
+ name: name
86
+ });
87
+ }
88
+ }
89
+ function GLSetNotificationNameIOS(name) {
90
+ registerGroupLinkPlugin();
91
+ if (core.Capacitor.getPlatform() === 'ios') {
92
+ GroupLinkIonicPlugin.setIOSNotificationName({
93
+ name: name
94
+ });
95
+ }
96
+ }
68
97
  function registerGroupLinkPlugin() {
69
98
  if (GroupLinkIonicPlugin == null) {
70
99
  GroupLinkIonicPlugin = core.registerPlugin('GroupLinkPlugin', {
@@ -73,12 +102,64 @@ var capacitorGroupLinkIonicPlugin = (function (exports, core) {
73
102
  }
74
103
  }
75
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
+
76
153
  var web = /*#__PURE__*/Object.freeze({
77
- __proto__: null
154
+ __proto__: null,
155
+ GroupLinkWeb: GroupLinkWeb
78
156
  });
79
157
 
80
158
  exports.GLGetUserID = GLGetUserID;
81
159
  exports.GLRequestPermissions = GLRequestPermissions;
160
+ exports.GLSetNotificationName = GLSetNotificationName;
161
+ exports.GLSetNotificationNameAndroid = GLSetNotificationNameAndroid;
162
+ exports.GLSetNotificationNameIOS = GLSetNotificationNameIOS;
82
163
  exports.GLSetNotificationToken = GLSetNotificationToken;
83
164
  exports.GLStart = GLStart;
84
165
 
@@ -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}\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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,YAAY;IACZ,iBAAiB;IACjB,gBAAgB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC;IACtE,YAAY;IACZ,QAAQ,CAAC,CAAC;IACV,IAAI;IACJ,IAAI,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC;IAC1D;IACO,SAAS,sBAAsB,CAAC,KAAK,EAAE;IAC9C,IAAI,uBAAuB,EAAE;IAC7B,IAAI,IAAIA,cAAS,CAAC,WAAW,EAAE,KAAK,SAAS,EAAE;IAC/C,QAAQ,oBAAoB,CAAC,uBAAuB,CAAC;IACrD,YAAY,aAAa,EAAE;IAC3B,SAAS,CAAC;IACV,IAAI;IACJ,SAAS,IAAIA,cAAS,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE;IAChD,QAAQ,oBAAoB,CAAC,uBAAuB,CAAC;IACrD,YAAY,KAAK,EAAE,KAAK;IACxB,SAAS,CAAC;IACV,IAAI;IACJ;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,IAA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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,60 +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)
98
+ }
99
+ }
100
+
101
+ // MARK: Set Notification Name
102
+ @objc func setIOSNotificationName(_ call: CAPPluginCall) {
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)
48
113
  }
49
- GroupLinkNotifications.setRemoteNotificationToken(token)
50
- call.resolve()
51
114
  }
52
- // MARK: Get UserID
115
+
116
+ // MARK: Get UserID
53
117
  @objc func getUserIDiOS(_ call: CAPPluginCall) {
54
- guard let userID: String = GroupLinkSDK.getUserID() else {
55
- call.reject("Failed to get user ID")
56
- 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)
57
127
  }
58
- 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)")
59
138
  }
60
139
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grouplinknetwork/group-link-ionic-plugin",
3
- "version": "1.0.2",
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,14 +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
- )