Added indication of whether the manager is hidden

This commit is contained in:
Viktor De Pasquale 2019-10-06 12:06:31 +02:00
parent 5e01f785ae
commit 8024089bde
2 changed files with 19 additions and 0 deletions

View File

@ -4,6 +4,14 @@ import android.content.res.Resources
val specialChars = arrayOf('!', '@', '#', '$', '%', '&', '?') val specialChars = arrayOf('!', '@', '#', '$', '%', '&', '?')
fun String.replaceRandomWithSpecial(passes: Int): String {
var string = this
repeat(passes) {
string = string.replaceRandomWithSpecial()
}
return string
}
fun String.replaceRandomWithSpecial(): String { fun String.replaceRandomWithSpecial(): String {
var random: Char var random: Char
do { do {

View File

@ -7,6 +7,8 @@ import com.topjohnwu.magisk.BuildConfig
import com.topjohnwu.magisk.Info import com.topjohnwu.magisk.Info
import com.topjohnwu.magisk.R import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.data.repository.MagiskRepository import com.topjohnwu.magisk.data.repository.MagiskRepository
import com.topjohnwu.magisk.extensions.packageName
import com.topjohnwu.magisk.extensions.replaceRandomWithSpecial
import com.topjohnwu.magisk.extensions.res import com.topjohnwu.magisk.extensions.res
import com.topjohnwu.magisk.model.entity.MagiskJson import com.topjohnwu.magisk.model.entity.MagiskJson
import com.topjohnwu.magisk.model.entity.ManagerJson import com.topjohnwu.magisk.model.entity.ManagerJson
@ -43,6 +45,15 @@ class HomeViewModel(
} }
} }
val stateHideManagerName = R.string.manager.res().let {
val result = R.string.manager.res()
if (packageName != BuildConfig.APPLICATION_ID) {
result.replaceRandomWithSpecial(3)
} else {
result
}
}
val itemsMainline = val itemsMainline =
listOf(HomeItem.PayPal.Mainline, HomeItem.Patreon, HomeItem.Twitter.Mainline) listOf(HomeItem.PayPal.Mainline, HomeItem.Patreon, HomeItem.Twitter.Mainline)
val itemsApp = val itemsApp =