chat_plugin_flutter

Creator: coderz1093

Last updated:

0 purchases

chat_plugin_flutter Image
chat_plugin_flutter Images

Languages

Categories

Add to Cart

Description:

chat plugin flutter

Chat Flutter Plugin #
Supply a chat sdk simple for flutter project.
Features #

Import a Contact from your phone to chat contact.
Conversation chat, chat detail
Share location, image, video...
Video call, audio call

How to Use #
Create a config:
final ChatConfig config = ChatConfig(
appId: your app id,
appKey: your app key,
accountKey: your account key,
iosConfig: IosConfig(
storeUrl: <your app store url>,
appGroupIdentifier: <your app group>,
),
androidConfig: AndroidConfig()
);
copied to clipboard
Create instance of plugin:
final ChatPluginFlutter chatFlutterPlugin = ChatPluginFlutter(config);
copied to clipboard
Call method initChatSDK() be fore use:
chatFlutterPlugin.initChatSDK();
copied to clipboard
Set user:
chatFlutterPlugin.setUser(user);
copied to clipboard
Open chat conversation (after set user):
chatFlutterPlugin.openChatConversation();
copied to clipboard
Open chat with another (after set user):
chatFlutterPlugin.openChatWithAnother(userAnother);
copied to clipboard
Logout:
chatFlutterPlugin.logout();
copied to clipboard
Handle Notification message (ex: from firebase): #
chatFlutterPlugin.handleChatNotification(message.data);
copied to clipboard
Example:
FirebaseMessaging.onMessage.listen((RemoteMessage message) async {
........ your code ........
// sdk chat
chatFlutterPlugin.handleChatNotification(message.data);
// sdk chat
});

FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
........ your code ........
// sdk chat
chatFlutterPlugin.handleChatNotification(message.data);
// sdk chat
});

FirebaseMessaging.instance
.getInitialMessage()
.then((RemoteMessage? message) {
........ your code ........
// sdk chat
if (message != null) {
chatFlutterPlugin.handleChatNotification(message.data);
}
// sdk chat
});
copied to clipboard
Set up #
Ios: #
This sdk require ios >=13.0.
Add dependencies to your Podfile
.... your dependencies ...

platform :ios, '13.0'
use_frameworks!

def netalo_sdks
pod 'NetacomSDKs', :git => 'https://github.com/Netacom-NetAlo/NetaloSDKs-iOS', tag: '10.0.1'
end

def netalo_sdks_notification
pod 'NotificationSDK', :git => 'https://github.com/Netacom-NetAlo/NotiSDKs-iOS', tag: '10.0.1'
end

def netalo_webrtc
pod 'WebRTC', :git => 'https://github.com/Netacom-NetAlo/WebRTC-iOS', branch: 'main'
end

def netalo_resolver
pod 'Resolver', :git => 'https://github.com/Netacom-NetAlo/Resolver-iOS', branch: 'main'
end

def netalo_messagekit
pod 'MessageKit', :git => 'https://github.com/Netacom-NetAlo/Messagekit-iOS'
end
copied to clipboard
Add to target Runner in your Podfile
target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
.... your dependencies ...

# sdk chat'
netalo_sdks
netalo_sdks_notification
netalo_webrtc
netalo_resolver
netalo_messagekit
# sdk chat

end
copied to clipboard
And add build_configurations in Podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)

# sdk chat
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings['ARCHS'] = 'arm64 x86_64'
end
# sdk chat

end
end
copied to clipboard
Please add some permissions in Plist.info:

NSMicrophoneUsageDescription
NSCameraUsageDescription
NSPhotoLibraryUsageDescription
NSContactsUsageDescription (If you want to sync contact)
NSLocationAlwaysAndWhenInUseUsageDescription (If you want to share location). If you want to use feature Live location please enable Location updates in your runner -> Signing and capabilities -> Background Modes -> Tick Location updates.

If you implement notification. Let add dependencies to target NotificationExtension in your Podfile
target 'NotificationExtension' do
.... your dependencies ...

# sdk chat'
netalo_sdks_notification
netalo_webrtc
netalo_resolver
# sdk chat

end
copied to clipboard
Add code to your NotificationService:
import UserNotifications
import RxSwift
import Resolver
import NotificationComponent

class NotificationService: UNNotificationServiceExtension {

var contentHandler: ((UNNotificationContent) -> Void)?
var bestAttemptContent: UNMutableNotificationContent?

// start sdk chat
private var disposeBag = DisposeBag()
@LazyInjected private var notificationRepo: NotificationComponentImpl

override init() {
super.init()

notificationRepo.initialize()
}

// end sdk chat

override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
self.contentHandler = contentHandler
bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)

// start sdk chat
if let bestAttemptContent = bestAttemptContent {
notificationRepo.replace(oldContent: bestAttemptContent)
.do(onSuccess: { (newContent) in
contentHandler(newContent)
})
.subscribe()
.disposed(by: disposeBag)
}
// end sdk chat

}

override func serviceExtensionTimeWillExpire() {
// Called just before the extension will be terminated by the system.
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {

// start sdk chat
contentHandler(
notificationRepo.expired(oldContent: bestAttemptContent)
)
// end sdk chat

}
}

}
copied to clipboard
If you need to override some method of Notification in AppDelegate then add code to these function else you no need to do anything.
public override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {

.... your code ...

# sdk chat'
SwiftChatPluginFlutterPlugin.instance.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)
# sdk chat'
}

public override func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {

.... your code ...

# sdk chat'
SwiftChatPluginFlutterPlugin.instance.userNotificationCenter(center, willPresent: notification, withCompletionHandler: completionHandler)
# sdk chat'
}

public override func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {

.... your code ...

# sdk chat'
SwiftChatPluginFlutterPlugin.instance.userNotificationCenter(center, didReceive: response, withCompletionHandler: completionHandler)
# sdk chat'
}
copied to clipboard
Android #
This sdk require minSdkVersion 24, targetSdkVersion 31

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.