Skip to content

Commit

Permalink
* Updated example app
Browse files Browse the repository at this point in the history
* Updated dependencies
* Fixed linter warnings
* Updated version
  • Loading branch information
rithik-dev committed Jun 7, 2022
1 parent 0d861df commit c28efcf
Show file tree
Hide file tree
Showing 14 changed files with 81 additions and 68 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [1.0.4] - 07/06/2022

* Updated example app
* Updated dependencies
* Fixed linter warnings

## [1.0.3] - 03/05/2022

* Updated example app
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.phone_auth_handler_demo">
<application
android:label="phone_auth_handler_demo"
android:label="FirebasePhoneAuthHandler Demo"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
Expand Down
2 changes: 1 addition & 1 deletion example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>phone_auth_handler_demo</string>
<string>FirebasePhoneAuthHandler Demo</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
Expand Down
9 changes: 5 additions & 4 deletions example/lib/screens/authentication_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class AuthenticationScreen extends StatefulWidget {
}) : super(key: key);

@override
// ignore: library_private_types_in_public_api
_AuthenticationScreenState createState() => _AuthenticationScreenState();
}

Expand Down Expand Up @@ -55,10 +56,6 @@ class _AuthenticationScreenState extends State<AuthenticationScreen> {
),
const SizedBox(height: 15),
EasyContainer(
child: const Text(
'Verify',
style: TextStyle(fontSize: 18),
),
width: double.infinity,
onTap: () async {
if (isNullOrBlank(phoneNumber) ||
Expand All @@ -72,6 +69,10 @@ class _AuthenticationScreenState extends State<AuthenticationScreen> {
);
}
},
child: const Text(
'Verify',
style: TextStyle(fontSize: 18),
),
),
],
),
Expand Down
2 changes: 2 additions & 0 deletions example/lib/screens/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class HomeScreen extends StatelessWidget {
onTap: () async {
await FirebasePhoneAuthHandler.signOut(context);
showSnackBar('Logged out successfully!');

// ignore: use_build_context_synchronously
Navigator.pushNamedAndRemoveUntil(
context,
AuthenticationScreen.id,
Expand Down
2 changes: 2 additions & 0 deletions example/lib/screens/splash_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class SplashScreen extends StatefulWidget {
}) : super(key: key);

@override
// ignore: library_private_types_in_public_api
_SplashScreenState createState() => _SplashScreenState();
}

Expand All @@ -22,6 +23,7 @@ class _SplashScreenState extends State<SplashScreen> {
await Future.delayed(Duration.zero);
final isLoggedIn = Globals.firebaseUser != null;

if (!mounted) return;
Navigator.pushReplacementNamed(
context,
isLoggedIn ? HomeScreen.id : AuthenticationScreen.id,
Expand Down
18 changes: 9 additions & 9 deletions example/lib/screens/verify_phone_number_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ class _VerifyPhoneNumberScreenState extends State<VerifyPhoneNumberScreen>
@override
void initState() {
scrollController = ScrollController();
WidgetsBinding.instance?.addObserver(this);
WidgetsBinding.instance.addObserver(this);
super.initState();
}

@override
void dispose() {
WidgetsBinding.instance?.removeObserver(this);
WidgetsBinding.instance.removeObserver(this);
scrollController.dispose();
super.dispose();
}

@override
void didChangeMetrics() {
final bottomViewInsets = WidgetsBinding.instance!.window.viewInsets.bottom;
final bottomViewInsets = WidgetsBinding.instance.window.viewInsets.bottom;
isKeyboardVisible = bottomViewInsets > 0;
}

Expand Down Expand Up @@ -101,18 +101,18 @@ class _VerifyPhoneNumberScreenState extends State<VerifyPhoneNumberScreen>
actions: [
if (controller.codeSent)
TextButton(
child: Text(
controller.timerIsActive
? '${controller.timerCount.inSeconds}s'
: 'Resend',
style: const TextStyle(color: Colors.blue, fontSize: 18),
),
onPressed: controller.timerIsActive
? null
: () async {
log(VerifyPhoneNumberScreen.id, msg: 'Resend OTP');
await controller.sendOTP();
},
child: Text(
controller.timerIsActive
? '${controller.timerCount.inSeconds}s'
: 'Resend',
style: const TextStyle(color: Colors.blue, fontSize: 18),
),
),
const SizedBox(width: 5),
],
Expand Down
1 change: 1 addition & 0 deletions example/lib/widgets/pin_input_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class PinInputField extends StatefulWidget {
}) : super(key: key);

@override
// ignore: library_private_types_in_public_api
_PinInputFieldState createState() => _PinInputFieldState();
}

Expand Down
42 changes: 21 additions & 21 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -42,70 +42,70 @@ packages:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
version: "1.16.0"
easy_container:
dependency: "direct main"
description:
name: easy_container
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
version: "1.0.4"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.0"
firebase_auth:
dependency: transitive
description:
name: firebase_auth
url: "https://pub.dartlang.org"
source: hosted
version: "3.3.16"
version: "3.3.19"
firebase_auth_platform_interface:
dependency: transitive
description:
name: firebase_auth_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "6.2.4"
version: "6.2.7"
firebase_auth_web:
dependency: transitive
description:
name: firebase_auth_web
url: "https://pub.dartlang.org"
source: hosted
version: "3.3.13"
version: "3.3.16"
firebase_core:
dependency: "direct main"
description:
name: firebase_core
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
version: "1.17.1"
firebase_core_platform_interface:
dependency: transitive
description:
name: firebase_core_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.5"
version: "4.4.0"
firebase_core_web:
dependency: transitive
description:
name: firebase_core_web
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.2"
version: "1.6.4"
firebase_phone_auth_handler:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "1.0.3"
version: "1.0.4"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -117,7 +117,7 @@ packages:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
version: "2.0.1"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down Expand Up @@ -155,14 +155,14 @@ packages:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
version: "0.6.4"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "2.0.0"
matcher:
dependency: transitive
description:
Expand All @@ -176,7 +176,7 @@ packages:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
version: "0.1.4"
meta:
dependency: transitive
description:
Expand All @@ -197,14 +197,14 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.8.1"
pinput:
dependency: "direct main"
description:
name: pinput
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.7"
version: "2.2.10"
plugin_platform_interface:
dependency: transitive
description:
Expand All @@ -218,7 +218,7 @@ packages:
name: provider
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.2"
version: "6.0.3"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -237,7 +237,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.2"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -272,7 +272,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.8"
version: "0.4.9"
typed_data:
dependency: transitive
description:
Expand All @@ -286,7 +286,7 @@ packages:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
version: "2.1.2"
sdks:
dart: ">=2.16.1 <3.0.0"
dart: ">=2.17.0-206.0.dev <3.0.0"
flutter: ">=2.5.0"
8 changes: 4 additions & 4 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ dependencies:
flutter:
sdk: flutter

pinput: ^2.2.7
firebase_core: ^1.15.0
easy_container: ^1.0.3
pinput: ^2.2.10
firebase_core: ^1.17.1
easy_container: ^1.0.4
intl_phone_field: ^3.1.0
firebase_phone_auth_handler:
path: "../"
Expand All @@ -23,7 +23,7 @@ dev_dependencies:
flutter_test:
sdk: flutter

flutter_lints: ^1.0.4
flutter_lints: ^2.0.1


flutter:
Expand Down
2 changes: 1 addition & 1 deletion example/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<!-- Favicon -->
<link rel="icon" type="image/png" href="favicon.png"/>

<title>phone_auth_handler_demo</title>
<title>FirebasePhoneAuthHandler Demo</title>
<link rel="manifest" href="manifest.json">
</head>
<body>
Expand Down
13 changes: 7 additions & 6 deletions lib/src/auth_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class FirebasePhoneAuthHandler extends StatefulWidget {
FirebasePhoneAuthController.of(context, listen: false).signOut();

@override
// ignore: library_private_types_in_public_api
_FirebasePhoneAuthHandlerState createState() =>
_FirebasePhoneAuthHandlerState();
}
Expand All @@ -103,22 +104,22 @@ class _FirebasePhoneAuthHandlerState extends State<FirebasePhoneAuthHandler> {
@override
void initState() {
(() async {
final _con = FirebasePhoneAuthController.of(context, listen: false);
final con = FirebasePhoneAuthController.of(context, listen: false);

RecaptchaVerifier? _captcha;
RecaptchaVerifier? captcha;
if (widget.recaptchaVerifierForWebProvider != null) {
_captcha = widget.recaptchaVerifierForWebProvider!(kIsWeb);
captcha = widget.recaptchaVerifierForWebProvider!(kIsWeb);
}

_con.setData(
con.setData(
phoneNumber: widget.phoneNumber,
onLoginSuccess: widget.onLoginSuccess,
onLoginFailed: widget.onLoginFailed,
timeOutDuration: widget.timeOutDuration,
recaptchaVerifierForWeb: _captcha,
recaptchaVerifierForWeb: captcha,
);

await _con.sendOTP();
await con.sendOTP();
})();
super.initState();
}
Expand Down
Loading

0 comments on commit c28efcf

Please sign in to comment.