# Updating from v4 to v5 We have made a lot of changes and improvements to the framework for v5. Some of these changes cause breaking changes. This document aims to summarize the changes and how to resolve them. - Replaced ChatActivity implementation with ChatKit - Removed social login module - you can use FirebaseUI if you need social login - Added multi-message select - Add message replies - Allow multiple images to be sent at once - Streamline image selection using Matisse - Make Firebase UI the default interface - Replace Fresco with Glide - Upgraded Audio message module to use ExoPlayer - Audio message module supports file compression If you need support join us on our [**Discord Server**](https://discord.gg/abT5BM4). There we will provide help in real-time. ### ChatActivity The ChatActivity is being deprecated in favour of a ChatKit implementation. ### Hooks Before: ``` ChatSDK.hook().addHook(new Hook(data -> Completable.create(emitter -> { // ... emitter.onComplete(); })), HookEvent.MessageReceived); ``` After: If you are adding synchronous code: ``` ChatSDK.hook().addHook(Hook.sync(data -> { // .... }), HookEvent.MessageReceived); ``` Or asynchronous code: ``` ChatSDK.hook().addHook(Hook.async(data -> Completable.create(emitter -> { // ... Async code here emitter.onComplete(); })), HookEvent.MessageReceived); ``` ### Thread Handler Before: ``` Completable forwardMessage(Message message, Thread thread); ``` After: ``` Completable forwardMessage(Thread thread, Message message); ``` ### Why did you remove social login? Social login is complicated and error prone. We have had a lot of issues with third party login SDKs that change their API every few months and generate build problems with CocoaPods (Facebook and Twitter I'm looking at both of you). It also requires a lot of instructions to setup properly and the steps are always changing. For this reason, supporting social login takes a lot of time for relatively little benefit. Especially since this functionality is provided by Firebase UI. So the bottom line is that if you want Social Login, you can either use Firebase UI. If you need custom social login, I recomment that you look at version 4.x of the project and migrate it to version 5. ### core `co.chatsdk` package changed to `sdk.chat` **Solution** Update all instancea of `co.chatsdk` in imports to `sdk.chat`. For example: ``` import co.chatsdk.core.dao.Thread; ``` Becomes: ``` import sdk.chat.core.dao.Thread; ``` ### Imports can't be found **Issue** > In the imports section at the top of the class the imports are red meaning they can't be found **Cause** The packages have been modified **Solution** In Android Studio open: Preferences / Settings -> Editor -> General -> Auto Import Check: "Add unambiguous imports on the fly" and "Optimize imports on the fly" Delete the imports that can't be found and Android Studio will automatically reimport the classes ### Can't find class `DisposableList` **Issue** > `DisposableList` not found **Cause** `DisposableList` has been removed in v5 **Solution** Replace `DisposableList` with `DisposableMap` ### `Thread` class not recognized **Issue** > Methods not recognized on `Thread` **Cause** Java thinks this is a Java thread not a chat thread **Solution** `import sdk.chat.core.dao.Thread;` ### Can't find `SimpleDraweeView` **Issue** > The app can't resolve the `SimpleDraweeView` class **Cause** We have replaced Fresco with Glide **Solution** Replace instances of `SimpleDraweeView` with `CircleImageView`. Use Glide to load the image from the URL ### Can't find `CrashReportingCompletableObserver;` **Issue** > `import co.chatsdk.core.utils.CrashReportingCompletableObserver;` not found **Cause** This class has been removed **Solution** This has been removed. Usually we use this in the situation like: ``` .subscribe(new CrashReportingCompletableObserver()); ``` This can be replaced with: ``` .subscribe(this) ``` If it is an Activity or a Fragment. If we are calling subscribe on something other than completable, you will have to call: ``` .ignoreElements().subscribe(this) ``` If it’s not an Activity or a Fragment use: ``` .subscribe(ChatSDK.events()) ``` ### Can't find `TextInputView` **Issue** > `import co.chatsdk.ui.chat.TextInputView; not found **Cause** This class has been replaced with the `MessageInput` class **Solution** Delete the imports and use `MessageInput` instead ### Can't find `Timber` **Issue** > `import timber.log.Timber; not found **Cause** Timber has been replaced with `Logger` **Solution** Delete the import and replaces instances of `Timber` logging with `Logger` logging i.e. `Logger.debug("...")` ### Can't find `ThreadEditDetailsActivity` **Issue** > `import co.chatsdk.ui.threads.ThreadEditDetailsActivity;` not found **Cause** This class has been renamed to `EditThreadActivity` **Solution** Replace instances of `ThreadEditDetailsActivity` with `EditThreadActivity` ### Can't find MessageListAdapter The `MessageListAdapter` has been removed in v5. We have replaced the old chat and thread view implementation with Chat Kit. Now the `ThreadsFragment` uses a Chat Kit [DialogsList](https://github.com/stfalcon-studio/ChatKit/blob/master/docs/COMPONENT_DIALOGS_LIST.MD) and the `ChatActivity` uses a [MessagesList](https://github.com/stfalcon-studio/ChatKit/blob/master/docs/COMPONENT_MESSAGES_LIST.md) and a [MessageInput](https://github.com/stfalcon-studio/ChatKit/blob/master/docs/COMPONENT_MESSAGE_INPUT.MD) for text entry. If you follow the links above you will find information on how to customize these elements.