Unverified Commit 10387d42 authored by Lucio Maciel's avatar Lucio Maciel Committed by GitHub

Merge branch 'beta' into fix/compress-image

parents 2dee6e0a fbc7df8a
...@@ -173,6 +173,7 @@ class RocketChatApplication : Application(), HasActivityInjector, HasServiceInje ...@@ -173,6 +173,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)
val currentServer = getCurrentServerInteractor.get() val currentServer = getCurrentServerInteractor.get()
currentServer?.let { server -> currentServer?.let { server ->
launch { launch {
......
...@@ -48,7 +48,11 @@ object EmojiRepository { ...@@ -48,7 +48,11 @@ object EmojiRepository {
this@EmojiRepository.customEmojis = customEmojis this@EmojiRepository.customEmojis = customEmojis
val allEmojis = mutableListOf<Emoji>() val allEmojis = mutableListOf<Emoji>()
db = EmojiDatabase.getInstance(context) db = EmojiDatabase.getInstance(context)
cachedTypeface = Typeface.createFromAsset(context.assets, "fonts/emojione-android.ttf")
if (!::cachedTypeface.isInitialized) {
cachedTypeface = Typeface.createFromAsset(context.assets, "fonts/emojione-android.ttf")
}
preferences = context.getSharedPreferences("emoji", Context.MODE_PRIVATE) preferences = context.getSharedPreferences("emoji", Context.MODE_PRIVATE)
val stream = context.assets.open(path) val stream = context.assets.open(path)
// Load emojis from emojione ttf file temporarily here. We still need to work on them. // Load emojis from emojione ttf file temporarily here. We still need to work on them.
...@@ -309,4 +313,10 @@ object EmojiRepository { ...@@ -309,4 +313,10 @@ object EmojiRepository {
val s2: Int = ((scalar - 0x10000) % 0x400) + 0xDC00 val s2: Int = ((scalar - 0x10000) % 0x400) + 0xDC00
return Pair(s1, s2) return Pair(s1, s2)
} }
fun loadTypeface(context: Context) {
launch {
cachedTypeface = Typeface.createFromAsset(context.assets, "fonts/emojione-android.ttf")
}
}
} }
\ No newline at end of file
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