AB#280444 - Add GamifyWidget SDK module - #140
Merged
Merged
Conversation
dmytro-b-optimove
marked this pull request as draft
April 13, 2026 23:41
dmytro-b-optimove
marked this pull request as ready for review
April 27, 2026 11:28
dmytro-b-optimove
force-pushed
the
feature/280444-gamify-widget-ios
branch
from
April 27, 2026 11:57
0ac9128 to
fa68645
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…wrapper Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dmytro-b-optimove
force-pushed
the
feature/280444-gamify-widget-ios
branch
from
April 27, 2026 22:27
fa68645 to
da1effe
Compare
4 tasks
SofiaVainstein
previously approved these changes
Apr 30, 2026
graciecooper
reviewed
May 1, 2026
graciecooper
reviewed
May 1, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
eligutovsky
reviewed
May 10, 2026
Match the ensureMain + assertOnMainThread pattern from InAppPresenter.swift so public entry points dispatch to main themselves instead of relying on a debug-only assert that strips in release builds. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a new “Gamify Widget” feature area to the OptimoveSDK, providing a public SDK entry point to configure a widget URL and present a modal sheet hosting a WKWebView with a simple JS bridge handshake.
Changes:
- Introduces
GamifyWidgetSDKas the public API for configuring and opening the widget. - Adds
GamifyWidgetViewControllerto host theWKWebView, show loading/error UI, and handle READY/INIT/CLOSE messages. - Adds
GamifyWidgetSDKTestscovering URL initialization behavior (including a background-thread call case).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| OptimoveSDK/Sources/Classes/GamifyWidget/GamifyWidgetSDK.swift | Public entry point to initialize widget URL and present the widget as a modal sheet. |
| OptimoveSDK/Sources/Classes/GamifyWidget/GamifyWidgetViewController.swift | Internal UIKit controller with WKWebView + JS bridge, loading spinner, and error state. |
| OptimoveSDK/Tests/Sources/GamifyWidget/GamifyWidgetSDKTests.swift | Unit tests validating widget URL initialization behavior. |
Comments suppressed due to low confidence (1)
OptimoveSDK/Tests/Sources/GamifyWidget/GamifyWidgetSDKTests.swift:21
- Same issue as above: this test asserts immediately after calling
initialize, butinitializemay be async if invoked off the main thread. Make the test deterministic by running the call on the main thread or waiting until the main-queue work has executed.
func testInitializeOverwritesPreviousUrl() {
GamifyWidgetSDK.initialize(widgetUrl: "https://first.example.com")
GamifyWidgetSDK.initialize(widgetUrl: "https://second.example.com")
XCTAssertEqual(GamifyWidgetSDK.widgetUrl, "https://second.example.com")
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…w error label Match the existing presenter pattern from InAppPresenter/OverlayMessagingPresenter: - GamifyWidgetSDK.open pre-flight guards empty/invalid widgetUrl with Logger.error + return - Remove the error label from GamifyWidgetViewController; nav failures silently dismiss Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Wrap GamifyWidgetSDK.initialize(widgetUrl:) calls in runOnMainSync helper so the write completes before assertions, removing the false-negative risk under off-main test execution. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
kris-opti
approved these changes
May 18, 2026
dmytro-b-optimove
added a commit
to optimove-tech/Optimove-SDK-React-Native
that referenced
this pull request
Jun 2, 2026
iOS 6.7.0 is the first release to bundle GamifyWidgetSDK (merged in optimove-tech/Optimove-SDK-iOS#140, released 2026-06-01). The Swift bridge already targets the released API (initialize(widgetUrl:) + open(from:userId:token:)), so this only bumps the dependency pins: OptimoveCore/OptimoveSDK ~> 6.7.0 in the podspec, OptimoveNotificationServiceExtension ~> 6.7.0 in the example Podfile, and the regenerated Podfile.lock. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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.
Summary
GamifyWidgetSDK— public entry point withinitialize(widgetUrl:)andopen(from:userId:token:)that presents a modal sheetGamifyWidgetViewController— internal UIKit view controller hosting aWKWebViewwith JS bridge (READY → INIT → CLOSE handshake), loading spinner, and error stateGamifyWidgetSDKTests— unit tests for URL initialisationiOS equivalent of Android SDK PR #91 (AB#280444). No changes to
Package.swift— new files sit inside the existingOptimoveSDKtarget source path.JS Bridge
Widget fires
READYviawindow.webkit.messageHandlers.receiveMessage.postMessage({type: "READY", ...})→ native responds withINIT(userId/token) viawindow.postMessage. Widget callswindow.webkit.messageHandlers.closeWidget.postMessage(...)to close. Handler names match the canonical bridge contract inopti-ls/packages/widget-fe/src/lib/bridge/bridge.ts. Token is redacted in logs.Test plan
cmd+UonOptimoveSDKscheme —GamifyWidgetSDKTestspasscmd+BoniOSscheme — clean build, no errors or warnings