The unofficial flutter plugin for Freshchat

Overview

💬 Flutter Freshchat

A Flutter plugin for integrating Freshchat in your mobile app.

Setup

Android

Add this to your AndroidManifest.xml

<provider
    android:name="android.support.v4.content.FileProvider"
    android:authorities="com.example.demoapp.provider"
    android:exported="false"
    android:grantUriPermissions="true">
    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/freshchat_file_provider_paths" />
</provider>

If you have migrated to AndroidX your might need change the provider attribute android:name to this:

<provider android:name="androidx.core.content.FileProvider">
</provider>

Add this to your Strings.xml located inside android/src/res/values

<string name="freshchat_file_provider_authority">com.example.demoapp.provider</string>

Firebase Cloud Messaging support

  1. Add dependency in <app-name>/android/app/build.gradle
dependencies {
  implementation "com.github.freshdesk:freshchat-android:3.3.0"
}
  1. Create FreshchatMessagingService.java (Java, not Kotlin) class to your app in the same directory as your MainActivity class
package com.example.app;

import com.freshchat.consumer.sdk.Freshchat;
import com.google.firebase.messaging.RemoteMessage;
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService;

public class FreshchatMessagingService extends FlutterFirebaseMessagingService {

    @Override
    public void onNewToken(String token) {
        super.onNewToken(token);
    }

    @Override
    public void onMessageReceived(final RemoteMessage remoteMessage) {
        super.onMessageReceived(remoteMessage);
        if (Freshchat.isFreshchatNotification(remoteMessage)) {
            Freshchat.handleFcmMessage(this, remoteMessage);
        }
    }
}
  1. In AndroidManifest.xml add
<service android:name=".FreshchatMessagingService">
  <intent-filter>
    <action android:name="com.google.firebase.MESSAGING_EVENT" />
  </intent-filter>
</service>
  1. In your Application class change
FlutterFirebaseMessagingService.setPluginRegistrant(this)

to

FreshchatMessagingService.setPluginRegistrant(this)

IOS

  1. Add this to info.plist

    Starting with iOS 10, Apple requires developers to declare access to privacy-sensitive controls ahead of time.

<key>NSPhotoLibraryUsageDescription</key>
<string>To Enable access to Photo Library</string>
<key>NSCameraUsageDescription</key>
<string>To take Images from Camera</string>
  1. If you encounter non-modular header error during project build
error: include of non-modular header inside framework module 'flutter_freshchat.FlutterFreshchatPlugin'
  • Manually in xcode update the FreshchatSDK.h to be in the flutter_freshchat target and public.

FreshchatSDK_fix

You may have to do this each time your switch or rebuild the xcode project from flutter.

Usage

To use this plugin, add flutter_freshchat as a dependency in your pubspec.yaml file.

import 'package:flutter_freshchat/flutter_freshchat.dart';

Initialize the Freshchat app with appID, appKey & domain which you could get from here: Where to find App ID and App Key

It has following [FreshchatConfig] properties:

  • domain Each Freshchat cluster falls in to one of this domains:

  • cameraEnabled property is used to either enable or disable camera within freshchat conversation widget. It default value is set to true.

  • gallerySelectionEnabled property is used to either enable or disable gallery within freshchat conversation widget. It default value is set to true.

  • teamMemberInfoVisible property is used to show team member info within freshchat conversation widget. It default value is set to true.

  • responseExpectationEnabled property is used to show exceptions that occur within freshchat conversation widget. It default value is set to true.

  • showNotificationBanner property is used enabled or disable in-app notification banner. It default value is set to true. (NOTE: IOS only).

  • notificationSoundEnabled property is used enabled or disable in-app notification sound. It default value is set to true. (NOTE: IOS only).

await FlutterFreshchat.init(
  appID: 'YOUR_APP_ID_HERE',
  appKey: 'YOUR_APP_KEY_HERE',
  domain: 'https://msdk.freshchat.com'
  );

Update the user info by setting by creating a FreshchatUser object

FreshchatUser user = FreshchatUser.initial();
user.email = "[email protected]";
user.firstName = "john";
user.lastName = "doe";
user.phoneCountryCode = "+91";
user.phone = "0123456789";

await FlutterFreshchat.updateUserInfo(user: user);

// Custom properties can be set by creating a Map<String, String>
Map<String, String> customProperties = Map<String, String>();
customProperties["loggedIn"] = "true";

await FlutterFreshchat.updateUserInfo(user: user, customProperties: customProperties);

Identify the user user by usin email address or any way you uniquely identify the user. externalID is required and returns a restoreID you can save it and use to restore the chats

await FlutterFreshchat.identifyUser(externalID: 'USER_UNIQUE_ID', restoreID: 'USER_RESTORE_ID');

Show conversation opens a conversation screen and also list all the other conversation if a list obejct is supplied to it. You can also pass a title for the chat screen.

await FlutterFreshchat.showConversations(tags: const [], title: 'CHAT_SCREEN_TITLE');

Send message directly within the app without opening the Freshchat interface. tag is optional.

await FlutterFreshchat.send(message: 'YOUR_MESSAGE_HERE', tag: 'YOUR_TAG_HERE');

ShowFAQs opens a FAQ screen in a grid like format as default you can change the default setting by changing this paramters.
showFaqCategoriesAsGrid = true
showContactUsOnAppBar = true
showContactUsOnFaqScreens = false
showContactUsOnFaqNotHelpful = false

await FlutterFreshchat.showFAQs();

Gets the unseen message count from freshchat you can use this to show a counter.

int count = await FlutterFreshchat.getUnreadMsgCount();

Reset user data at logout or when deemed appropriate based on user action in the app.

await FlutterFreshchat.resetUser();

Example

Find the example wiring in the Flutter_Freshchat example application.

API details

See the flutter_freshchat.dart for more API details

Issues and feedback

Please file issues to send feedback or report a bug. Thank you!

Comments
  • [BUG] Crash in iOS when calling FlutterFreshchat

    [BUG] Crash in iOS when calling FlutterFreshchat

    Describe the bug When you open the app for the first time it crashes with this error below. ( I am using flutter_freshchat version 1.2.6)

    Desktop (please complete the following information):

    • OS: MacOS Catalina Version: 10.15.2
    • Device: All iPhone devices + simulators

    Flutter doctor -v

    [✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.15.2 19C57, locale en-BH) • Flutter version 1.12.13+hotfix.8 at /Users/dev/development/flutter • Framework revision 0b8abb4724 (3 weeks ago), 2020-02-11 11:44:36 -0800 • Engine revision e1e6ced81d • Dart version 2.7.0

    [!] Android toolchain - develop for Android devices (Android SDK version 29.0.0) • Android SDK at /Users/dev/Library/Android/sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-29, build-tools 29.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405) ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

    [✓] Xcode - develop for iOS and macOS (Xcode 11.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.3, Build version 11C29 • CocoaPods version 1.9.0

    [!] Android Studio (version 3.5) • Android Studio at /Applications/Android Studio.app/Contents ✗ Flutter plugin not installed; this adds Flutter specific functionality. • Dart plugin version 183.6270 • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

    [✓] VS Code (version 1.42.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.8.1

    [✓] Connected device (1 available) • iPhone 11 • B60011B4-308E-4228-B0E3-ED5091980954 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)

    ! Doctor found issues in 2 categories. ITs-MacBook-Air:homiez-mobile dev$

    Additional context Launching lib/main.dart on iPhone 11 in debug mode... Xcode build done. 94.7s path: satisfied (Path is satisfied), interface: en0 Configuring the default Firebase app... path: satisfied (Path is satisfied), interface: en0 Configured the default Firebase app __FIRAPP_DEFAULT. path: satisfied (Path is satisfied), interface: en0 path: satisfied (Path is satisfied), interface: en0 [C4.1 8C472F77-CA5E-4E2B-99A0-B30318B4A2DA 192.168.100.60:60991<->172.217.19.14:443] Connected Path: satisfied (Path is satisfied), interface: en0 Duration: 0.364s, DNS @0.001s took 0.007s, TCP @0.010s took 0.036s, TLS took 0.166s bytes in/out: 4370/1117, packets in/out: 8/10, rtt: 0.029s, retransmitted packets: 0, out-of-order packets: 0 [C5.1 AA781AED-06EC-4E96-A886-FEF7E3017F5D 192.168.100.60:60992<->172.217.19.14:443] Connected Path: satisfied (Path is satisfied), interface: en0 Duration: 0.402s, DNS @0.002s took 0.005s, TCP @0.009s took 0.040s, TLS took 0.207s bytes in/out: 4732/1022, packets in/out: 8/9, rtt: 0.034s, retransmitted packets: 0, out-of-order packets: 0 [C6.1 64032EE7-57BF-4699-BF46-0B3EEB523365 192.168.100.60:60993<->172.217.19.14:443] Connected Path: satisfied (Path is satisfied), interface: en0 Duration: 0.338s, DNS @0.001s took 0.004s, TCP @0.007s took 0.033s, TLS took 0.159s bytes in/out: 4242/1464, packets in/out: 8/10, rtt: 0.028s, retransmitted packets: 0, out-of-order packets: 0 flutter: {deviceid: E5AC360A-D9FF-450D-AC2F-2D22E80FE2A2, os: iOS, systemversion: 13.3, mobile: iPhone 11, version: 2.3.8, buildNumber: 0.0.0} path: satisfied (Path is satisfied), interface: en0 [C7.1 0D81BD57-304C-4CDA-9197-E873CE0B392E 192.168.100.60:61020<->172.217.19.14:443] Connected Path: satisfied (Path is satisfied), interface: en0 Duration: 0.395s, DNS @0.002s took 0.004s, TCP @0.008s took 0.036s, TLS took 0.211s bytes in/out: 4242/1406, packets in/out: 8/10, rtt: 0.029s, retransmitted packets: 0, out-of-order packets: 0 Lost connection to device. *** First throw call stack:

    (
    	0   CoreFoundation                      0x00007fff23c7127e __exceptionPreprocess + 350
    	1   libobjc.A.dylib                     0x00007fff513fbb20 objc_exception_throw + 48
    	2   CoreFoundation                      0x00007fff23c91ed4 +[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    	3   CoreFoundation                      0x00007fff23c75c4c ___forwarding___ + 1436
    	4   CoreFoundation                      0x00007fff23c77f78 _CF_forwarding_prep_0 + 120
    	5   flutter_freshchat                   0x000000010d3b072d -[FDWebImageDownloaderOperation URLSession:task:didCompleteWithError:] + 476
    	6   flutter_freshchat                   0x000000010d41a266 -[FDWebImageDownloader URLSession:task:didCompleteWithError:] + 113
    	7   CFNetwork                           0x00007fff22f31884 _CFNetworkHTTPConnectionCacheSetL<…>
    
    opened by mohdkhmais 26
  • [BUG] The whole new version(v1.3.0) is wrong

    [BUG] The whole new version(v1.3.0) is wrong

    Desktop (please complete the following information):

    • OS: [e.g. Mac]
    • Device: [e.g. iPhoneX] | Emulator
    • Version [e.g. 1.3.0]

    Additional context'

    Comparison of versions

    v 1.3.0 image

    v 1.2.6 image

    v 1.2.6 icon file missing

    v1.3.0 a lot less files!!!!

    But v1.2.6 can run! please fix !!!!!!!! THX

    opened by lessthanno 12
  • Feature Request : setting phone and phoneCountry and other arbitrary user attributes

    Feature Request : setting phone and phoneCountry and other arbitrary user attributes

    FreshChat has this API to set User attributes (to know more about the user in the dashboard while chatting), phone number especially is important because it is linked with other FreshWork CRM services.

    enhancement 
    opened by daadu 10
  • flutter_freshchat` does not specify a Swift version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.

    flutter_freshchat` does not specify a Swift version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.

    - `flutter_freshchat` does not specify a Swift version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.
    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.7.0/lib/cocoapods/installer/xcode/target_validator.rb:122:in `verify_swift_pods_swift_version'
    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.7.0/lib/cocoapods/installer/xcode/target_validator.rb:37:in `validate!'
    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.7.0/lib/cocoapods/installer.rb:578:in `validate_targets'
    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.7.0/lib/cocoapods/installer.rb:158:in `install!'
    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.7.0/lib/cocoapods/command/install.rb:51:in `run'
    /Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.7.0/lib/cocoapods/command.rb:52:in `run'
    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.7.0/bin/pod:55:in `<top (required)>'
    /usr/local/bin/pod:22:in `load'
    /usr/local/bin/pod:22:in `<main>'
    

    Error output from CocoaPods: ↳ WARNING: CocoaPods requires your terminal to be using UTF-8 encoding. Consider adding the following to ~/.profile: export LANG=en_US.UTF-8

    I already tried to add "config.build_settings['SWIFT_VERSION'] = '4.2'", but it didn't work

    good first issue 
    opened by MilenaSousa 8
  • Fixes for some iOS build isses.

    Fixes for some iOS build isses.

    I was unable to build on iOS getting lots of error: include of non-modular header inside framework module 'flutter_freshchat.FlutterFreshchatPlugin'

    • Update the podspec to include swift, I think this makes xcode generate and use a umbrella header, that will fix Opjective-C and Swift issues.
    • Updated the code to fix swift errors with null safety.
    • Added flutter template import fallback to the .m file.
    • Manualy in xcode update the FreshchatSDK.h to be in the flutter_freshchat target and public. freshchat https://imgur.com/a/BRYZt0R This setup on the SDK is often lost by flutter when rebuilding the project, so you may have to reapply it. (I could not find a way to do it automatically)

    After this I can build from xCode or command line with flutter run

    I'm not a iOS expert, but I think these changes may be very helpful.

    Pubspec test

      flutter_freshchat:
        git:
          url: https://github.com/GuruJohn/flutter_freshchat.git
    

    This might fix some issues people may still be having with https://github.com/fayeed/flutter_freshchat/issues/31

    opened by GuruJohn 7
  • [BUG] Can't build for iOS

    [BUG] Can't build for iOS

    Describe the bug When trying to build my app for iOS, I'm getting a lot of errors related to FreshChat that makes the app fails to build

    To Reproduce Just try to run the command 'Flutter build ios'

    Expected behavior it should make a successful build

    Desktop (please complete the following information):

    • OS: Mac OS (11.1)
    • Device: Generic build for iOS
    • Freshchat Version: 1.4.0
    • Flutter (Channel stable, 1.22.5)

    Additional context Here's the log:

    Xcode's output:
    ↳
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:48:17: error: value of optional type 'FreshchatConfig?' must be
        unwrapped to refer to member 'gallerySelectionEnabled' of wrapped base type 'FreshchatConfig'
                        freshchatConfig.gallerySelectionEnabled = gallerySelectionEnabled
                        ^
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:48:17: note: chain the optional using '?' to access member
        'gallerySelectionEnabled' only for non-'nil' base values
                        freshchatConfig.gallerySelectionEnabled = gallerySelectionEnabled
                        ^
                                       ?
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:48:17: note: force-unwrap using '!' to abort execution if the
        optional value contains 'nil'
                        freshchatConfig.gallerySelectionEnabled = gallerySelectionEnabled
                        ^
                                       !
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:49:17: error: value of optional type 'FreshchatConfig?' must be
        unwrapped to refer to member 'cameraCaptureEnabled' of wrapped base type 'FreshchatConfig'
                        freshchatConfig.cameraCaptureEnabled = cameraEnabled
                        ^
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:49:17: note: chain the optional using '?' to access member
        'cameraCaptureEnabled' only for non-'nil' base values
                        freshchatConfig.cameraCaptureEnabled = cameraEnabled
                        ^
                                       ?
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:49:17: note: force-unwrap using '!' to abort execution if the
        optional value contains 'nil'
                        freshchatConfig.cameraCaptureEnabled = cameraEnabled
                        ^
                                       !
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:50:17: error: value of optional type 'FreshchatConfig?' must be
        unwrapped to refer to member 'teamMemberInfoVisible' of wrapped base type 'FreshchatConfig'
                        freshchatConfig.teamMemberInfoVisible = teamMemberInfoVisible
                        ^
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:50:17: note: chain the optional using '?' to access member
        'teamMemberInfoVisible' only for non-'nil' base values
                        freshchatConfig.teamMemberInfoVisible = teamMemberInfoVisible
                        ^
                                       ?
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:50:17: note: force-unwrap using '!' to abort execution if the
        optional value contains 'nil'
                        freshchatConfig.teamMemberInfoVisible = teamMemberInfoVisible
                        ^
                                       !
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:51:17: error: value of optional type 'FreshchatConfig?' must be
        unwrapped to refer to member 'showNotificationBanner' of wrapped base type 'FreshchatConfig'
                        freshchatConfig.showNotificationBanner = showNotificationBanner
                        ^
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:51:17: note: chain the optional using '?' to access member
        'showNotificationBanner' only for non-'nil' base values
                        freshchatConfig.showNotificationBanner = showNotificationBanner
                        ^
                                       ?
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:51:17: note: force-unwrap using '!' to abort execution if the
        optional value contains 'nil'
                        freshchatConfig.showNotificationBanner = showNotificationBanner
                        ^
                                       !
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:52:17: error: value of optional type 'FreshchatConfig?' must be
        unwrapped to refer to member 'responseExpectationVisible' of wrapped base type 'FreshchatConfig'
                        freshchatConfig.responseExpectationVisible = responseExpectationEnabled
                        ^
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:52:17: note: chain the optional using '?' to access member
        'responseExpectationVisible' only for non-'nil' base values
                        freshchatConfig.responseExpectationVisible = responseExpectationEnabled
                        ^
                                       ?
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:52:17: note: force-unwrap using '!' to abort execution if the
        optional value contains 'nil'
                        freshchatConfig.responseExpectationVisible = responseExpectationEnabled
                        ^
                                       !
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:53:17: error: value of optional type 'FreshchatConfig?' must be
        unwrapped to refer to member 'notificationSoundEnabled' of wrapped base type 'FreshchatConfig'
                        freshchatConfig.notificationSoundEnabled = notificationSoundEnabled
                        ^
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:53:17: note: chain the optional using '?' to access member
        'notificationSoundEnabled' only for non-'nil' base values
                        freshchatConfig.notificationSoundEnabled = notificationSoundEnabled
                        ^
                                       ?
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:53:17: note: force-unwrap using '!' to abort execution if the
        optional value contains 'nil'
                        freshchatConfig.notificationSoundEnabled = notificationSoundEnabled
                        ^
                                       !
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:54:17: error: value of optional type 'FreshchatConfig?' must be
        unwrapped to refer to member 'domain' of wrapped base type 'FreshchatConfig'
                        freshchatConfig.domain = domain
                        ^
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:54:17: note: chain the optional using '?' to access member
        'domain' only for non-'nil' base values
                        freshchatConfig.domain = domain
                        ^
                                       ?
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:54:17: note: force-unwrap using '!' to abort execution if the
        optional value contains 'nil'
                        freshchatConfig.domain = domain
                        ^
                                       !
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:77:17: error: value of optional type 'FreshchatUser?' must be
        unwrapped to refer to member 'firstName' of wrapped base type 'FreshchatUser'
                        user.firstName = arguments["first_name"] as? String
                        ^
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:77:17: note: chain the optional using '?' to access member
        'firstName' only for non-'nil' base values
                        user.firstName = arguments["first_name"] as? String
                        ^
                            ?
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:77:17: note: force-unwrap using '!' to abort execution if the
        optional value contains 'nil'
                        user.firstName = arguments["first_name"] as? String
                        ^
                            !
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:78:17: error: value of optional type 'FreshchatUser?' must be
        unwrapped to refer to member 'lastName' of wrapped base type 'FreshchatUser'
                        user.lastName = arguments["last_name"] as? String
                        ^
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:78:17: note: chain the optional using '?' to access member
        'lastName' only for non-'nil' base values
                        user.lastName = arguments["last_name"] as? String
                        ^
                            ?
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:78:17: note: force-unwrap using '!' to abort execution if the
        optional value contains 'nil'
                        user.lastName = arguments["last_name"] as? String
                        ^
                            !
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:79:17: error: value of optional type 'FreshchatUser?' must be
        unwrapped to refer to member 'phoneNumber' of wrapped base type 'FreshchatUser'
                        user.phoneNumber  = arguments["phone"] as? String
                        ^
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:79:17: note: chain the optional using '?' to access member
        'phoneNumber' only for non-'nil' base values
                        user.phoneNumber  = arguments["phone"] as? String
                        ^
                            ?
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:79:17: note: force-unwrap using '!' to abort execution if the
        optional value contains 'nil'
                        user.phoneNumber  = arguments["phone"] as? String
                        ^
                            !
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:80:17: error: value of optional type 'FreshchatUser?' must be
        unwrapped to refer to member 'email' of wrapped base type 'FreshchatUser'
                        user.email = arguments["email"] as? String
                        ^
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:80:17: note: chain the optional using '?' to access member 'email'
        only for non-'nil' base values
                        user.email = arguments["email"] as? String
                        ^
                            ?
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:80:17: note: force-unwrap using '!' to abort execution if the
        optional value contains 'nil'
                        user.email = arguments["email"] as? String
                        ^
                            !
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:81:17: error: value of optional type 'FreshchatUser?' must be
        unwrapped to refer to member 'phoneCountryCode' of wrapped base type 'FreshchatUser'
                        user.phoneCountryCode = arguments["phone_country_code"] as? String
                        ^
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:81:17: note: chain the optional using '?' to access member
        'phoneCountryCode' only for non-'nil' base values
                        user.phoneCountryCode = arguments["phone_country_code"] as? String
                        ^
                            ?
        /Users/muhammedrefaat/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/ios/Classes/SwiftFlutterFreshchatPlugin.swift:81:17: note: force-unwrap using '!' to abort execution if the
        optional value contains 'nil'
                        user.phoneCountryCode = arguments["phone_country_code"] as? String
                        ^
                            !
        Command CompileSwift failed with a nonzero exit code
        Command CompileSwift failed with a nonzero exit code
        note: Using new build system
        note: Building targets in parallel
        note: Planning build
        note: Constructing build description
    
    
    opened by MuhammedRefaat 6
  • [iOS] using only *.h, *.m and *.swift files as sources

    [iOS] using only *.h, *.m and *.swift files as sources

    Fixes https://github.com/fayeed/flutter_freshchat/issues/22 #34 Inspiered from https://github.com/fayeed/flutter_freshchat/issues/22#issuecomment-586158563 workaround

    opened by daadu 5
  • Customization through dart code

    Customization through dart code

    Currently I can not find how to customize the theme.

    It will be nice to have a way to customize the freshchat as they explain in their documentation.

    Example:

    FlutterFreshchat.init(
      appID: '<appID>',
      appKey: '<appKey>',
      navigatorBar: NavigatorBarStyle(
        backgroudColor: Colors.red,
      ),
    );
    
    opened by karelric 5
  • Crash on iOS

    Crash on iOS

    Hi, I'm currently experiencing crashes on iOS. I am running the latest available version of the package from pub.dev and no errors on the android build of my app.

    Here is the error I face whenever I try to show the FAQs:

    *** First throw call stack:
    (
    	0   CoreFoundation                      0x000000010feab1bb __exceptionPreprocess + 331
    	1   libobjc.A.dylib                     0x000000010f449735 objc_exception_throw + 48
    	2   CoreFoundation                      0x000000010fec9e44 +[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    	3   CoreFoundation                      0x000000010feafed6 ___forwarding___ + 1446
    	4   CoreFoundation                      0x000000010feb1da8 _CF_forwarding_prep_0 + 120
    	5   flutter_freshchat                   0x000000010e786638 -[FDWebImageDownloaderOperation URLSession:task:didCompleteWithError:] + 514
    	6   flutter_freshchat                   0x000000010e7eb7f7 -[FDWebImageDownloader URLSession:task:didCompleteWithError:] + 113
    	7   CFNetwork                           0x0000000112018342 __51-[NSURLSession delegate_task:did<…>
    Lost connection to device.
    

    Here is the code needed to replicate the error above:

    initChat () async {
       await FlutterFreshchat.init(appID: '...', appKey: '...', cameraEnabled: false);
       //FreshchatUser user = FreshchatUser.initail();
       //user.firstName = appState.snapshot.customer.appUser.name;
       //user.lastName = appState.snapshot.customer.appUser.surname;
       //user.phone = appState.snapshot.customer.appUser.loginPhoneNumber;
       //user.email = appState.snapshot.customer.appUser.email;
       //await FlutterFreshchat.identifyUser(externalID: appState.snapshot.customer.appUser.id);
       //await FlutterFreshchat.updateUserInfo(user: user);
     }
    
     showChat() async {
       await FlutterFreshchat.showConversations(tags: const [], title: 'Chat di assistenza');
     }
    
     showFaq() async {
       await FlutterFreshchat.showFAQs(showContactUsOnAppBar: false, showContactUsOnFaqScreens: false, showFaqCategoriesAsGrid: false);
     }
    
     @override
     void dispose(){
       super.dispose();
       FlutterFreshchat.resetUser();
     }
    
     @override
     void initState() {
       super.initState();
       initChat();
     }
    

    If I uncomment the remaining lines in initChat() then the app crashes earlier without writing any debug information in console. It crashes during the initChat() call.

    The code as is is able to successfully open and run the chat but crashes with the FAQ page.

    On Android, we are currently using the code without all the comments in initChat.

    I was able to replicate it with a physical iPhone 6s on iOS 12.0.1 and on an emulated iPhone XR on iOS 12.1

    Here is also the output from flutter doctor

    [✓] Flutter (Channel stable, v1.9.1+hotfix.2, on Mac OS X 10.13.6 17G65, locale
        it-IT)
    [✓] Xcode - develop for iOS and macOS (Xcode 10.1)
    
    bug help wanted 
    opened by savy-91 5
  • Migrate to AndroidX

    Migrate to AndroidX

    Is your feature request related to a problem? Please describe. Migrating to AndroidX is inevitable!!

    Describe the solution you'd like Update the freshdesk android dependency to the latest version. I had requested this to the freshdesk team they now support AndroidX. Check this issue

    Describe alternatives you've considered Nil

    Additional context Mark the latest version number that doesn't support AndroidX and put that in README.md

    enhancement 
    opened by daadu 5
  • [BUG] Unsupported version of Picaso found

    [BUG] Unsupported version of Picaso found

    Describe the bug The packages throws an "Unsupported version of Picaso found." error and doesn't initialize.

    To Reproduce Steps to reproduce the behavior: Add the FlutterFreshchat and call the init method. The error below should appear.

    Error log:

    E/MethodChannel#flutter_freshchat( 3862): Failed to handle method call
    E/MethodChannel#flutter_freshchat( 3862): java.lang.IllegalArgumentException: Unsupported version of Picasso found. Please create and set custom Image loader using Freshchat.setImageLoader().
    E/MethodChannel#flutter_freshchat( 3862): 	at com.freshchat.consumer.sdk.j.ba.fX(Unknown Source:29)
    E/MethodChannel#flutter_freshchat( 3862): 	at com.freshchat.consumer.sdk.Freshchat.init(Unknown Source:55)
    E/MethodChannel#flutter_freshchat( 3862): 	at com.freshchat.flutter_freshchat.FlutterFreshchatPlugin.onMethodCall(FlutterFreshchatPlugin.java:65)
    E/MethodChannel#flutter_freshchat( 3862): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:226)
    E/MethodChannel#flutter_freshchat( 3862): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
    E/MethodChannel#flutter_freshchat( 3862): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:631)
    E/MethodChannel#flutter_freshchat( 3862): 	at android.os.MessageQueue.nativePollOnce(Native Method)
    E/MethodChannel#flutter_freshchat( 3862): 	at android.os.MessageQueue.next(MessageQueue.java:336)
    E/MethodChannel#flutter_freshchat( 3862): 	at android.os.Looper.loop(Looper.java:197)
    E/MethodChannel#flutter_freshchat( 3862): 	at android.app.ActivityThread.main(ActivityThread.java:7860)
    E/MethodChannel#flutter_freshchat( 3862): 	at java.lang.reflect.Method.invoke(Native Method)
    E/MethodChannel#flutter_freshchat( 3862): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    E/MethodChannel#flutter_freshchat( 3862): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
    

    Desktop (please complete the following information):

    • OS: Ubuntu
    • Device: Samsung A10
    • Package Version 1.3.0
    • Flutter version 1.17.1
    opened by VytorCalixto 4
  • could not build Objective-C module 'flutter_freshchat'(Not able to take iOS build)

    could not build Objective-C module 'flutter_freshchat'(Not able to take iOS build)

    In one of my project Iam using flutter_freshchat integration. In that am facing an issue in iOS, when I add flutter_freshchat: ^1.3.0 in pubspec.yaml. Am not able to build only with this. Am getting error the following;

    <module-includes>:1:9: note: in file included from <module-includes>:1:#import "Headers/flutter_freshchat-umbrella.h" ^/Users/docty/Workspace/Projects/Docty/ios/Pods/Target Support Files/flutter_freshchat/flutter_freshchat-umbrella.h:13:9: note: in file included from /Users/docty/Workspace/Projects/Docty/ios/Pods/Target Support Files/flutter_freshchat/flutter_freshchat-umbrella.h:13:#import "FlutterFreshchatPlugin.h" ^/Users/docty/Workspace/FlutterDevelopments/flutter/.pub-cache/git/flutter_freshchat-37d8d569f7adc8c6451384634386f1151b1d686f/ios/Classes/FlutterFreshchatPlugin.h:2:9: error: include of non-modular header inside framework module 'flutter_freshchat.FlutterFreshchatPlugin': '/Users/docty/Workspace/Projects/Docty/ios/Pods/FreshchatSDK/FreshchatSDK/FreshchatSDK.h'#import "FreshchatSDK.h" ^<unknown>:0: error: could not build Objective-C module 'flutter_freshchat'

    But when I use the workaround like the following link I am able to build. #33

    That time I have to remove the domain from FlutterFreshchat.init. But without a domain it's not loading the data also. May I know why I am getting this kind of issue. Struggling from past one week. I tried all the git issues solution. It's not working.

    Flutter details:

    Flutter 1.22.3 • channel unknown • unknown source Framework • revision 8874f21e79 (7 months ago) • 2020-10-29 14:14:35 -0700 Engine • revision a1440ca392 Tools • Dart 2.10.3

    Xcode details: Version 12.5

    opened by Sunsiha 0
  • how to hide powered by freshchat  in  showConversations  dialog?

    how to hide powered by freshchat in showConversations dialog?

    Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

    Describe the solution you'd like A clear and concise description of what you want to happen.

    Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

    Additional context Add any other context or screenshots about the feature request here.

    opened by wangxingxing123654 0
  • Handle deprecation of Freshchat SDK v3.3.0

    Handle deprecation of Freshchat SDK v3.3.0

    Is your feature request related to a problem? Please describe. Freshchat SDK v3.3.0 might not function properly after December 2020. Check screenshot below for more details.

    Describe the solution you'd like Need to study API changes and upgrade to latest SDK

    Additional context Screenshot of email received from Freshchat Screenshot 2020-11-26 at 11 24 04 PM

    opened by daadu 0
  • Theme Customization

    Theme Customization

    Hi,

    Would it be possible to add the ability to customise the theme for both iOS and Android into this package?

    Android

    • https://support.freshchat.com/support/solutions/articles/229492-freshchat-android-sdk-themes-and-customizations

    iOS

    • https://support.freshchat.com/support/solutions/articles/229814-freshchat-ios-sdk-themes

    Best regards, Chris

    opened by carman247 0
  • No compile error help

    No compile error help

    I try to used the plugin with flutter 1.22 and show me the following error after try compile the apps

    Note: /home/cesar/Descargas/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_freshchat-1.4.0/android/src/main/java/com/freshchat/flutter_freshchat/FlutterFreshchatPlugin.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.

    If I continue with the message the app all time crashed never open.

    any have solution to this problem? thanks for you help

    opened by maevllc 0
Releases(1.4.0)
Owner
Fayeed Pawaskar
Creator of ChartNerd | Flutter | React Native | ReactJs
Fayeed Pawaskar
An unofficial Flutter plugin that wraps pusher-websocket-java on Android and pusher-websocket-swift on iOS

Pusher Flutter Client An unofficial Flutter plugin that wraps pusher-websocket-java on Android and pusher-websocket-swift on iOS. Get it from pub. How

HomeX 31 Oct 21, 2022
VerificaC19-flutter - Unofficial EU DGC validation package for Flutter

VerificaC19 package for Flutter About This package allows to decode and validate

Federico Mastrini 13 Oct 21, 2022
Flutter list view - An unofficial list view for flutter

Flutter List View I don't like official list view. There are some features don't

null 24 Dec 15, 2022
Unofficial delivery app for Rapidinho made with Flutter

Rapidinho Unofficial delivery app for Rapidinho made with Flutter Getting Started Gradle version: 4.6 Flutter version: 0.8.3 Install Flutter Clone thi

GDG Luanda 190 Dec 26, 2022
Unofficial Turkish Dictionary app of TDK (Turkish Language Association) developing with Flutter

Turkish Dictionary Unofficial Turkish Dictionary app of TDK (Turkish Language Association) developing with Flutter Design Feyza Nur Demirci Şahin Abut

Flutter Turkey 80 Oct 20, 2022
Flutter & Dart Unofficial Flat Data API

Flutter & Dart Unofficial Flat Data API Flat Dataset for different helpful Flutter APIs Flutter Releases Currently does a daily snapshot of the Flutte

Leo Farias 21 Dec 26, 2022
Vrchat mobile client - VRChat Unofficial Mobile Client For Flutter

VRChatMC VRChatの非公式なAPIを利用したVRChatのモバイルクライアント Flutterで作成されたシンプルなUIが特徴的です iosビルドは

ふぁ 8 Sep 28, 2022
An unofficial wrapper for the kdecole api

This is an UNOFFICIAL wrapper for the kdecole api How to use ? Login First, you need to create a Client() object : LOGIN AND PASSWORD ARE NOT YOUR ENT

null 5 Nov 2, 2022
unofficial windows client for smotreshka.tv

smotreshka Rebuild models flutter pub run build_runner build --delete-conflicting-outputs Getting Started This project is a starting point for a Flut

null 0 Dec 3, 2021
Unofficial 🐘 client written in 🎯

mastodon_dart The official Dart library for accessing the Mastodon API. Optionally use in conjunction with mastodon_flutter to build a Flutter Mastodo

Luke Pighetti 21 Dec 22, 2022
Unofficial wrapper for using Rapid7 insightOps logs (former LogEntries) with Dart.

An unofficial wrapper for using Rapid7 insightOps logs (former LogEntries) with Dart. This package is using logging package to do the actual logging,

Kirill Bubochkin 2 Mar 3, 2021
An open-source unofficial GitHub mobile client, that aims to deliver the ultimate GitHub experience on mobile devices.

DioHub for Github Summary Features Roadmap Support Screenshots Build Instructions Summary DioHub is an open-source unofficial GitHub mobile client, th

Naman Shergill 401 Jan 4, 2023
Unofficial KronoX app for Android and iOS

School Schedule Unofficial KronoX app for Android and iOS made using Flutter Supported Platforms The app is available on Google Play. It's not availab

kraxie 8 Oct 31, 2022
Flathub-desktop - Unofficial Desktop Client for Flathub

Flathub Desktop Unofficial Desktop Client for Flathub How to build and run: You

Jean3219 2 Sep 19, 2022
Federico 1 Feb 3, 2022
An unofficial nhentai app.

Eros-N English | 简体中文 Introduction An unofficial Nhentai app. Features Front page User login Favorites View gallery Gallery tags More view settings Do

null 131 Jan 9, 2023
An unofficial, platform independent, client for accessing different AI models developed by OpenAI

The OpenAI API can be applied to virtually any task that involves understanding or generating natural language or code. They offer a spectrum of model

Francesco Coppola 14 Dec 30, 2022
This is just the simplyfied Flutter Plugin use for one of the popular flutter plugin for social media login.

social_media_logins Flutter Plugin to login via Social Media Accounts. Available Social Media Logins: Facebook Google Apple Getting Started To use thi

Reymark Esponilla 3 Aug 24, 2022