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

[in_app_purchase][android] currencySymbol is missing #147565

Open
dgminhngoc opened this issue Apr 30, 2024 · 8 comments
Open

[in_app_purchase][android] currencySymbol is missing #147565

dgminhngoc opened this issue Apr 30, 2024 · 8 comments
Labels
p: in_app_purchase Plugin for in-app purchase P2 Important issues not at the top of the work list package flutter/packages repository. See also p: labels. platform-android Android applications specifically team-android Owned by Android platform team triaged-android Triaged by Android platform team

Comments

@dgminhngoc
Copy link

Steps to reproduce

Just request ProductDetail from InAppPurchase.instance.queryProductDetails(_kProductIds)

Expected results

Euro symbol is displayed

Actual results

Euro symbol is missing

Code sample

await InAppPurchase.instance.queryProductDetails(_kProductIds);

Screenshots or Video

Emulator_GooglePlay_Android13
GalaxyS21_Android14

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
flutter doctor -v
[✓] Flutter (Channel stable, 3.19.6, on macOS 14.4.1 23E224 darwin-x64, locale
    de-DE)
    • Flutter version 3.19.6 on channel stable at
      /Users/timnguyen/WorkSpace/SDK/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 54e66469a9 (vor 12 Tagen), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/timnguyen/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Users/timnguyen/Applications/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.14.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.3)
    • Android Studio at /Users/timnguyen/Applications/Android
      Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      17.0.10+0-17.0.10b1087.21-11572160)

[✓] IntelliJ IDEA Community Edition (version 2024.1.1)
    • IntelliJ at /Users/timnguyen/Applications/IntelliJ IDEA Community
      Edition.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.88.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 14.4.1 23E224 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 124.0.6367.92
    ! Error: Browsing on the local area network for Malastare. Ensure the device is unlocked
      and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
    ! Error: Browsing on the local area network for iPad von Ngoc. Ensure the device is
      unlocked and attached with a cable or associated with the same local area network as
      this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources
    • All expected network resources are available.

• No issues found!
@darshankawar darshankawar added the in triage Presently being triaged by the triage team label Apr 30, 2024
@darshankawar
Copy link
Member

@dgminhngoc
What plugin version are you using ? currencySymbol was added as part of flutter/plugins#4115

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Apr 30, 2024
@dgminhngoc
Copy link
Author

@dgminhngoc What plugin version are you using ? currencySymbol was added as part of flutter/plugins#4115

currently I'm using in_app_purchase 3.1.13 and in_app_purchase_storekit 0.3.4 (because in_app_purchase 3.2.0 requires in_app_purchase_storekit 0.3.14 which decodes null "countryCode" value on iOS, I have no idea if this bug related to XCode Storekit so haven't report yet). I tested also in_app_purchase 3.2.0 and this issue remains.

The 2 screenshot are from Emulator - Android 13 with Google Play (currencySymbol is Euro) and from Galaxy S24 - Android 14 (currencySymbol missing)

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Apr 30, 2024
@darshankawar
Copy link
Member

Thanks for the update @dgminhngoc

The 2 screenshot are from Emulator - Android 13 with Google Play (currencySymbol is Euro) and from Galaxy S24 - Android 14 (currencySymbol missing)

Could this be due to the locale you are using on both the emulators / devices ?

Screenshot 2024-05-02 at 12 21 05 PM Screenshot 2024-05-02 at 12 21 11 PM

I see that the Euro symbol is to the left and to the right in respective screenshots ? Can you check if this is the case ?

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 2, 2024
@dgminhngoc
Copy link
Author

Ah yes, locale on Emulator - Android 13 with Google Play is US/us whereas on my Galaxy S21 (S24 was typo, but it doesn't matter) is DE/de. After locale of emulator is changed from US/us to De/de, the price is changed automatically from "€4.99" to "4.99 €" and currentcySymbol is now empty.

on my Galaxy S21, I tested with the current version of my app downloaded from Google Play Store (I built with Flutter 3.7 at that time) and saw no issues, currencySymbol is always available

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 3, 2024
@darshankawar
Copy link
Member

Thanks for the update. Keeping the issue open for tracking.

@darshankawar darshankawar added platform-android Android applications specifically p: in_app_purchase Plugin for in-app purchase package flutter/packages repository. See also p: labels. team-android Owned by Android platform team fyi-ecosystem For the attention of Ecosystem team and removed in triage Presently being triaged by the triage team labels May 6, 2024
@stuartmorgan stuartmorgan added the triaged-ecosystem Triaged by Ecosystem team label May 8, 2024
@flutter-triage-bot flutter-triage-bot bot removed fyi-ecosystem For the attention of Ecosystem team triaged-ecosystem Triaged by Ecosystem team labels May 8, 2024
@reidbaker reidbaker added P2 Important issues not at the top of the work list triaged-android Triaged by Android platform team labels May 9, 2024
@reidbaker
Copy link
Contributor

@dgminhngoc I am trying to figure out the conditions that cause the issue. Is it that the locale needs to change or that this is a regression from version x to version y?

If it is a locale change what are the good and bad locale's?
If it is a version change what are the good and bad versions?

@reidbaker reidbaker added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 9, 2024
@dgminhngoc
Copy link
Author

dgminhngoc commented May 10, 2024

I think the problem is from this function of google_play_product_detail.dart
/// Extracts the currency symbol from [formattedPrice].
///
/// Note that a currency symbol might consist of more than a google_play_product_detail.dartsingle character.
///
/// Just in case, we assume currency symbols can appear at the start or the
/// end of [formattedPrice].
///
/// The regex captures the characters from the start/end of the [String]
/// until the first/last digit or space.
static String? _extractCurrencySymbol(String formattedPrice) {
return RegExp(r'^[^\d ]|[^\d ]$').firstMatch(formattedPrice)?.group(0);

it cannot extract currencySymbol from the price "4,99 €" but works when the price is "€4.99".
interestingly in both cases, currencyCode is always "EUR". Isn't it better if simpleCurrencySymbol is simply called instead ?
https://api.flutter.dev/flutter/intl/NumberFormat/simpleCurrencySymbol.html

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 10, 2024
@reidbaker reidbaker added good first issue Relatively approachable for first-time contributors and removed good first issue Relatively approachable for first-time contributors labels May 10, 2024
@reidbaker
Copy link
Contributor

I tried to use dartpad to validate the regular expression.

void main() {
  String formattedPrice = '4,99 €';
  print(RegExp(r'^[^\d ]|[^\d ]$').firstMatch(formattedPrice)?.group(0));
}

and it matches just fine.

I dont think we should use https://api.flutter.dev/flutter/intl/NumberFormat/simpleCurrencySymbol.html in the plugin because we are trying to expose google play vended values. As a work around this bug then authors could choose to use it though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p: in_app_purchase Plugin for in-app purchase P2 Important issues not at the top of the work list package flutter/packages repository. See also p: labels. platform-android Android applications specifically team-android Owned by Android platform team triaged-android Triaged by Android platform team
Projects
None yet
Development

No branches or pull requests

4 participants