capacitor-event-bird 0.0.26 → 0.0.28
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 +37 -17
- package/dist/docs.json +38 -18
- package/dist/esm/definitions.d.ts +11 -10
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +10 -9
- package/dist/esm/web.js +13 -7
- package/dist/esm/web.js.map +1 -1
- package/ios/Sources/CapacitorEventBirdPlugin/CapacitorEventBird.swift +8 -0
- package/ios/Sources/CapacitorEventBirdPlugin/CapacitorEventBirdPlugin.swift +38 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,25 +13,49 @@ npx cap sync
|
|
|
13
13
|
|
|
14
14
|
<docgen-index>
|
|
15
15
|
|
|
16
|
+
* [`echo(...)`](#echo)
|
|
17
|
+
* [`logout()`](#logout)
|
|
16
18
|
* [`signupWithGoogle()`](#signupwithgoogle)
|
|
17
19
|
* [`waitlistAfterInit()`](#waitlistafterinit)
|
|
18
20
|
* [`openHelpModal()`](#openhelpmodal)
|
|
19
21
|
* [`getDeviceId()`](#getdeviceid)
|
|
22
|
+
* [`getGoogleData()`](#getgoogledata)
|
|
20
23
|
* [`getFCMToken(...)`](#getfcmtoken)
|
|
21
|
-
* [`saveCredentials(...)`](#savecredentials)
|
|
22
24
|
|
|
23
25
|
</docgen-index>
|
|
24
26
|
|
|
25
27
|
<docgen-api>
|
|
26
28
|
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
27
29
|
|
|
28
|
-
###
|
|
30
|
+
### echo(...)
|
|
29
31
|
|
|
30
32
|
```typescript
|
|
31
|
-
|
|
33
|
+
echo(options: { value: string; }) => Promise<{ value: string; }>
|
|
32
34
|
```
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
| Param | Type |
|
|
37
|
+
| ------------- | ------------------------------- |
|
|
38
|
+
| **`options`** | <code>{ value: string; }</code> |
|
|
39
|
+
|
|
40
|
+
**Returns:** <code>Promise<{ value: string; }></code>
|
|
41
|
+
|
|
42
|
+
--------------------
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### logout()
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
logout() => Promise<void>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
--------------------
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### signupWithGoogle()
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
signupWithGoogle() => Promise<void>
|
|
58
|
+
```
|
|
35
59
|
|
|
36
60
|
--------------------
|
|
37
61
|
|
|
@@ -65,32 +89,28 @@ getDeviceId() => Promise<{ value: string; }>
|
|
|
65
89
|
--------------------
|
|
66
90
|
|
|
67
91
|
|
|
68
|
-
###
|
|
92
|
+
### getGoogleData()
|
|
69
93
|
|
|
70
94
|
```typescript
|
|
71
|
-
|
|
95
|
+
getGoogleData() => Promise<{ displayName: string; email: string; firebaseToken: string; }>
|
|
72
96
|
```
|
|
73
97
|
|
|
74
|
-
|
|
75
|
-
| ------------- | ------------------------------- |
|
|
76
|
-
| **`options`** | <code>{ value: string; }</code> |
|
|
77
|
-
|
|
78
|
-
**Returns:** <code>Promise<{ value: string; }></code>
|
|
98
|
+
**Returns:** <code>Promise<{ displayName: string; email: string; firebaseToken: string; }></code>
|
|
79
99
|
|
|
80
100
|
--------------------
|
|
81
101
|
|
|
82
102
|
|
|
83
|
-
###
|
|
103
|
+
### getFCMToken(...)
|
|
84
104
|
|
|
85
105
|
```typescript
|
|
86
|
-
|
|
106
|
+
getFCMToken(options: { value: string; }) => Promise<{ value: string; }>
|
|
87
107
|
```
|
|
88
108
|
|
|
89
|
-
| Param | Type
|
|
90
|
-
| ------------- |
|
|
91
|
-
| **`options`** | <code>{
|
|
109
|
+
| Param | Type |
|
|
110
|
+
| ------------- | ------------------------------- |
|
|
111
|
+
| **`options`** | <code>{ value: string; }</code> |
|
|
92
112
|
|
|
93
|
-
**Returns:** <code>Promise<{
|
|
113
|
+
**Returns:** <code>Promise<{ value: string; }></code>
|
|
94
114
|
|
|
95
115
|
--------------------
|
|
96
116
|
|
package/dist/docs.json
CHANGED
|
@@ -5,11 +5,37 @@
|
|
|
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
|
+
},
|
|
8
34
|
{
|
|
9
35
|
"name": "signupWithGoogle",
|
|
10
|
-
"signature": "() => Promise<
|
|
36
|
+
"signature": "() => Promise<void>",
|
|
11
37
|
"parameters": [],
|
|
12
|
-
"returns": "Promise<
|
|
38
|
+
"returns": "Promise<void>",
|
|
13
39
|
"tags": [],
|
|
14
40
|
"docs": "",
|
|
15
41
|
"complexTypes": [],
|
|
@@ -46,36 +72,30 @@
|
|
|
46
72
|
"slug": "getdeviceid"
|
|
47
73
|
},
|
|
48
74
|
{
|
|
49
|
-
"name": "
|
|
50
|
-
"signature": "(
|
|
51
|
-
"parameters": [
|
|
52
|
-
|
|
53
|
-
"name": "options",
|
|
54
|
-
"docs": "",
|
|
55
|
-
"type": "{ value: string; }"
|
|
56
|
-
}
|
|
57
|
-
],
|
|
58
|
-
"returns": "Promise<{ value: string; }>",
|
|
75
|
+
"name": "getGoogleData",
|
|
76
|
+
"signature": "() => Promise<{ displayName: string; email: string; firebaseToken: string; }>",
|
|
77
|
+
"parameters": [],
|
|
78
|
+
"returns": "Promise<{ displayName: string; email: string; firebaseToken: string; }>",
|
|
59
79
|
"tags": [],
|
|
60
80
|
"docs": "",
|
|
61
81
|
"complexTypes": [],
|
|
62
|
-
"slug": "
|
|
82
|
+
"slug": "getgoogledata"
|
|
63
83
|
},
|
|
64
84
|
{
|
|
65
|
-
"name": "
|
|
66
|
-
"signature": "(options: {
|
|
85
|
+
"name": "getFCMToken",
|
|
86
|
+
"signature": "(options: { value: string; }) => Promise<{ value: string; }>",
|
|
67
87
|
"parameters": [
|
|
68
88
|
{
|
|
69
89
|
"name": "options",
|
|
70
90
|
"docs": "",
|
|
71
|
-
"type": "{
|
|
91
|
+
"type": "{ value: string; }"
|
|
72
92
|
}
|
|
73
93
|
],
|
|
74
|
-
"returns": "Promise<{
|
|
94
|
+
"returns": "Promise<{ value: string; }>",
|
|
75
95
|
"tags": [],
|
|
76
96
|
"docs": "",
|
|
77
97
|
"complexTypes": [],
|
|
78
|
-
"slug": "
|
|
98
|
+
"slug": "getfcmtoken"
|
|
79
99
|
}
|
|
80
100
|
],
|
|
81
101
|
"properties": []
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
export interface CapacitorEventBirdPlugin {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
echo(options: {
|
|
3
|
+
value: string;
|
|
4
|
+
}): Promise<{
|
|
5
|
+
value: string;
|
|
6
6
|
}>;
|
|
7
|
+
logout(): Promise<void>;
|
|
8
|
+
signupWithGoogle(): Promise<void>;
|
|
7
9
|
waitlistAfterInit(): Promise<void>;
|
|
8
10
|
openHelpModal(): Promise<void>;
|
|
9
11
|
getDeviceId(): Promise<{
|
|
10
12
|
value: string;
|
|
11
13
|
}>;
|
|
14
|
+
getGoogleData(): Promise<{
|
|
15
|
+
displayName: string;
|
|
16
|
+
email: string;
|
|
17
|
+
firebaseToken: string;
|
|
18
|
+
}>;
|
|
12
19
|
getFCMToken(options: {
|
|
13
20
|
value: string;
|
|
14
21
|
}): Promise<{
|
|
15
22
|
value: string;
|
|
16
23
|
}>;
|
|
17
|
-
saveCredentials(options: {
|
|
18
|
-
username: string;
|
|
19
|
-
password: string;
|
|
20
|
-
}): Promise<{
|
|
21
|
-
isSuccess: boolean;
|
|
22
|
-
}>;
|
|
23
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface CapacitorEventBirdPlugin {\n
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface CapacitorEventBirdPlugin {\n echo(options: { value: string }): Promise<{ value: string }>;\n logout(): Promise<void>;\n signupWithGoogle(): Promise<void>;\n waitlistAfterInit(): Promise<void>;\n openHelpModal(): Promise<void>;\n getDeviceId(): Promise<{ value: string }>;\n getGoogleData(): Promise<{ displayName: string; email: string, firebaseToken: string }>;\n getFCMToken(options: { value: string }): Promise<{ value: string }>;\n}\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
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
|
-
|
|
6
|
-
password: string;
|
|
4
|
+
echo(options: {
|
|
5
|
+
value: string;
|
|
7
6
|
}): Promise<{
|
|
8
|
-
|
|
7
|
+
value: string;
|
|
9
8
|
}>;
|
|
10
9
|
getFCMToken(options: {
|
|
11
10
|
value: string;
|
|
12
11
|
}): Promise<{
|
|
13
12
|
value: string;
|
|
14
13
|
}>;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
email: string;
|
|
18
|
-
firebaseToken: string;
|
|
19
|
-
}>;
|
|
14
|
+
logout(): Promise<void>;
|
|
15
|
+
signupWithGoogle(): Promise<void>;
|
|
20
16
|
openHelpModal(): Promise<void>;
|
|
21
17
|
waitlistAfterInit(): Promise<void>;
|
|
22
18
|
getDeviceId(): Promise<{
|
|
23
19
|
value: string;
|
|
24
20
|
}>;
|
|
21
|
+
getGoogleData(): Promise<{
|
|
22
|
+
displayName: string;
|
|
23
|
+
email: string;
|
|
24
|
+
firebaseToken: string;
|
|
25
|
+
}>;
|
|
25
26
|
}
|
package/dist/esm/web.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
|
2
2
|
export class CapacitorEventBirdWeb extends WebPlugin {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
async echo(options) {
|
|
4
|
+
console.log('ECHO', options);
|
|
5
|
+
return options;
|
|
5
6
|
}
|
|
6
7
|
async getFCMToken(options) {
|
|
7
8
|
console.log('getFCMToken', options);
|
|
8
9
|
return options;
|
|
9
10
|
}
|
|
11
|
+
async logout() {
|
|
12
|
+
console.log('logout in web isnt really needed it already works');
|
|
13
|
+
}
|
|
10
14
|
async signupWithGoogle() {
|
|
11
15
|
console.log('signupWithGoogle in web isnt really needed it already works');
|
|
12
|
-
return {
|
|
13
|
-
displayName: '',
|
|
14
|
-
email: '',
|
|
15
|
-
firebaseToken: '',
|
|
16
|
-
};
|
|
17
16
|
}
|
|
18
17
|
async openHelpModal() {
|
|
19
18
|
console.log('openHelpModal in web isnt really needed it already works');
|
|
@@ -24,5 +23,12 @@ export class CapacitorEventBirdWeb extends WebPlugin {
|
|
|
24
23
|
async getDeviceId() {
|
|
25
24
|
return { value: 'ios device id is not needed for web' };
|
|
26
25
|
}
|
|
26
|
+
async getGoogleData() {
|
|
27
|
+
return {
|
|
28
|
+
displayName: '',
|
|
29
|
+
email: '',
|
|
30
|
+
firebaseToken: '',
|
|
31
|
+
};
|
|
32
|
+
}
|
|
27
33
|
}
|
|
28
34
|
//# 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,KAAK,CAAC,IAAI,CAAC,OAA0B;QACnC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IACjB,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,MAAM;QACV,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;IACnE,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,CAAC,GAAG,CAAC,6DAA6D,CAAC,CAAC;IAC7E,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;IAED,KAAK,CAAC,aAAa;QACjB,OAAO;YACL,WAAW,EAAE,EAAE;YACf,KAAK,EAAE,EAAE;YACT,aAAa,EAAE,EAAE;SAClB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { CapacitorEventBirdPlugin } from './definitions';\n\nexport class CapacitorEventBirdWeb extends WebPlugin implements CapacitorEventBirdPlugin {\n async echo(options: { value: string }): Promise<{ value: string }> {\n console.log('ECHO', options);\n return options;\n }\n\n async getFCMToken(options: { value: string }): Promise<{ value: string }> {\n console.log('getFCMToken', options);\n return options;\n }\n\n async logout(): Promise<void> {\n console.log('logout in web isnt really needed it already works');\n }\n\n async signupWithGoogle(): Promise<void> {\n console.log('signupWithGoogle in web isnt really needed it already works');\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 async getGoogleData(): Promise<{ displayName: string; email: string; firebaseToken: string }> {\n return {\n displayName: '',\n email: '',\n firebaseToken: '',\n };\n }\n}\n"]}
|
|
@@ -7,35 +7,33 @@ 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),
|
|
10
11
|
CAPPluginMethod(name: "getFCMToken", returnType: CAPPluginReturnPromise),
|
|
12
|
+
CAPPluginMethod(name: "logout", returnType: CAPPluginReturnPromise),
|
|
13
|
+
CAPPluginMethod(name: "signupWithGoogle", returnType: CAPPluginReturnPromise),
|
|
11
14
|
CAPPluginMethod(name: "waitlistAfterInit", returnType: CAPPluginReturnPromise),
|
|
12
15
|
CAPPluginMethod(name: "openHelpModal", returnType: CAPPluginReturnPromise),
|
|
13
16
|
CAPPluginMethod(name: "getDeviceId", returnType: CAPPluginReturnPromise),
|
|
14
|
-
CAPPluginMethod(name: "
|
|
15
|
-
CAPPluginMethod(name: "saveCredentials", returnType: CAPPluginReturnPromise),
|
|
17
|
+
CAPPluginMethod(name: "getGoogleData", returnType: CAPPluginReturnPromise),
|
|
16
18
|
]
|
|
17
19
|
|
|
20
|
+
private var pendingEchoCalls: [CAPPluginCall] = []
|
|
18
21
|
private var pendingFCMCalls: [CAPPluginCall] = []
|
|
19
22
|
private var pendingGoogleCalls: [CAPPluginCall] = []
|
|
20
|
-
private var pendingSaveCredentialsCall: [CAPPluginCall] = []
|
|
21
23
|
|
|
24
|
+
private var savedToken: String?
|
|
22
25
|
private var savedFCMToken: String?
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
let username = call.getString("username") ?? ""
|
|
26
|
-
let password = call.getString("password") ?? ""
|
|
27
|
-
|
|
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()")
|
|
27
|
+
private let implementation = CapacitorEventBird()
|
|
34
28
|
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
@objc func echo(_ call: CAPPluginCall) {
|
|
30
|
+
if let token = savedToken {
|
|
31
|
+
print("[Native] JS called echo, passing the token.")
|
|
32
|
+
call.resolve(["value": token])
|
|
33
|
+
} else {
|
|
34
|
+
print("[Native] JS called echo, but token not ready. Queuing callback.")
|
|
35
|
+
pendingEchoCalls.append(call)
|
|
37
36
|
}
|
|
38
|
-
pendingSaveCredentialsCall.removeAll()
|
|
39
37
|
}
|
|
40
38
|
|
|
41
39
|
@objc func getFCMToken(_ call: CAPPluginCall) {
|
|
@@ -53,9 +51,8 @@ public class CapacitorEventBirdPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
53
51
|
return
|
|
54
52
|
}
|
|
55
53
|
|
|
56
|
-
@objc func
|
|
57
|
-
|
|
58
|
-
print("[Native] JS called getGoogleData, sending CapacitorSignupWithGoogle event")
|
|
54
|
+
@objc func getGoogleData(_ call: CAPPluginCall) {
|
|
55
|
+
print("[Native] JS called getGoogleData, but data not ready. Queuing callback.")
|
|
59
56
|
pendingGoogleCalls.append(call)
|
|
60
57
|
}
|
|
61
58
|
|
|
@@ -79,6 +76,28 @@ public class CapacitorEventBirdPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
79
76
|
notifyListeners("fcmTokenRefreshed", data: ["token": token])
|
|
80
77
|
}
|
|
81
78
|
|
|
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
|
+
|
|
82
101
|
@objc func openHelpModal(_ call: CAPPluginCall) {
|
|
83
102
|
NotificationCenter.default.post(name: Notification.Name("HelpBeaconOpenEvent"), object: nil)
|
|
84
103
|
call.resolve()
|