• Stars
    star
    289
  • Rank 143,419 (Top 3 %)
  • Language
    Java
  • License
    MIT License
  • Created almost 6 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Flutter plugin to provide SMS code autofill support

sms_autofill

pub package Flutter plugin to provide SMS code autofill support.

For iOS, this package is not needed as the SMS autofill is provided by default, but not for Android, that's where this package is useful.

No permission to read SMS messages is asked to the user as there no need thanks to SMSRetriever API.

Usage

You have two widgets at your disposable for autofill an SMS code, PinFieldAutoFill and TextFieldPinAutoFill.

Just before you sent your phone number to the backend, you need to let the plugin know that it needs to listen for the SMS with the code.

To do that you need to do:

await SmsAutoFill().listenForCode();

This will listen for the SMS with the code during 5 minutes and when received, autofill the following widget.

PinFieldAutoFill

PinFieldAutoFill

PinFieldAutoFill(
                decoration: // UnderlineDecoration, BoxLooseDecoration or BoxTightDecoration see https://github.com/TinoGuo/pin_input_text_field for more info,
                currentCode: // prefill with a code
                onCodeSubmitted: //code submitted callback
                onCodeChanged: //code changed callback
                codeLength: //code length, default 6
              ),

TextFieldPinAutoFill

TextFieldPinAutoFill

TextFieldPinAutoFill(
                decoration: // basic InputDecoration
                currentCode: // prefill with a code
                onCodeSubmitted: //code submitted callback
                onCodeChanged: //code changed callback
                codeLength: //code length, default 6
              ),

Android SMS constraint

For the code to be receive, it need to follow some rules as describe here: https://developers.google.com/identity/sms-retriever/verify

  • Be no longer than 140 bytes
  • Contain a one-time code that the client sends back to your server to complete the verification flow
  • End with an 11-character hash string that identifies your app

One example of SMS would be:

ExampleApp: Your code is 123456
FA+9qCX9VSu

Helper

PhoneFieldHint [Android only]

PhoneFieldHint is a widget that will allow you ask for system phone number and autofill the widget if a phone is choosen by the user.

Phone hint

Custom CodeAutoFill

If you want to create a custom widget that will autofill with the sms code, you can use the CodeAutoFill mixin that will offer you:

  • listenForCode() to listen for the SMS code from the native plugin when SMS is received, need to be called on your initState.
  • cancel() to dispose the subscription of the SMS code from the native plugin, need to be called on your dispose.
  • codeUpdated() called when the code is received, you can access the value with the field code.
  • unregisterListener() to unregister the broadcast receiver, need to be called on your dispose.

App Signature

To get the app signature at runtime just call the getter getAppSignature on SmsAutoFill. You can also find the sample code in example app.

More Repositories

1

flare_splash_screen

Facilitator for having a Splash Screen with a Flare animation
Dart
95
star
2

ngx-dashboard

Dashboard library for angular 4 and more
TypeScript
71
star
3

flare_loading

Loading widget based on a Flare animation, allow you to create beautiful custom loading widgets or dialogs
Dart
25
star
4

sails-hook-schedule

Hook to manage basic cron job for sails application
JavaScript
21
star
5

flutter_speech_recognition

Objective-C
17
star
6

infinite_widgets

Set of widgets to show infinite data like list, grid...
Dart
15
star
7

rive_splash_screen

Facilitator for having a Splash Screen with a Rive animation
Dart
12
star
8

intellij-sails-ide

IntelliJ plugin for Sails and Treeline integration
Java
11
star
9

trailpack-passport

πŸ“¦ Trailpack to allow passport authentification to Trails application
JavaScript
11
star
10

sails-hook-push

JavaScript
10
star
11

jimtl

Intl utilities to easily manage localization in Dart and Flutter
Dart
8
star
12

proxy_layout

Package to select layout per orientation or device size like mobile vs tablet layouts or portrait vs landscape
Dart
8
star
13

trailpack-acl

πŸ“¦ Trailpack to manage permissions on models/routes for Trails with Express webserver
JavaScript
8
star
14

sails-hook-passport

Implement basic passport strategies into sails server
JavaScript
8
star
15

trailpack-annotations

πŸ“¦ Add annotation support for Tails.js applications
JavaScript
7
star
16

flare_checkbox

Checkbox widget with two or three state animation with a Flare animation of your choice
Dart
7
star
17

crypted_preferences

Flutter preferences management with crypto capabilities
Dart
7
star
18

SpannedGridLayoutManager

Java
6
star
19

serverless-openapi-plugin

OpenApi generator for serverless
JavaScript
6
star
20

trails-angular2-isomorphic

JavaScript
6
star
21

day_selector

Flutter widget to select week day easily, week day or workable day mode are available, same as unique, multiple selection
Dart
5
star
22

trails-express-gulp-angular-2

Trails example project with Express, Sequelize, Gulp and Angular2
JavaScript
4
star
23

trailpack-cron

πŸ“¦ Add Trails service for running cron tasks
JavaScript
4
star
24

trailpack-pdf

πŸ“¦ Trailpack to generate PDF from routes or templates for Trails.js project
JavaScript
3
star
25

sails-hook-user-acl

Hook to manage basic user ACL
JavaScript
3
star
26

sails-generate-archive

Generate a production zip file ready to deploy
JavaScript
3
star
27

RxWearBridge

Small library to support data synchronisation and messages between Android and Android Wear devices with Rx interface
Kotlin
3
star
28

trailpack-machinepack

πŸ“¦ Map machine packs into Trails services
JavaScript
3
star
29

trails-todo-app-angular2

Trails Todo Applications with Angular 2
JavaScript
2
star
30

instagrim

Demo app, for education purpose
Kotlin
2
star
31

trails-example-express-gulp

Trails example project to use express4 and gulp as asset manager
JavaScript
2
star
32

rive_loading

Loading widget based on a Rive animation, allow you to create beautiful custom loading widgets or dialogs
Dart
2
star
33

crazy_list

Crazy list is a widget that change his layout depending of the item count on the list, can be square, triangle, diagonal, grid, list
Dart
2
star
34

trailpack-push

πŸ“¦ Trailpack to send push notification to Android and iOS devices from Trails application
JavaScript
2
star
35

trailpack-email

πŸ“¦ Add a Trails service to sending emails
JavaScript
1
star
36

trails-ts

Typescript version of Trails project
TypeScript
1
star
37

trailpack-twilio

πŸ“¦ Twilio Trailpack
JavaScript
1
star
38

ReactiveNetwork

Swift
1
star
39

RecyclerViewBinding

Recycler view helper for data binding, no more adapter and view holder !
Kotlin
1
star