capacitor-event-bird 0.0.28 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -34
- package/dist/docs.json +59 -39
- package/dist/esm/definitions.d.ts +14 -11
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +9 -10
- package/dist/esm/web.js +7 -13
- package/dist/esm/web.js.map +1 -1
- package/ios/Sources/CapacitorEventBirdPlugin/CapacitorEventBirdPlugin.swift +20 -39
- package/package.json +1 -1
- package/ios/Sources/CapacitorEventBirdPlugin/CapacitorEventBird.swift +0 -8
package/README.md
CHANGED
|
@@ -13,105 +13,113 @@ npx cap sync
|
|
|
13
13
|
|
|
14
14
|
<docgen-index>
|
|
15
15
|
|
|
16
|
-
* [`echo(...)`](#echo)
|
|
17
|
-
* [`logout()`](#logout)
|
|
18
16
|
* [`signupWithGoogle()`](#signupwithgoogle)
|
|
19
17
|
* [`waitlistAfterInit()`](#waitlistafterinit)
|
|
20
18
|
* [`openHelpModal()`](#openhelpmodal)
|
|
21
19
|
* [`getDeviceId()`](#getdeviceid)
|
|
22
|
-
* [`getGoogleData()`](#getgoogledata)
|
|
23
20
|
* [`getFCMToken(...)`](#getfcmtoken)
|
|
21
|
+
* [`saveCredentials(...)`](#savecredentials)
|
|
22
|
+
* [`addListener('fcmTokenRefreshed', ...)`](#addlistenerfcmtokenrefreshed-)
|
|
23
|
+
* [Interfaces](#interfaces)
|
|
24
24
|
|
|
25
25
|
</docgen-index>
|
|
26
26
|
|
|
27
27
|
<docgen-api>
|
|
28
28
|
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
29
29
|
|
|
30
|
-
###
|
|
30
|
+
### signupWithGoogle()
|
|
31
31
|
|
|
32
32
|
```typescript
|
|
33
|
-
|
|
33
|
+
signupWithGoogle() => Promise<{ displayName: string; email: string; firebaseToken: string; }>
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
| ------------- | ------------------------------- |
|
|
38
|
-
| **`options`** | <code>{ value: string; }</code> |
|
|
39
|
-
|
|
40
|
-
**Returns:** <code>Promise<{ value: string; }></code>
|
|
36
|
+
**Returns:** <code>Promise<{ displayName: string; email: string; firebaseToken: string; }></code>
|
|
41
37
|
|
|
42
38
|
--------------------
|
|
43
39
|
|
|
44
40
|
|
|
45
|
-
###
|
|
41
|
+
### waitlistAfterInit()
|
|
46
42
|
|
|
47
43
|
```typescript
|
|
48
|
-
|
|
44
|
+
waitlistAfterInit() => Promise<void>
|
|
49
45
|
```
|
|
50
46
|
|
|
51
47
|
--------------------
|
|
52
48
|
|
|
53
49
|
|
|
54
|
-
###
|
|
50
|
+
### openHelpModal()
|
|
55
51
|
|
|
56
52
|
```typescript
|
|
57
|
-
|
|
53
|
+
openHelpModal() => Promise<void>
|
|
58
54
|
```
|
|
59
55
|
|
|
60
56
|
--------------------
|
|
61
57
|
|
|
62
58
|
|
|
63
|
-
###
|
|
59
|
+
### getDeviceId()
|
|
64
60
|
|
|
65
61
|
```typescript
|
|
66
|
-
|
|
62
|
+
getDeviceId() => Promise<{ value: string; }>
|
|
67
63
|
```
|
|
68
64
|
|
|
65
|
+
**Returns:** <code>Promise<{ value: string; }></code>
|
|
66
|
+
|
|
69
67
|
--------------------
|
|
70
68
|
|
|
71
69
|
|
|
72
|
-
###
|
|
70
|
+
### getFCMToken(...)
|
|
73
71
|
|
|
74
72
|
```typescript
|
|
75
|
-
|
|
73
|
+
getFCMToken(options: { value: string; }) => Promise<{ value: string; }>
|
|
76
74
|
```
|
|
77
75
|
|
|
76
|
+
| Param | Type |
|
|
77
|
+
| ------------- | ------------------------------- |
|
|
78
|
+
| **`options`** | <code>{ value: string; }</code> |
|
|
79
|
+
|
|
80
|
+
**Returns:** <code>Promise<{ value: string; }></code>
|
|
81
|
+
|
|
78
82
|
--------------------
|
|
79
83
|
|
|
80
84
|
|
|
81
|
-
###
|
|
85
|
+
### saveCredentials(...)
|
|
82
86
|
|
|
83
87
|
```typescript
|
|
84
|
-
|
|
88
|
+
saveCredentials(options: { username: string; password: string; }) => Promise<{ isSuccess: boolean; }>
|
|
85
89
|
```
|
|
86
90
|
|
|
87
|
-
|
|
91
|
+
| Param | Type |
|
|
92
|
+
| ------------- | ---------------------------------------------------- |
|
|
93
|
+
| **`options`** | <code>{ username: string; password: string; }</code> |
|
|
94
|
+
|
|
95
|
+
**Returns:** <code>Promise<{ isSuccess: boolean; }></code>
|
|
88
96
|
|
|
89
97
|
--------------------
|
|
90
98
|
|
|
91
99
|
|
|
92
|
-
###
|
|
100
|
+
### addListener('fcmTokenRefreshed', ...)
|
|
93
101
|
|
|
94
102
|
```typescript
|
|
95
|
-
|
|
103
|
+
addListener(eventName: 'fcmTokenRefreshed', listenerFunc: (data: { token: string; }) => void) => Promise<PluginListenerHandle>
|
|
96
104
|
```
|
|
97
105
|
|
|
98
|
-
|
|
106
|
+
| Param | Type |
|
|
107
|
+
| ------------------ | -------------------------------------------------- |
|
|
108
|
+
| **`eventName`** | <code>'fcmTokenRefreshed'</code> |
|
|
109
|
+
| **`listenerFunc`** | <code>(data: { token: string; }) => void</code> |
|
|
110
|
+
|
|
111
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
99
112
|
|
|
100
113
|
--------------------
|
|
101
114
|
|
|
102
115
|
|
|
103
|
-
###
|
|
116
|
+
### Interfaces
|
|
104
117
|
|
|
105
|
-
```typescript
|
|
106
|
-
getFCMToken(options: { value: string; }) => Promise<{ value: string; }>
|
|
107
|
-
```
|
|
108
118
|
|
|
109
|
-
|
|
110
|
-
| ------------- | ------------------------------- |
|
|
111
|
-
| **`options`** | <code>{ value: string; }</code> |
|
|
119
|
+
#### PluginListenerHandle
|
|
112
120
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
121
|
+
| Prop | Type |
|
|
122
|
+
| ------------ | ----------------------------------------- |
|
|
123
|
+
| **`remove`** | <code>() => Promise<void></code> |
|
|
116
124
|
|
|
117
125
|
</docgen-api>
|
package/dist/docs.json
CHANGED
|
@@ -5,37 +5,11 @@
|
|
|
5
5
|
"docs": "",
|
|
6
6
|
"tags": [],
|
|
7
7
|
"methods": [
|
|
8
|
-
{
|
|
9
|
-
"name": "echo",
|
|
10
|
-
"signature": "(options: { value: string; }) => Promise<{ value: string; }>",
|
|
11
|
-
"parameters": [
|
|
12
|
-
{
|
|
13
|
-
"name": "options",
|
|
14
|
-
"docs": "",
|
|
15
|
-
"type": "{ value: string; }"
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
"returns": "Promise<{ value: string; }>",
|
|
19
|
-
"tags": [],
|
|
20
|
-
"docs": "",
|
|
21
|
-
"complexTypes": [],
|
|
22
|
-
"slug": "echo"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"name": "logout",
|
|
26
|
-
"signature": "() => Promise<void>",
|
|
27
|
-
"parameters": [],
|
|
28
|
-
"returns": "Promise<void>",
|
|
29
|
-
"tags": [],
|
|
30
|
-
"docs": "",
|
|
31
|
-
"complexTypes": [],
|
|
32
|
-
"slug": "logout"
|
|
33
|
-
},
|
|
34
8
|
{
|
|
35
9
|
"name": "signupWithGoogle",
|
|
36
|
-
"signature": "() => Promise<
|
|
10
|
+
"signature": "() => Promise<{ displayName: string; email: string; firebaseToken: string; }>",
|
|
37
11
|
"parameters": [],
|
|
38
|
-
"returns": "Promise<
|
|
12
|
+
"returns": "Promise<{ displayName: string; email: string; firebaseToken: string; }>",
|
|
39
13
|
"tags": [],
|
|
40
14
|
"docs": "",
|
|
41
15
|
"complexTypes": [],
|
|
@@ -71,16 +45,6 @@
|
|
|
71
45
|
"complexTypes": [],
|
|
72
46
|
"slug": "getdeviceid"
|
|
73
47
|
},
|
|
74
|
-
{
|
|
75
|
-
"name": "getGoogleData",
|
|
76
|
-
"signature": "() => Promise<{ displayName: string; email: string; firebaseToken: string; }>",
|
|
77
|
-
"parameters": [],
|
|
78
|
-
"returns": "Promise<{ displayName: string; email: string; firebaseToken: string; }>",
|
|
79
|
-
"tags": [],
|
|
80
|
-
"docs": "",
|
|
81
|
-
"complexTypes": [],
|
|
82
|
-
"slug": "getgoogledata"
|
|
83
|
-
},
|
|
84
48
|
{
|
|
85
49
|
"name": "getFCMToken",
|
|
86
50
|
"signature": "(options: { value: string; }) => Promise<{ value: string; }>",
|
|
@@ -96,11 +60,67 @@
|
|
|
96
60
|
"docs": "",
|
|
97
61
|
"complexTypes": [],
|
|
98
62
|
"slug": "getfcmtoken"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "saveCredentials",
|
|
66
|
+
"signature": "(options: { username: string; password: string; }) => Promise<{ isSuccess: boolean; }>",
|
|
67
|
+
"parameters": [
|
|
68
|
+
{
|
|
69
|
+
"name": "options",
|
|
70
|
+
"docs": "",
|
|
71
|
+
"type": "{ username: string; password: string; }"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"returns": "Promise<{ isSuccess: boolean; }>",
|
|
75
|
+
"tags": [],
|
|
76
|
+
"docs": "",
|
|
77
|
+
"complexTypes": [],
|
|
78
|
+
"slug": "savecredentials"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"name": "addListener",
|
|
82
|
+
"signature": "(eventName: 'fcmTokenRefreshed', listenerFunc: (data: { token: string; }) => void) => Promise<PluginListenerHandle>",
|
|
83
|
+
"parameters": [
|
|
84
|
+
{
|
|
85
|
+
"name": "eventName",
|
|
86
|
+
"docs": "",
|
|
87
|
+
"type": "'fcmTokenRefreshed'"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "listenerFunc",
|
|
91
|
+
"docs": "",
|
|
92
|
+
"type": "(data: { token: string; }) => void"
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
"returns": "Promise<PluginListenerHandle>",
|
|
96
|
+
"tags": [],
|
|
97
|
+
"docs": "",
|
|
98
|
+
"complexTypes": [
|
|
99
|
+
"PluginListenerHandle"
|
|
100
|
+
],
|
|
101
|
+
"slug": "addlistenerfcmtokenrefreshed-"
|
|
99
102
|
}
|
|
100
103
|
],
|
|
101
104
|
"properties": []
|
|
102
105
|
},
|
|
103
|
-
"interfaces": [
|
|
106
|
+
"interfaces": [
|
|
107
|
+
{
|
|
108
|
+
"name": "PluginListenerHandle",
|
|
109
|
+
"slug": "pluginlistenerhandle",
|
|
110
|
+
"docs": "",
|
|
111
|
+
"tags": [],
|
|
112
|
+
"methods": [],
|
|
113
|
+
"properties": [
|
|
114
|
+
{
|
|
115
|
+
"name": "remove",
|
|
116
|
+
"tags": [],
|
|
117
|
+
"docs": "",
|
|
118
|
+
"complexTypes": [],
|
|
119
|
+
"type": "() => Promise<void>"
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
],
|
|
104
124
|
"enums": [],
|
|
105
125
|
"typeAliases": [],
|
|
106
126
|
"pluginConfigs": []
|
|
@@ -1,24 +1,27 @@
|
|
|
1
|
+
import { PluginListenerHandle } from '@capacitor/core';
|
|
1
2
|
export interface CapacitorEventBirdPlugin {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
signupWithGoogle(): Promise<{
|
|
4
|
+
displayName: string;
|
|
5
|
+
email: string;
|
|
6
|
+
firebaseToken: string;
|
|
6
7
|
}>;
|
|
7
|
-
logout(): Promise<void>;
|
|
8
|
-
signupWithGoogle(): Promise<void>;
|
|
9
8
|
waitlistAfterInit(): Promise<void>;
|
|
10
9
|
openHelpModal(): Promise<void>;
|
|
11
10
|
getDeviceId(): Promise<{
|
|
12
11
|
value: string;
|
|
13
12
|
}>;
|
|
14
|
-
getGoogleData(): Promise<{
|
|
15
|
-
displayName: string;
|
|
16
|
-
email: string;
|
|
17
|
-
firebaseToken: string;
|
|
18
|
-
}>;
|
|
19
13
|
getFCMToken(options: {
|
|
20
14
|
value: string;
|
|
21
15
|
}): Promise<{
|
|
22
16
|
value: string;
|
|
23
17
|
}>;
|
|
18
|
+
saveCredentials(options: {
|
|
19
|
+
username: string;
|
|
20
|
+
password: string;
|
|
21
|
+
}): Promise<{
|
|
22
|
+
isSuccess: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
addListener(eventName: 'fcmTokenRefreshed', listenerFunc: (data: {
|
|
25
|
+
token: string;
|
|
26
|
+
}) => void): Promise<PluginListenerHandle>;
|
|
24
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import { PluginListenerHandle } from '@capacitor/core';\n\nexport interface CapacitorEventBirdPlugin {\n signupWithGoogle(): Promise<{ displayName: string; email: string; firebaseToken: string }>;\n waitlistAfterInit(): Promise<void>;\n openHelpModal(): Promise<void>;\n getDeviceId(): Promise<{ value: string }>;\n getFCMToken(options: { value: string }): Promise<{ value: string }>;\n saveCredentials(options: { username: string; password: string }): Promise<{ isSuccess: boolean }>;\n addListener(\n eventName: 'fcmTokenRefreshed',\n listenerFunc: (data: { token: string }) => void,\n ): Promise<PluginListenerHandle>;\n}\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
|
2
2
|
import type { CapacitorEventBirdPlugin } from './definitions';
|
|
3
3
|
export declare class CapacitorEventBirdWeb extends WebPlugin implements CapacitorEventBirdPlugin {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
saveCredentials(_: {
|
|
5
|
+
username: string;
|
|
6
|
+
password: string;
|
|
6
7
|
}): Promise<{
|
|
7
|
-
|
|
8
|
+
isSuccess: boolean;
|
|
8
9
|
}>;
|
|
9
10
|
getFCMToken(options: {
|
|
10
11
|
value: string;
|
|
11
12
|
}): Promise<{
|
|
12
13
|
value: string;
|
|
13
14
|
}>;
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
signupWithGoogle(): Promise<{
|
|
16
|
+
displayName: string;
|
|
17
|
+
email: string;
|
|
18
|
+
firebaseToken: string;
|
|
19
|
+
}>;
|
|
16
20
|
openHelpModal(): Promise<void>;
|
|
17
21
|
waitlistAfterInit(): Promise<void>;
|
|
18
22
|
getDeviceId(): Promise<{
|
|
19
23
|
value: string;
|
|
20
24
|
}>;
|
|
21
|
-
getGoogleData(): Promise<{
|
|
22
|
-
displayName: string;
|
|
23
|
-
email: string;
|
|
24
|
-
firebaseToken: string;
|
|
25
|
-
}>;
|
|
26
25
|
}
|
package/dist/esm/web.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
|
2
2
|
export class CapacitorEventBirdWeb extends WebPlugin {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return options;
|
|
3
|
+
saveCredentials(_) {
|
|
4
|
+
throw new Error('Method not implemented.');
|
|
6
5
|
}
|
|
7
6
|
async getFCMToken(options) {
|
|
8
7
|
console.log('getFCMToken', options);
|
|
9
8
|
return options;
|
|
10
9
|
}
|
|
11
|
-
async logout() {
|
|
12
|
-
console.log('logout in web isnt really needed it already works');
|
|
13
|
-
}
|
|
14
10
|
async signupWithGoogle() {
|
|
15
11
|
console.log('signupWithGoogle in web isnt really needed it already works');
|
|
12
|
+
return {
|
|
13
|
+
displayName: '',
|
|
14
|
+
email: '',
|
|
15
|
+
firebaseToken: '',
|
|
16
|
+
};
|
|
16
17
|
}
|
|
17
18
|
async openHelpModal() {
|
|
18
19
|
console.log('openHelpModal in web isnt really needed it already works');
|
|
@@ -23,12 +24,5 @@ export class CapacitorEventBirdWeb extends WebPlugin {
|
|
|
23
24
|
async getDeviceId() {
|
|
24
25
|
return { value: 'ios device id is not needed for web' };
|
|
25
26
|
}
|
|
26
|
-
async getGoogleData() {
|
|
27
|
-
return {
|
|
28
|
-
displayName: '',
|
|
29
|
-
email: '',
|
|
30
|
-
firebaseToken: '',
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
27
|
}
|
|
34
28
|
//# sourceMappingURL=web.js.map
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,qBAAsB,SAAQ,SAAS;IAClD,
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,qBAAsB,SAAQ,SAAS;IAClD,eAAe,CAAC,CAAyC;QACvD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAA0B;QAC1C,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QACpC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,CAAC,GAAG,CAAC,6DAA6D,CAAC,CAAC;QAC3E,OAAO;YACL,WAAW,EAAE,EAAE;YACf,KAAK,EAAE,EAAE;YACT,aAAa,EAAE,EAAE;SAClB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC;IAC1E,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC,CAAC;IAC9E,CAAC;IAED,KAAK,CAAC,WAAW;QACf,OAAO,EAAE,KAAK,EAAE,qCAAqC,EAAE,CAAC;IAC1D,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { CapacitorEventBirdPlugin } from './definitions';\n\nexport class CapacitorEventBirdWeb extends WebPlugin implements CapacitorEventBirdPlugin {\n saveCredentials(_: { username: string; password: string }): Promise<{ isSuccess: boolean }> {\n throw new Error('Method not implemented.');\n }\n\n async getFCMToken(options: { value: string }): Promise<{ value: string }> {\n console.log('getFCMToken', options);\n return options;\n }\n\n async signupWithGoogle(): Promise<{ displayName: string; email: string; firebaseToken: string }> {\n console.log('signupWithGoogle in web isnt really needed it already works');\n return {\n displayName: '',\n email: '',\n firebaseToken: '',\n };\n }\n\n async openHelpModal(): Promise<void> {\n console.log('openHelpModal in web isnt really needed it already works');\n }\n\n async waitlistAfterInit(): Promise<void> {\n console.log('waitlistAfterInit in web isnt really needed it already works');\n }\n\n async getDeviceId(): Promise<{ value: string }> {\n return { value: 'ios device id is not needed for web' };\n }\n}\n"]}
|
|
@@ -7,33 +7,35 @@ public class CapacitorEventBirdPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
7
7
|
public let jsName = "CapacitorEventBird"
|
|
8
8
|
|
|
9
9
|
public let pluginMethods: [CAPPluginMethod] = [
|
|
10
|
-
CAPPluginMethod(name: "echo", returnType: CAPPluginReturnPromise),
|
|
11
10
|
CAPPluginMethod(name: "getFCMToken", returnType: CAPPluginReturnPromise),
|
|
12
|
-
CAPPluginMethod(name: "logout", returnType: CAPPluginReturnPromise),
|
|
13
|
-
CAPPluginMethod(name: "signupWithGoogle", returnType: CAPPluginReturnPromise),
|
|
14
11
|
CAPPluginMethod(name: "waitlistAfterInit", returnType: CAPPluginReturnPromise),
|
|
15
12
|
CAPPluginMethod(name: "openHelpModal", returnType: CAPPluginReturnPromise),
|
|
16
13
|
CAPPluginMethod(name: "getDeviceId", returnType: CAPPluginReturnPromise),
|
|
17
|
-
CAPPluginMethod(name: "
|
|
14
|
+
CAPPluginMethod(name: "signupWithGoogle", returnType: CAPPluginReturnPromise),
|
|
15
|
+
CAPPluginMethod(name: "saveCredentials", returnType: CAPPluginReturnPromise),
|
|
18
16
|
]
|
|
19
17
|
|
|
20
|
-
private var pendingEchoCalls: [CAPPluginCall] = []
|
|
21
18
|
private var pendingFCMCalls: [CAPPluginCall] = []
|
|
22
19
|
private var pendingGoogleCalls: [CAPPluginCall] = []
|
|
20
|
+
private var pendingSaveCredentialsCall: [CAPPluginCall] = []
|
|
23
21
|
|
|
24
|
-
private var savedToken: String?
|
|
25
22
|
private var savedFCMToken: String?
|
|
26
23
|
|
|
27
|
-
|
|
24
|
+
@objc func saveCredentials(_ call: CAPPluginCall) {
|
|
25
|
+
let username = call.getString("username") ?? ""
|
|
26
|
+
let password = call.getString("password") ?? ""
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
NotificationCenter.default.post(name: Notification.Name("SaveCredentials"), object: ["username": username, "password": password])
|
|
29
|
+
pendingSaveCredentialsCall.append(call)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@objc public func saveCredentialsResult(_ isSuccess: Bool) {
|
|
33
|
+
print("[Native] saveCredentialsResult()")
|
|
34
|
+
|
|
35
|
+
for call in pendingSaveCredentialsCall {
|
|
36
|
+
call.resolve(["isSuccess": isSuccess])
|
|
36
37
|
}
|
|
38
|
+
pendingSaveCredentialsCall.removeAll()
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
@objc func getFCMToken(_ call: CAPPluginCall) {
|
|
@@ -51,8 +53,9 @@ public class CapacitorEventBirdPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
51
53
|
return
|
|
52
54
|
}
|
|
53
55
|
|
|
54
|
-
@objc func
|
|
55
|
-
|
|
56
|
+
@objc func signupWithGoogle(_ call: CAPPluginCall) {
|
|
57
|
+
NotificationCenter.default.post(name: Notification.Name("CapacitorSignupWithGoogle"), object: nil)
|
|
58
|
+
print("[Native] JS called getGoogleData, sending CapacitorSignupWithGoogle event")
|
|
56
59
|
pendingGoogleCalls.append(call)
|
|
57
60
|
}
|
|
58
61
|
|
|
@@ -71,33 +74,11 @@ public class CapacitorEventBirdPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
71
74
|
for call in pendingFCMCalls {
|
|
72
75
|
call.resolve(["value": token])
|
|
73
76
|
}
|
|
74
|
-
pendingFCMCalls.removeAll()
|
|
75
77
|
|
|
78
|
+
pendingFCMCalls.removeAll()
|
|
76
79
|
notifyListeners("fcmTokenRefreshed", data: ["token": token])
|
|
77
80
|
}
|
|
78
81
|
|
|
79
|
-
@objc public func setAuthToken(_ token: String) {
|
|
80
|
-
print("[Native] Setting auth token in plugin")
|
|
81
|
-
self.savedToken = token
|
|
82
|
-
|
|
83
|
-
for call in pendingEchoCalls {
|
|
84
|
-
call.resolve(["value": token])
|
|
85
|
-
}
|
|
86
|
-
pendingEchoCalls.removeAll()
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
@objc func logout(_ call: CAPPluginCall) {
|
|
90
|
-
NotificationCenter.default.post(name: Notification.Name("NativeLogoutEvent"), object: nil)
|
|
91
|
-
savedToken = nil
|
|
92
|
-
pendingEchoCalls.removeAll()
|
|
93
|
-
call.resolve()
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
@objc func signupWithGoogle(_ call: CAPPluginCall) {
|
|
97
|
-
NotificationCenter.default.post(name: Notification.Name("CapacitorSignupWithGoogle"), object: nil)
|
|
98
|
-
call.resolve()
|
|
99
|
-
}
|
|
100
|
-
|
|
101
82
|
@objc func openHelpModal(_ call: CAPPluginCall) {
|
|
102
83
|
NotificationCenter.default.post(name: Notification.Name("HelpBeaconOpenEvent"), object: nil)
|
|
103
84
|
call.resolve()
|
package/package.json
CHANGED