facebookarchive / react-native-fbsdk

A React Native wrapper around the Facebook SDKs for Android and iOS. Provides access to Facebook login, sharing, graph requests, app events etc.
https://developers.facebook.com/docs/react-native
Other
2.99k stars 910 forks source link

App crash on release when user logs in with Turkish locale on Android #728

Open kyo504 opened 4 years ago

kyo504 commented 4 years ago

🐛 Bug Report

In a certain scenario, app crashes on release mode. This is because of locale-aware operations for toUpperCase and toLowerCase. If passed string arguments are used for key instead of display, it doesn't need to be converted to locale-aware strings. So, to obtain correct results for locale insensitive strings, we should use toUpperCase(Locale.ROOT) and toLowerCase(Locale.ROOT) which is described on [android doc](https://developer.android.com/reference/java/lang/String#toUpperCase()).

To Reproduce

  1. Set device locale to tr-TR (Turkish)
  2. Use following code snippet for custom login button callback
    try {
    LoginManager.setLoginBehavior('native_with_fallback');
    const fbLogin = await LoginManager.logInWithPermissions(['email']);
    ...
    } catch(e) {
    ...
    }
  3. Run App on release mode
  4. Press login button

Expected Behavior

App should move to next step which means opening Facebook app or web.

Code Example

try {
  LoginManager.setLoginBehavior('native_with_fallback');
  const fbLogin = await LoginManager.logInWithPermissions(['email']);
  ...
} catch(e) {
  ...
}

Environment

System:
    OS: macOS 10.15.4
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 47.69 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 10.18.1 - ~/.nvm/versions/node/v10.18.1/bin/node
    Yarn: 1.22.0 - /usr/local/bin/yarn
    npm: 6.13.4 - ~/.nvm/versions/node/v10.18.1/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 23, 25, 26, 27, 28
      Build Tools: 25.0.0, 25.0.1, 25.0.2, 26.0.1, 26.0.3, 27.0.0, 27.0.3, 28.0.0, 28.0.2, 28.0.3
      System Images: android-27 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.6010548
    Xcode: 11.4/11E146 - /usr/bin/xcodebuild
  npmPackages:
    @react-native-community/cli: 3.0.4 => 3.0.4 
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.5 => 0.61.5
asafda commented 3 years ago

@kyo504 I see you opened a PR to fix this 9 month ago but it's still open. Did you manage to solve this differently?