capacitor-event-bird 0.0.24 → 0.0.26
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 +16 -0
- package/dist/docs.json +16 -0
- package/dist/esm/definitions.d.ts +6 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +6 -0
- package/dist/esm/web.js +3 -0
- package/dist/esm/web.js.map +1 -1
- package/ios/Sources/CapacitorEventBirdPlugin/CapacitorEventBirdPlugin.swift +21 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@ npx cap sync
|
|
|
18
18
|
* [`openHelpModal()`](#openhelpmodal)
|
|
19
19
|
* [`getDeviceId()`](#getdeviceid)
|
|
20
20
|
* [`getFCMToken(...)`](#getfcmtoken)
|
|
21
|
+
* [`saveCredentials(...)`](#savecredentials)
|
|
21
22
|
|
|
22
23
|
</docgen-index>
|
|
23
24
|
|
|
@@ -78,4 +79,19 @@ getFCMToken(options: { value: string; }) => Promise<{ value: string; }>
|
|
|
78
79
|
|
|
79
80
|
--------------------
|
|
80
81
|
|
|
82
|
+
|
|
83
|
+
### saveCredentials(...)
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
saveCredentials(options: { username: string; password: string; }) => Promise<{ isSuccess: boolean; }>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
| Param | Type |
|
|
90
|
+
| ------------- | ---------------------------------------------------- |
|
|
91
|
+
| **`options`** | <code>{ username: string; password: string; }</code> |
|
|
92
|
+
|
|
93
|
+
**Returns:** <code>Promise<{ isSuccess: boolean; }></code>
|
|
94
|
+
|
|
95
|
+
--------------------
|
|
96
|
+
|
|
81
97
|
</docgen-api>
|
package/dist/docs.json
CHANGED
|
@@ -60,6 +60,22 @@
|
|
|
60
60
|
"docs": "",
|
|
61
61
|
"complexTypes": [],
|
|
62
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"
|
|
63
79
|
}
|
|
64
80
|
],
|
|
65
81
|
"properties": []
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface CapacitorEventBirdPlugin {\n signupWithGoogle(): Promise<{ displayName: string; email: string
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export 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}\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
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
|
+
saveCredentials(_: {
|
|
5
|
+
username: string;
|
|
6
|
+
password: string;
|
|
7
|
+
}): Promise<{
|
|
8
|
+
isSuccess: boolean;
|
|
9
|
+
}>;
|
|
4
10
|
getFCMToken(options: {
|
|
5
11
|
value: string;
|
|
6
12
|
}): Promise<{
|
package/dist/esm/web.js
CHANGED
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,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 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
|
|
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"]}
|
|
@@ -12,13 +12,32 @@ public class CapacitorEventBirdPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
12
12
|
CAPPluginMethod(name: "openHelpModal", returnType: CAPPluginReturnPromise),
|
|
13
13
|
CAPPluginMethod(name: "getDeviceId", returnType: CAPPluginReturnPromise),
|
|
14
14
|
CAPPluginMethod(name: "signupWithGoogle", returnType: CAPPluginReturnPromise),
|
|
15
|
+
CAPPluginMethod(name: "saveCredentials", returnType: CAPPluginReturnPromise),
|
|
15
16
|
]
|
|
16
17
|
|
|
17
18
|
private var pendingFCMCalls: [CAPPluginCall] = []
|
|
18
19
|
private var pendingGoogleCalls: [CAPPluginCall] = []
|
|
20
|
+
private var pendingSaveCredentialsCall: [CAPPluginCall] = []
|
|
19
21
|
|
|
20
22
|
private var savedFCMToken: String?
|
|
21
23
|
|
|
24
|
+
@objc func saveCredentials(_ call: CAPPluginCall) {
|
|
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()")
|
|
34
|
+
|
|
35
|
+
for call in pendingSaveCredentialsCall {
|
|
36
|
+
call.resolve(["isSuccess": isSuccess])
|
|
37
|
+
}
|
|
38
|
+
pendingSaveCredentialsCall.removeAll()
|
|
39
|
+
}
|
|
40
|
+
|
|
22
41
|
@objc func getFCMToken(_ call: CAPPluginCall) {
|
|
23
42
|
if let token = savedFCMToken {
|
|
24
43
|
print("[Native] JS called getFCMToken, passing the token.")
|
|
@@ -56,6 +75,8 @@ public class CapacitorEventBirdPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
56
75
|
call.resolve(["value": token])
|
|
57
76
|
}
|
|
58
77
|
pendingFCMCalls.removeAll()
|
|
78
|
+
|
|
79
|
+
notifyListeners("fcmTokenRefreshed", data: ["token": token])
|
|
59
80
|
}
|
|
60
81
|
|
|
61
82
|
@objc func openHelpModal(_ call: CAPPluginCall) {
|