Skip to content
Open
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
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ android {

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.github.verloop:android-sdk:1.1.16'
implementation 'com.github.verloop:android-sdk:1.1.19-rc.5'
}
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,42 @@ class VerloopFlutterSdkPlugin : FlutterPlugin, MethodCallHandler, ActivityAware
return
}

"logout" -> {
if (verloop == null) {
result.error(
ERROR_101,
"verloop object null",
"buildVerloop is not called before calling logout"
)
return
}
verloop!!.logout()
configBuilder = null
verloop = null
config = null
clientId = null
buttonClickHandler = ButtonClickHandler()
buttonCallbackChannel.setStreamHandler(buttonClickHandler)
urlClickHandler = UrlClickHandler()
urlCallbackChannel.setStreamHandler(urlClickHandler)
result.success(1)
return
}

"closeChat" -> {
if (verloop == null) {
result.error(
ERROR_101,
"verloop object null",
"buildVerloop is not called before calling closeChat"
)
return
}
verloop!!.closeChat()
result.success(1)
return
}

else -> {
result.notImplemented()
}
Expand Down
9 changes: 9 additions & 0 deletions ios/Classes/SwiftVerloopFlutterSdkPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,15 @@ public class SwiftVerloopFlutterSdkPlugin: NSObject, FlutterPlugin, VLEventDeleg
self.viewController = nil // Clear the reference after dismissing
})
result(1)

case "logout":
config?.logout()
result(1)

case "closeChat":
config?.close()
result(1)

default:
result(FlutterMethodNotImplemented)
}
Expand Down
2 changes: 1 addition & 1 deletion ios/verloop_flutter_sdk.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This is a wrapper over native SDK for flutter app
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.dependency 'Flutter'
s.dependency "VerloopSDKiOS", "0.2.16"
s.dependency "VerloopSDKiOS", "0.2.19-rc.1"
s.platform = :ios, '12.0'

# Flutter.framework does not contain a i386 slice.
Expand Down
8 changes: 8 additions & 0 deletions lib/verloop_flutter_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,12 @@ class VerloopSdk {
Future<void> dismissChat() async {
return await VerloopFlutterSdkPlatform.instance.dismissChat();
}

Future<void> logout() async {
return await VerloopFlutterSdkPlatform.instance.logout();
}

Future<void> closeChat() async {
return await VerloopFlutterSdkPlatform.instance.closeChat();
}
}
18 changes: 18 additions & 0 deletions lib/verloop_flutter_sdk_method_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,22 @@ class MethodChannelVerloopFlutterSdk extends VerloopFlutterSdkPlatform {
log("Failed to load widget: '${e.message}'.");
}
}

@override
Future<void> logout() async {
try {
await verloopMethods.invokeMethod('logout');
} on PlatformException catch (e) {
log("Failed to logout: '${e.message}'.");
}
}

@override
Future<void> closeChat() async {
try {
await verloopMethods.invokeMethod('closeChat');
} on PlatformException catch (e) {
log("Failed to close chat: '${e.message}'.");
}
}
}
7 changes: 7 additions & 0 deletions lib/verloop_flutter_sdk_platform_interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,11 @@ abstract class VerloopFlutterSdkPlatform extends PlatformInterface {
throw UnimplementedError('dismissChat() has not been implemented.');
}

Future<void> logout() async {
throw UnimplementedError('logout() has not been implemented.');
}

Future<void> closeChat() async {
throw UnimplementedError('closeChat() has not been implemented.');
}
}