Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
039809e
feat(sdk): products get old price, discount, deeplinks and facets
Xyzcancer Oct 21, 2026
818f6a1
feat(ios): bridge passes old price, discount, deeplink and facets
Xyzcancer Oct 21, 2026
6c7d374
feat(ui): one mapper from SDK products to the kit product
Xyzcancer Oct 21, 2026
bf5ac6e
feat(ui): showRating on the search results screen, off by default
Xyzcancer Oct 21, 2026
e8c4e2e
feat(ui): in-memory request cache for the kit's data widgets
Xyzcancer Oct 21, 2026
45b36f2
feat(ui): load state with retry for the kit's data widgets
Xyzcancer Oct 21, 2026
e18e7f8
feat(ui): search results show a failed page and retry it
Xyzcancer Oct 21, 2026
3564f2f
fix(ui): discount badge only for a positive discount
Xyzcancer Oct 21, 2026
8fb7b07
fix(ui): cache keys encode params, answers age on a monotonic clock
Xyzcancer Oct 21, 2026
50e03fd
fix(ui): a request in flight can no longer block its cache key
Xyzcancer Oct 21, 2026
f292a7d
fix(ui): search results always offer a retry after an error
Xyzcancer Oct 21, 2026
669e6e8
test(ui): retrying a search page does not track the search again
Xyzcancer Oct 21, 2026
a2c886d
fix(ui): no results count above a failed first page
Xyzcancer Oct 21, 2026
5da6069
fix(ui): load controller ignores load, retry and reset after dispose
Xyzcancer Oct 21, 2026
31b0906
fix(ios): products list sends a discount only when there is one
Xyzcancer Oct 21, 2026
3c78a0b
test(sdk): recommendations and categories in the shape each bridge sends
Xyzcancer Oct 21, 2026
9ba524f
chore: keep the test API samples out of the published package
Xyzcancer Oct 21, 2026
b0e7db5
test(ui): the leaving waiter test keeps another waiter on the request
Xyzcancer Oct 21, 2026
59c6db5
fix(ui): a discount_percent badge does not take discount_formatted
Xyzcancer Oct 21, 2026
a9060e9
refactor(ui): the presentational block is PersonalizationProductsBlock
Xyzcancer Oct 21, 2026
5620fb2
feat(ui): products block title is optional, rating behind showRating
Xyzcancer Oct 21, 2026
4a06e57
feat(ui): request cache can peek a fresh answer synchronously
Xyzcancer Oct 21, 2026
76c1628
feat(ui): PersonalizationRecommenderBlock loads its own products
Xyzcancer Oct 21, 2026
721cccc
feat(example): live recommender blocks of the demo shop in Blocks
Xyzcancer Oct 21, 2026
b3dd3bc
feat(ui): the card button of a recommender block sets the source too
Xyzcancer Oct 21, 2026
343bf44
feat(example): demo shop card mapper and add-to-cart helper
Xyzcancer Oct 22, 2026
6c4e459
feat(example): demo shop product screen with similar products
Xyzcancer Oct 22, 2026
284c421
feat(example): demo shop category screen with paging and retry
Xyzcancer Oct 22, 2026
852170d
feat(example): demo shop search screen on the kit results screen
Xyzcancer Oct 22, 2026
540657c
feat(example): demo shop home and its entry on the main page
Xyzcancer Oct 22, 2026
2df242f
feat(sdk): getCategory takes brands, locations and facet filters
Xyzcancer Nov 2, 2026
024cc6e
feat(sdk): brands, colours and sizes carry product counts, product li…
Xyzcancer Nov 2, 2026
f646caf
fix(ui): carousel dots are off by default
Xyzcancer Nov 2, 2026
185f26c
fix(ui): badge text stays on one line
Xyzcancer Nov 2, 2026
04fb31c
fix(ui): card prices and the narrow list card's button wrap instead o…
Xyzcancer Nov 2, 2026
4890257
fix(ui): filters keep the title and buttons in place while sections s…
Xyzcancer Nov 2, 2026
3b0f44c
feat(ui): category screen shares the search results core
Xyzcancer Nov 2, 2026
48e6857
feat(example): API, UI Kit and Shop are bottom tabs
Xyzcancer Nov 2, 2026
fac66dd
feat(example): shop home takes its categories from the listing
Xyzcancer Nov 2, 2026
12a1bb1
feat(example): product page has the shop's search on top and similar,…
Xyzcancer Nov 2, 2026
b6c2c86
feat(example): category runs on the kit's category screen, with sorti…
Xyzcancer Nov 2, 2026
b47e50c
feat(ui): stories V2 share button and opening a campaign by link over…
Xyzcancer Nov 2, 2026
e355f45
feat(example): stories V2 with sharing and deep links to a story
Xyzcancer Nov 2, 2026
1dbd71c
Merge branch 'DEV-4618-stories-share' into ui-components-use-cases
Xyzcancer Nov 2, 2026
0566ac5
feat(ui): polls on stories V2 slides (API v3)
Xyzcancer Nov 3, 2026
c6e55bf
fix(ui): text blocks stand on y_offset inside the slide area, like polls
Xyzcancer Nov 3, 2026
c590e64
feat(ui): share link opens the shared slide, product campaigns too
Xyzcancer Nov 3, 2026
6fe14ae
feat(example): shop-only variant, its home stories on API v3 with sha…
Xyzcancer Nov 3, 2026
14bff3d
feat(example): stories V2 polls offline showcase
Xyzcancer Nov 3, 2026
f301a7c
feat(ui): popups v3 — native rendering of the new popup builder's des…
Xyzcancer Nov 3, 2026
94c78c6
feat(example): popups v3 on in both demos, screens report themselves,…
Xyzcancer Nov 3, 2026
6ba1549
feat(ui): stories polls restyled to the reference — frosted card, let…
Xyzcancer Nov 4, 2026
e96d461
feat(example): one shop layout on all platforms, search behind a head…
Xyzcancer Nov 4, 2026
54bfbf9
fix(ui): popups v3 keep to their design in a dark system theme — the …
Xyzcancer Nov 5, 2026
244c2bb
feat(sdk): enableAutoPopupPresentation can be changed at any time, as…
Xyzcancer Nov 5, 2026
bcca0f9
feat(example): a tic-tac-toe mini-game the link rees46flutter://game …
Xyzcancer Nov 5, 2026
dcaf5f5
feat(ui): the UI kit opens to apps from package:rees46_sdk/rees46_sdk…
Xyzcancer Nov 9, 2026
bb40bef
feat(sdk): native SDKs Android 2.47.0 and iOS 3.37.0; a category take…
Xyzcancer Nov 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .pubignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ migrate_working_dir/
# Maintainer-only release docs, not part of the public API.
/doc/
/docs/
# Live API samples of a demo shop's catalog: test data, not part of the package.
/test/fixtures/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ repository. The tag is the version the plugin requires — the `REES46` dependen
[`ios/rees46_sdk.podspec`](ios/rees46_sdk.podspec):

```ruby
pod 'REES46', :git => 'https://github.com/rees46/ios-sdk.git', :tag => 'v3.36.1'
pod 'REES46', :git => 'https://github.com/rees46/ios-sdk.git', :tag => 'v3.37.0'
```

`pod install` then runs as part of `flutter run`. Update the tag together with the
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ android {

dependencies {
// REES46 Android SDK.
val rees46AndroidSdkVersion = "v2.45.0"
val rees46AndroidSdkVersion = "v2.47.0"
add("rees46Implementation", "com.github.rees46:android-sdk:$rees46AndroidSdkVersion")

// Used directly by the push presenter (NotificationCompat / ContextCompat). The native SDK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import android.os.Build
import android.os.Bundle
import android.provider.Settings
import android.os.SystemClock
import android.view.View
import android.view.ViewTreeObserver
import com.rees46.rees46_flutter_sdk.pigeon.FlutterError
import com.rees46.rees46_flutter_sdk.pigeon.InitConfig
import com.rees46.rees46_flutter_sdk.pigeon.ManageSubscriptionParamsWire
Expand Down Expand Up @@ -467,6 +469,7 @@ class Rees46FlutterSdkPlugin :
category: String,
limit: Long?,
page: Long?,
paramsJson: String?,
shopId: String?,
callback: (Result<String>) -> Unit,
) {
Expand All @@ -475,10 +478,22 @@ class Rees46FlutterSdkPlugin :
return
}
try {
val p = if (!paramsJson.isNullOrBlank()) JSONObject(paramsJson) else null
val filters: Map<String, Any>? = p?.optJSONObject("filters")?.let { obj ->
obj.keys().asSequence().associateWith { key -> obj.get(key) }
}?.takeIf { it.isNotEmpty() }
fun price(key: String): Double? = p?.takeIf { it.has(key) && !it.isNull(key) }?.getDouble(key)
sdk(shopId).categoryManager.getCategory(
category = category,
limit = limit?.toInt(),
page = page?.toInt(),
brands = p?.optString("brands")?.takeIf { it.isNotEmpty() },
locations = p?.optString("locations")?.takeIf { it.isNotEmpty() },
filters = filters,
priceMin = price("price_min"),
priceMax = price("price_max"),
sortBy = p?.optString("sort_by")?.takeIf { it.isNotEmpty() },
sortDir = p?.optString("sort_dir")?.takeIf { it.isNotEmpty() },
onSuccess = { response ->
callback(Result.success(Gson().toJson(response)))
},
Expand Down Expand Up @@ -555,6 +570,34 @@ class Rees46FlutterSdkPlugin :
}
}

override fun shareUrl(
url: String,
anchorX: Double,
anchorY: Double,
anchorWidth: Double,
anchorHeight: Double,
callback: (Result<Unit>) -> Unit,
) {
// The anchor is for the iPad popover; the Android chooser has none.
val send = Intent(Intent.ACTION_SEND)
.setType("text/plain")
.putExtra(Intent.EXTRA_TEXT, url)
val chooser = Intent.createChooser(send, null)
val activity = activityBinding?.activity
if (activity == null) chooser.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
try {
(activity ?: applicationContext).startActivity(chooser)
} catch (e: ActivityNotFoundException) {
callback(Result.failure(FlutterError("share_failed", e.message, null)))
return
}
if (activity == null) {
callback(Result.success(Unit))
return
}
ShareSheetWatcher(activity.window.decorView, callback).start()
}

override fun trackPopupShown(popupId: Long, shopId: String?, callback: (Result<Unit>) -> Unit) =
trackingCall(callback, shopId) {
it.popupShown(popupId.toInt(), trackingListener(callback))
Expand Down Expand Up @@ -1183,3 +1226,41 @@ private fun NotificationData.toPayload(): Map<String, String?> {
}
return map
}

/**
* Completes [shareUrl][Rees46FlutterSdkPlugin.shareUrl] when the chooser is gone: the window of
* the activity lost its focus to the chooser and got it back (the user picked a target and came
* back, or closed the chooser). A chooser that never took the focus does not hold the viewer:
* the call completes after [NO_SHEET_MS].
*/
private class ShareSheetWatcher(
private val view: View,
private val done: (Result<Unit>) -> Unit,
) : ViewTreeObserver.OnWindowFocusChangeListener {
private var lost = !view.hasWindowFocus()
private var finished = false

fun start() {
view.viewTreeObserver.addOnWindowFocusChangeListener(this)
view.postDelayed({ if (!lost) finish() }, NO_SHEET_MS)
}

override fun onWindowFocusChanged(hasFocus: Boolean) {
if (!hasFocus) {
lost = true
} else if (lost) {
finish()
}
}

private fun finish() {
if (finished) return
finished = true
view.viewTreeObserver.removeOnWindowFocusChangeListener(this)
done(Result.success(Unit))
}

private companion object {
const val NO_SHEET_MS = 1500L
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -606,9 +606,13 @@ interface PersonalizationHostApi {
/**
* Returns a category product listing as a JSON string.
* [limit] and [page] paginate the result; both are optional.
* [paramsJson] is a JSON object string with the optional filters: "brands" and
* "locations" (comma-separated strings), "filters" (facet name → [values]),
* "price_min" / "price_max" (numbers), "sort_by" / "sort_dir" (strings). A bridge
* passes on only what its native SDK takes for a category.
* Dart layer parses the result into [CategoryResponse].
*/
fun getCategory(category: String, limit: Long?, page: Long?, shopId: String?, callback: (Result<String>) -> Unit)
fun getCategory(category: String, limit: Long?, page: Long?, paramsJson: String?, shopId: String?, callback: (Result<String>) -> Unit)
/**
* Returns a merchandised collection's products as a JSON string.
* Dart layer parses the result into [CollectionResponse].
Expand All @@ -626,6 +630,14 @@ interface PersonalizationHostApi {
* Returns false when nothing could open it.
*/
fun openUrl(url: String, callback: (Result<Boolean>) -> Unit)
/**
* Shows the system share sheet with one link [url] — the "Share" button of the stories
* viewer. Completes when the sheet is gone: iOS — `completionWithItemsHandler` of
* `UIActivityViewController`; Android — the window got its focus back after the
* chooser (`Intent.createChooser` of `ACTION_SEND`). The anchor is the button in
* logical pixels of the Flutter view: the popover of the sheet points at it on iPad.
*/
fun shareUrl(url: String, anchorX: Double, anchorY: Double, anchorWidth: Double, anchorHeight: Double, callback: (Result<Unit>) -> Unit)
/**
* The slide ids seen per story id for [shop] — the plugin's own store
* (SharedPreferences on Android, UserDefaults on iOS), not the native SDK's. It
Expand Down Expand Up @@ -1075,8 +1087,9 @@ interface PersonalizationHostApi {
val categoryArg = args[0] as String
val limitArg = args[1] as Long?
val pageArg = args[2] as Long?
val shopIdArg = args[3] as String?
api.getCategory(categoryArg, limitArg, pageArg, shopIdArg) { result: Result<String> ->
val paramsJsonArg = args[3] as String?
val shopIdArg = args[4] as String?
api.getCategory(categoryArg, limitArg, pageArg, paramsJsonArg, shopIdArg) { result: Result<String> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(PersonalizationApiPigeonUtils.wrapError(error))
Expand Down Expand Up @@ -1152,6 +1165,29 @@ interface PersonalizationHostApi {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.personalization_flutter_sdk.PersonalizationHostApi.shareUrl$separatedMessageChannelSuffix", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val urlArg = args[0] as String
val anchorXArg = args[1] as Double
val anchorYArg = args[2] as Double
val anchorWidthArg = args[3] as Double
val anchorHeightArg = args[4] as Double
api.shareUrl(urlArg, anchorXArg, anchorYArg, anchorWidthArg, anchorHeightArg) { result: Result<Unit> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(PersonalizationApiPigeonUtils.wrapError(error))
} else {
reply.reply(PersonalizationApiPigeonUtils.wrapResult(null))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.personalization_flutter_sdk.PersonalizationHostApi.getStoriesSeen$separatedMessageChannelSuffix", codec)
if (api != null) {
Expand Down
3 changes: 3 additions & 0 deletions assets/icons/share.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

Demonstrates how to use the rees46_flutter_sdk plugin.

The demo shop alone, without the API and UI Kit tabs: `flutter run -t lib/main_shop.dart`
(build: `flutter build apk -t lib/main_shop.dart`, `flutter build ios -t lib/main_shop.dart`).

## Getting Started

This project is a starting point for a Flutter application.
Expand Down
15 changes: 15 additions & 0 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- Links in the demo scheme, any host and path: stories "Share" links,
rees46flutter://<site>/?r46_stories=<code>&r46_story=<id>[&r46_slide=<id>],
and the game's, rees46flutter://game. MainActivity hands them to Dart
(see main.dart). -->
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="rees46flutter"/>
</intent-filter>
<!-- The links go over the demo's own channel: Flutter's deep linking would push
them to the Navigator as routes. -->
<meta-data
android:name="flutter_deeplinking_enabled"
android:value="false" />
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,46 @@
package com.rees46.rees46_flutter_sdk_example

import android.Manifest
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel

class MainActivity : FlutterActivity() {

/** Demo link the activity was started with, until Dart takes it (`getInitialLink`). */
private var initialLink: String? = null
private var links: MethodChannel? = null

override fun onCreate(savedInstanceState: Bundle?) {
// A recreated activity (rotation, process restore) does not open the link again.
if (savedInstanceState == null) initialLink = demoLink(intent)
super.onCreate(savedInstanceState)
}

override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
// singleTop: a link while the app is open comes here, not to onCreate.
demoLink(intent)?.let { links?.invokeMethod("onLink", it) }
}

override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
links = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, LINKS_CHANNEL)
.apply {
setMethodCallHandler { call, result ->
when (call.method) {
"getInitialLink" -> {
result.success(initialLink)
initialLink = null
}
else -> result.notImplemented()
}
}
}
// The Flutter layer asks for the notification permission from a post-frame
// callback (see main.dart) instead of from onCreate. Requesting it only after
// the engine and first frame are up keeps the system dialog from racing
Expand Down Expand Up @@ -44,8 +74,20 @@ class MainActivity : FlutterActivity() {
}
}

/**
* A VIEW link of the demo scheme, whatever its host and path: a stories "Share" link
* (`r46_stories`) or the game's (`rees46flutter://game`). Dart tells them apart.
*/
private fun demoLink(intent: Intent?): String? {
if (intent?.action != Intent.ACTION_VIEW) return null
val data = intent.data ?: return null
return if (data.scheme.equals(DEMO_SCHEME, ignoreCase = true)) data.toString() else null
}

private companion object {
const val CHANNEL = "rees46_sdk_example/platform"
const val LINKS_CHANNEL = "rees46_sdk_example/links"
const val DEMO_SCHEME = "rees46flutter"
const val REQUEST_CODE_POST_NOTIFICATIONS = 1001
}
}
Loading