capacitor-event-bird 0.0.5 → 0.0.7
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 +10 -0
- package/dist/docs.json +10 -0
- package/dist/esm/definitions.d.ts +1 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +1 -0
- package/dist/esm/web.js +6 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +6 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +6 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CapacitorEventBirdPlugin/CapacitorEventBirdPlugin.swift +14 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,6 +14,7 @@ npx cap sync
|
|
|
14
14
|
<docgen-index>
|
|
15
15
|
|
|
16
16
|
* [`echo(...)`](#echo)
|
|
17
|
+
* [`notifyNativeReady()`](#notifynativeready)
|
|
17
18
|
* [`logout()`](#logout)
|
|
18
19
|
* [`addListener('authTokenReceived', ...)`](#addlistenerauthtokenreceived-)
|
|
19
20
|
* [Interfaces](#interfaces)
|
|
@@ -38,6 +39,15 @@ echo(options: { value: string; }) => Promise<{ value: string; }>
|
|
|
38
39
|
--------------------
|
|
39
40
|
|
|
40
41
|
|
|
42
|
+
### notifyNativeReady()
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
notifyNativeReady() => Promise<void>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
--------------------
|
|
49
|
+
|
|
50
|
+
|
|
41
51
|
### logout()
|
|
42
52
|
|
|
43
53
|
```typescript
|
package/dist/docs.json
CHANGED
|
@@ -21,6 +21,16 @@
|
|
|
21
21
|
"complexTypes": [],
|
|
22
22
|
"slug": "echo"
|
|
23
23
|
},
|
|
24
|
+
{
|
|
25
|
+
"name": "notifyNativeReady",
|
|
26
|
+
"signature": "() => Promise<void>",
|
|
27
|
+
"parameters": [],
|
|
28
|
+
"returns": "Promise<void>",
|
|
29
|
+
"tags": [],
|
|
30
|
+
"docs": "",
|
|
31
|
+
"complexTypes": [],
|
|
32
|
+
"slug": "notifynativeready"
|
|
33
|
+
},
|
|
24
34
|
{
|
|
25
35
|
"name": "logout",
|
|
26
36
|
"signature": "() => Promise<void>",
|
|
@@ -7,6 +7,7 @@ export interface CapacitorEventBirdPlugin {
|
|
|
7
7
|
}): Promise<{
|
|
8
8
|
value: string;
|
|
9
9
|
}>;
|
|
10
|
+
notifyNativeReady(): Promise<void>;
|
|
10
11
|
logout(): Promise<void>;
|
|
11
12
|
addListener(eventName: 'authTokenReceived', listenerFunc: (data: AuthTokenReceivedData) => void): Promise<{
|
|
12
13
|
remove: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface AuthTokenReceivedData {\n token: string;\n}\n\nexport interface CapacitorEventBirdPlugin {\n echo(options: { value: string }): Promise<{ value: string }>;\n logout(): Promise<void>;\n addListener(\n eventName: 'authTokenReceived',\n listenerFunc: (data: AuthTokenReceivedData) => void\n ): Promise<{ remove: () => void }>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface AuthTokenReceivedData {\n token: string;\n}\n\nexport interface CapacitorEventBirdPlugin {\n echo(options: { value: string }): Promise<{ value: string }>;\n notifyNativeReady(): Promise<void>;\n logout(): Promise<void>;\n addListener(\n eventName: 'authTokenReceived',\n listenerFunc: (data: AuthTokenReceivedData) => void\n ): Promise<{ remove: () => void }>;\n}\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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
|
+
notifyNativeReady(): Promise<void>;
|
|
4
5
|
echo(options: {
|
|
5
6
|
value: string;
|
|
6
7
|
}): Promise<{
|
package/dist/esm/web.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
|
2
2
|
export class CapacitorEventBirdWeb extends WebPlugin {
|
|
3
|
+
notifyNativeReady() {
|
|
4
|
+
console.log('notifyNativeReady() not implemented.');
|
|
5
|
+
return new Promise((resolve, _) => {
|
|
6
|
+
resolve();
|
|
7
|
+
});
|
|
8
|
+
}
|
|
3
9
|
async echo(options) {
|
|
4
10
|
console.log('ECHO', options);
|
|
5
11
|
return options;
|
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,IAAI,CAAC,OAA0B;QACnC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,
|
|
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,iBAAiB;QACf,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;QAEpD,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE;YACtC,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAA0B;QACnC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;IACnE,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { CapacitorEventBirdPlugin } from './definitions';\n\nexport class CapacitorEventBirdWeb extends WebPlugin implements CapacitorEventBirdPlugin {\n notifyNativeReady(): Promise<void> {\n console.log('notifyNativeReady() not implemented.');\n\n return new Promise<void>((resolve, _) => {\n resolve();\n })\n }\n\n async echo(options: { value: string }): Promise<{ value: string }> {\n console.log('ECHO', 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"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -7,6 +7,12 @@ const CapacitorEventBird = core.registerPlugin('CapacitorEventBird', {
|
|
|
7
7
|
});
|
|
8
8
|
|
|
9
9
|
class CapacitorEventBirdWeb extends core.WebPlugin {
|
|
10
|
+
notifyNativeReady() {
|
|
11
|
+
console.log('notifyNativeReady() not implemented.');
|
|
12
|
+
return new Promise((resolve, _) => {
|
|
13
|
+
resolve();
|
|
14
|
+
});
|
|
15
|
+
}
|
|
10
16
|
async echo(options) {
|
|
11
17
|
console.log('ECHO', options);
|
|
12
18
|
return options;
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorEventBird = registerPlugin('CapacitorEventBird', {\n web: () => import('./web').then((m) => new m.CapacitorEventBirdWeb()),\n});\nexport * from './definitions';\nexport { CapacitorEventBird };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorEventBirdWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async logout() {\n console.log('logout in web isnt really needed it already works');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,kBAAkB,GAAGA,mBAAc,CAAC,oBAAoB,EAAE;AAChE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,qBAAqB,EAAE,CAAC;AACzE,CAAC;;ACFM,MAAM,qBAAqB,SAASC,cAAS,CAAC;AACrD,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;AACpC,QAAQ,OAAO,OAAO;AACtB;AACA,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC;AACxE;AACA;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorEventBird = registerPlugin('CapacitorEventBird', {\n web: () => import('./web').then((m) => new m.CapacitorEventBirdWeb()),\n});\nexport * from './definitions';\nexport { CapacitorEventBird };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorEventBirdWeb extends WebPlugin {\n notifyNativeReady() {\n console.log('notifyNativeReady() not implemented.');\n return new Promise((resolve, _) => {\n resolve();\n });\n }\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async logout() {\n console.log('logout in web isnt really needed it already works');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,kBAAkB,GAAGA,mBAAc,CAAC,oBAAoB,EAAE;AAChE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,qBAAqB,EAAE,CAAC;AACzE,CAAC;;ACFM,MAAM,qBAAqB,SAASC,cAAS,CAAC;AACrD,IAAI,iBAAiB,GAAG;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC;AAC3D,QAAQ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,KAAK;AAC3C,YAAY,OAAO,EAAE;AACrB,SAAS,CAAC;AACV;AACA,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;AACpC,QAAQ,OAAO,OAAO;AACtB;AACA,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC;AACxE;AACA;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -6,6 +6,12 @@ var capacitorCapacitorEventBird = (function (exports, core) {
|
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
class CapacitorEventBirdWeb extends core.WebPlugin {
|
|
9
|
+
notifyNativeReady() {
|
|
10
|
+
console.log('notifyNativeReady() not implemented.');
|
|
11
|
+
return new Promise((resolve, _) => {
|
|
12
|
+
resolve();
|
|
13
|
+
});
|
|
14
|
+
}
|
|
9
15
|
async echo(options) {
|
|
10
16
|
console.log('ECHO', options);
|
|
11
17
|
return options;
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorEventBird = registerPlugin('CapacitorEventBird', {\n web: () => import('./web').then((m) => new m.CapacitorEventBirdWeb()),\n});\nexport * from './definitions';\nexport { CapacitorEventBird };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorEventBirdWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async logout() {\n console.log('logout in web isnt really needed it already works');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,kBAAkB,GAAGA,mBAAc,CAAC,oBAAoB,EAAE;IAChE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,qBAAqB,EAAE,CAAC;IACzE,CAAC;;ICFM,MAAM,qBAAqB,SAASC,cAAS,CAAC;IACrD,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IACpC,QAAQ,OAAO,OAAO;IACtB;IACA,IAAI,MAAM,MAAM,GAAG;IACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC;IACxE;IACA;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorEventBird = registerPlugin('CapacitorEventBird', {\n web: () => import('./web').then((m) => new m.CapacitorEventBirdWeb()),\n});\nexport * from './definitions';\nexport { CapacitorEventBird };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorEventBirdWeb extends WebPlugin {\n notifyNativeReady() {\n console.log('notifyNativeReady() not implemented.');\n return new Promise((resolve, _) => {\n resolve();\n });\n }\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async logout() {\n console.log('logout in web isnt really needed it already works');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,kBAAkB,GAAGA,mBAAc,CAAC,oBAAoB,EAAE;IAChE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,qBAAqB,EAAE,CAAC;IACzE,CAAC;;ICFM,MAAM,qBAAqB,SAASC,cAAS,CAAC;IACrD,IAAI,iBAAiB,GAAG;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC;IAC3D,QAAQ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,KAAK;IAC3C,YAAY,OAAO,EAAE;IACrB,SAAS,CAAC;IACV;IACA,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IACpC,QAAQ,OAAO,OAAO;IACtB;IACA,IAAI,MAAM,MAAM,GAAG;IACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC;IACxE;IACA;;;;;;;;;;;;;;;"}
|
|
@@ -8,12 +8,8 @@ public class CapacitorEventBirdPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
8
8
|
|
|
9
9
|
public let pluginMethods: [CAPPluginMethod] = [
|
|
10
10
|
CAPPluginMethod(name: "echo", returnType: CAPPluginReturnPromise),
|
|
11
|
-
CAPPluginMethod(name: "logout", returnType: CAPPluginReturnPromise)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
// Register the supported events
|
|
15
|
-
public let pluginEvents: [CAPPluginEvent] = [
|
|
16
|
-
CAPPluginEvent(name: "authTokenReceived", returnType: CAPPluginReturnCallback)
|
|
11
|
+
CAPPluginMethod(name: "logout", returnType: CAPPluginReturnPromise),
|
|
12
|
+
CAPPluginMethod(name: "notifyNativeReady", returnType: CAPPluginReturnPromise),
|
|
17
13
|
]
|
|
18
14
|
|
|
19
15
|
private let implementation = CapacitorEventBird()
|
|
@@ -39,4 +35,16 @@ public class CapacitorEventBirdPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
39
35
|
data: json
|
|
40
36
|
)
|
|
41
37
|
}
|
|
38
|
+
|
|
39
|
+
@objc func notifyNativeReady(_ call: CAPPluginCall) {
|
|
40
|
+
print("[Native] JS signaled ready")
|
|
41
|
+
|
|
42
|
+
// If we already have a token pending, send it now
|
|
43
|
+
if let token = AppDelegate.shared?.pendingToken {
|
|
44
|
+
sendAuthTokenToJS(token)
|
|
45
|
+
AppDelegate.shared?.pendingToken = nil
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
call.resolve()
|
|
49
|
+
}
|
|
42
50
|
}
|