Repository navigation
feat: [SDK-5024] add loginWithProfile (Android only) - #904
Draft
abdulraqeeb33 wants to merge 3 commits into
Draft
abdulraqeeb33 wants to merge 3 commits into
abdulraqeeb33 wants to merge 3 commits into
Conversation
Adds OneSignal.LoginWithProfileAsync(externalId, profile, jwt) returning a typed LoginResult. Android calls the native suspend login through Continue.with and parses OneSignalResult.toMap(). iOS and the Editor return the unsupported failure without touching native code. Bumps the native Android SDK to 5.11.0 and adds LOGIN WITH PROFILE to the demo. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
Author
|
Heads-up on the native Android dependency, so the red Android CI doesn't cause alarm:
|
Rename LoginData.OnesignalId to OneSignalId to match User.OneSignalId. Build the Consumer proxy inside the guard so it can never throw, log native failures once, use the exception message, and reject success with errors. Co-authored-by: Cursor <cursoragent@cursor.com>
The native constructor is now private so new profile fields never break compiled callers. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
One Line Summary
Add
loginWithProfile(externalId, profile, jwt?): one Create User call that logs in and attaches email, SMS, tags and aliases. Android only for now.Details
Motivation
Exposes the Android SDK's composite
login(externalId, profile)(OneSignal-Android-SDK#2743) so wrapper apps can log in with a profile in a single request and get a typed result back.Scope
loginis unchanged (its void return type cannot change).success,data,error). Never throws or rejects; bad input resolvesINVALID_ARGUMENT, anything unexpected resolvesUNKNOWN.{ success: false, error: [{ code: "UNKNOWN", source: "CLIENT", message: "loginWithProfile is only supported on Android" }] }and calls no native iOS API, so it cannot crash or hang.5.11.0(unreleased, see the comment below).composite_login_*test IDs from the shared spec (sdk-shared#58).Public API
Plus static
OneSignal.LoginWithProfileAsync. NewOneSignalUserProfileandLoginResult(Success,Data,Errors). Parsing uses the bundled MiniJSON; no new dependency.com.onesignal.Continue.with(same asRequestPermissionAsync), so no new Java plugin file. A non-suspending return is detected by checking for aOneSignalResultinstance rather than the stdlibCOROUTINE_SUSPENDEDmarker, which R8 can rename under JNI lookup.OneSignaliOS.cs. No newDllImport, so no IL2CPP link risk. Editor stub does the same.Open naming question for reviewers: the list is
Errors(C# plural) while the other wrappers mirror the wire keyerror.Testing
Unit testing
No repo test harness. A scratch parser test (not committed) passed 21/21 including the real native JSON.
Manual testing
Roslyn compile of SDK core/Android/iOS/Editor and demo scripts with all defines pass;
csharpier checkandvalidate-unity-distribution.pypass.javacagainst the locally published aar confirmed every signature used. Not run in the Editor or on a device (no Unity license on the build machine).Affected code checklist
Checklist
Overview
Testing
Final pass