Commit 33d3b5f0 authored by Lucio Maciel's avatar Lucio Maciel

More fixes

parent d51c48f4
...@@ -25,7 +25,6 @@ import chat.rocket.android.server.domain.GetSettingsInteractor ...@@ -25,7 +25,6 @@ import chat.rocket.android.server.domain.GetSettingsInteractor
import chat.rocket.android.server.domain.SITE_URL import chat.rocket.android.server.domain.SITE_URL
import chat.rocket.android.server.domain.TokenRepository import chat.rocket.android.server.domain.TokenRepository
import chat.rocket.android.server.infraestructure.RocketChatClientFactory import chat.rocket.android.server.infraestructure.RocketChatClientFactory
import chat.rocket.android.util.extension.launchUI
import chat.rocket.android.util.retryIO import chat.rocket.android.util.retryIO
import chat.rocket.android.util.setupFabric import chat.rocket.android.util.setupFabric
import chat.rocket.common.RocketChatException import chat.rocket.common.RocketChatException
...@@ -34,7 +33,6 @@ import com.facebook.drawee.backends.pipeline.DraweeConfig ...@@ -34,7 +33,6 @@ import com.facebook.drawee.backends.pipeline.DraweeConfig
import com.facebook.drawee.backends.pipeline.Fresco import com.facebook.drawee.backends.pipeline.Fresco
import com.facebook.imagepipeline.core.ImagePipelineConfig import com.facebook.imagepipeline.core.ImagePipelineConfig
import com.jakewharton.threetenabp.AndroidThreeTen import com.jakewharton.threetenabp.AndroidThreeTen
import dagger.android.AndroidInjector
import dagger.android.DispatchingAndroidInjector import dagger.android.DispatchingAndroidInjector
import dagger.android.HasActivityInjector import dagger.android.HasActivityInjector
import dagger.android.HasBroadcastReceiverInjector import dagger.android.HasBroadcastReceiverInjector
...@@ -173,7 +171,7 @@ class RocketChatApplication : Application(), HasActivityInjector, HasServiceInje ...@@ -173,7 +171,7 @@ class RocketChatApplication : Application(), HasActivityInjector, HasServiceInje
* but custom emojis vary according to the its url. * but custom emojis vary according to the its url.
*/ */
fun loadEmojis() { fun loadEmojis() {
EmojiRepository.loadTypeface(this) EmojiRepository.init(this)
val currentServer = getCurrentServerInteractor.get() val currentServer = getCurrentServerInteractor.get()
currentServer?.let { server -> currentServer?.let { server ->
launch { launch {
......
...@@ -169,7 +169,7 @@ class ChatRoomAdapter( ...@@ -169,7 +169,7 @@ class ChatRoomAdapter(
} }
val minAdditionDate = filteredDataSet.minBy { it.message.timestamp } ?: return val minAdditionDate = filteredDataSet.minBy { it.message.timestamp } ?: return
//---In the most cases we will just add new elements to the top of messages heap //---In the most cases we will just add new elements to the top of messages heap
if (minAdditionDate.message.timestamp > this.dataSet[0].message.timestamp) { if (this.dataSet.isEmpty() || minAdditionDate.message.timestamp > this.dataSet[0].message.timestamp) {
this.dataSet.addAll(0, filteredDataSet) this.dataSet.addAll(0, filteredDataSet)
notifyItemRangeInserted(0, filteredDataSet.size) notifyItemRangeInserted(0, filteredDataSet.size)
return return
......
...@@ -314,8 +314,10 @@ object EmojiRepository { ...@@ -314,8 +314,10 @@ object EmojiRepository {
return Pair(s1, s2) return Pair(s1, s2)
} }
fun loadTypeface(context: Context) { fun init(context: Context) {
launch { launch {
db = EmojiDatabase.getInstance(context)
preferences = context.getSharedPreferences("emoji", Context.MODE_PRIVATE)
cachedTypeface = Typeface.createFromAsset(context.assets, "fonts/emojione-android.ttf") cachedTypeface = Typeface.createFromAsset(context.assets, "fonts/emojione-android.ttf")
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment