-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6017621
commit 675eeea
Showing
11 changed files
with
116 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
PODS: | ||
- Flutter (1.0.0) | ||
- smart_auth (0.0.1): | ||
- Flutter | ||
- url_launcher_ios (0.0.1): | ||
- Flutter | ||
|
||
DEPENDENCIES: | ||
- Flutter (from `Flutter`) | ||
- smart_auth (from `.symlinks/plugins/smart_auth/ios`) | ||
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) | ||
|
||
EXTERNAL SOURCES: | ||
Flutter: | ||
:path: Flutter | ||
smart_auth: | ||
:path: ".symlinks/plugins/smart_auth/ios" | ||
url_launcher_ios: | ||
:path: ".symlinks/plugins/url_launcher_ios/ios" | ||
|
||
SPEC CHECKSUMS: | ||
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 | ||
smart_auth: 4bedbc118723912d0e45a07e8ab34039c19e04f2 | ||
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe | ||
|
||
PODFILE CHECKSUM: c4c93c5f6502fe2754f48404d3594bf779584011 | ||
|
||
COCOAPODS: 1.15.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...es/widget_toolkit_otp/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/widget_toolkit_otp/example/ios/Runner/AppDelegate.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
packages/widget_toolkit_otp/lib/src/base/data_sources/sms_retriever.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import 'package:pinput/pinput.dart'; | ||
import 'package:smart_auth/smart_auth.dart'; | ||
|
||
/// Local implementation of a sms retriever to facilitate the retrieval of sms | ||
/// codes for the SmsCodeField autofill feature. | ||
class SmsRetrieverImpl implements SmsRetriever { | ||
const SmsRetrieverImpl( | ||
this.smartAuth, { | ||
this.senderPhoneNumber, | ||
this.useUserConsentAPI = false, | ||
this.checkForMultipleSms = false, | ||
}); | ||
|
||
/// The [SmartAuth] instance to use for SMS retrieval | ||
final SmartAuth smartAuth; | ||
|
||
/// The phone number of the sender (if any) | ||
final String? senderPhoneNumber; | ||
|
||
/// Flag indicating wheter to use the user consent API. | ||
/// | ||
/// For more information, see https://developers.google.com/identity/sms-retriever/user-consent/overview | ||
final bool useUserConsentAPI; | ||
|
||
/// Should the service listen to multiple sms messages | ||
final bool checkForMultipleSms; | ||
|
||
@override | ||
Future<void> dispose() { | ||
return smartAuth.removeSmsListener(); | ||
} | ||
|
||
@override | ||
Future<String?> getSmsCode() async { | ||
final res = await smartAuth.getSmsCode( | ||
senderPhoneNumber: senderPhoneNumber, | ||
useUserConsentApi: useUserConsentAPI, | ||
); | ||
if (res.succeed && res.codeFound) { | ||
return res.code!; | ||
} | ||
return null; | ||
} | ||
|
||
@override | ||
bool get listenForMultipleSms => checkForMultipleSms; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters