Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 10 additions & 0 deletions intercom_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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` `<meta-data>` 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)
Expand Down
4 changes: 2 additions & 2 deletions intercom_flutter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
6 changes: 3 additions & 3 deletions intercom_flutter/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand Down
2 changes: 1 addition & 1 deletion intercom_flutter/ios/intercom_flutter/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
16 changes: 16 additions & 0 deletions intercom_flutter/lib/intercom_flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -400,4 +400,20 @@ class Intercom {
Future<void> 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<void> setMessengerStyleId(String? styleId) {
return IntercomFlutterPlatform.instance.setMessengerStyleId(styleId);
}
}
6 changes: 3 additions & 3 deletions intercom_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
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:
flutter:
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:
Expand Down
16 changes: 16 additions & 0 deletions intercom_flutter/test/intercom_flutter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
});
});
}
4 changes: 4 additions & 0 deletions intercom_flutter_platform_interface/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.0.11

* Added method `setMessengerStyleId`.

## 2.0.10

* Added methods `setLocationPermissionProvider`, `updateLocationAuthorizationStatus` and `removeLocationPermissionProvider`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> setMessengerStyleId(String? styleId) {
throw UnimplementedError('setMessengerStyleId() has not been implemented.');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,13 @@ class MethodChannelIntercomFlutter extends IntercomFlutterPlatform {
await _channel.invokeMethod('removeLocationPermissionProvider');
}

@override
Future<void> 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].
Expand Down
2 changes: 1 addition & 1 deletion intercom_flutter_platform_interface/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,32 @@ void main() {
expect(calls, ['whenInUse', 'always']);
});
});

group('setMessengerStyleId', () {
test('sets the style', () async {
await intercom.setMessengerStyleId('123456');
expect(
log,
<Matcher>[
isMethodCall('setMessengerStyleId', arguments: {
'styleId': '123456',
})
],
);
});

test('clears the style', () async {
await intercom.setMessengerStyleId(null);
expect(
log,
<Matcher>[
isMethodCall('setMessengerStyleId', arguments: {
'styleId': null,
})
],
);
});
});
});
}

Expand Down
5 changes: 5 additions & 0 deletions intercom_flutter_web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
});
}
13 changes: 13 additions & 0 deletions intercom_flutter_web/lib/intercom_flutter_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,19 @@ class IntercomFlutterWeb extends IntercomFlutterPlatform {
print("Theme overridden");
}

@override
Future<void> 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<dynamic, dynamic> getIntercomSettings() {
if (globalContext.hasProperty('intercomSettings'.toJS).toDart) {
Expand Down
4 changes: 2 additions & 2 deletions intercom_flutter_web/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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

Expand Down
Loading