Skip to content

Commit

Permalink
Fix package warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
DDavidPrime committed Sep 4, 2024
1 parent 6017621 commit 675eeea
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 18 deletions.
2 changes: 1 addition & 1 deletion packages/widget_toolkit_otp/example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion packages/widget_toolkit_otp/example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'
# platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
28 changes: 28 additions & 0 deletions packages/widget_toolkit_otp/example/ios/Podfile.lock
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
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -343,7 +343,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -421,7 +421,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -470,7 +470,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import UIKit
import Flutter

@UIApplicationMain
@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
Expand Down
8 changes: 8 additions & 0 deletions packages/widget_toolkit_otp/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,14 @@ packages:
description: flutter
source: sdk
version: "0.0.99"
smart_auth:
dependency: transitive
description:
name: smart_auth
sha256: "88aa8fe66e951c78a307f26d1c29672dce2e9eb3da2e12e853864d0e615a73ad"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
source_span:
dependency: transitive
description:
Expand Down
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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import 'package:flutter/material.dart';
import 'package:flutter_rx_bloc/flutter_rx_bloc.dart';
import 'package:pinput/pinput.dart';
import 'package:provider/provider.dart';
import 'package:smart_auth/smart_auth.dart';
import 'package:widget_toolkit/widget_toolkit.dart';

import '../base/data_sources/sms_retriever.dart';
import '../base/models/temporary_code_state.dart';
import '../base/theme/sms_code_theme.dart';
import '../base/utils/enums.dart' as enums;
Expand Down Expand Up @@ -147,8 +149,8 @@ class SmsCodeField extends StatefulWidget {
/// Is the pin field enabled
final bool? enabled;

/// Allow the communication between components of the Prime SMS Package. If
/// this field is set to `true`, the widget will perform a lookup up the
/// Allow the communication between components of the widget_toolkit Package.
/// If this field is set to `true`, the widget will perform a lookup up the
/// widget tree. If the SmsCodeBlocType bloc is not part of the widget tree,
/// the
final bool useInternalCommunication;
Expand All @@ -159,22 +161,35 @@ class SmsCodeField extends StatefulWidget {

class _SmsCodeFieldState extends State<SmsCodeField> {
TextEditingController? _controller;
SmsRetriever? _smsRetriever;

@override
void initState() {
_controller = widget.controller;
_smsRetriever = _smsAutofillMethod;

super.initState();
}

AndroidSmsAutofillMethod get _smsAutofillMethod {
@override
void dispose() {
_controller?.dispose();
_smsRetriever?.dispose();
super.dispose();
}

SmsRetrieverImpl? get _smsAutofillMethod {
switch (widget.androidSmsAutofillMethod) {
case enums.AndroidSmsAutofillMethod.none:
return AndroidSmsAutofillMethod.none;
case enums.AndroidSmsAutofillMethod.smsRetrieverApi:
return AndroidSmsAutofillMethod.smsRetrieverApi;
case enums.AndroidSmsAutofillMethod.smsUserConsentApi:
return AndroidSmsAutofillMethod.smsUserConsentApi;
return SmsRetrieverImpl(
context.read() ?? SmartAuth(),
senderPhoneNumber: widget.senderPhoneNumber,
useUserConsentAPI: enums.AndroidSmsAutofillMethod.smsUserConsentApi ==
widget.androidSmsAutofillMethod,
);
case enums.AndroidSmsAutofillMethod.none:
return null;
}
}

Expand Down Expand Up @@ -242,7 +257,7 @@ class _SmsCodeFieldState extends State<SmsCodeField> {
focusedPinTheme: _buildFocusedTheme(context),
submittedPinTheme: _buildSubmittedTheme(context),
followingPinTheme: _buildUnfilledStyleTheme(context),
//androidSmsAutofillMethod: _smsAutofillMethod,
smsRetriever: _smsRetriever,
hapticFeedbackType: _hapticFeedbackType,
pinAnimationType: _animationType,
preFilledWidget: widget.prefilledWidget,
Expand All @@ -261,7 +276,6 @@ class _SmsCodeFieldState extends State<SmsCodeField> {
onSubmitted: widget.onSubmitted,
obscureText: widget.obscureText,
obscuringWidget: widget.obscuringWidget,
// senderPhoneNumber: widget.senderPhoneNumber,
pinContentAlignment: widget.pinContentAlignment,
errorBuilder: widget.errorBuilder,
forceErrorState: forceErrorState,
Expand Down
1 change: 1 addition & 0 deletions packages/widget_toolkit_otp/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dependencies:
provider: ^6.0.5
rx_bloc: ^6.0.0
rxdart: ^0.28.0
smart_auth: ^2.0.0
theme_tailor_annotation: ^3.0.0
widget_toolkit: ^0.2.0

Expand Down

0 comments on commit 675eeea

Please sign in to comment.