diff --git a/.changeset/dull-keys-remain.md b/.changeset/dull-keys-remain.md new file mode 100644 index 00000000..66f19d5f --- /dev/null +++ b/.changeset/dull-keys-remain.md @@ -0,0 +1,12 @@ +--- +"@capacitor-firebase/analytics": major +"@capacitor-firebase/app": major +"@capacitor-firebase/app-check": major +"@capacitor-firebase/authentication": major +"@capacitor-firebase/crashlytics": major +"@capacitor-firebase/messaging": major +"@capacitor-firebase/performance": major +"@capacitor-firebase/remote-config": major +--- + +refactor(android): use `getMessage` instead of `getLocalizedMessage` diff --git a/packages/analytics/BREAKING.md b/packages/analytics/BREAKING.md index 15993813..f4b6286e 100644 --- a/packages/analytics/BREAKING.md +++ b/packages/analytics/BREAKING.md @@ -19,6 +19,12 @@ If you want to use this plugin with Capacitor 4, please install version `1.4.0`: npm i @capacitor-firebase/analytics@1.4.0 ``` +### Localized error messages + +On Android, error messages were previously generated with `getLocalizedMessage`. They are no longer localized and are generated with `getMessage` instead. + +You should therefore check your error handling. + ## Version 1.x.x ### Capacitor 4 diff --git a/packages/analytics/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/analytics/FirebaseAnalytics.java b/packages/analytics/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/analytics/FirebaseAnalytics.java index 0c088a06..16a5c38b 100644 --- a/packages/analytics/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/analytics/FirebaseAnalytics.java +++ b/packages/analytics/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/analytics/FirebaseAnalytics.java @@ -26,7 +26,7 @@ public void getAppInstanceId(@NonNull final GetAppInstanceIdCallback resultCallb if (!task.isSuccessful()) { Exception exception = task.getException(); Log.w(FirebaseAnalyticsPlugin.TAG, "Get AppInstanceId failed.", exception); - resultCallback.error(exception.getLocalizedMessage()); + resultCallback.error(exception.getMessage()); return; } diff --git a/packages/analytics/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/analytics/FirebaseAnalyticsPlugin.java b/packages/analytics/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/analytics/FirebaseAnalyticsPlugin.java index 40c40120..6668ee15 100644 --- a/packages/analytics/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/analytics/FirebaseAnalyticsPlugin.java +++ b/packages/analytics/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/analytics/FirebaseAnalyticsPlugin.java @@ -44,7 +44,7 @@ public void error(String message) { ); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -56,7 +56,7 @@ public void setUserId(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -73,7 +73,7 @@ public void setUserProperty(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -86,7 +86,7 @@ public void setCurrentScreen(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -103,7 +103,7 @@ public void logEvent(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -115,7 +115,7 @@ public void setSessionTimeoutDuration(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -131,7 +131,7 @@ public void setEnabled(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -147,7 +147,7 @@ public void resetAnalyticsData(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } } diff --git a/packages/app-check/BREAKING.md b/packages/app-check/BREAKING.md index 3cca4a6e..5be2c560 100644 --- a/packages/app-check/BREAKING.md +++ b/packages/app-check/BREAKING.md @@ -17,3 +17,9 @@ If you want to use this plugin with Capacitor 4, please install version `1.4.0`: ``` npm i @capacitor-firebase/app-check@1.4.0 ``` + +### Localized error messages + +On Android, error messages were previously generated with `getLocalizedMessage`. They are no longer localized and are generated with `getMessage` instead. + +You should therefore check your error handling. diff --git a/packages/app-check/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/appcheck/FirebaseAppCheck.java b/packages/app-check/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/appcheck/FirebaseAppCheck.java index a8cc7a4c..f5a40d8f 100644 --- a/packages/app-check/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/appcheck/FirebaseAppCheck.java +++ b/packages/app-check/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/appcheck/FirebaseAppCheck.java @@ -22,7 +22,7 @@ public void getToken(boolean forceRefresh, final GetTokenResultCallback resultCa .addOnFailureListener( exception -> { Log.w(FirebaseAppCheckPlugin.TAG, "Get App Check token failed.", exception); - resultCallback.error(exception.getLocalizedMessage()); + resultCallback.error(exception.getMessage()); } ); } diff --git a/packages/app-check/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/appcheck/FirebaseAppCheckPlugin.java b/packages/app-check/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/appcheck/FirebaseAppCheckPlugin.java index 636143ba..3039c74b 100644 --- a/packages/app-check/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/appcheck/FirebaseAppCheckPlugin.java +++ b/packages/app-check/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/appcheck/FirebaseAppCheckPlugin.java @@ -38,7 +38,7 @@ public void error(String message) { ); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -51,7 +51,7 @@ public void initialize(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -67,7 +67,7 @@ public void setTokenAutoRefreshEnabled(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } } diff --git a/packages/app/BREAKING.md b/packages/app/BREAKING.md index 3cc64614..30930bd4 100644 --- a/packages/app/BREAKING.md +++ b/packages/app/BREAKING.md @@ -19,6 +19,12 @@ If you want to use this plugin with Capacitor 4, please install version `1.4.0`: npm i @capacitor-firebase/app@1.4.0 ``` +### Localized error messages + +On Android, error messages were previously generated with `getLocalizedMessage`. They are no longer localized and are generated with `getMessage` instead. + +You should therefore check your error handling. + ## Version 1.x.x ### Capacitor 4 diff --git a/packages/app/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/capawesome/FirebaseAppPlugin.java b/packages/app/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/capawesome/FirebaseAppPlugin.java index b030540a..2a872f3e 100644 --- a/packages/app/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/capawesome/FirebaseAppPlugin.java +++ b/packages/app/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/capawesome/FirebaseAppPlugin.java @@ -27,7 +27,7 @@ public void getName(PluginCall call) { call.resolve(ret); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -45,7 +45,7 @@ public void getOptions(PluginCall call) { call.resolve(ret); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } } diff --git a/packages/authentication/BREAKING.md b/packages/authentication/BREAKING.md index c8c79018..7e4fa703 100644 --- a/packages/authentication/BREAKING.md +++ b/packages/authentication/BREAKING.md @@ -20,6 +20,12 @@ If you want to use this plugin with Capacitor 4, please install version `1.4.0`: npm i @capacitor-firebase/authentication@1.4.0 ``` +### Localized error messages + +On Android, error messages were previously generated with `getLocalizedMessage`. They are no longer localized and are generated with `getMessage` instead. + +You should therefore check your error handling. + ## Version 1.x.x ### Capacitor 4 diff --git a/packages/authentication/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/authentication/FirebaseAuthentication.java b/packages/authentication/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/authentication/FirebaseAuthentication.java index 5a1be554..1af2dc71 100644 --- a/packages/authentication/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/authentication/FirebaseAuthentication.java +++ b/packages/authentication/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/authentication/FirebaseAuthentication.java @@ -158,7 +158,7 @@ public void getIdToken(Boolean forceRefresh, final GetIdTokenResultCallback resu String token = task.getResult().getToken(); resultCallback.success(token); } else { - String message = task.getException().getLocalizedMessage(); + String message = task.getException().getMessage(); resultCallback.error(message); } } @@ -351,7 +351,7 @@ public void signInAnonymously(final PluginCall call) { call.resolve(signInResult); } else { Logger.error(TAG, "signInAnonymously failed.", task.getException()); - call.reject(task.getException().getLocalizedMessage()); + call.reject(task.getException().getMessage()); } } ); @@ -649,7 +649,7 @@ public void handleSuccessfulSignIn( public void handleFailedSignIn(final PluginCall call, String message, Exception exception) { Logger.error(TAG, exception.getMessage(), exception); if (message == null && exception != null) { - message = exception.getLocalizedMessage(); + message = exception.getMessage(); } call.reject(message, exception); } @@ -704,7 +704,7 @@ public void handleSuccessfulLink( public void handleFailedLink(final PluginCall call, String message, Exception exception) { Logger.error(TAG, exception.getMessage(), exception); if (message == null && exception != null) { - message = exception.getLocalizedMessage(); + message = exception.getMessage(); } call.reject(message, exception); } diff --git a/packages/authentication/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/authentication/FirebaseAuthenticationPlugin.java b/packages/authentication/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/authentication/FirebaseAuthenticationPlugin.java index 9e64792c..cd3cc71c 100644 --- a/packages/authentication/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/authentication/FirebaseAuthenticationPlugin.java +++ b/packages/authentication/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/authentication/FirebaseAuthenticationPlugin.java @@ -72,7 +72,7 @@ public void applyActionCode(PluginCall call) { implementation.applyActionCode(oobCode, () -> call.resolve()); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -92,7 +92,7 @@ public void confirmPasswordReset(PluginCall call) { implementation.confirmPasswordReset(oobCode, newPassword, () -> call.resolve()); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -102,7 +102,7 @@ public void createUserWithEmailAndPassword(PluginCall call) { implementation.createUserWithEmailAndPassword(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -117,7 +117,7 @@ public void deleteUser(PluginCall call) { implementation.deleteUser(user, () -> call.resolve()); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -131,7 +131,7 @@ public void getCurrentUser(PluginCall call) { call.resolve(result); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -158,7 +158,7 @@ public void error(String message) { ); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -175,7 +175,7 @@ public void getTenantId(PluginCall call) { call.resolve(result); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -192,7 +192,7 @@ public void isSignInWithEmailLink(PluginCall call) { call.resolve(result); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -202,7 +202,7 @@ public void linkWithApple(PluginCall call) { implementation.linkWithApple(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -212,7 +212,7 @@ public void linkWithEmailAndPassword(PluginCall call) { implementation.linkWithEmailAndPassword(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -222,7 +222,7 @@ public void linkWithEmailLink(PluginCall call) { implementation.linkWithEmailLink(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -232,7 +232,7 @@ public void linkWithFacebook(PluginCall call) { implementation.linkWithFacebook(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -242,7 +242,7 @@ public void linkWithGithub(PluginCall call) { implementation.linkWithGithub(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -252,7 +252,7 @@ public void linkWithGoogle(PluginCall call) { implementation.linkWithGoogle(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -262,7 +262,7 @@ public void linkWithMicrosoft(PluginCall call) { implementation.linkWithMicrosoft(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -281,7 +281,7 @@ public void linkWithPhoneNumber(PluginCall call) { implementation.linkWithPhoneNumber(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -291,7 +291,7 @@ public void linkWithPlayGames(PluginCall call) { implementation.linkWithPlayGames(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -301,7 +301,7 @@ public void linkWithTwitter(PluginCall call) { implementation.linkWithTwitter(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -311,7 +311,7 @@ public void linkWithYahoo(PluginCall call) { implementation.linkWithYahoo(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -326,7 +326,7 @@ public void reload(PluginCall call) { implementation.reload(user, () -> call.resolve()); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -341,7 +341,7 @@ public void sendEmailVerification(PluginCall call) { implementation.sendEmailVerification(user, () -> call.resolve()); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -356,7 +356,7 @@ public void sendPasswordResetEmail(PluginCall call) { implementation.sendPasswordResetEmail(email, () -> call.resolve()); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -395,7 +395,7 @@ public void sendSignInLinkToEmail(PluginCall call) { implementation.sendSignInLinkToEmail(email, actionCodeSettings.build(), () -> call.resolve()); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -408,7 +408,7 @@ public void setLanguageCode(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -425,7 +425,7 @@ public void setTenantId(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -435,7 +435,7 @@ public void signInAnonymously(PluginCall call) { implementation.signInAnonymously(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -445,7 +445,7 @@ public void signInWithApple(PluginCall call) { implementation.signInWithApple(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -460,7 +460,7 @@ public void signInWithCustomToken(PluginCall call) { implementation.signInWithCustomToken(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -470,7 +470,7 @@ public void signInWithEmailAndPassword(PluginCall call) { implementation.signInWithEmailAndPassword(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -480,7 +480,7 @@ public void signInWithEmailLink(PluginCall call) { implementation.signInWithEmailLink(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -490,7 +490,7 @@ public void signInWithFacebook(PluginCall call) { implementation.signInWithFacebook(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -500,7 +500,7 @@ public void signInWithGithub(PluginCall call) { implementation.signInWithGithub(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -510,7 +510,7 @@ public void signInWithGoogle(PluginCall call) { implementation.signInWithGoogle(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -520,7 +520,7 @@ public void signInWithMicrosoft(PluginCall call) { implementation.signInWithMicrosoft(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -539,7 +539,7 @@ public void signInWithPhoneNumber(PluginCall call) { implementation.signInWithPhoneNumber(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -549,7 +549,7 @@ public void signInWithPlayGames(PluginCall call) { implementation.signInWithPlayGames(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -559,7 +559,7 @@ public void signInWithTwitter(PluginCall call) { implementation.signInWithTwitter(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -569,7 +569,7 @@ public void signInWithYahoo(PluginCall call) { implementation.signInWithYahoo(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -579,7 +579,7 @@ public void signOut(PluginCall call) { implementation.signOut(call); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -599,7 +599,7 @@ public void unlink(PluginCall call) { implementation.unlink(call, user, providerId); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -619,7 +619,7 @@ public void updateEmail(PluginCall call) { implementation.updateEmail(user, newEmail, () -> call.resolve()); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -639,7 +639,7 @@ public void updatePassword(PluginCall call) { implementation.updatePassword(user, newPassword, () -> call.resolve()); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -656,7 +656,7 @@ public void updateProfile(PluginCall call) { implementation.updateProfile(user, displayName, photoUrl, () -> call.resolve()); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -667,7 +667,7 @@ public void useAppLanguage(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -685,7 +685,7 @@ public void useEmulator(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -698,7 +698,7 @@ public void handlePhoneVerificationCompleted(String smsCode) { public void handlePhoneVerificationFailed(Exception exception) { Logger.error(TAG, exception.getMessage(), exception); JSObject result = new JSObject(); - result.put("message", exception.getLocalizedMessage()); + result.put("message", exception.getMessage()); notifyListeners(PHONE_VERIFICATION_FAILED_EVENT, result, true); } diff --git a/packages/crashlytics/BREAKING.md b/packages/crashlytics/BREAKING.md index de0c9eab..d3b9083b 100644 --- a/packages/crashlytics/BREAKING.md +++ b/packages/crashlytics/BREAKING.md @@ -19,6 +19,12 @@ If you want to use this plugin with Capacitor 4, please install version `1.4.0`: npm i @capacitor-firebase/crashlytics@1.4.0 ``` +### Localized error messages + +On Android, error messages were previously generated with `getLocalizedMessage`. They are no longer localized and are generated with `getMessage` instead. + +You should therefore check your error handling. + ## Version 1.x.x ### Capacitor 4 diff --git a/packages/crashlytics/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/crashlytics/FirebaseCrashlyticsPlugin.java b/packages/crashlytics/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/crashlytics/FirebaseCrashlyticsPlugin.java index 83c91732..1c3bcdbd 100644 --- a/packages/crashlytics/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/crashlytics/FirebaseCrashlyticsPlugin.java +++ b/packages/crashlytics/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/crashlytics/FirebaseCrashlyticsPlugin.java @@ -53,7 +53,7 @@ public void setCustomKey(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -69,7 +69,7 @@ public void setUserId(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -85,7 +85,7 @@ public void log(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -101,7 +101,7 @@ public void setEnabled(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -119,7 +119,7 @@ public void didCrashOnPreviousExecution(PluginCall call) { call.resolve(ret); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -130,7 +130,7 @@ public void sendUnsentReports(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -141,7 +141,7 @@ public void deleteUnsentReports(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -159,7 +159,7 @@ public void recordException(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } } diff --git a/packages/messaging/BREAKING.md b/packages/messaging/BREAKING.md index 52279d1f..974cb345 100644 --- a/packages/messaging/BREAKING.md +++ b/packages/messaging/BREAKING.md @@ -21,6 +21,12 @@ If you want to use this plugin with Capacitor 4, please install version `1.4.0`: npm i @capacitor-firebase/messaging@1.4.0 ``` +### Localized error messages + +On Android, error messages were previously generated with `getLocalizedMessage`. They are no longer localized and are generated with `getMessage` instead. + +You should therefore check your error handling. + ## Version 1.x.x ### Capacitor 4 diff --git a/packages/messaging/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/messaging/FirebaseMessaging.java b/packages/messaging/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/messaging/FirebaseMessaging.java index 50974ad3..3cf0fbb6 100644 --- a/packages/messaging/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/messaging/FirebaseMessaging.java +++ b/packages/messaging/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/messaging/FirebaseMessaging.java @@ -34,7 +34,7 @@ public void getToken(final GetTokenResultCallback resultCallback) { if (!task.isSuccessful()) { Exception exception = task.getException(); Log.w(FirebaseMessagingPlugin.TAG, "Fetching FCM registration token failed", exception); - resultCallback.error(exception.getLocalizedMessage()); + resultCallback.error(exception.getMessage()); return; } diff --git a/packages/messaging/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/messaging/FirebaseMessagingPlugin.java b/packages/messaging/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/messaging/FirebaseMessagingPlugin.java index ba0b3c8c..c9b6ea83 100644 --- a/packages/messaging/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/messaging/FirebaseMessagingPlugin.java +++ b/packages/messaging/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/messaging/FirebaseMessagingPlugin.java @@ -106,7 +106,7 @@ public void error(String message) { ); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -117,7 +117,7 @@ public void deleteToken(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -136,7 +136,7 @@ public void getDeliveredNotifications(PluginCall call) { call.resolve(result); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -173,7 +173,7 @@ public void removeDeliveredNotifications(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -184,7 +184,7 @@ public void removeAllDeliveredNotifications(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -200,7 +200,7 @@ public void subscribeToTopic(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -216,7 +216,7 @@ public void unsubscribeFromTopic(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -239,7 +239,7 @@ public void createChannel(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -260,7 +260,7 @@ public void deleteChannel(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -282,7 +282,7 @@ public void listChannels(PluginCall call) { call.resolve(result); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } diff --git a/packages/performance/BREAKING.md b/packages/performance/BREAKING.md index 36f1e1df..e6911cd1 100644 --- a/packages/performance/BREAKING.md +++ b/packages/performance/BREAKING.md @@ -19,6 +19,12 @@ If you want to use this plugin with Capacitor 4, please install version `1.4.0`: npm i @capacitor-firebase/performance@1.4.0 ``` +### Localized error messages + +On Android, error messages were previously generated with `getLocalizedMessage`. They are no longer localized and are generated with `getMessage` instead. + +You should therefore check your error handling. + ## Version 1.x.x ### Capacitor 4 diff --git a/packages/performance/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/performance/FirebasePerformancePlugin.java b/packages/performance/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/performance/FirebasePerformancePlugin.java index e9fde8bc..e51d144e 100644 --- a/packages/performance/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/performance/FirebasePerformancePlugin.java +++ b/packages/performance/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/performance/FirebasePerformancePlugin.java @@ -36,7 +36,7 @@ public void startTrace(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -57,7 +57,7 @@ public void stopTrace(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -84,7 +84,7 @@ public void incrementMetric(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -100,7 +100,7 @@ public void setEnabled(PluginCall call) { call.resolve(); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -113,7 +113,7 @@ public void isEnabled(PluginCall call) { call.resolve(result); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } } diff --git a/packages/remote-config/BREAKING.md b/packages/remote-config/BREAKING.md index 0fe2dd1f..1245090d 100644 --- a/packages/remote-config/BREAKING.md +++ b/packages/remote-config/BREAKING.md @@ -17,3 +17,9 @@ If you want to use this plugin with Capacitor 4, please install version `1.4.0`: ``` npm i @capacitor-firebase/remote-config@1.4.0 ``` + +### Localized error messages + +On Android, error messages were previously generated with `getLocalizedMessage`. They are no longer localized and are generated with `getMessage` instead. + +You should therefore check your error handling. diff --git a/packages/remote-config/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/remoteconfig/FirebaseRemoteConfig.java b/packages/remote-config/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/remoteconfig/FirebaseRemoteConfig.java index 0959b918..6a0ff04f 100644 --- a/packages/remote-config/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/remoteconfig/FirebaseRemoteConfig.java +++ b/packages/remote-config/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/remoteconfig/FirebaseRemoteConfig.java @@ -22,7 +22,7 @@ public void activate(final ActivateResultCallback resultCallback) { .addOnFailureListener( exception -> { Log.w(FirebaseRemoteConfigPlugin.TAG, "Activate config failed.", exception); - resultCallback.error(exception.getLocalizedMessage()); + resultCallback.error(exception.getMessage()); } ); } @@ -38,7 +38,7 @@ public void fetchAndActivate(final ActivateResultCallback resultCallback) { .addOnFailureListener( exception -> { Log.w(FirebaseRemoteConfigPlugin.TAG, "Fetch and activate config failed.", exception); - resultCallback.error(exception.getLocalizedMessage()); + resultCallback.error(exception.getMessage()); } ); } @@ -54,7 +54,7 @@ public void fetchConfig(long minimumFetchIntervalInSeconds, final FetchConfigRes .addOnFailureListener( exception -> { Log.w(FirebaseRemoteConfigPlugin.TAG, "Fetch config failed.", exception); - resultCallback.error(exception.getLocalizedMessage()); + resultCallback.error(exception.getMessage()); } ); } diff --git a/packages/remote-config/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/remoteconfig/FirebaseRemoteConfigPlugin.java b/packages/remote-config/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/remoteconfig/FirebaseRemoteConfigPlugin.java index f5b3b523..a5fcca95 100644 --- a/packages/remote-config/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/remoteconfig/FirebaseRemoteConfigPlugin.java +++ b/packages/remote-config/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/remoteconfig/FirebaseRemoteConfigPlugin.java @@ -32,7 +32,7 @@ public void error(String message) { ); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -54,7 +54,7 @@ public void error(String message) { ); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -78,7 +78,7 @@ public void error(String message) { ); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -97,7 +97,7 @@ public void getBoolean(PluginCall call) { call.resolve(result); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -116,7 +116,7 @@ public void getNumber(PluginCall call) { call.resolve(result); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } } @@ -135,7 +135,7 @@ public void getString(PluginCall call) { call.resolve(result); } catch (Exception exception) { Logger.error(TAG, exception.getMessage(), exception); - call.reject(exception.getLocalizedMessage()); + call.reject(exception.getMessage()); } }