Migration Instructions
This article covers the instructions for migration to newer library versions.
Migration to 4.0.0
Changes in Operation of edna Chat Center Push Library 4.0.0
- Dependency on the push-lite library has been removed.
- The following classes used in the integration have been removed:
- im.threads.push.ThreadsPushBroadcastReceiver
- im.threads.push.ThreadsPushFcmIntentService
For push notifications to work correctly, own child must be defined in the application https://firebase.google.com/docs/reference/android/com/google/firebase/messaging/FirebaseMessagingService. To pass the token in the corresponding child method, use ChatCenterPushMessageHelper.setFcmToken(...). To process incoming push notifications, use ChatCenterPushMessageHelper.process(...). This method will only process the push notifications that contain origin=threads, i.e. the edna Chat Center membership flag.
The integration code example:
override fun onNewToken(token: String) {
super.onNewToken(token)
ChatCenterPushMessageHelper.setFcmToken(token)
//your custom handling here
}
override fun onMessageReceived(message: RemoteMessage) {
super.onMessageReceived(message)
ChatCenterPushMessageHelper.process(this, message.data)
//your custom handling here
}
}
Migration from 4.1.0 to 4.2.0
Changes in Chat Center Library 4.2.0
- A new required parameter,
datastoreUrl: String
, has been added: it must be passed before starting the library.
If you do not separate the paths for sending files and for working with the backend API, you can pass the same parameters for both serverBaseUrl
and datastoreUrl
.
Example of implementation via ConfigBuilder
:
- Kotlin
- Java
val configBuilder = ConfigBuilder(this) // this - android context
val transportConfig = getTransportConfig(this)
configBuilder.serverBaseUrl(transportConfig.baseUrl)
.datastoreUrl(transportConfig.datastoreUrl)
.threadsGateUrl(transportConfig.threadsGateUrl)
.threadsGateProviderUid(transportConfig.threadsGateProviderUid)
fun getTransportConfig(ctx: Context?): TransportConfig? {
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(ctx)
val baseUrl = sharedPreferences.getString(PREF_SERVER_BASE_URL, null)
?: return null
val datastoreUrl = sharedPreferences.getString(PREF_DATASTORE_URL, null)
?: return null
val threadsGateUrl = sharedPreferences.getString(PREF_THREADS_GATE_URL, null)
?: return null
val threadsGateProviderUid =
sharedPreferences.getString(PREF_THREADS_GATE_PROVIDER_UID, null)
?: return null
return TransportConfig(
baseUrl,
datastoreUrl,
threadsGateUrl,
threadsGateProviderUid
)
}
ConfigBuilder configBuilder = new ConfigBuilder(this); // this - android context
TransportConfig transportConfig = getTransportConfig(this);
configBuilder.serverBaseUrl(transportConfig.baseUrl)
.datastoreUrl(transportConfig.datastoreUrl)
.threadsGateUrl(transportConfig.threadsGateUrl)
.threadsGateProviderUid(transportConfig.threadsGateProviderUid);
TransportConfig getTransportConfig(Context ctx) {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(ctx)
String baseUrl = sharedPreferences.getString(PREF_SERVER_BASE_URL, null)
?: return null
String datastoreUrl = sharedPreferences.getString(PREF_DATASTORE_URL, null)
?: return null
String threadsGateUrl = sharedPreferences.getString(PREF_THREADS_GATE_URL, null)
?: return null
String threadsGateProviderUid =
sharedPreferences.getString(PREF_THREADS_GATE_PROVIDER_UID, null)
?: return null
return new TransportConfig(
baseUrl,
datastoreUrl,
threadsGateUrl,
threadsGateProviderUid
)
}
You can also register a parameter via the manifest:
<meta-data
android:name="im.threads.getDatastoreUrl"
android:value="http://datastore.yourcompany.com/"/>
Migration from 4.5.0 to 4.6.0
In 4.6.0, we have refactored the SDK, as a result of which some imports have changed. The classes, that have changed their location, now have the ui
or business
path in the package name.
The PrefUtils
class, which gave you direct access to the SDK settings, is no longer available. Now, you need to use the external API methods for that.
Migration from 4.9.0 to 4.10.0
The first change is that attachments are now disabled by default. To enable adding and sending attachments, in the manifest, set the following parameter to true
:
<meta-data
android:name="im.threads.attachmentEnabled"
tools:replace="android:value"
android:value="@bool/attachment_enabled"/>
Alternatively, you can do it using the showAttachmentsButton()
method when creating ConfigBuilder
:
val configBuilder = ConfigBuilder(this).showAttachmentsButton()
ThreadsLib.init(configBuilder)
The second change is that you might require to adjust the display of images. In version 4.10, the proportions of the displayed images have changed, and also the ability to display a border for an image and adjust its size has been added. Learn more about these changes in the Chat Header Style Customization section of the Appearance and Behavior Customization article.