Installation
Set up the development environment
To setup the Flutter development environment folow the steps in this guide.
Add the library to your application
To add the chatvisor module into your application just install it using flutter pub:
flutter pub add engage_plugin
This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):
dependencies:
engage_plugin: ^1.0.14
Android
Make sure your minSdkVersion
is equal or greater than 21
.
iOS
Make sure your iOS version is equal or greater than 12
.
ProGuard
For Release Builds, If you use ProGuard to minify and obfuscate your application, add the following rules:
#Flutter Wrapper
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.** { *; }
-keep class io.flutter.util.** { *; }
-keep class io.flutter.view.** { *; }
-keep class io.flutter.** { *; }
-keep class io.flutter.plugins.** { *; }
## Library
-keep class com.chatvisor.** {*;}
-dontwarn com.chatvisor.**
-dontwarn okhttp3.**
## Dependencies
### Protocol Buffers
-keep class com.google.**
-dontwarn com.google.**
### Moshi (https://github.com/square/moshi/blob/master/moshi/src/main/resources/META-INF/proguard/moshi.pro)
# JSR 305 annotations are for embedding nullability information.
-dontwarn javax.annotation.**
-keepclasseswithmembers class * {
@com.squareup.moshi.* <methods>;
}
-keep @com.squareup.moshi.JsonQualifier interface *
# Enum field names are used by the integrated EnumJsonAdapter.
# values() is synthesized by the Kotlin compiler and is used by EnumJsonAdapter indirectly
# Annotate enums with @JsonClass(generateAdapter = false) to use them with Moshi.
-keepclassmembers @com.squareup.moshi.JsonClass class * extends java.lang.Enum {
<fields>;
**[] values();
}
### Retrofit (https://github.com/square/retrofit/blob/master/retrofit/src/main/resources/META-INF/proguard/retrofit2.pro)
# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and
# EnclosingMethod is required to use InnerClasses.
-keepattributes Signature, InnerClasses, EnclosingMethod
# Retrofit does reflection on method and parameter annotations.
-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations
# Retain service method parameters when optimizing.
-keepclassmembers,allowshrinking,allowobfuscation interface * {
@retrofit2.http.* <methods>;
}
# Ignore annotation used for build tooling.
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
# Ignore JSR 305 annotations for embedding nullability information.
-dontwarn javax.annotation.**
# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath.
-dontwarn kotlin.Unit
# Top-level functions that can only be used by Kotlin.
-dontwarn retrofit2.KotlinExtensions
-dontwarn retrofit2.KotlinExtensions$*
# With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy
# and replaces all potential values with null. Explicitly keeping the interfaces prevents this.
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1>
### Kotlin
-keep class kotlin.**
-dontwarn kotlin.**
Android Deep-Links
If you want deep-links to be recognized from your app please add the proper meta-data and intent-filter inside your activity like the example below:
<activity
android:name=".MainActivity"
android:exported="true"
...
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data android:name="flutter_deeplinking_enabled" android:value="true" />
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data android:host="example.com"
android:pathPrefix="/demo"/>
</intent-filter>
</activity>