wannatalkcore 0.0.6 wannatalkcore: ^0.0.6 copied to clipboard
Wannatalk Official Flutter plugin.
wannatalkcore #
Wannatalk Official Flutter plugin.
Getting Started #
Edit the pubspec.yaml
file in your app directory to define the Wannatalk SDK dependency:
dependencies:
wannatalkcore: ^0.0.6
iOS Setup #
-
Request WTService-Info.plist from wannatalk.ai and drag it into your application. When prompted, select "Copy items if needed" and continue.
-
Add below keys in your application's Info.plist
<key>NSPhotoLibraryUsageDescription</key> <string>To save in-chat photos and videos</string> <key>NSContactsUsageDescription</key> <string>To locate friends already on the Wannatalk network</string> <key>NSCameraUsageDescription</key> <string>To take photos and videos to send to friends in-chat</string> <key>NSLocationWhenInUseUsageDescription</key> <string>To display it in map</string> <key>NSMicrophoneUsageDescription</key> <string>To record live photos and movies</string>
-
Add this line to your application pod file
pod 'WTExternalSDK', :git =>'https://github.com/edzehoo/WannatalkAPI-iOS.git', :tag => '1.6.0'
-
That's it! Run the app
To strip simulator architecture framework for your app submission #
- Copy trim.sh file into your project folder.
- Create Run Script Phase in Build Phases of your application target.
- Paste
"$SRCROOT/trim.sh"
inside the body of Run Script Phase. - Enable
Run script only when installing
andShow environment variables in build log
.
Android Setup #
-
Request wannatalk-services.json from wannatalk.ai and drag it into your application
assets
directory -
Enable
multiDexEnabled
in your application build.gradleandroid { defaultConfig { // Enabling multidex support. multiDexEnabled true } ... }
-
Set colorPrimary, colorPrimaryDark and colorAccent attributes in app's color.xml (src/main/res/values/colors.xml)
-
That's it! Run the app
Usage #
import 'package:wannatalkcore/wannatalkcore.dart';
To link Wannatalk account #
Wannatalkcore.login(onCompletion: (WTResult result) {
if (result.success) {
}
});
To link Wannatalk account with user credentials #
Wannatalkcore.silentLogin("<user_identifier>", { displayname: "name", key1: "Value1", key2: "Value2"}, onCompletion: (WTResult result) {
if (result.success) {
}
});
To check login status #
bool loggedIn = await Wannatalkcore.isUserLoggedIn;
To unlink Wannatalk account #
Wannatalkcore.logout(onCompletion: (WTResult result) {
});
Wannatalk events #
Wannatalkcore.setMethodCallHandler(onReceivedEvent:(WTEventResponse eventResponse) {
});
HelpDesk #
To load your organization profile #
Wannatalkcore.loadOrganizationProfile(autoOpenChat, onCompletion: (WTResult result){
});
Collaboration #
To view all chats #
Wannatalkcore.loadChats(onCompletion: (WTResult result) {
});
To view all users #
Wannatalkcore.loadUsers(onCompletion: (WTResult result) {
});
Other #
To show or hide guide button #
WannatalkConfig.showGuideButton(true); // default = true
To enable or disable sending audio message #
WannatalkConfig.allowSendAudioMessage(false); // default = true
To show or hide add participants option in new ticket page and chat item profile page #
WannatalkConfig.allowAddParticipants(false); // default = true
To show or hide remove participants option in chat item profile #
WannatalkConfig.allowRemoveParticipants(false); // default = false
To show or hide welcome message #
WannatalkConfig.showWelcomeMessage(false); // default = false
To show or hide Profile Info page #
WannatalkConfig.showProfileInfoPage(false); // default = true
To create auto tickets: #
Chat ticket will create automatically when auto tickets is enabled, otherwise default ticket creation page will popup
WannatalkConfig.enableAutoTickets(true); // default = false
To show or hide close chat button in chat page #
WannatalkConfig.showExitButton(true); // default = false
To show or hide participants in chat profile page #
WannatalkConfig.showChatParticipants(false); // default = true
To enable or disbale chat profile page #
WannatalkConfig.enableChatProfile(false); // default = true
To allow modify in chat profile page #
WannatalkConfig.allowModifyChatProfile(false); // default = true
To set Inactive chat timeout: #
Chat session will end if user is inactive for timeout interval duration. If timeout interval is 0, chat session will not end automatically. The default timout interval is 1800 seconds (30 minutes).
double timeoutInterval = 1800; // Default Value: 1800 seconds ~ 30 minutes
WannatalkConfig.setInactiveChatTimeoutInterval(timeoutInterval);