capacitor-event-bird 0.0.29 → 0.0.31

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 CHANGED
@@ -13,15 +13,15 @@ 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
+ * [`getFontScale()`](#getfontscale)
24
23
  * [`addListener('fcmTokenRefreshed', ...)`](#addlistenerfcmtokenrefreshed-)
24
+ * [`addListener('fontScaleChanged', ...)`](#addlistenerfontscalechanged-)
25
25
  * [Interfaces](#interfaces)
26
26
 
27
27
  </docgen-index>
@@ -29,90 +29,83 @@ npx cap sync
29
29
  <docgen-api>
30
30
  <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
31
31
 
32
- ### echo(...)
32
+ ### signupWithGoogle()
33
33
 
34
34
  ```typescript
35
- echo(options: { value: string; }) => Promise<{ value: string; }>
35
+ signupWithGoogle() => Promise<{ displayName: string; email: string; firebaseToken: string; }>
36
36
  ```
37
37
 
38
- | Param | Type |
39
- | ------------- | ------------------------------- |
40
- | **`options`** | <code>{ value: string; }</code> |
41
-
42
- **Returns:** <code>Promise&lt;{ value: string; }&gt;</code>
38
+ **Returns:** <code>Promise&lt;{ displayName: string; email: string; firebaseToken: string; }&gt;</code>
43
39
 
44
40
  --------------------
45
41
 
46
42
 
47
- ### logout()
43
+ ### waitlistAfterInit()
48
44
 
49
45
  ```typescript
50
- logout() => Promise<void>
46
+ waitlistAfterInit() => Promise<void>
51
47
  ```
52
48
 
53
49
  --------------------
54
50
 
55
51
 
56
- ### signupWithGoogle()
52
+ ### openHelpModal()
57
53
 
58
54
  ```typescript
59
- signupWithGoogle() => Promise<void>
55
+ openHelpModal() => Promise<void>
60
56
  ```
61
57
 
62
58
  --------------------
63
59
 
64
60
 
65
- ### waitlistAfterInit()
61
+ ### getDeviceId()
66
62
 
67
63
  ```typescript
68
- waitlistAfterInit() => Promise<void>
64
+ getDeviceId() => Promise<{ value: string; }>
69
65
  ```
70
66
 
71
- --------------------
72
-
73
-
74
- ### openHelpModal()
75
-
76
- ```typescript
77
- openHelpModal() => Promise<void>
78
- ```
67
+ **Returns:** <code>Promise&lt;{ value: string; }&gt;</code>
79
68
 
80
69
  --------------------
81
70
 
82
71
 
83
- ### getDeviceId()
72
+ ### getFCMToken(...)
84
73
 
85
74
  ```typescript
86
- getDeviceId() => Promise<{ value: string; }>
75
+ getFCMToken(options: { value: string; }) => Promise<{ value: string; }>
87
76
  ```
88
77
 
78
+ | Param | Type |
79
+ | ------------- | ------------------------------- |
80
+ | **`options`** | <code>{ value: string; }</code> |
81
+
89
82
  **Returns:** <code>Promise&lt;{ value: string; }&gt;</code>
90
83
 
91
84
  --------------------
92
85
 
93
86
 
94
- ### getGoogleData()
87
+ ### saveCredentials(...)
95
88
 
96
89
  ```typescript
97
- getGoogleData() => Promise<{ displayName: string; email: string; firebaseToken: string; }>
90
+ saveCredentials(options: { username: string; password: string; }) => Promise<{ isSuccess: boolean; }>
98
91
  ```
99
92
 
100
- **Returns:** <code>Promise&lt;{ displayName: string; email: string; firebaseToken: string; }&gt;</code>
93
+ | Param | Type |
94
+ | ------------- | ---------------------------------------------------- |
95
+ | **`options`** | <code>{ username: string; password: string; }</code> |
96
+
97
+ **Returns:** <code>Promise&lt;{ isSuccess: boolean; }&gt;</code>
101
98
 
102
99
  --------------------
103
100
 
104
101
 
105
- ### getFCMToken(...)
102
+ ### getFontScale()
106
103
 
107
104
  ```typescript
108
- getFCMToken(options: { value: string; }) => Promise<{ value: string; }>
105
+ getFontScale() => Promise<{ scale: number; category: string; }>
109
106
  ```
110
107
 
111
- | Param | Type |
112
- | ------------- | ------------------------------- |
113
- | **`options`** | <code>{ value: string; }</code> |
114
-
115
- **Returns:** <code>Promise&lt;{ value: string; }&gt;</code>
108
+ **Returns:** <code>Promise&lt;{ scale: number; category: string; }&gt;</code>
116
109
 
117
110
  --------------------
118
111
 
@@ -133,6 +126,22 @@ addListener(eventName: 'fcmTokenRefreshed', listenerFunc: (data: { token: string
133
126
  --------------------
134
127
 
135
128
 
129
+ ### addListener('fontScaleChanged', ...)
130
+
131
+ ```typescript
132
+ addListener(eventName: 'fontScaleChanged', listenerFunc: (data: { scale: number; category: string; }) => void) => Promise<PluginListenerHandle>
133
+ ```
134
+
135
+ | Param | Type |
136
+ | ------------------ | -------------------------------------------------------------------- |
137
+ | **`eventName`** | <code>'fontScaleChanged'</code> |
138
+ | **`listenerFunc`** | <code>(data: { scale: number; category: string; }) =&gt; void</code> |
139
+
140
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
141
+
142
+ --------------------
143
+
144
+
136
145
  ### Interfaces
137
146
 
138
147
 
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<void>",
10
+ "signature": "() => Promise<{ displayName: string; email: string; firebaseToken: string; }>",
37
11
  "parameters": [],
38
- "returns": "Promise<void>",
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; }>",
@@ -97,6 +61,32 @@
97
61
  "complexTypes": [],
98
62
  "slug": "getfcmtoken"
99
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": "getFontScale",
82
+ "signature": "() => Promise<{ scale: number; category: string; }>",
83
+ "parameters": [],
84
+ "returns": "Promise<{ scale: number; category: string; }>",
85
+ "tags": [],
86
+ "docs": "",
87
+ "complexTypes": [],
88
+ "slug": "getfontscale"
89
+ },
100
90
  {
101
91
  "name": "addListener",
102
92
  "signature": "(eventName: 'fcmTokenRefreshed', listenerFunc: (data: { token: string; }) => void) => Promise<PluginListenerHandle>",
@@ -119,6 +109,29 @@
119
109
  "PluginListenerHandle"
120
110
  ],
121
111
  "slug": "addlistenerfcmtokenrefreshed-"
112
+ },
113
+ {
114
+ "name": "addListener",
115
+ "signature": "(eventName: 'fontScaleChanged', listenerFunc: (data: { scale: number; category: string; }) => void) => Promise<PluginListenerHandle>",
116
+ "parameters": [
117
+ {
118
+ "name": "eventName",
119
+ "docs": "",
120
+ "type": "'fontScaleChanged'"
121
+ },
122
+ {
123
+ "name": "listenerFunc",
124
+ "docs": "",
125
+ "type": "(data: { scale: number; category: string; }) => void"
126
+ }
127
+ ],
128
+ "returns": "Promise<PluginListenerHandle>",
129
+ "tags": [],
130
+ "docs": "",
131
+ "complexTypes": [
132
+ "PluginListenerHandle"
133
+ ],
134
+ "slug": "addlistenerfontscalechanged-"
122
135
  }
123
136
  ],
124
137
  "properties": []
@@ -1,28 +1,35 @@
1
1
  import { PluginListenerHandle } from '@capacitor/core';
2
2
  export interface CapacitorEventBirdPlugin {
3
- echo(options: {
4
- value: string;
5
- }): Promise<{
6
- value: string;
3
+ signupWithGoogle(): Promise<{
4
+ displayName: string;
5
+ email: string;
6
+ firebaseToken: string;
7
7
  }>;
8
- logout(): Promise<void>;
9
- signupWithGoogle(): Promise<void>;
10
8
  waitlistAfterInit(): Promise<void>;
11
9
  openHelpModal(): Promise<void>;
12
10
  getDeviceId(): Promise<{
13
11
  value: string;
14
12
  }>;
15
- getGoogleData(): Promise<{
16
- displayName: string;
17
- email: string;
18
- firebaseToken: string;
19
- }>;
20
13
  getFCMToken(options: {
21
14
  value: string;
22
15
  }): Promise<{
23
16
  value: string;
24
17
  }>;
18
+ saveCredentials(options: {
19
+ username: string;
20
+ password: string;
21
+ }): Promise<{
22
+ isSuccess: boolean;
23
+ }>;
24
+ getFontScale(): Promise<{
25
+ scale: number;
26
+ category: string;
27
+ }>;
25
28
  addListener(eventName: 'fcmTokenRefreshed', listenerFunc: (data: {
26
29
  token: string;
27
30
  }) => void): Promise<PluginListenerHandle>;
31
+ addListener(eventName: 'fontScaleChanged', listenerFunc: (data: {
32
+ scale: number;
33
+ category: string;
34
+ }) => void): Promise<PluginListenerHandle>;
28
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import { PluginListenerHandle } from '@capacitor/core';\n\nexport 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 addListener(\n eventName: 'fcmTokenRefreshed',\n listenerFunc: (data: { token: string }) => void,\n ): Promise<PluginListenerHandle>;\n}\n"]}
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 getFontScale(): Promise<{ scale: number; category: string }>;\n addListener(\n eventName: 'fcmTokenRefreshed',\n listenerFunc: (data: { token: string }) => void,\n ): Promise<PluginListenerHandle>;\n addListener(\n eventName: 'fontScaleChanged',\n listenerFunc: (data: { scale: number; category: string }) => void,\n ): Promise<PluginListenerHandle>;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -1,26 +1,29 @@
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
- echo(options: {
5
- value: string;
4
+ saveCredentials(_: {
5
+ username: string;
6
+ password: string;
6
7
  }): Promise<{
7
- value: string;
8
+ isSuccess: boolean;
8
9
  }>;
9
10
  getFCMToken(options: {
10
11
  value: string;
11
12
  }): Promise<{
12
13
  value: string;
13
14
  }>;
14
- logout(): Promise<void>;
15
- signupWithGoogle(): Promise<void>;
16
- openHelpModal(): Promise<void>;
17
- waitlistAfterInit(): Promise<void>;
18
- getDeviceId(): Promise<{
19
- value: string;
15
+ getFontScale(): Promise<{
16
+ scale: number;
17
+ category: string;
20
18
  }>;
21
- getGoogleData(): Promise<{
19
+ signupWithGoogle(): Promise<{
22
20
  displayName: string;
23
21
  email: string;
24
22
  firebaseToken: string;
25
23
  }>;
24
+ openHelpModal(): Promise<void>;
25
+ waitlistAfterInit(): Promise<void>;
26
+ getDeviceId(): Promise<{
27
+ value: string;
28
+ }>;
26
29
  }
package/dist/esm/web.js CHANGED
@@ -1,18 +1,22 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
2
  export class CapacitorEventBirdWeb extends WebPlugin {
3
- async echo(options) {
4
- console.log('ECHO', options);
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');
10
+ async getFontScale() {
11
+ return { scale: 1, category: 'L' };
13
12
  }
14
13
  async signupWithGoogle() {
15
14
  console.log('signupWithGoogle in web isnt really needed it already works');
15
+ return {
16
+ displayName: '',
17
+ email: '',
18
+ firebaseToken: '',
19
+ };
16
20
  }
17
21
  async openHelpModal() {
18
22
  console.log('openHelpModal in web isnt really needed it already works');
@@ -23,12 +27,5 @@ export class CapacitorEventBirdWeb extends WebPlugin {
23
27
  async getDeviceId() {
24
28
  return { value: 'ios device id is not needed for web' };
25
29
  }
26
- async getGoogleData() {
27
- return {
28
- displayName: '',
29
- email: '',
30
- firebaseToken: '',
31
- };
32
- }
33
30
  }
34
31
  //# sourceMappingURL=web.js.map
@@ -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,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"]}
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,YAAY;QAChB,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC;IACrC,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 getFontScale(): Promise<{ scale: number; category: string }> {\n return { scale: 1, category: 'L' };\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: "getGoogleData", returnType: CAPPluginReturnPromise),
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
- private let implementation = CapacitorEventBird()
24
+ @objc func saveCredentials(_ call: CAPPluginCall) {
25
+ let username = call.getString("username") ?? ""
26
+ let password = call.getString("password") ?? ""
28
27
 
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)
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 getGoogleData(_ call: CAPPluginCall) {
55
- print("[Native] JS called getGoogleData, but data not ready. Queuing callback.")
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,40 +74,42 @@ 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()
82
+ @objc func openHelpModal(_ call: CAPPluginCall) {
83
+ NotificationCenter.default.post(name: Notification.Name("HelpBeaconOpenEvent"), object: nil)
84
+ call.resolve()
87
85
  }
88
86
 
89
- @objc func logout(_ call: CAPPluginCall) {
90
- NotificationCenter.default.post(name: Notification.Name("NativeLogoutEvent"), object: nil)
91
- savedToken = nil
92
- pendingEchoCalls.removeAll()
87
+ @objc func waitlistAfterInit(_ call: CAPPluginCall) {
88
+ NotificationCenter.default.post(name: Notification.Name("WaitlistAfterInit"), object: nil)
93
89
  call.resolve()
94
90
  }
95
91
 
96
- @objc func signupWithGoogle(_ call: CAPPluginCall) {
97
- NotificationCenter.default.post(name: Notification.Name("CapacitorSignupWithGoogle"), object: nil)
98
- call.resolve()
92
+ @objc func getFontScale(_ call: CAPPluginCall) {
93
+ call.resolve(currentFontScalePayload())
99
94
  }
100
95
 
101
- @objc func openHelpModal(_ call: CAPPluginCall) {
102
- NotificationCenter.default.post(name: Notification.Name("HelpBeaconOpenEvent"), object: nil)
103
- call.resolve()
96
+ @objc private func contentSizeCategoryDidChange() {
97
+ notifyListeners("fontScaleChanged", data: currentFontScalePayload())
104
98
  }
105
99
 
106
- @objc func waitlistAfterInit(_ call: CAPPluginCall) {
107
- NotificationCenter.default.post(name: Notification.Name("WaitlistAfterInit"), object: nil)
108
- call.resolve()
100
+ private func currentFontScalePayload() -> [String: Any] {
101
+ let category = UIApplication.shared.preferredContentSizeCategory
102
+ return [
103
+ "scale": Self.scale(for: category),
104
+ "category": category.rawValue,
105
+ ]
106
+ }
107
+
108
+ private static func scale(for category: UIContentSizeCategory) -> Double {
109
+ let traits = UITraitCollection(preferredContentSizeCategory: category)
110
+ let baseSize: CGFloat = 17
111
+ let scaledSize = UIFontMetrics(forTextStyle: .body)
112
+ .scaledValue(for: baseSize, compatibleWith: traits)
113
+ return Double(scaledSize / baseSize)
109
114
  }
110
115
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-event-bird",
3
- "version": "0.0.29",
3
+ "version": "0.0.31",
4
4
  "description": "returns events back to native env",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -1,8 +0,0 @@
1
- import Foundation
2
-
3
- @objc public class CapacitorEventBird: NSObject {
4
- @objc public func echo(_ value: String) -> String {
5
- print(value)
6
- return value
7
- }
8
- }