-
Notifications
You must be signed in to change notification settings - Fork 233
Feature app defined setLanguage #452
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
Conversation
* Add setLanguage method to Android plugin in OneSignalPlugin.java
* Update Podfile and Podspec with OneSignalXCFramework 3.6.0 * OneSignalXCFramework 3.6.0 enables the use of setLanguage on iOS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit the commit that changes the iOS plugin is named add setLanguage to Android plugin.
Reviewable status: 0 of 7 files reviewed, 1 unresolved discussion (waiting on @Jeasmine, @jkasten2, and @tanaynigam)
test/mock_channel.dart, line 71 at r1 (raw file):
return {"success" : true}; case "OneSignal#setLanguage": this.state.language = (call.arguments as Map<dynamic, dynamic>)['language'] as String?;;
nit indentation here looks off
* Add setLanguage method to iOS plugin in OneSignalPlugin.m
* Add setLanguage bridge method to onesignal_flutter.dart
* Add language string and OneSignal setLanguage call to OneSignalMockChannelController * Add setLanguage test to onesignalflutter_test.dart
9302f83
to
2872895
Compare
* Fix indentation in mock_channel.dart
@@ -337,6 +339,14 @@ public void onFailure(OneSignal.OSSMSUpdateError error) { | |||
}); | |||
} | |||
|
|||
private void setLanguage(MethodCall call, final Result result) { | |||
String language = call.argument("language"); | |||
if(language != null && language.length() == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a space after the if? Also, isn't there a string utils notNullorEmpty? I might be wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this condition i referred from setExternalUserId looks for a condition where the string may be non-null but is empty. I which case it assigns null value to the string (possibly to push null to the endpoint instead of an empty string?)
ios/Classes/OneSignalPlugin.m
Outdated
@@ -320,6 +322,14 @@ - (void)removeExternalUserId:(FlutterMethodCall *)call withResult:(FlutterResult | |||
}]; | |||
} | |||
|
|||
- (void)setLanguage:(FlutterMethodCall *)call withResult:(FlutterResult)result { | |||
id language = call.arguments[@"language"]; | |||
if (language == [NSNull null]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in iOS i think you always need to put the braces {}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 6 of 7 files at r1, 1 of 1 files at r2.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @emawby and @tanaynigam)
test/mock_channel.dart, line 71 at r1 (raw file):
Previously, emawby (Elliot Mawby) wrote…
nit indentation here looks off
Remove extra semicolon ;
* fix format errors in OneSignalPlugin.java, OneSignalPlugin.m and mock_channel.dart
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 3 files at r3.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @Jeasmine and @tanaynigam)
android/src/main/java/com/onesignal/flutter/OneSignalPlugin.java, line 344 at r2 (raw file):
Previously, tanaynigam (Tanay Nigam) wrote…
I think this condition i referred from setExternalUserId looks for a condition where the string may be non-null but is empty. I which case it assigns null value to the string (possibly to push null to the endpoint instead of an empty string?)
I think either way this is fine, since on REST API it will just set language to "en" for either "" or null values. Would code would be a simpler if we just remove this if completely. @Jeasmine thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @Jeasmine and @tanaynigam)
Description
Line Summary
Add feature app-defined language implementation to OneSignal-Flutter-SDK. A user can define their own language setting to be used by OneSignal-SDK
Details
setLanguage
method to OneSignal Android pluginsetLanguage
method to OneSignal iOS pluginOneSignalXCFramework 3.6.0
setLanguage
bridge methods to onesignal_flutter.dartTest
setLanguage
callback that expectslanguage
returned to be the sameThis change is