Skip to content

Commit

Permalink
style: rename pangu to pangu_spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
std-microblock committed Aug 21, 2023
1 parent 8b3e5c4 commit 6da29d7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
5 changes: 2 additions & 3 deletions app/src/main/java/cc/microblock/hook/Pangu.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import io.github.qauxv.base.annotation.FunctionHookEntry
import io.github.qauxv.base.annotation.UiItemAgentEntry
import io.github.qauxv.dsl.FunctionEntryRouter
import io.github.qauxv.hook.CommonSwitchFunctionHook
import io.github.qauxv.util.Log
import io.github.qauxv.util.dexkit.AIOTextElementCtor
import io.github.qauxv.util.dexkit.DexKit
import xyz.nextalone.util.get
Expand Down Expand Up @@ -92,7 +91,7 @@ fun convertToFullwidth(symbols: String): String {
// https://github.com/vinta/pangu.js/blob/6107055384b99e6f30a49f5d1b85aa0b78251dc2/src/shared/core.js#L118-L126
// These lines are implemented, work in the playground, but are commented in the actual code, as they are causing compile errors
// As I'm not so familiar with Kotlin, if someone is able to figure it out and make it a complete impl, I'll appreciate it.
fun spacing(text: String): String {
fun pangu_spacing(text: String): String {
if (text.length <= 1 || !ANY_CJK.matcher(text).find()) {
return text
}
Expand Down Expand Up @@ -182,6 +181,6 @@ object SendPangu : CommonSwitchFunctionHook("sendMsgPangu",arrayOf(AIOTextElemen
}

private fun processPangu(message: String): String {
return spacing(message);
return pangu_spacing(message);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ package io.github.qauxv.hook
import android.app.Activity
import android.content.Context
import android.view.View
import cc.microblock.hook.spacing
import cc.microblock.hook.pangu_spacing
import io.github.qauxv.base.ISwitchCellAgent
import io.github.qauxv.base.IUiItemAgent
import io.github.qauxv.util.SyncUtils
Expand Down Expand Up @@ -77,10 +77,10 @@ abstract class CommonConfigFunctionHook(

override val uiItemAgent by lazy { uiItemAgent() }
private fun uiItemAgent() = object : IUiItemAgent {
override val titleProvider: (IUiItemAgent) -> String = { _ -> spacing(name) }
override val titleProvider: (IUiItemAgent) -> String = { _ -> pangu_spacing(name) }
override val summaryProvider: (IUiItemAgent, Context) -> CharSequence? = { _, _ ->
if(description is CharSequence)
spacing(description.toString())
pangu_spacing(description.toString())
else null
}
override val valueState: MutableStateFlow<String?>?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ package io.github.qauxv.hook
import android.app.Activity
import android.content.Context
import android.view.View
import cc.microblock.hook.spacing
import cc.microblock.hook.pangu_spacing
import io.github.qauxv.base.ISwitchCellAgent
import io.github.qauxv.base.IUiItemAgent
import io.github.qauxv.util.SyncUtils
Expand Down Expand Up @@ -68,10 +68,10 @@ abstract class CommonSwitchFunctionHook(
override val uiItemAgent by lazy { uiItemAgent() }

private fun uiItemAgent() = object : IUiItemAgent {
override val titleProvider: (IUiItemAgent) -> String = { _ -> spacing(name) }
override val titleProvider: (IUiItemAgent) -> String = { _ -> pangu_spacing(name) }
override val summaryProvider: (IUiItemAgent, Context) -> CharSequence? = { _, _ ->
if(description is CharSequence)
spacing(description.toString())
pangu_spacing(description.toString())
else null
}
override val valueState: MutableStateFlow<String?>? = null
Expand Down

0 comments on commit 6da29d7

Please sign in to comment.