@capgo/capacitor-android-sms-retriever 8.0.1
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/CapgoCapacitorAndroidSmsRetriever.podspec +17 -0
- package/LICENSE +373 -0
- package/Package.swift +28 -0
- package/README.md +312 -0
- package/android/build.gradle +63 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/app/capgo/androidsmsretriever/AndroidSmsRetriever.java +137 -0
- package/android/src/main/java/app/capgo/androidsmsretriever/AndroidSmsRetrieverPlugin.java +224 -0
- package/android/src/main/java/app/capgo/androidsmsretriever/AppSignatureHashHelper.java +78 -0
- package/android/src/main/java/app/capgo/androidsmsretriever/SmsBroadcastReceiver.java +79 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +423 -0
- package/dist/esm/definitions.d.ts +165 -0
- package/dist/esm/definitions.js +2 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +9 -0
- package/dist/esm/web.js +21 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +35 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +38 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Sources/AndroidSmsRetrieverPlugin/AndroidSmsRetriever.swift +7 -0
- package/ios/Sources/AndroidSmsRetrieverPlugin/AndroidSmsRetrieverPlugin.swift +36 -0
- package/ios/Tests/AndroidSmsRetrieverPluginTests/AndroidSmsRetrieverTests.swift +11 -0
- package/package.json +94 -0
- package/src/definitions.ts +185 -0
- package/src/index.ts +10 -0
- package/src/web.ts +34 -0
package/dist/docs.json
ADDED
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
{
|
|
2
|
+
"api": {
|
|
3
|
+
"name": "AndroidSmsRetrieverPlugin",
|
|
4
|
+
"slug": "androidsmsretrieverplugin",
|
|
5
|
+
"docs": "Android-only Capacitor plugin for Google Play services SMS Retriever and Phone Number Hint APIs.",
|
|
6
|
+
"tags": [
|
|
7
|
+
{
|
|
8
|
+
"text": "8.0.0",
|
|
9
|
+
"name": "since"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"methods": [
|
|
13
|
+
{
|
|
14
|
+
"name": "startWatch",
|
|
15
|
+
"signature": "() => Promise<StartWatchResult>",
|
|
16
|
+
"parameters": [],
|
|
17
|
+
"returns": "Promise<StartWatchResult>",
|
|
18
|
+
"tags": [
|
|
19
|
+
{
|
|
20
|
+
"name": "since",
|
|
21
|
+
"text": "8.0.0"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"docs": "Start listening for one verification SMS through Android's SMS Retriever API.\n\nAndroid stops listening automatically when a matching message arrives or after the\nfive-minute SMS Retriever timeout. No SMS permissions are required.",
|
|
25
|
+
"complexTypes": [
|
|
26
|
+
"StartWatchResult"
|
|
27
|
+
],
|
|
28
|
+
"slug": "startwatch"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "stopWatch",
|
|
32
|
+
"signature": "() => Promise<StopWatchResult>",
|
|
33
|
+
"parameters": [],
|
|
34
|
+
"returns": "Promise<StopWatchResult>",
|
|
35
|
+
"tags": [
|
|
36
|
+
{
|
|
37
|
+
"name": "since",
|
|
38
|
+
"text": "8.0.0"
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"docs": "Stop the active SMS Retriever watch, if any.",
|
|
42
|
+
"complexTypes": [
|
|
43
|
+
"StopWatchResult"
|
|
44
|
+
],
|
|
45
|
+
"slug": "stopwatch"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "getHashString",
|
|
49
|
+
"signature": "() => Promise<GetHashStringResult>",
|
|
50
|
+
"parameters": [],
|
|
51
|
+
"returns": "Promise<GetHashStringResult>",
|
|
52
|
+
"tags": [
|
|
53
|
+
{
|
|
54
|
+
"name": "since",
|
|
55
|
+
"text": "8.0.0"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"docs": "Get the 11-character app hash for the installed app signature.\n\nGenerate this once for the signing key used to distribute the app and append it\nto verification SMS messages.",
|
|
59
|
+
"complexTypes": [
|
|
60
|
+
"GetHashStringResult"
|
|
61
|
+
],
|
|
62
|
+
"slug": "gethashstring"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "getPhoneNumber",
|
|
66
|
+
"signature": "() => Promise<GetPhoneNumberResult>",
|
|
67
|
+
"parameters": [],
|
|
68
|
+
"returns": "Promise<GetPhoneNumberResult>",
|
|
69
|
+
"tags": [
|
|
70
|
+
{
|
|
71
|
+
"name": "since",
|
|
72
|
+
"text": "8.0.0"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"docs": "Show Android's Phone Number Hint UI and return the user-selected SIM-based phone number.",
|
|
76
|
+
"complexTypes": [
|
|
77
|
+
"GetPhoneNumberResult"
|
|
78
|
+
],
|
|
79
|
+
"slug": "getphonenumber"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "addListener",
|
|
83
|
+
"signature": "(eventName: 'smsReceived', listenerFunc: (event: SmsReceivedEvent) => void) => Promise<PluginListenerHandle>",
|
|
84
|
+
"parameters": [
|
|
85
|
+
{
|
|
86
|
+
"name": "eventName",
|
|
87
|
+
"docs": "",
|
|
88
|
+
"type": "'smsReceived'"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"name": "listenerFunc",
|
|
92
|
+
"docs": "",
|
|
93
|
+
"type": "(event: SmsReceivedEvent) => void"
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
"returns": "Promise<PluginListenerHandle>",
|
|
97
|
+
"tags": [
|
|
98
|
+
{
|
|
99
|
+
"name": "since",
|
|
100
|
+
"text": "8.0.0"
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"docs": "Listen for a verification SMS received after {@link startWatch}.",
|
|
104
|
+
"complexTypes": [
|
|
105
|
+
"PluginListenerHandle",
|
|
106
|
+
"SmsReceivedEvent"
|
|
107
|
+
],
|
|
108
|
+
"slug": "addlistenersmsreceived-"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"name": "addListener",
|
|
112
|
+
"signature": "(eventName: 'smsRetrieverTimeout', listenerFunc: () => void) => Promise<PluginListenerHandle>",
|
|
113
|
+
"parameters": [
|
|
114
|
+
{
|
|
115
|
+
"name": "eventName",
|
|
116
|
+
"docs": "",
|
|
117
|
+
"type": "'smsRetrieverTimeout'"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"name": "listenerFunc",
|
|
121
|
+
"docs": "",
|
|
122
|
+
"type": "() => void"
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
"returns": "Promise<PluginListenerHandle>",
|
|
126
|
+
"tags": [
|
|
127
|
+
{
|
|
128
|
+
"name": "since",
|
|
129
|
+
"text": "8.0.0"
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
"docs": "Listen for the five-minute SMS Retriever timeout.",
|
|
133
|
+
"complexTypes": [
|
|
134
|
+
"PluginListenerHandle"
|
|
135
|
+
],
|
|
136
|
+
"slug": "addlistenersmsretrievertimeout-"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"name": "addListener",
|
|
140
|
+
"signature": "(eventName: 'smsRetrieverError', listenerFunc: (event: SmsRetrieverErrorEvent) => void) => Promise<PluginListenerHandle>",
|
|
141
|
+
"parameters": [
|
|
142
|
+
{
|
|
143
|
+
"name": "eventName",
|
|
144
|
+
"docs": "",
|
|
145
|
+
"type": "'smsRetrieverError'"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"name": "listenerFunc",
|
|
149
|
+
"docs": "",
|
|
150
|
+
"type": "(event: SmsRetrieverErrorEvent) => void"
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
"returns": "Promise<PluginListenerHandle>",
|
|
154
|
+
"tags": [
|
|
155
|
+
{
|
|
156
|
+
"name": "since",
|
|
157
|
+
"text": "8.0.0"
|
|
158
|
+
}
|
|
159
|
+
],
|
|
160
|
+
"docs": "Listen for SMS Retriever runtime errors after {@link startWatch}.",
|
|
161
|
+
"complexTypes": [
|
|
162
|
+
"PluginListenerHandle",
|
|
163
|
+
"SmsRetrieverErrorEvent"
|
|
164
|
+
],
|
|
165
|
+
"slug": "addlistenersmsretrievererror-"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"name": "removeAllListeners",
|
|
169
|
+
"signature": "() => Promise<void>",
|
|
170
|
+
"parameters": [],
|
|
171
|
+
"returns": "Promise<void>",
|
|
172
|
+
"tags": [
|
|
173
|
+
{
|
|
174
|
+
"name": "since",
|
|
175
|
+
"text": "8.0.0"
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
"docs": "Remove all registered listeners for this plugin.",
|
|
179
|
+
"complexTypes": [],
|
|
180
|
+
"slug": "removealllisteners"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"name": "getPluginVersion",
|
|
184
|
+
"signature": "() => Promise<PluginVersionResult>",
|
|
185
|
+
"parameters": [],
|
|
186
|
+
"returns": "Promise<PluginVersionResult>",
|
|
187
|
+
"tags": [
|
|
188
|
+
{
|
|
189
|
+
"name": "since",
|
|
190
|
+
"text": "8.0.0"
|
|
191
|
+
}
|
|
192
|
+
],
|
|
193
|
+
"docs": "Get the native Capacitor plugin version.",
|
|
194
|
+
"complexTypes": [
|
|
195
|
+
"PluginVersionResult"
|
|
196
|
+
],
|
|
197
|
+
"slug": "getpluginversion"
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
"properties": []
|
|
201
|
+
},
|
|
202
|
+
"interfaces": [
|
|
203
|
+
{
|
|
204
|
+
"name": "StartWatchResult",
|
|
205
|
+
"slug": "startwatchresult",
|
|
206
|
+
"docs": "Result returned when SMS Retriever watching starts.",
|
|
207
|
+
"tags": [
|
|
208
|
+
{
|
|
209
|
+
"text": "8.0.0",
|
|
210
|
+
"name": "since"
|
|
211
|
+
}
|
|
212
|
+
],
|
|
213
|
+
"methods": [],
|
|
214
|
+
"properties": [
|
|
215
|
+
{
|
|
216
|
+
"name": "status",
|
|
217
|
+
"tags": [
|
|
218
|
+
{
|
|
219
|
+
"text": "8.0.0",
|
|
220
|
+
"name": "since"
|
|
221
|
+
}
|
|
222
|
+
],
|
|
223
|
+
"docs": "Native status returned by Android.",
|
|
224
|
+
"complexTypes": [
|
|
225
|
+
"SmsRetrieverStartStatus"
|
|
226
|
+
],
|
|
227
|
+
"type": "SmsRetrieverStartStatus"
|
|
228
|
+
}
|
|
229
|
+
]
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"name": "StopWatchResult",
|
|
233
|
+
"slug": "stopwatchresult",
|
|
234
|
+
"docs": "Result returned when SMS Retriever watching stops.",
|
|
235
|
+
"tags": [
|
|
236
|
+
{
|
|
237
|
+
"text": "8.0.0",
|
|
238
|
+
"name": "since"
|
|
239
|
+
}
|
|
240
|
+
],
|
|
241
|
+
"methods": [],
|
|
242
|
+
"properties": [
|
|
243
|
+
{
|
|
244
|
+
"name": "status",
|
|
245
|
+
"tags": [
|
|
246
|
+
{
|
|
247
|
+
"text": "8.0.0",
|
|
248
|
+
"name": "since"
|
|
249
|
+
}
|
|
250
|
+
],
|
|
251
|
+
"docs": "Native status returned by Android.",
|
|
252
|
+
"complexTypes": [],
|
|
253
|
+
"type": "'SMS_RETRIEVER_DONE'"
|
|
254
|
+
}
|
|
255
|
+
]
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"name": "GetHashStringResult",
|
|
259
|
+
"slug": "gethashstringresult",
|
|
260
|
+
"docs": "Result returned by {@link AndroidSmsRetrieverPlugin.getHashString}.",
|
|
261
|
+
"tags": [
|
|
262
|
+
{
|
|
263
|
+
"text": "8.0.0",
|
|
264
|
+
"name": "since"
|
|
265
|
+
}
|
|
266
|
+
],
|
|
267
|
+
"methods": [],
|
|
268
|
+
"properties": [
|
|
269
|
+
{
|
|
270
|
+
"name": "hash",
|
|
271
|
+
"tags": [
|
|
272
|
+
{
|
|
273
|
+
"text": "8.0.0",
|
|
274
|
+
"name": "since"
|
|
275
|
+
}
|
|
276
|
+
],
|
|
277
|
+
"docs": "The 11-character app hash that must be appended to verification SMS messages.",
|
|
278
|
+
"complexTypes": [],
|
|
279
|
+
"type": "string"
|
|
280
|
+
}
|
|
281
|
+
]
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"name": "GetPhoneNumberResult",
|
|
285
|
+
"slug": "getphonenumberresult",
|
|
286
|
+
"docs": "Result returned by {@link AndroidSmsRetrieverPlugin.getPhoneNumber}.",
|
|
287
|
+
"tags": [
|
|
288
|
+
{
|
|
289
|
+
"text": "8.0.0",
|
|
290
|
+
"name": "since"
|
|
291
|
+
}
|
|
292
|
+
],
|
|
293
|
+
"methods": [],
|
|
294
|
+
"properties": [
|
|
295
|
+
{
|
|
296
|
+
"name": "phoneNumber",
|
|
297
|
+
"tags": [
|
|
298
|
+
{
|
|
299
|
+
"text": "8.0.0",
|
|
300
|
+
"name": "since"
|
|
301
|
+
}
|
|
302
|
+
],
|
|
303
|
+
"docs": "Phone number selected by the user from Android's Phone Number Hint UI.",
|
|
304
|
+
"complexTypes": [],
|
|
305
|
+
"type": "string"
|
|
306
|
+
}
|
|
307
|
+
]
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"name": "PluginListenerHandle",
|
|
311
|
+
"slug": "pluginlistenerhandle",
|
|
312
|
+
"docs": "",
|
|
313
|
+
"tags": [],
|
|
314
|
+
"methods": [],
|
|
315
|
+
"properties": [
|
|
316
|
+
{
|
|
317
|
+
"name": "remove",
|
|
318
|
+
"tags": [],
|
|
319
|
+
"docs": "",
|
|
320
|
+
"complexTypes": [],
|
|
321
|
+
"type": "() => Promise<void>"
|
|
322
|
+
}
|
|
323
|
+
]
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"name": "SmsReceivedEvent",
|
|
327
|
+
"slug": "smsreceivedevent",
|
|
328
|
+
"docs": "SMS Retriever message event payload.",
|
|
329
|
+
"tags": [
|
|
330
|
+
{
|
|
331
|
+
"text": "8.0.0",
|
|
332
|
+
"name": "since"
|
|
333
|
+
}
|
|
334
|
+
],
|
|
335
|
+
"methods": [],
|
|
336
|
+
"properties": [
|
|
337
|
+
{
|
|
338
|
+
"name": "message",
|
|
339
|
+
"tags": [
|
|
340
|
+
{
|
|
341
|
+
"text": "8.0.0",
|
|
342
|
+
"name": "since"
|
|
343
|
+
}
|
|
344
|
+
],
|
|
345
|
+
"docs": "Full verification SMS message received by Android's SMS Retriever API.",
|
|
346
|
+
"complexTypes": [],
|
|
347
|
+
"type": "string"
|
|
348
|
+
}
|
|
349
|
+
]
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"name": "SmsRetrieverErrorEvent",
|
|
353
|
+
"slug": "smsretrievererrorevent",
|
|
354
|
+
"docs": "SMS Retriever error event payload.",
|
|
355
|
+
"tags": [
|
|
356
|
+
{
|
|
357
|
+
"text": "8.0.0",
|
|
358
|
+
"name": "since"
|
|
359
|
+
}
|
|
360
|
+
],
|
|
361
|
+
"methods": [],
|
|
362
|
+
"properties": [
|
|
363
|
+
{
|
|
364
|
+
"name": "message",
|
|
365
|
+
"tags": [
|
|
366
|
+
{
|
|
367
|
+
"text": "8.0.0",
|
|
368
|
+
"name": "since"
|
|
369
|
+
}
|
|
370
|
+
],
|
|
371
|
+
"docs": "Error message returned by Android or Google Play services.",
|
|
372
|
+
"complexTypes": [],
|
|
373
|
+
"type": "string"
|
|
374
|
+
}
|
|
375
|
+
]
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
"name": "PluginVersionResult",
|
|
379
|
+
"slug": "pluginversionresult",
|
|
380
|
+
"docs": "Plugin version payload.",
|
|
381
|
+
"tags": [
|
|
382
|
+
{
|
|
383
|
+
"text": "8.0.0",
|
|
384
|
+
"name": "since"
|
|
385
|
+
}
|
|
386
|
+
],
|
|
387
|
+
"methods": [],
|
|
388
|
+
"properties": [
|
|
389
|
+
{
|
|
390
|
+
"name": "version",
|
|
391
|
+
"tags": [
|
|
392
|
+
{
|
|
393
|
+
"text": "8.0.0",
|
|
394
|
+
"name": "since"
|
|
395
|
+
}
|
|
396
|
+
],
|
|
397
|
+
"docs": "Version identifier returned by the platform implementation.",
|
|
398
|
+
"complexTypes": [],
|
|
399
|
+
"type": "string"
|
|
400
|
+
}
|
|
401
|
+
]
|
|
402
|
+
}
|
|
403
|
+
],
|
|
404
|
+
"enums": [],
|
|
405
|
+
"typeAliases": [
|
|
406
|
+
{
|
|
407
|
+
"name": "SmsRetrieverStartStatus",
|
|
408
|
+
"slug": "smsretrieverstartstatus",
|
|
409
|
+
"docs": "Status values returned by {@link AndroidSmsRetrieverPlugin.startWatch}.",
|
|
410
|
+
"types": [
|
|
411
|
+
{
|
|
412
|
+
"text": "'SMS_RETRIEVER_STARTED'",
|
|
413
|
+
"complexTypes": []
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
"text": "'SMS_RETRIEVER_ALREADY_STARTED'",
|
|
417
|
+
"complexTypes": []
|
|
418
|
+
}
|
|
419
|
+
]
|
|
420
|
+
}
|
|
421
|
+
],
|
|
422
|
+
"pluginConfigs": []
|
|
423
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import type { PluginListenerHandle } from '@capacitor/core';
|
|
2
|
+
/**
|
|
3
|
+
* Result returned when SMS Retriever watching starts.
|
|
4
|
+
*
|
|
5
|
+
* @since 8.0.0
|
|
6
|
+
*/
|
|
7
|
+
export interface StartWatchResult {
|
|
8
|
+
/**
|
|
9
|
+
* Native status returned by Android.
|
|
10
|
+
*
|
|
11
|
+
* @since 8.0.0
|
|
12
|
+
*/
|
|
13
|
+
status: SmsRetrieverStartStatus;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Result returned when SMS Retriever watching stops.
|
|
17
|
+
*
|
|
18
|
+
* @since 8.0.0
|
|
19
|
+
*/
|
|
20
|
+
export interface StopWatchResult {
|
|
21
|
+
/**
|
|
22
|
+
* Native status returned by Android.
|
|
23
|
+
*
|
|
24
|
+
* @since 8.0.0
|
|
25
|
+
*/
|
|
26
|
+
status: 'SMS_RETRIEVER_DONE';
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Result returned by {@link AndroidSmsRetrieverPlugin.getHashString}.
|
|
30
|
+
*
|
|
31
|
+
* @since 8.0.0
|
|
32
|
+
*/
|
|
33
|
+
export interface GetHashStringResult {
|
|
34
|
+
/**
|
|
35
|
+
* The 11-character app hash that must be appended to verification SMS messages.
|
|
36
|
+
*
|
|
37
|
+
* @since 8.0.0
|
|
38
|
+
*/
|
|
39
|
+
hash: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Result returned by {@link AndroidSmsRetrieverPlugin.getPhoneNumber}.
|
|
43
|
+
*
|
|
44
|
+
* @since 8.0.0
|
|
45
|
+
*/
|
|
46
|
+
export interface GetPhoneNumberResult {
|
|
47
|
+
/**
|
|
48
|
+
* Phone number selected by the user from Android's Phone Number Hint UI.
|
|
49
|
+
*
|
|
50
|
+
* @since 8.0.0
|
|
51
|
+
*/
|
|
52
|
+
phoneNumber: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* SMS Retriever message event payload.
|
|
56
|
+
*
|
|
57
|
+
* @since 8.0.0
|
|
58
|
+
*/
|
|
59
|
+
export interface SmsReceivedEvent {
|
|
60
|
+
/**
|
|
61
|
+
* Full verification SMS message received by Android's SMS Retriever API.
|
|
62
|
+
*
|
|
63
|
+
* @since 8.0.0
|
|
64
|
+
*/
|
|
65
|
+
message: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* SMS Retriever error event payload.
|
|
69
|
+
*
|
|
70
|
+
* @since 8.0.0
|
|
71
|
+
*/
|
|
72
|
+
export interface SmsRetrieverErrorEvent {
|
|
73
|
+
/**
|
|
74
|
+
* Error message returned by Android or Google Play services.
|
|
75
|
+
*
|
|
76
|
+
* @since 8.0.0
|
|
77
|
+
*/
|
|
78
|
+
message: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Plugin version payload.
|
|
82
|
+
*
|
|
83
|
+
* @since 8.0.0
|
|
84
|
+
*/
|
|
85
|
+
export interface PluginVersionResult {
|
|
86
|
+
/**
|
|
87
|
+
* Version identifier returned by the platform implementation.
|
|
88
|
+
*
|
|
89
|
+
* @since 8.0.0
|
|
90
|
+
*/
|
|
91
|
+
version: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Status values returned by {@link AndroidSmsRetrieverPlugin.startWatch}.
|
|
95
|
+
*
|
|
96
|
+
* @since 8.0.0
|
|
97
|
+
*/
|
|
98
|
+
export type SmsRetrieverStartStatus = 'SMS_RETRIEVER_STARTED' | 'SMS_RETRIEVER_ALREADY_STARTED';
|
|
99
|
+
/**
|
|
100
|
+
* Android-only Capacitor plugin for Google Play services SMS Retriever and Phone Number Hint APIs.
|
|
101
|
+
*
|
|
102
|
+
* @since 8.0.0
|
|
103
|
+
*/
|
|
104
|
+
export interface AndroidSmsRetrieverPlugin {
|
|
105
|
+
/**
|
|
106
|
+
* Start listening for one verification SMS through Android's SMS Retriever API.
|
|
107
|
+
*
|
|
108
|
+
* Android stops listening automatically when a matching message arrives or after the
|
|
109
|
+
* five-minute SMS Retriever timeout. No SMS permissions are required.
|
|
110
|
+
*
|
|
111
|
+
* @since 8.0.0
|
|
112
|
+
*/
|
|
113
|
+
startWatch(): Promise<StartWatchResult>;
|
|
114
|
+
/**
|
|
115
|
+
* Stop the active SMS Retriever watch, if any.
|
|
116
|
+
*
|
|
117
|
+
* @since 8.0.0
|
|
118
|
+
*/
|
|
119
|
+
stopWatch(): Promise<StopWatchResult>;
|
|
120
|
+
/**
|
|
121
|
+
* Get the 11-character app hash for the installed app signature.
|
|
122
|
+
*
|
|
123
|
+
* Generate this once for the signing key used to distribute the app and append it
|
|
124
|
+
* to verification SMS messages.
|
|
125
|
+
*
|
|
126
|
+
* @since 8.0.0
|
|
127
|
+
*/
|
|
128
|
+
getHashString(): Promise<GetHashStringResult>;
|
|
129
|
+
/**
|
|
130
|
+
* Show Android's Phone Number Hint UI and return the user-selected SIM-based phone number.
|
|
131
|
+
*
|
|
132
|
+
* @since 8.0.0
|
|
133
|
+
*/
|
|
134
|
+
getPhoneNumber(): Promise<GetPhoneNumberResult>;
|
|
135
|
+
/**
|
|
136
|
+
* Listen for a verification SMS received after {@link startWatch}.
|
|
137
|
+
*
|
|
138
|
+
* @since 8.0.0
|
|
139
|
+
*/
|
|
140
|
+
addListener(eventName: 'smsReceived', listenerFunc: (event: SmsReceivedEvent) => void): Promise<PluginListenerHandle>;
|
|
141
|
+
/**
|
|
142
|
+
* Listen for the five-minute SMS Retriever timeout.
|
|
143
|
+
*
|
|
144
|
+
* @since 8.0.0
|
|
145
|
+
*/
|
|
146
|
+
addListener(eventName: 'smsRetrieverTimeout', listenerFunc: () => void): Promise<PluginListenerHandle>;
|
|
147
|
+
/**
|
|
148
|
+
* Listen for SMS Retriever runtime errors after {@link startWatch}.
|
|
149
|
+
*
|
|
150
|
+
* @since 8.0.0
|
|
151
|
+
*/
|
|
152
|
+
addListener(eventName: 'smsRetrieverError', listenerFunc: (event: SmsRetrieverErrorEvent) => void): Promise<PluginListenerHandle>;
|
|
153
|
+
/**
|
|
154
|
+
* Remove all registered listeners for this plugin.
|
|
155
|
+
*
|
|
156
|
+
* @since 8.0.0
|
|
157
|
+
*/
|
|
158
|
+
removeAllListeners(): Promise<void>;
|
|
159
|
+
/**
|
|
160
|
+
* Get the native Capacitor plugin version.
|
|
161
|
+
*
|
|
162
|
+
* @since 8.0.0
|
|
163
|
+
*/
|
|
164
|
+
getPluginVersion(): Promise<PluginVersionResult>;
|
|
165
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\n/**\n * Result returned when SMS Retriever watching starts.\n *\n * @since 8.0.0\n */\nexport interface StartWatchResult {\n /**\n * Native status returned by Android.\n *\n * @since 8.0.0\n */\n status: SmsRetrieverStartStatus;\n}\n\n/**\n * Result returned when SMS Retriever watching stops.\n *\n * @since 8.0.0\n */\nexport interface StopWatchResult {\n /**\n * Native status returned by Android.\n *\n * @since 8.0.0\n */\n status: 'SMS_RETRIEVER_DONE';\n}\n\n/**\n * Result returned by {@link AndroidSmsRetrieverPlugin.getHashString}.\n *\n * @since 8.0.0\n */\nexport interface GetHashStringResult {\n /**\n * The 11-character app hash that must be appended to verification SMS messages.\n *\n * @since 8.0.0\n */\n hash: string;\n}\n\n/**\n * Result returned by {@link AndroidSmsRetrieverPlugin.getPhoneNumber}.\n *\n * @since 8.0.0\n */\nexport interface GetPhoneNumberResult {\n /**\n * Phone number selected by the user from Android's Phone Number Hint UI.\n *\n * @since 8.0.0\n */\n phoneNumber: string;\n}\n\n/**\n * SMS Retriever message event payload.\n *\n * @since 8.0.0\n */\nexport interface SmsReceivedEvent {\n /**\n * Full verification SMS message received by Android's SMS Retriever API.\n *\n * @since 8.0.0\n */\n message: string;\n}\n\n/**\n * SMS Retriever error event payload.\n *\n * @since 8.0.0\n */\nexport interface SmsRetrieverErrorEvent {\n /**\n * Error message returned by Android or Google Play services.\n *\n * @since 8.0.0\n */\n message: string;\n}\n\n/**\n * Plugin version payload.\n *\n * @since 8.0.0\n */\nexport interface PluginVersionResult {\n /**\n * Version identifier returned by the platform implementation.\n *\n * @since 8.0.0\n */\n version: string;\n}\n\n/**\n * Status values returned by {@link AndroidSmsRetrieverPlugin.startWatch}.\n *\n * @since 8.0.0\n */\nexport type SmsRetrieverStartStatus = 'SMS_RETRIEVER_STARTED' | 'SMS_RETRIEVER_ALREADY_STARTED';\n\n/**\n * Android-only Capacitor plugin for Google Play services SMS Retriever and Phone Number Hint APIs.\n *\n * @since 8.0.0\n */\nexport interface AndroidSmsRetrieverPlugin {\n /**\n * Start listening for one verification SMS through Android's SMS Retriever API.\n *\n * Android stops listening automatically when a matching message arrives or after the\n * five-minute SMS Retriever timeout. No SMS permissions are required.\n *\n * @since 8.0.0\n */\n startWatch(): Promise<StartWatchResult>;\n\n /**\n * Stop the active SMS Retriever watch, if any.\n *\n * @since 8.0.0\n */\n stopWatch(): Promise<StopWatchResult>;\n\n /**\n * Get the 11-character app hash for the installed app signature.\n *\n * Generate this once for the signing key used to distribute the app and append it\n * to verification SMS messages.\n *\n * @since 8.0.0\n */\n getHashString(): Promise<GetHashStringResult>;\n\n /**\n * Show Android's Phone Number Hint UI and return the user-selected SIM-based phone number.\n *\n * @since 8.0.0\n */\n getPhoneNumber(): Promise<GetPhoneNumberResult>;\n\n /**\n * Listen for a verification SMS received after {@link startWatch}.\n *\n * @since 8.0.0\n */\n addListener(eventName: 'smsReceived', listenerFunc: (event: SmsReceivedEvent) => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for the five-minute SMS Retriever timeout.\n *\n * @since 8.0.0\n */\n addListener(eventName: 'smsRetrieverTimeout', listenerFunc: () => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for SMS Retriever runtime errors after {@link startWatch}.\n *\n * @since 8.0.0\n */\n addListener(\n eventName: 'smsRetrieverError',\n listenerFunc: (event: SmsRetrieverErrorEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Remove all registered listeners for this plugin.\n *\n * @since 8.0.0\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Get the native Capacitor plugin version.\n *\n * @since 8.0.0\n */\n getPluginVersion(): Promise<PluginVersionResult>;\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { registerPlugin } from '@capacitor/core';
|
|
2
|
+
const AndroidSmsRetriever = registerPlugin('AndroidSmsRetriever', {
|
|
3
|
+
web: () => import('./web').then((m) => new m.AndroidSmsRetrieverWeb()),
|
|
4
|
+
});
|
|
5
|
+
export * from './definitions';
|
|
6
|
+
export { AndroidSmsRetriever };
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,mBAAmB,GAAG,cAAc,CAA4B,qBAAqB,EAAE;IAC3F,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,sBAAsB,EAAE,CAAC;CACvE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,mBAAmB,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { AndroidSmsRetrieverPlugin } from './definitions';\n\nconst AndroidSmsRetriever = registerPlugin<AndroidSmsRetrieverPlugin>('AndroidSmsRetriever', {\n web: () => import('./web').then((m) => new m.AndroidSmsRetrieverWeb()),\n});\n\nexport * from './definitions';\nexport { AndroidSmsRetriever };\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import type { AndroidSmsRetrieverPlugin, GetHashStringResult, GetPhoneNumberResult, PluginVersionResult, StartWatchResult, StopWatchResult } from './definitions';
|
|
3
|
+
export declare class AndroidSmsRetrieverWeb extends WebPlugin implements AndroidSmsRetrieverPlugin {
|
|
4
|
+
startWatch(): Promise<StartWatchResult>;
|
|
5
|
+
stopWatch(): Promise<StopWatchResult>;
|
|
6
|
+
getHashString(): Promise<GetHashStringResult>;
|
|
7
|
+
getPhoneNumber(): Promise<GetPhoneNumberResult>;
|
|
8
|
+
getPluginVersion(): Promise<PluginVersionResult>;
|
|
9
|
+
}
|
package/dist/esm/web.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
export class AndroidSmsRetrieverWeb extends WebPlugin {
|
|
3
|
+
async startWatch() {
|
|
4
|
+
throw this.unimplemented('startWatch is only available on Android.');
|
|
5
|
+
}
|
|
6
|
+
async stopWatch() {
|
|
7
|
+
throw this.unimplemented('stopWatch is only available on Android.');
|
|
8
|
+
}
|
|
9
|
+
async getHashString() {
|
|
10
|
+
throw this.unimplemented('getHashString is only available on Android.');
|
|
11
|
+
}
|
|
12
|
+
async getPhoneNumber() {
|
|
13
|
+
throw this.unimplemented('getPhoneNumber is only available on Android.');
|
|
14
|
+
}
|
|
15
|
+
async getPluginVersion() {
|
|
16
|
+
return {
|
|
17
|
+
version: 'web',
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAW5C,MAAM,OAAO,sBAAuB,SAAQ,SAAS;IACnD,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,CAAC,aAAa,CAAC,0CAA0C,CAAC,CAAC;IACvE,CAAC;IAED,KAAK,CAAC,SAAS;QACb,MAAM,IAAI,CAAC,aAAa,CAAC,yCAAyC,CAAC,CAAC;IACtE,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,MAAM,IAAI,CAAC,aAAa,CAAC,6CAA6C,CAAC,CAAC;IAC1E,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,MAAM,IAAI,CAAC,aAAa,CAAC,8CAA8C,CAAC,CAAC;IAC3E,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO;YACL,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n AndroidSmsRetrieverPlugin,\n GetHashStringResult,\n GetPhoneNumberResult,\n PluginVersionResult,\n StartWatchResult,\n StopWatchResult,\n} from './definitions';\n\nexport class AndroidSmsRetrieverWeb extends WebPlugin implements AndroidSmsRetrieverPlugin {\n async startWatch(): Promise<StartWatchResult> {\n throw this.unimplemented('startWatch is only available on Android.');\n }\n\n async stopWatch(): Promise<StopWatchResult> {\n throw this.unimplemented('stopWatch is only available on Android.');\n }\n\n async getHashString(): Promise<GetHashStringResult> {\n throw this.unimplemented('getHashString is only available on Android.');\n }\n\n async getPhoneNumber(): Promise<GetPhoneNumberResult> {\n throw this.unimplemented('getPhoneNumber is only available on Android.');\n }\n\n async getPluginVersion(): Promise<PluginVersionResult> {\n return {\n version: 'web',\n };\n }\n}\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@capacitor/core');
|
|
4
|
+
|
|
5
|
+
const AndroidSmsRetriever = core.registerPlugin('AndroidSmsRetriever', {
|
|
6
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.AndroidSmsRetrieverWeb()),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
class AndroidSmsRetrieverWeb extends core.WebPlugin {
|
|
10
|
+
async startWatch() {
|
|
11
|
+
throw this.unimplemented('startWatch is only available on Android.');
|
|
12
|
+
}
|
|
13
|
+
async stopWatch() {
|
|
14
|
+
throw this.unimplemented('stopWatch is only available on Android.');
|
|
15
|
+
}
|
|
16
|
+
async getHashString() {
|
|
17
|
+
throw this.unimplemented('getHashString is only available on Android.');
|
|
18
|
+
}
|
|
19
|
+
async getPhoneNumber() {
|
|
20
|
+
throw this.unimplemented('getPhoneNumber is only available on Android.');
|
|
21
|
+
}
|
|
22
|
+
async getPluginVersion() {
|
|
23
|
+
return {
|
|
24
|
+
version: 'web',
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
30
|
+
__proto__: null,
|
|
31
|
+
AndroidSmsRetrieverWeb: AndroidSmsRetrieverWeb
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
exports.AndroidSmsRetriever = AndroidSmsRetriever;
|
|
35
|
+
//# sourceMappingURL=plugin.cjs.js.map
|