Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: SmartAuth getSmsCode is not supported on TargetPlatform.iOS #194

Open
burekas7 opened this issue Sep 23, 2024 · 2 comments
Open

Bug: SmartAuth getSmsCode is not supported on TargetPlatform.iOS #194

burekas7 opened this issue Sep 23, 2024 · 2 comments
Assignees

Comments

@burekas7
Copy link

burekas7 commented Sep 23, 2024

Hi,

I use your SmsRetrieverImpl implementation.
There is a bug regarding the getSmsCode().

  @override
  Future<String?> getSmsCode() async {
    final res = await smartAuth.getSmsCode();
    if (res.succeed && res.codeFound) {
      return res.code!;
    }
    return null;
  }

It's ok when running Android.

But when running iOS, there is an error:
flutter: SmartAuth getSmsCode is not supported on TargetPlatform.iOS

So I add this condition: Platform.isAndroid, but on iOS the screen is getting stuck, I can't press on anything.
Maybe it shouldn't be return null? (I tried also return '', doesn't work)

  @override
  Future<String?> getSmsCode() async {
    if (Platform.isAndroid) {
      final res = await smartAuth.getSmsCode();
      if (res.succeed && res.codeFound) {
        return res.code!;
      }
    }
    return null;
  }

Pinput version: 5.0.0

Flutter: 3.24.2
iOS: 17.5.1

@burekas7
Copy link
Author

This is the solution:

Pinput(
      smsRetriever: Platform.isAndroid ? smsRetrieverImpl : null,

@burekas7
Copy link
Author

@Tkko
Is this the correct way to solve it?
I know that previously for iOS the code was shown above the keyboard.

@burekas7 burekas7 reopened this Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants