diff --git a/intercom_flutter/CHANGELOG.md b/intercom_flutter/CHANGELOG.md index e77d6612..3f0ed891 100755 --- a/intercom_flutter/CHANGELOG.md +++ b/intercom_flutter/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 9.7.0 + +* Bump Intercom Android SDK version to [19.0.0](https://github.com/intercom/intercom-android/releases/tag/19.0.0) + * The Android SDK removed `Intercom.setMessengerEnvironment`. If your app calls it from native code, replace it with the `AndroidManifest.xml` `` entry described in the release notes. +* Bump Intercom iOS SDK version to [19.13.0](https://github.com/intercom/intercom-ios/releases/tag/19.13.0) +* Bump Android `com.google.firebase:firebase-messaging` version to 25.1.3 +* Added API `setMessengerStyleId` to choose which Messenger style to show. Supported on iOS and web; it has no effect on Android. +* Updated dependency `intercom_flutter_platform_interface: ^2.0.11` +* Updated dependency `intercom_flutter_web: ^1.1.16` + ## 9.6.39 * Bump Intercom Android SDK version to [18.14.0](https://github.com/intercom/intercom-android/releases/tag/18.14.0) diff --git a/intercom_flutter/README.md b/intercom_flutter/README.md index ad764709..26540f44 100755 --- a/intercom_flutter/README.md +++ b/intercom_flutter/README.md @@ -5,10 +5,10 @@ Flutter wrapper for Intercom [Android](https://github.com/intercom/intercom-android), [iOS](https://github.com/intercom/intercom-ios), and [Web](https://developers.intercom.com/installing-intercom/docs/basic-javascript) projects. -- Uses Intercom Android SDK Version `18.14.0`. +- Uses Intercom Android SDK Version `19.0.0`. - The minimum Android SDK `minSdk` required is 23. - The compile Android SDK `compileSdk` required is 36. -- Uses Intercom iOS SDK Version `19.12.0`. +- Uses Intercom iOS SDK Version `19.13.0`. - The minimum iOS target version required is 15. - The Xcode version required is 15. diff --git a/intercom_flutter/android/build.gradle b/intercom_flutter/android/build.gradle index d4231a2d..d5154f94 100644 --- a/intercom_flutter/android/build.gradle +++ b/intercom_flutter/android/build.gradle @@ -59,7 +59,7 @@ kotlin { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'io.intercom.android:intercom-sdk:18.14.0' - implementation 'io.intercom.android:intercom-sdk-ui:18.14.0' - implementation 'com.google.firebase:firebase-messaging:25.0.1' + implementation 'io.intercom.android:intercom-sdk:19.0.0' + implementation 'io.intercom.android:intercom-sdk-ui:19.0.0' + implementation 'com.google.firebase:firebase-messaging:25.1.3' } diff --git a/intercom_flutter/android/src/main/kotlin/io/maido/intercom/IntercomFlutterPlugin.kt b/intercom_flutter/android/src/main/kotlin/io/maido/intercom/IntercomFlutterPlugin.kt index 31ef3fa3..b9e8b1dc 100644 --- a/intercom_flutter/android/src/main/kotlin/io/maido/intercom/IntercomFlutterPlugin.kt +++ b/intercom_flutter/android/src/main/kotlin/io/maido/intercom/IntercomFlutterPlugin.kt @@ -381,6 +381,9 @@ class IntercomFlutterPlugin : FlutterPlugin, MethodCallHandler, EventChannel.Str } result.success("Theme overridden") } + "setMessengerStyleId" -> { + result.success("Messenger style is not available on Android") + } else -> result.notImplemented() } } diff --git a/intercom_flutter/ios/intercom_flutter/Package.swift b/intercom_flutter/ios/intercom_flutter/Package.swift index d5d2a98b..75fda417 100644 --- a/intercom_flutter/ios/intercom_flutter/Package.swift +++ b/intercom_flutter/ios/intercom_flutter/Package.swift @@ -12,7 +12,7 @@ let package = Package( .library(name: "intercom-flutter", targets: ["intercom_flutter"]) ], dependencies: [ - .package(url: "https://github.com/intercom/intercom-ios-sp.git", exact: "19.12.0") + .package(url: "https://github.com/intercom/intercom-ios-sp.git", exact: "19.13.0") ], targets: [ .target( diff --git a/intercom_flutter/ios/intercom_flutter/Sources/intercom_flutter/IntercomFlutterPlugin.m b/intercom_flutter/ios/intercom_flutter/Sources/intercom_flutter/IntercomFlutterPlugin.m index 033ca639..8526de5c 100644 --- a/intercom_flutter/ios/intercom_flutter/Sources/intercom_flutter/IntercomFlutterPlugin.m +++ b/intercom_flutter/ios/intercom_flutter/Sources/intercom_flutter/IntercomFlutterPlugin.m @@ -435,6 +435,13 @@ - (void) handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result [Intercom setThemeOverride:ICMThemeOverrideNone]; } result(@"Theme overridden"); + } else if([@"setMessengerStyleId" isEqualToString:call.method]) { + NSString *styleId = call.arguments[@"styleId"]; + if(styleId == (id)[NSNull null]) { + styleId = nil; + } + [Intercom setMessengerStyleId:styleId]; + result(@"Messenger style set"); } else { result(FlutterMethodNotImplemented); diff --git a/intercom_flutter/lib/intercom_flutter.dart b/intercom_flutter/lib/intercom_flutter.dart index aaa1dfc2..607d02d6 100755 --- a/intercom_flutter/lib/intercom_flutter.dart +++ b/intercom_flutter/lib/intercom_flutter.dart @@ -400,4 +400,20 @@ class Intercom { Future removeLocationPermissionProvider() { return IntercomFlutterPlatform.instance.removeLocationPermissionProvider(); } + + /// Sets which Messenger style to show, for example when one app serves + /// several brands. + /// + /// By default, the Messenger shows the style that matches your app (the + /// bundle ID on iOS, the page URL on web), or your default style if none + /// matches. Pass `null` or an empty string to go back to that behaviour. + /// + /// Style IDs are available in your Intercom workspace under + /// Settings → Messenger → Appearance → Manage Style. + /// + /// Note: this is only supported on iOS and web. It has no effect on Android, + /// where the Intercom SDK has no Messenger style API. + Future setMessengerStyleId(String? styleId) { + return IntercomFlutterPlatform.instance.setMessengerStyleId(styleId); + } } diff --git a/intercom_flutter/pubspec.yaml b/intercom_flutter/pubspec.yaml index 928b48d8..c45060e8 100644 --- a/intercom_flutter/pubspec.yaml +++ b/intercom_flutter/pubspec.yaml @@ -1,7 +1,7 @@ name: intercom_flutter description: Flutter plugin for Intercom integration. Provides in-app messaging and help-center Intercom services -version: 9.6.39 +version: 9.7.0 homepage: https://github.com/v3rm0n/intercom_flutter dependencies: @@ -9,8 +9,8 @@ dependencies: sdk: flutter flutter_web_plugins: sdk: flutter - intercom_flutter_platform_interface: ^2.0.10 - intercom_flutter_web: ^1.1.15 + intercom_flutter_platform_interface: ^2.0.11 + intercom_flutter_web: ^1.1.16 dev_dependencies: flutter_test: diff --git a/intercom_flutter/test/intercom_flutter_test.dart b/intercom_flutter/test/intercom_flutter_test.dart index a167a175..3734e820 100755 --- a/intercom_flutter/test/intercom_flutter_test.dart +++ b/intercom_flutter/test/intercom_flutter_test.dart @@ -422,4 +422,20 @@ void main() { expectMethodCall('removeLocationPermissionProvider'); }); }); + + group('setMessengerStyleId', () { + test('sets the style', () async { + await Intercom.instance.setMessengerStyleId('123456'); + expectMethodCall('setMessengerStyleId', arguments: { + 'styleId': '123456', + }); + }); + + test('clears the style', () async { + await Intercom.instance.setMessengerStyleId(null); + expectMethodCall('setMessengerStyleId', arguments: { + 'styleId': null, + }); + }); + }); } diff --git a/intercom_flutter_platform_interface/CHANGELOG.md b/intercom_flutter_platform_interface/CHANGELOG.md index f01f8b1d..efe2677b 100755 --- a/intercom_flutter_platform_interface/CHANGELOG.md +++ b/intercom_flutter_platform_interface/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 2.0.11 + +* Added method `setMessengerStyleId`. + ## 2.0.10 * Added methods `setLocationPermissionProvider`, `updateLocationAuthorizationStatus` and `removeLocationPermissionProvider`. diff --git a/intercom_flutter_platform_interface/lib/intercom_flutter_platform_interface.dart b/intercom_flutter_platform_interface/lib/intercom_flutter_platform_interface.dart index e7cc8fbd..9eb6b5bf 100644 --- a/intercom_flutter_platform_interface/lib/intercom_flutter_platform_interface.dart +++ b/intercom_flutter_platform_interface/lib/intercom_flutter_platform_interface.dart @@ -418,4 +418,20 @@ abstract class IntercomFlutterPlatform extends PlatformInterface { throw UnimplementedError( 'removeLocationPermissionProvider() has not been implemented.'); } + + /// Sets which Messenger style to show, for example when one app serves + /// several brands. + /// + /// By default, the Messenger shows the style that matches your app (the + /// bundle ID on iOS, the page URL on web), or your default style if none + /// matches. Pass `null` or an empty string to go back to that behaviour. + /// + /// Style IDs are available in your Intercom workspace under + /// Settings → Messenger → Appearance → Manage Style. + /// + /// Note: this is only supported on iOS and web. It has no effect on Android, + /// where the Intercom SDK has no Messenger style API. + Future setMessengerStyleId(String? styleId) { + throw UnimplementedError('setMessengerStyleId() has not been implemented.'); + } } diff --git a/intercom_flutter_platform_interface/lib/method_channel_intercom_flutter.dart b/intercom_flutter_platform_interface/lib/method_channel_intercom_flutter.dart index 6ebe6430..0f0f7a46 100644 --- a/intercom_flutter_platform_interface/lib/method_channel_intercom_flutter.dart +++ b/intercom_flutter_platform_interface/lib/method_channel_intercom_flutter.dart @@ -375,6 +375,13 @@ class MethodChannelIntercomFlutter extends IntercomFlutterPlatform { await _channel.invokeMethod('removeLocationPermissionProvider'); } + @override + Future setMessengerStyleId(String? styleId) async { + await _channel.invokeMethod('setMessengerStyleId', { + 'styleId': styleId, + }); + } + /// Convert the [PlatformException] details to [IntercomError]. /// From the Platform side if the intercom operation failed then error details /// will be sent as details in [PlatformException]. diff --git a/intercom_flutter_platform_interface/pubspec.yaml b/intercom_flutter_platform_interface/pubspec.yaml index c4904144..c00e8392 100644 --- a/intercom_flutter_platform_interface/pubspec.yaml +++ b/intercom_flutter_platform_interface/pubspec.yaml @@ -1,6 +1,6 @@ name: intercom_flutter_platform_interface description: A common platform interface for the intercom_flutter plugin. -version: 2.0.10 +version: 2.0.11 homepage: https://github.com/v3rm0n/intercom_flutter dependencies: diff --git a/intercom_flutter_platform_interface/test/method_channel_intercom_flutter_test.dart b/intercom_flutter_platform_interface/test/method_channel_intercom_flutter_test.dart index e0b35828..b2d2efa7 100644 --- a/intercom_flutter_platform_interface/test/method_channel_intercom_flutter_test.dart +++ b/intercom_flutter_platform_interface/test/method_channel_intercom_flutter_test.dart @@ -713,6 +713,32 @@ void main() { expect(calls, ['whenInUse', 'always']); }); }); + + group('setMessengerStyleId', () { + test('sets the style', () async { + await intercom.setMessengerStyleId('123456'); + expect( + log, + [ + isMethodCall('setMessengerStyleId', arguments: { + 'styleId': '123456', + }) + ], + ); + }); + + test('clears the style', () async { + await intercom.setMessengerStyleId(null); + expect( + log, + [ + isMethodCall('setMessengerStyleId', arguments: { + 'styleId': null, + }) + ], + ); + }); + }); }); } diff --git a/intercom_flutter_web/CHANGELOG.md b/intercom_flutter_web/CHANGELOG.md index cea4bc24..6b7fe5eb 100755 --- a/intercom_flutter_web/CHANGELOG.md +++ b/intercom_flutter_web/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 1.1.16 + +* Implemented `setMessengerStyleId`. +* Updated `intercom_flutter_platform_interface` to `^2.0.11`. + ## 1.1.15 * Updated `intercom_flutter_platform_interface` to `^2.0.10`. diff --git a/intercom_flutter_web/example/integration_test/intercom_flutter_web_test.dart b/intercom_flutter_web/example/integration_test/intercom_flutter_web_test.dart index 7fb69aad..844f7a68 100755 --- a/intercom_flutter_web/example/integration_test/intercom_flutter_web_test.dart +++ b/intercom_flutter_web/example/integration_test/intercom_flutter_web_test.dart @@ -206,5 +206,15 @@ void main() { expect(plugin.setThemeMode(IntercomTheme.none), completes); }); }); + + group('setMessengerStyleId', () { + testWidgets('sets the style', (WidgetTester _) async { + expect(plugin.setMessengerStyleId('123456'), completes); + }); + + testWidgets('clears the style', (WidgetTester _) async { + expect(plugin.setMessengerStyleId(null), completes); + }); + }); }); } diff --git a/intercom_flutter_web/lib/intercom_flutter_web.dart b/intercom_flutter_web/lib/intercom_flutter_web.dart index 1ce94d6d..582b55ec 100644 --- a/intercom_flutter_web/lib/intercom_flutter_web.dart +++ b/intercom_flutter_web/lib/intercom_flutter_web.dart @@ -367,6 +367,19 @@ class IntercomFlutterWeb extends IntercomFlutterPlatform { print("Theme overridden"); } + @override + Future setMessengerStyleId(String? styleId) async { + globalContext.callMethod( + 'Intercom'.toJS, + 'update'.toJS, + updateIntercomSettings( + 'messenger_style_id', + styleId?.isEmpty ?? true ? null : styleId, + ).jsify(), + ); + print("Messenger style set"); + } + /// get the [window.intercomSettings] Map getIntercomSettings() { if (globalContext.hasProperty('intercomSettings'.toJS).toDart) { diff --git a/intercom_flutter_web/pubspec.yaml b/intercom_flutter_web/pubspec.yaml index 793a38a5..7e0a00d4 100644 --- a/intercom_flutter_web/pubspec.yaml +++ b/intercom_flutter_web/pubspec.yaml @@ -1,6 +1,6 @@ name: intercom_flutter_web description: Web platform implementation of intercom_flutter -version: 1.1.15 +version: 1.1.16 homepage: https://github.com/v3rm0n/intercom_flutter flutter: @@ -15,7 +15,7 @@ dependencies: sdk: flutter flutter_web_plugins: sdk: flutter - intercom_flutter_platform_interface: ^2.0.10 + intercom_flutter_platform_interface: ^2.0.11 uuid: ^4.2.1 # to get the random uuid for loginUnidentifiedUser in web web: ^1.0.0