Repository navigation
feat: [SDK-5024] add loginWithProfile (Android only) - #210
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 IOneSignal.LoginWithProfileAsync returning a typed LoginResult parsed from the native OneSignalResult.toMap() envelope. Android bridges the suspend login(externalId, profile, jwt) through a Kotlin Continuation; iOS returns an unsupported failure. Bumps versions.json to Android 5.11.0; the binding AARs still need update_native_binaries.sh once 5.11.0 is on Maven Central. Demo gains a LOGIN WITH PROFILE button and dialog on Android. 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:
|
Reject a success envelope that carries errors, and report and log the native exception message instead of the kotlin.Result wrapper. 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
On
IOneSignaland the staticOneSignal. NewOneSignalUserProfile,LoginResult(Success,Data,Error),LoginData,OneSignalErrorinOneSignalSDK.DotNet.Core/User/. Codes are strings, matching the wire shape.LoginResultContinuationimplementsKotlin.Coroutines.IContinuationagainst the generatedLogin(..., IContinuation)binding (no Metadata.xml change needed). Handles the non-COROUTINE_SUSPENDEDreturn, completes aTaskCompletionSourceexactly once, and mapsResult$Failure/ exceptions toUNKNOWN. Result is marshalled viaToMap()and the repo'sJson.Deserialize.iOSOneSignal.cs; no native call.Testing
Unit testing
No test project in the repo. A scratch console app (not committed) ran 17 parser cases: success, backend and client failures, malformed and wrong-type input.
Manual testing
With the locally published 5.11.0 AARs:
dotnet buildof the Core binding, Android, iOS andOneSignalSDK.DotNet, plus the demo fornet10.0-androidandnet10.0-ios, all succeeded. Android emulator: invalid email and SMS returnedINVALID_ARGUMENTfrom native, an empty externalId was caught in C#, and the await resumed on the main thread. A real backend login was not run.Affected code checklist
Checklist
Overview
Testing
Final pass