Move denylist fragment to settings

This commit is contained in:
topjohnwu 2021-09-13 00:33:36 -07:00
parent 65b0ea792e
commit 16de4674ec
7 changed files with 21 additions and 20 deletions

View File

@ -60,7 +60,6 @@ open class MainActivity : BaseUIActivity<MainViewModel, ActivityMainMd2Binding>(
R.id.homeFragment,
R.id.modulesFragment,
R.id.superuserFragment,
R.id.denyFragment,
R.id.logFragment -> true
else -> false
}
@ -182,7 +181,6 @@ open class MainActivity : BaseUIActivity<MainViewModel, ActivityMainMd2Binding>(
R.id.modulesFragment -> MainDirections.actionModuleFragment()
R.id.superuserFragment -> MainDirections.actionSuperuserFragment()
R.id.logFragment -> MainDirections.actionLogFragment()
R.id.denyFragment -> MainDirections.actionDenylistFragment()
else -> null
}
}

View File

@ -253,7 +253,7 @@ object Magisk : BaseSettingsItem.Section() {
}
object DenyList : BaseSettingsItem.Toggle() {
override val title = R.string.denylist.asText()
override val title = R.string.settings_denylist_title.asText()
override val description = R.string.settings_denylist_summary.asText()
override var value = Info.env.denyListEnforced
set(value) = setV(value, field, { field = it }) {
@ -262,9 +262,15 @@ object DenyList : BaseSettingsItem.Toggle() {
if (cb.isSuccess) Info.env.denyListEnforced = it
else field = !it
}
DenyListConfig.isEnabled = it
}
}
object DenyListConfig : BaseSettingsItem.Blank() {
override val title = R.string.settings_denylist_config_title.asText()
override val description = R.string.settings_denylist_config_summary.asText()
}
// --- Superuser
object Superuser : BaseSettingsItem.Section() {

View File

@ -73,7 +73,7 @@ class SettingsViewModel(
SystemlessHosts
))
if (Const.Version.isCanary()) {
list.add(DenyList)
list.addAll(listOf(DenyList, DenyListConfig))
}
}
@ -105,6 +105,7 @@ class SettingsViewModel(
is DownloadPath -> withExternalRW(callback)
is Biometrics -> authenticate(callback)
is Theme -> SettingsFragmentDirections.actionSettingsFragmentToThemeFragment().navigate()
is DenyListConfig -> SettingsFragmentDirections.actionSettingsFragmentToDenyFragment().navigate()
is ClearRepoCache -> clearRepoCache()
is SystemlessHosts -> createHosts()
is Restore -> HideAPK.restore(view.activity)

View File

@ -38,7 +38,7 @@
android:layout_gravity="bottom|end"
android:layout_marginStart="@dimen/l1"
android:layout_marginEnd="@dimen/l1"
android:layout_marginBottom="72dp"
android:layout_marginBottom="@dimen/l1"
app:backgroundTint="?colorSurfaceSurfaceVariant"
app:layout_fitsSystemWindowsInsets="bottom"
app:srcCompat="@drawable/ic_search_md2"

View File

@ -14,12 +14,6 @@
android:title="@string/superuser"
tools:showAsAction="always" />
<item
android:id="@+id/denyFragment"
android:icon="@drawable/ic_hide_md2"
android:title="@string/denylist"
tools:showAsAction="always" />
<item
android:id="@+id/logFragment"
android:icon="@drawable/ic_bug_md2"

View File

@ -104,6 +104,14 @@
app:popEnterAnim="@anim/fragment_enter_pop"
app:popExitAnim="@anim/fragment_exit_pop" />
<action
android:id="@+id/action_settingsFragment_to_denyFragment"
app:destination="@id/denyFragment"
app:enterAnim="@anim/fragment_enter"
app:exitAnim="@anim/fragment_exit"
app:popEnterAnim="@anim/fragment_enter_pop"
app:popExitAnim="@anim/fragment_exit_pop" />
</fragment>
<fragment
@ -164,13 +172,4 @@
app:popExitAnim="@anim/fragment_exit_pop"
app:popUpTo="@id/homeFragment" />
<action
android:id="@+id/action_denylistFragment"
app:destination="@id/denyFragment"
app:enterAnim="@anim/fragment_enter"
app:exitAnim="@anim/fragment_exit"
app:popEnterAnim="@anim/fragment_enter_pop"
app:popExitAnim="@anim/fragment_exit_pop"
app:popUpTo="@id/homeFragment"/>
</navigation>

View File

@ -147,7 +147,10 @@
<string name="settings_update_beta">Beta</string>
<string name="settings_update_custom">Custom Channel</string>
<string name="settings_update_custom_msg">Insert a custom URL</string>
<string name="settings_denylist_title">Enforce DenyList</string>
<string name="settings_denylist_summary">Processes on the denylist will have all Magisk modifications reverted</string>
<string name="settings_denylist_config_title">Configure DenyList</string>
<string name="settings_denylist_config_summary">Select the processes to be included on the denylist</string>
<string name="settings_hosts_title">Systemless hosts</string>
<string name="settings_hosts_summary">Systemless hosts support for Adblock apps</string>
<string name="settings_hosts_toast">Added systemless hosts module</string>