[app & key-selector] Deprecate SandHook (#208)

* fix contributor

* Mark SandHook as deprecated
This commit is contained in:
双草酸酯 2021-02-27 01:57:21 +08:00 committed by GitHub
parent d1867122d0
commit bb3ffeee3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 5 deletions

View File

@ -22,6 +22,7 @@ package io.github.lsposed.manager.ui.activity;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
@ -222,7 +223,16 @@ public class SettingsActivity extends BaseActivity {
} else {
prefVariant.setEnabled(installed);
prefVariant.setValue(String.valueOf(ConfigManager.getVariant()));
prefVariant.setOnPreferenceChangeListener((preference, newValue) -> ConfigManager.setVariant(Integer.parseInt((String) newValue)));
prefVariant.setOnPreferenceChangeListener((preference, newValue) -> {
if (newValue.equals("2")) {
new AlertDialog.Builder(requireActivity())
.setCancelable(true)
.setMessage(R.string.settings_sandhook_deprecated_warning)
.setPositiveButton(android.R.string.ok, (di, i) -> {})
.show();
}
return ConfigManager.setVariant(Integer.parseInt((String) newValue));
});
}
}

View File

@ -151,6 +151,8 @@
<string name="settings_restoring">恢复中…</string>
<string name="settings_restore_success">恢复成功!</string>
<string name="settings_restore_failed">恢复失败</string>
<string name="settings_variant_sandhook">SandHook已废弃</string>
<string name="settings_sandhook_deprecated_warning">警告SandHook 现已废弃,并且将在以后的版本中移除。\n请考虑切换到 YAHFA。</string>
<string name="menu_backup_and_restore">备份…</string>
<string name="menu_backup">备份</string>
<string name="menu_restore">恢复</string>

View File

@ -33,9 +33,9 @@
<item>MODE_NIGHT_FOLLOW_SYSTEM</item>
</string-array>
<string-array name="variant_texts" translatable="false">
<string-array name="variant_texts">
<item>YAHFA</item>
<item>SandHook</item>
<item>@string/settings_variant_sandhook</item>
</string-array>
<string-array name="variant_values" translatable="false">
<item>1</item>

View File

@ -140,6 +140,8 @@
<string name="settings_restoring">Restoring…</string>
<string name="settings_restore_success">Restore finished!</string>
<string name="settings_restore_failed">Failed to restore</string>
<string name="settings_variant_sandhook">SandHook (Deprecated)</string>
<string name="settings_sandhook_deprecated_warning">Warning: SandHook is deprecated and will be removed in the future. \nPlease consider migrating to YAHFA.</string>
<string name="group_network">Network</string>
<string name="dns_over_http">DNS over HTTPS</string>
<string name="dns_over_http_summary">Workaround DNS poisoning in some nations</string>

View File

@ -39,6 +39,9 @@ public:
const char base[] = "No operation after %hu seconds.";
return u16fmt(base, seconds);
};
virtual const std::string deprecated() {
return "(Deprecated)";
};
protected:
std::string u16fmt(const char* base, std::uint16_t s){
std::string out;
@ -61,6 +64,9 @@ public:
const char base[] = "在 %hu 秒内没有任何操作。";
return u16fmt(base, seconds);
}
virtual const std::string deprecated() override {
return "(已废弃)";
};
};
#endif //LSPOSED_LANGUAGES_H

View File

@ -14,7 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
*
* Copyright (C) 2020 EdXposed Contributors
* Copyright (C) 2010 The Android Open Source Project
* Copyright (C) 2015-2016 The CyanogenMod Project
* Copyright (C) 2021 LSPosed Contributors
*/
@ -266,6 +267,7 @@ int main() {
#endif
std::unordered_map<Variant, VariantDetail> variants;
std::string sandhook_deprecated = "SandHook " + l->deprecated();
for (const auto i: AllVariants) {
switch (i) {
case Variant::YAHFA:
@ -276,7 +278,7 @@ int main() {
break;
case Variant::SandHook:
variants[i] = {
.expression = "SandHook",
.expression = sandhook_deprecated.c_str(),
.supported_arch = {ARM, ARM64}
};
break;