diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c1dcb56..510082ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Flutter Plugin Changelog +## Version 5.5.0 - May 4, 2022 +Minor release that updates Airship Android SDK to 16.4.0, and iOS SDK to 16.6.0. These SDK releases fix several issues with Scenes and Surveys. Apps using Scenes & Surveys should update. + +- Added support for randomizing Survey responses. +- Added subscription list action. +- Updated localizations. All strings within the SDK are now localized in 48 different languages. +- Improved accessibility with OOTB Message Center UI. +- In-App rules will now attempt to refresh before displaying. This change should reduce the chances of showing out of data or cancelled in-app automations, scenes, or surveys when background refresh is disabled. +- Fixed reporting issue with a single page Scene. +- Fixed rendering issues for Scenes & Surveys. +- Fixed deep links that contain invalid characters by encoding those deep links. +- Fixed crash on Android 8 with Scenes & Surveys. +- Fixed Survey attribute storage on Android. + + ## Version 5.4.0 - April 4, 2022 Minor release that adds support for registering a handler that will be called when a message is received in the background on Android. diff --git a/android/build.gradle b/android/build.gradle index 1563753a..61723241 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -4,7 +4,7 @@ version '1.0-SNAPSHOT' buildscript { ext.kotlin_version = '1.5.31' ext.coroutine_version = '1.5.0' - ext.airship_version = '16.3.3' + ext.airship_version = '16.4.0' repositories { google() diff --git a/android/src/main/kotlin/com/airship/flutter/AirshipPlugin.kt b/android/src/main/kotlin/com/airship/flutter/AirshipPlugin.kt index 5e233bbe..a68f740a 100644 --- a/android/src/main/kotlin/com/airship/flutter/AirshipPlugin.kt +++ b/android/src/main/kotlin/com/airship/flutter/AirshipPlugin.kt @@ -692,26 +692,11 @@ class AirshipPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { @SuppressLint("RestrictedApi") private fun getPreferenceCenterConfig(call: MethodCall, result: Result) { - val preferenceCenterID = call.arguments as String - val remoteData = UAirship.shared().remoteData - - remoteData.payloadsForType("preference_forms") - .flatMap { payload -> - val payloadForms = payload.data.opt("preference_forms").optList() - val form = payloadForms.mapNotNull { - val form = it.optMap().opt("form").optMap() - if (form.opt("id").optString() == preferenceCenterID) { - form - } else { - null - } - }.firstOrNull() - Observable.just(form ?: JsonMap.EMPTY_MAP) - }.subscribe(object : Subscriber() { - override fun onNext(value: JsonMap) { - result.success(value.toString()) - } - }) + val preferenceCenterId = call.arguments as String + + PreferenceCenter.shared().getJsonConfig(preferenceCenterId).addResultCallback { config -> + result.success(config?.toString() ?: JsonMap.EMPTY_MAP.toString()) + } } private fun setAutoLaunchDefaultPreferenceCenter(call: MethodCall, result: Result) { diff --git a/android/src/main/kotlin/com/airship/flutter/AirshipPluginVersion.kt b/android/src/main/kotlin/com/airship/flutter/AirshipPluginVersion.kt index bfa24b37..ce4b0b1b 100644 --- a/android/src/main/kotlin/com/airship/flutter/AirshipPluginVersion.kt +++ b/android/src/main/kotlin/com/airship/flutter/AirshipPluginVersion.kt @@ -2,6 +2,6 @@ package com.airship.flutter class AirshipPluginVersion { companion object { - const val AIRSHIP_PLUGIN_VERSION = "5.4.0" + const val AIRSHIP_PLUGIN_VERSION = "5.5.0" } } diff --git a/ios/Classes/AirshipPluginVersion.swift b/ios/Classes/AirshipPluginVersion.swift index b4053e16..102002f5 100644 --- a/ios/Classes/AirshipPluginVersion.swift +++ b/ios/Classes/AirshipPluginVersion.swift @@ -1,5 +1,5 @@ import Foundation class AirshipPluginVersion { - static let pluginVersion = "5.4.0" + static let pluginVersion = "5.5.0" } diff --git a/ios/Classes/SwiftAirshipPlugin.swift b/ios/Classes/SwiftAirshipPlugin.swift index 6226d2ca..53fd743c 100644 --- a/ios/Classes/SwiftAirshipPlugin.swift +++ b/ios/Classes/SwiftAirshipPlugin.swift @@ -692,21 +692,13 @@ public class SwiftAirshipPlugin: NSObject, FlutterPlugin, PreferenceCenterOpenDe } private func getPreferenceCenterConfig(_ call: FlutterMethodCall, result: @escaping FlutterResult) { - guard let preferenceCenterID = call.arguments as? String else { + guard let configID = call.arguments as? String else { result(nil) return } - - var disposable: Disposable? - let remoteData = Airship.requireComponent(ofType: RemoteDataManager.self) - disposable = remoteData.subscribe(types: ["preference_forms"]) { payloads in - let data = payloads.first?.data["preference_forms"] as? [[String : Any]] - let config = data? - .compactMap { $0["form"] as? [String : Any] } - .first(where: { $0["id"] as? String == preferenceCenterID}) - - disposable?.dispose() - result(JSONUtils.string(config ?? [:])) + + PreferenceCenter.shared.jsonConfig(preferenceCenterID: configID) { config in + result(JSONUtils.string(config)) } } diff --git a/ios/airship_flutter.podspec b/ios/airship_flutter.podspec index 470df7aa..2efb6a52 100644 --- a/ios/airship_flutter.podspec +++ b/ios/airship_flutter.podspec @@ -1,5 +1,5 @@ -AIRSHIP_FLUTTER_VERSION="5.4.0" +AIRSHIP_FLUTTER_VERSION="5.5.0" # # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html @@ -21,9 +21,9 @@ Airship flutter plugin. s.dependency 'Flutter' s.ios.deployment_target = "11.0" - s.dependency 'Airship/Core', '~> 16.5.1' - s.dependency 'Airship/MessageCenter', '~> 16.5.1' - s.dependency 'Airship/Automation', '~> 16.5.1' - s.dependency 'Airship/PreferenceCenter', '~> 16.5.1' + s.dependency 'Airship/Core', '~> 16.6.0' + s.dependency 'Airship/MessageCenter', '~> 16.6.0' + s.dependency 'Airship/Automation', '~> 16.6.0' + s.dependency 'Airship/PreferenceCenter', '~> 16.6.0' end