diff --git a/intercom_flutter/CHANGELOG.md b/intercom_flutter/CHANGELOG.md index ea1e20a6..6b44a186 100755 --- a/intercom_flutter/CHANGELOG.md +++ b/intercom_flutter/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 7.8.4 + +* Bump Intercom iOS SDK version to 15.1.4 +* Bump Intercom Android SDK version to 15.1.6 +* Implemented `displayConversation` for all platforms. + ## 7.8.3 * Bump Intercom iOS SDK version to 15.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 32af04b9..95dfe1ab 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 @@ -251,6 +251,13 @@ class IntercomFlutterPlugin : FlutterPlugin, MethodCallHandler, EventChannel.Str result.success("displaying survey $surveyId") } } + "displayConversation" -> { + val conversationId = call.argument("conversationId") + if (conversationId != null) { + Intercom.client().presentContent(IntercomContent.Conversation(conversationId)) + result.success("displaying conversation $conversationId") + } + } else -> result.notImplemented() } } diff --git a/intercom_flutter/ios/Classes/IntercomFlutterPlugin.m b/intercom_flutter/ios/Classes/IntercomFlutterPlugin.m index ca55eb27..235cc9ad 100644 --- a/intercom_flutter/ios/Classes/IntercomFlutterPlugin.m +++ b/intercom_flutter/ios/Classes/IntercomFlutterPlugin.m @@ -218,6 +218,12 @@ - (void) handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result NSDictionary *message = call.arguments[@"message"]; [Intercom handleIntercomPushNotification:message]; result(@"handle push"); + } else if([@"displayConversation" isEqualToString:call.method]) { + NSString *conversationId = call.arguments[@"conversationId"]; + if(conversationId != (id)[NSNull null] && conversationId != nil) { + [Intercom presentContent:[IntercomContent conversationWithId:conversationId]]; + result(@"displaying conversation"); + } } else { result(FlutterMethodNotImplemented); diff --git a/intercom_flutter/lib/intercom_flutter.dart b/intercom_flutter/lib/intercom_flutter.dart index 2cbcf889..c32517de 100755 --- a/intercom_flutter/lib/intercom_flutter.dart +++ b/intercom_flutter/lib/intercom_flutter.dart @@ -281,4 +281,9 @@ class Intercom { Future displaySurvey(String surveyId) { return IntercomFlutterPlatform.instance.displaySurvey(surveyId); } + + /// To display a Conversation, pass in a [conversationId] from your Intercom workspace. + Future displayConversation(String conversationId) { + return IntercomFlutterPlatform.instance.displayConversation(conversationId); + } } diff --git a/intercom_flutter/pubspec.yaml b/intercom_flutter/pubspec.yaml index 14eae4cb..aa3ef84e 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: 7.8.3 +version: 7.8.4 homepage: https://github.com/v3rm0n/intercom_flutter dependencies: @@ -9,7 +9,7 @@ dependencies: sdk: flutter flutter_web_plugins: sdk: flutter - intercom_flutter_platform_interface: ^1.3.0 + intercom_flutter_platform_interface: ^1.3.1 intercom_flutter_web: ^0.3.1 dev_dependencies: diff --git a/intercom_flutter/test/intercom_flutter_test.dart b/intercom_flutter/test/intercom_flutter_test.dart index c0216f13..69fa270c 100755 --- a/intercom_flutter/test/intercom_flutter_test.dart +++ b/intercom_flutter/test/intercom_flutter_test.dart @@ -265,4 +265,12 @@ void main() { 'surveyId': testSurveyId, }); }); + + test('displayConversation', () async { + final String testConversationId = "123456"; + await Intercom.instance.displayConversation(testConversationId); + expectMethodCall('displayConversation', arguments: { + 'conversationId': testConversationId, + }); + }); } diff --git a/intercom_flutter_web/lib/intercom_flutter_web.dart b/intercom_flutter_web/lib/intercom_flutter_web.dart index b6989257..edb2a5a2 100644 --- a/intercom_flutter_web/lib/intercom_flutter_web.dart +++ b/intercom_flutter_web/lib/intercom_flutter_web.dart @@ -268,6 +268,12 @@ class IntercomFlutterWeb extends IntercomFlutterPlatform { await js.context.callMethod('Intercom', ['startSurvey', surveyId]); } + @override + Future displayConversation(String conversationId) async { + await js.context + .callMethod('Intercom', ['showConversation', conversationId]); + } + /// get the [window.IntercomSettings] js.JsObject getIntercomSettings() { if (js.context.hasProperty('intercomSettings')) {