Skip to content

Commit 299830d

Browse files
committed
Remove null check and JSONException operation at OneSignal.setLanguage
* Remove unnecessary null check at OneSignal.setLanguage * Remove error logging at JSONException catch at OneSignal.setLanguage
1 parent de9f029 commit 299830d

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

OneSignalSDK/onesignal/src/main/java/com/onesignal/OneSignal.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,8 @@ public static void init(Context context, String googleProjectNumber, String oneS
791791
initDone = true;
792792

793793
outcomeEventsController.sendSavedOutcomes();
794+
// Set Language Context to null
795+
languageContext = new LanguageContext(preferences);
794796

795797
// Clean up any pending tasks that were queued up before initialization
796798
startPendingTasks();
@@ -1586,8 +1588,6 @@ public void run() {
15861588
deviceInfo.put("language", languageContext.getLanguage());
15871589
OneSignalStateSynchronizer.updateDeviceInfo(deviceInfo);
15881590
} catch (JSONException exception) {
1589-
String operation = language.equals("") ? "remove" : "set";
1590-
logger.error("Attempted to " + operation + " external ID but encountered a JSON exception");
15911591
exception.printStackTrace();
15921592
}
15931593
}
@@ -1603,11 +1603,6 @@ public void run() {
16031603
if (shouldLogUserPrivacyConsentErrorMessageForMethodName("setLanguage()"))
16041604
return;
16051605

1606-
if (language == null) {
1607-
logger.warning("Language can't be null");
1608-
return;
1609-
}
1610-
16111606
LanguageProviderAppDefined languageProviderAppDefined = new LanguageProviderAppDefined(preferences);
16121607
languageProviderAppDefined.setLanguage(language);
16131608
languageContext.setStrategy(languageProviderAppDefined);

0 commit comments

Comments
 (0)