Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update dependency com.github.anitrend:android-emojify to v1.9.5 #696

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import android.widget.FrameLayout
import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.lifecycle.Lifecycle
import androidx.startup.AppInitializer
import com.annimon.stream.IntPair
import com.mxt.anitrend.R
import com.mxt.anitrend.base.custom.consumer.BaseConsumer
Expand All @@ -19,6 +18,7 @@ import com.mxt.anitrend.base.interfaces.event.RetroCallback
import com.mxt.anitrend.base.interfaces.view.CustomView
import com.mxt.anitrend.databinding.WidgetComposerBinding
import com.mxt.anitrend.extension.getLayoutInflater
import com.mxt.anitrend.extension.koinOf
import com.mxt.anitrend.model.entity.anilist.FeedList
import com.mxt.anitrend.model.entity.anilist.FeedReply
import com.mxt.anitrend.model.entity.base.UserBase
Expand All @@ -29,7 +29,7 @@ import com.mxt.anitrend.util.NotifyUtil
import com.mxt.anitrend.util.graphql.GraphUtil
import com.mxt.anitrend.util.graphql.apiError
import com.mxt.anitrend.util.markdown.MarkDownUtil
import io.wax911.emojify.initializer.EmojiInitializer
import io.wax911.emojify.EmojiManager
import io.wax911.emojify.parser.parseToUnicode
import okhttp3.ResponseBody
import org.greenrobot.eventbus.EventBus
Expand Down Expand Up @@ -273,8 +273,7 @@ class ComposerWidget : FrameLayout, CustomView, View.OnClickListener, RetroCallb
}

fun setText(textValue: String?) {
val manager = AppInitializer.getInstance(context)
.initializeComponent(EmojiInitializer::class.java)
val manager = koinOf<EmojiManager>()
val emojified: String? = when (!textValue.isNullOrBlank()) {
true -> manager.parseToUnicode(textValue)
else -> null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,19 @@ import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputConnection
import androidx.annotation.IdRes
import androidx.core.content.ContextCompat
import androidx.core.view.ViewCompat
import androidx.core.view.inputmethod.EditorInfoCompat
import androidx.core.view.inputmethod.InputConnectionCompat
import androidx.core.view.inputmethod.InputContentInfoCompat
import androidx.startup.AppInitializer
import com.google.android.material.textfield.TextInputEditText
import com.mxt.anitrend.R
import com.mxt.anitrend.base.interfaces.view.CustomView
import com.mxt.anitrend.extension.koinOf
import com.mxt.anitrend.util.CompatUtil
import com.mxt.anitrend.util.KeyUtil
import com.mxt.anitrend.util.KeyUtil.*
import com.mxt.anitrend.util.markdown.MarkDownUtil
import io.noties.markwon.editor.MarkwonEditor
import io.noties.markwon.editor.MarkwonEditorTextWatcher
import io.wax911.emojify.initializer.EmojiInitializer
import io.wax911.emojify.EmojiManager
import io.wax911.emojify.parser.parseToHtmlHexadecimal
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
Expand Down Expand Up @@ -84,11 +82,10 @@ class MarkdownInputEditor : TextInputEditText, CustomView, ActionMode.Callback,
/**
* @return composed text as hex html entities
*/
val formattedText: String?
val formattedText: String
get() {
val content = text.toString()
val manager = AppInitializer.getInstance(context)
.initializeComponent(EmojiInitializer::class.java)
val manager = koinOf<EmojiManager>()
return manager.parseToHtmlHexadecimal(content)
}

Expand Down
8 changes: 8 additions & 0 deletions app/src/main/java/com/mxt/anitrend/koin/Modules.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ import io.noties.markwon.ext.tasklist.TaskListPlugin
import io.noties.markwon.html.HtmlPlugin
import io.noties.markwon.image.glide.GlideImagesPlugin
import io.noties.markwon.linkify.LinkifyPlugin
import io.wax911.emojify.EmojiManager
import io.wax911.emojify.serializer.gson.GsonDeserializer
import org.koin.android.ext.koin.androidContext
import org.koin.androidx.workmanager.dsl.worker
import org.koin.dsl.module
Expand Down Expand Up @@ -100,6 +102,12 @@ private val coreModule = module {
) as NotificationManager?
)
}
single(createdAtStart = true) {
EmojiManager.create(
context = androidContext(),
serializer = GsonDeserializer()
)
}
}

private val widgetModule = module {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ internal fun Project.configureDependencies() {

/** AniTrend */
dependencies.implementation(libs.anitrend.android.emoji)
dependencies.implementation(libs.anitrend.android.emoji.contract)
dependencies.implementation(libs.anitrend.android.emoji.gson)
dependencies.implementation(libs.anitrend.support.markwon)
dependencies.implementation(libs.square.converter.simplexml.get()) {
exclude("xpp3", "xpp3")
Expand Down
6 changes: 5 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ hamcrest = "2.2"
txtmark = "0.16"
chuncker = "3.5.2"

anitrend-android-emoji = "1.9.5"

[libraries]
alerter = { module = "com.github.tapadoo:alerter", version.ref = "alerter" }
android-about-page = { module = "com.github.medyo:android-about-page", version.ref = "aboutPage" }
Expand Down Expand Up @@ -125,7 +127,9 @@ androidx-work-runtimeKtx = { module = "androidx.work:work-runtime-ktx", version.
androidx-work-runtime = { module = "androidx.work:work-runtime", version.ref = "androidx-work" }
androidx-work-test = { module = "androidx.work:work-test", version.ref = "androidx-work" }

anitrend-android-emoji = "com.github.anitrend:android-emojify:1.6.0-beta01"
anitrend-android-emoji = { module = "com.github.anitrend.android-emojify:emojify", version.ref = "anitrend-android-emoji" }
anitrend-android-emoji-contract = { module = "com.github.anitrend.android-emojify:contract", version.ref = "anitrend-android-emoji" }
anitrend-android-emoji-gson = { module = "com.github.anitrend.android-emojify:gson", version.ref = "anitrend-android-emoji" }
anitrend-support-markwon = "com.github.AniTrend:support-markdown:0.12.1-alpha01"
anitrend-retrofit-graphql = "com.github.anitrend:retrofit-graphql:0.11.5"

Expand Down
Loading