@capgo/capacitor-android-sms-retriever 8.0.11 → 8.0.13
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
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
# @capgo/capacitor-android-sms-retriever
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Read one-time codes from SMS on Android without the SMS permission, using Google Play services SMS Retriever, and let users pick their phone number with Phone Number Hint. Smoother sign-in and verification flows.
|
|
4
|
+
|
|
5
|
+
<a href="https://capgo.app/?ref=plugin_android_sms_retriever"><img src="https://capgo.app/readme-banner.svg?repo=Cap-go/capacitor-android-sms-retriever" alt="Capgo - Instant updates for Capacitor" /></a>
|
|
4
6
|
|
|
5
7
|
<div align="center">
|
|
6
|
-
<
|
|
7
|
-
<h2><a href="https://capgo.app/
|
|
8
|
+
<p><b>Capgo</b>: open-source live updates for Ionic and Capacitor apps. Ship OTA fixes and features instantly, without waiting for app store review.</p>
|
|
9
|
+
<h2><a href="https://capgo.app/register/?ref=plugin_android_sms_retriever">➡️ Get started for free</a></h2>
|
|
10
|
+
<p>14-day unlimited free trial. No credit card required</p>
|
|
11
|
+
<p><a href="https://capgo.app/consulting/?ref=plugin_android_sms_retriever">Missing a feature? We'll build the plugin for you 💪</a></p>
|
|
8
12
|
</div>
|
|
9
13
|
|
|
10
|
-
|
|
14
|
+
<p align="center">
|
|
15
|
+
<img src="https://raw.githubusercontent.com/Cap-go/capacitor-android-sms-retriever/main/assets/github-social-preview.png" alt="@capgo/capacitor-android-sms-retriever for Capacitor apps" width="300" />
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
## Key features
|
|
19
|
+
|
|
20
|
+
- **SMS Retriever**: `startWatch()` waits for one verification SMS and emits `smsReceived`, with `smsRetrieverTimeout` and `smsRetrieverError` events.
|
|
21
|
+
- **No SMS permission**: Google Play services delivers the matching message, so you do not request `READ_SMS`.
|
|
22
|
+
- **App hash**: `getHashString()` returns the 11-character hash your server adds to the SMS.
|
|
23
|
+
- **Phone Number Hint**: `getPhoneNumber()` shows the system picker and returns the selected SIM number.
|
|
24
|
+
- **Stop anytime**: `stopWatch()` cancels the active watch.
|
|
25
|
+
- **Platforms**: Android. Android only. iOS and web are not supported.
|
|
11
26
|
|
|
12
27
|
## Install
|
|
13
28
|
|
|
@@ -25,10 +25,10 @@ public class AndroidSmsRetrieverPlugin extends Plugin {
|
|
|
25
25
|
private static final String EVENT_SMS_ERROR = "smsRetrieverError";
|
|
26
26
|
private static final String STATUS_DONE = "SMS_RETRIEVER_DONE";
|
|
27
27
|
|
|
28
|
-
private final String pluginVersion = "8.0.
|
|
28
|
+
private final String pluginVersion = "8.0.13";
|
|
29
29
|
private AndroidSmsRetriever implementation;
|
|
30
30
|
private ActivityResultLauncher<IntentSenderRequest> phoneNumberHintLauncher;
|
|
31
|
-
private
|
|
31
|
+
private PluginCall pendingPhoneNumberCall;
|
|
32
32
|
|
|
33
33
|
@Override
|
|
34
34
|
public void load() {
|
|
@@ -121,7 +121,7 @@ public class AndroidSmsRetrieverPlugin extends Plugin {
|
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
if (
|
|
124
|
+
if (pendingPhoneNumberCall != null) {
|
|
125
125
|
call.reject("Another Phone Number Hint request is already in progress.");
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
@@ -137,13 +137,13 @@ public class AndroidSmsRetrieverPlugin extends Plugin {
|
|
|
137
137
|
.getPhoneNumberHintIntent(request)
|
|
138
138
|
.addOnSuccessListener((pendingIntent) -> {
|
|
139
139
|
try {
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
call.setKeepAlive(true);
|
|
141
|
+
pendingPhoneNumberCall = call;
|
|
142
142
|
IntentSenderRequest intentSenderRequest = new IntentSenderRequest.Builder(pendingIntent.getIntentSender()).build();
|
|
143
143
|
phoneNumberHintLauncher.launch(intentSenderRequest);
|
|
144
144
|
} catch (Exception exception) {
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
pendingPhoneNumberCall = null;
|
|
146
|
+
call.setKeepAlive(false);
|
|
147
147
|
call.reject(resolveMessage("Unable to launch Phone Number Hint.", exception), exception);
|
|
148
148
|
}
|
|
149
149
|
})
|
|
@@ -168,7 +168,7 @@ public class AndroidSmsRetrieverPlugin extends Plugin {
|
|
|
168
168
|
private void handlePhoneNumberHintResult(ActivityResult result) {
|
|
169
169
|
PluginCall call = getPendingPhoneNumberCall();
|
|
170
170
|
if (call == null) {
|
|
171
|
-
|
|
171
|
+
pendingPhoneNumberCall = null;
|
|
172
172
|
return;
|
|
173
173
|
}
|
|
174
174
|
|
|
@@ -202,16 +202,13 @@ public class AndroidSmsRetrieverPlugin extends Plugin {
|
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
private PluginCall getPendingPhoneNumberCall() {
|
|
205
|
-
|
|
206
|
-
return null;
|
|
207
|
-
}
|
|
208
|
-
return bridge.getSavedCall(pendingPhoneNumberCallId);
|
|
205
|
+
return pendingPhoneNumberCall;
|
|
209
206
|
}
|
|
210
207
|
|
|
211
208
|
private void releasePendingPhoneNumberCall(PluginCall call) {
|
|
212
|
-
if (
|
|
213
|
-
|
|
214
|
-
|
|
209
|
+
if (pendingPhoneNumberCall != null) {
|
|
210
|
+
call.setKeepAlive(false);
|
|
211
|
+
pendingPhoneNumberCall = null;
|
|
215
212
|
}
|
|
216
213
|
}
|
|
217
214
|
|
package/package.json
CHANGED