Repository navigation
feat: [SDK-5024] add loginWithProfile (Android only) - #75
Draft
abdulraqeeb33 wants to merge 4 commits into
Draft
abdulraqeeb33 wants to merge 4 commits into
abdulraqeeb33 wants to merge 4 commits into
Conversation
Adds OneSignal.loginWithProfile(externalId, profile, jwt?) resolving with a typed LoginResult parsed from the native OneSignalResult.toMap() envelope. iOS and web resolve with an UNKNOWN failure from the TS layer. Bumps Android SDK to 5.11.0 and adds a LOGIN WITH PROFILE flow to the demo apps. 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 also carries errors, log native login failures, cover web in the platform guard test, and drop stale demo results when a logout or another login happens during the await. Co-authored-by: Cursor <cursoragent@cursor.com>
The user change listener and fetchUserDataFromApi also bump requestSequenceRef, so a successful login that changed the onesignalId was treated as stale and never saved the external id.
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
Exports
OneSignalUserProfile,LoginResult,LoginData,LoginError,LoginErrorCode,LoginErrorSource. The Android plugin is Kotlin, so it calls the suspendOneSignal.logindirectly on the existingpluginScope. iOS and web short-circuit in TypeScript viaCapacitor.getPlatform(); Swift is untouched.Testing
Unit testing
301 tests pass (99.1% statements, 97.1% branches). The iOS-envelope test fails if the platform guard is removed.
Manual testing
bun run lintand demotscpass fordemoanddemo_pods.:onesignal-capacitor-plugin:compileDebugKotlinsucceeded against the locally published Android SDK.format:check(README.md) andverify(missing example node modules) fail identically onmain. Not run on a device or iOS.Affected code checklist
Checklist
Overview
Testing
Final pass