fix(docs): correct handleLog signature in iOS and Android SuperwallDelegate - #265
Open
0xwurdig wants to merge 1 commit into
Open
fix(docs): correct handleLog signature in iOS and Android SuperwallDelegate#2650xwurdig wants to merge 1 commit into
0xwurdig wants to merge 1 commit into
Conversation
…legate The SuperwallDelegate reference documents handleLog as taking LogLevel and LogScope, but both SDKs declare level and scope as String, and message as optional. This has been the case since 4.0.0 on iOS and across the current Android line. Because LogLevel and LogScope are real public types, the documented signature compiles. And because every delegate method has a default empty implementation, there is no conformance error either — you have simply declared an unrelated method, so the callback never fires and the build stays clean. Corrects the Swift, Kotlin and Java blocks, and adds a note plus a TypeTable row explaining that level and scope are the string forms of the enums.
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.
What changed and why
The
SuperwallDelegatereference on iOS and Android documentshandleLogas:Both SDKs actually declare
levelandscopeasString, andmessageas optional:Sources/SuperwallKit/Delegate/SuperwallDelegate.swift:102superwall/src/main/java/com/superwall/sdk/delegate/SuperwallDelegate.kt:34(andSuperwallDelegateJava.kt:38)This isn't drift from an older API.
handleLoghas takenStringat every v4 tag I checked — 4.0.0, 4.5.0, 4.10.0, 4.16.1 — so the documented signature has never matched a shipped SDK.Why it's worth fixing rather than just wrong
It fails silently. Three things line up:
LogLevelandLogScopeare real public types, so the documented signature compiles.DEBUG,INFO,WARN, orERROR, as defined byLogLevel", which describes the string's contents in a way that sounds like the parameter's type.Net result: the delegate keeps calling its own empty default,
handleLognever fires, and there is no warning anywhere. I hit this while wiring the iOS SDK into a test app and only found it by reading the SDK source.Corroboration that
Stringis intendedThe React Native reference already documents it correctly —
content/docs/react-native/sdk-reference/SuperwallDelegate.mdx:75declareslevel: string, scope: string, message?: string.Superwall's own Android sample app overrides it with
Stringand compares against the stringified enum —app/src/main/java/com/superwall/superapp/MainApplication.kt:137:So the iOS and Android reference pages are the outliers, not the SDKs.
The change
<Note>on each explaining thatlevelandscopeare the string forms, since otherwise the fix reads as a mistake. The exact values are verified from the call sites: iOSLogger.swift:78passeslogLevel.description, AndroidLogger.kt:51passeslogLevel.toString(), both yielding"DEBUG"/"INFO"/"WARN"/"ERROR"/"NONE".handleLogrow to each page's existingTypeTable, per theTypeTableconvention inAGENTS.md.Scope kept to
handleLog. I found some other gaps while auditing and will raise those separately rather than bundle them here.Testing performed
bun install --frozen-lockfilebun run build— succeeds, 602 pages prerenderedbun run build:cf— succeeds, search index generatedbun test— 64 pass, 0 failcontent/for any other page documentinghandleLogwith the enum types: none. React Native was already correct; changelog entries are historical and left alone.Only
content/docs/**touched. Nothing underpublic/. Not deployed.