Skip to content
This repository has been archived by the owner on Mar 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #41 from YTVanced/dev
Browse files Browse the repository at this point in the history
Changed alert dialogs a bit
  • Loading branch information
KevinX8 authored Jul 2, 2020
2 parents d3520f4 + a5730a9 commit 029958d
Show file tree
Hide file tree
Showing 17 changed files with 17 additions and 68 deletions.
7 changes: 4 additions & 3 deletions app/src/main/java/com/vanced/manager/core/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import android.content.Context
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.preference.PreferenceManager
import com.vanced.manager.ui.dialogs.DialogContainer.secondMiuiDialog
import com.vanced.manager.ui.dialogs.DialogContainer.showRootDialog
import com.vanced.manager.ui.dialogs.DialogContainer.showSecurityDialog
import com.vanced.manager.ui.dialogs.DialogContainer.statementFalse
import com.vanced.manager.utils.MiuiHelper.isMiuiOptimisationsDisabled

// This activity will NOT be used in manifest
// since MainActivity will extend it
Expand All @@ -21,11 +20,13 @@ open class Main: AppCompatActivity() {
val prefs = PreferenceManager.getDefaultSharedPreferences(this)
val firstStart = prefs.getBoolean("firstStart", true)
val falseStatement = prefs.getBoolean("statement", true)
val variant = prefs.getString("vanced_variant", "nonroot")
val showRootDialog = prefs.getBoolean("show_root_dialog", true)

when {
firstStart -> showSecurityDialog(this)
!falseStatement -> statementFalse(this)
!firstStart && !isMiuiOptimisationsDisabled() -> secondMiuiDialog(this)
variant == "root" && showRootDialog -> showRootDialog(this)
}

}
Expand Down
30 changes: 12 additions & 18 deletions app/src/main/java/com/vanced/manager/ui/dialogs/DialogContainer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,11 @@ object DialogContainer {
.setMessage(activity.getString(R.string.disable_signature))
.setPositiveButton(activity.getString(R.string.button_dismiss)) { dialog, _ ->
dialog.dismiss()
PreferenceManager.getDefaultSharedPreferences(activity).edit().putBoolean("show_root_dialog", false).apply()
}
.setNeutralButton(activity.getString(R.string.guide)) { _, _ ->
openUrl("https://lmgtfy.com/?q=andnixsh+apk+verification+disable", R.color.Twitter, activity)
}
.create()
.show()
}

fun secondMiuiDialog(context: Context) {
AlertDialog.Builder(context)
.setTitle(context.getString(R.string.miui_two_title))
.setMessage(context.getString(R.string.miui_two))
.setPositiveButton(context.getString(R.string.button_fine)) { dialog, _ ->
dialog.dismiss()
}
.setNeutralButton(context.getString(R.string.guide)) { _, _ ->
openUrl("https://telegra.ph/How-to-install-v15-on-MIUI-02-11", R.color.Telegram, context)
}
.setOnDismissListener { PreferenceManager.getDefaultSharedPreferences(activity).edit().putBoolean("show_root_dialog", false).apply() }
.create()
.show()
}
Expand All @@ -93,10 +79,18 @@ object DialogContainer {
setTitle(context.getString(R.string.error))
setMessage(msg)
setPositiveButton(context.getString(R.string.close)) { dialog, _ -> dialog.dismiss() }
if (msg == context.getString(R.string.installation_signature))
setNeutralButton(context.getString(R.string.guide)) { _, _ ->
openUrl("https://lmgtfy.com/?q=andnixsh+apk+verification+disable", R.color.Twitter, context)
when (msg) {
context.getString(R.string.installation_signature) -> {
setNeutralButton(context.getString(R.string.guide)) { _, _ ->
openUrl("https://lmgtfy.com/?q=andnixsh+apk+verification+disable", R.color.Twitter, context)
}
}
context.getString(R.string.installation_miui) -> {
setNeutralButton(context.getString(R.string.guide)) { _, _ ->
openUrl("https://telegra.ph/How-to-install-v15-on-MIUI-02-11", R.color.Telegram, context)
}
}
}
create()
show()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ManagerChangelogFragment : Fragment() {
val changelogTxt = view.findViewById<TextView>(R.id.manager_changelog)

if (GetJson().isConnected(activity)) {
val checkUrl = GetJson().AsJSONObject("https://vanced.app/api/v1/manager.json")
val checkUrl = GetJson().AsJSONObject("https://x1nto.github.io/VancedFiles/manager.json")
val changelog = checkUrl.get("changelog").asString
changelogTxt.text = changelog
}
Expand Down
7 changes: 0 additions & 7 deletions app/src/main/java/com/vanced/manager/utils/MiuiHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ object MiuiHelper {

fun isMiui(): Boolean = !TextUtils.isEmpty(getSystemProps("ro.miui.ui.version.name"))

fun isMiuiOptimisationsDisabled(): Boolean {
return if (isMiui())
getSystemProps("persist.sys.miui_optimization").equals("0")
else
true
}

private fun getSystemProps(propname: String): String? {
val line: String
var input: BufferedReader? = null
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<string name="title_install">Installieren</string>
<string name="title_settings">Einstellungen</string>
<string name="button_dismiss">Schließen</string>
<string name="button_fine">Okay</string>
<!-- Home Page -->
<string name="changelogs">Changelogs</string>
<string name="downloading_file">%1$s wird heruntergeladen</string>
Expand Down Expand Up @@ -70,8 +69,6 @@
<string name="hold_on">Warte!</string>
<string name="miui_one_title">MIUI-Nutzer erkannt!</string>
<string name="miui_one">Hey! Du scheinst ein MIUI-Nutzer zu sein. Damit Vanced Manager richtig funktioniert musst du diese in den Entwicklereinstellungen deines Gerätes deaktivieren.\nSolltest du jedoch auf einem 20.2.20 Betriebssystem sein, das auf xiaomi.eu basiert ist, kannst du diese Warnung ignorieren.</string>
<string name="miui_two_title">Halt!</string>
<string name="miui_two">Es scheint so, als hättest du die MIUI-Optimisierung nicht deaktiviert. Bitte deaktiviere sie. (Solltest du jedoch ein 20.2.20 Betriebssystem haben, das auf xiaomi.eu basiert, kannst du diese Warnung ignorieren)</string>
<string name="error">Fehler</string>
<string name="security_context">Bitte stelle sicher, dass du die App von vanced.app, dem Vanced Discord Server oder GitHub heruntergeldaden hast.</string>
<string name="success">Erfolg!</string>
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<string name="title_install">Instalar</string>
<string name="title_settings">Ajustes</string>
<string name="button_dismiss">Descartar</string>
<string name="button_fine">Bien</string>
<!-- Home Page -->
<string name="changelogs">Actualizaciones</string>
<string name="downloading_file">Descargando %1$s</string>
Expand Down Expand Up @@ -70,8 +69,6 @@
<string name="hold_on">Un momento!</string>
<string name="miui_one_title">Usuario MiUI detectado!</string>
<string name="miui_one">"Hey! Parece que eres un usuario MiUI. Pará poder usar Vanced Manager apropiadamente necesitarás deshabilitar las Optimizaciones MiUI en configuraciónes de desarrollador.\nSin embargo, si estas en el ROM 20.2.20 que esta basado en xiaomi.eu, entonces puedes ignorar esta advertencia de forma segura. "</string>
<string name="miui_two_title">"Te voy a detener allí! "</string>
<string name="miui_two">Parece que tu NO has deshabilitado las optimizaciones MiUI. Por favor deshabilitalo. Sin embargo, si estas en el ROM 20.2.20 que esta basado en xiaomi.eu, puedes ignorar esta advertencia de forma segura.</string>
<string name="error">Error</string>
<string name="security_context">Porfavor asegurate de haver descargado la aplicacion mediante vanced.app, el server de Vanced en Discord, o Github</string>
<string name="success">"Éxito! "</string>
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/values-hi-rIN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<string name="title_install">इंस्टॉल</string>
<string name="title_settings">सेट्इन्ग</string>
<string name="button_dismiss">डिस्मिस</string>
<string name="button_fine">ठीक</string>
<!-- Home Page -->
<string name="changelogs">चेंजलॉग</string>
<string name="downloading_file">डाउनलोड कर रहा है %1$s</string>
Expand Down Expand Up @@ -73,8 +72,6 @@
<string name="hold_on">रुको!</string>
<string name="miui_one_title">पता लगाया MiUI उपयोगकर्ता!</string>
<string name="miui_one">अरे! लगता है कि आप MiUI उपयोगकर्ता हैं। Vanced Manager को ठीक से उपयोग करने के लिए, आपको डेवलपर सेटिंग में MiUI ऑप्टिमाइज़ेशन को अक्षम करना होगा\nहालाँकि, यदि आप 20.2.20 ROM पर हैं जो xiaomi.eu पर आधारित है, तो आप इस चेतावनी को सुरक्षित रूप से अनदेखा कर सकते हैं।</string>
<string name="miui_two_title">मैं तुम्हें वहीं रोक रहा हूँ!</string>
<string name="miui_two">ऐसा लगता है कि आपने MiUI ऑप्टिमाइज़ेशन को अक्षम नहीं किया है। कृपया इसे निष्क्रिय कर दें। हालाँकि, यदि आप 20.2.20 ROM पर हैं जो xiaomi.eu पर आधारित है, तो आप इस चेतावनी को सुरक्षित रूप से अनदेखा कर सकते हैं।</string>
<string name="error">इरर</string>
<string name="security_context">कृपया सुनिश्चित करें कि आपने vanced.app, Vanced Discord सर्वर या GitHub से ऐप डाउनलोड किया है</string>
<string name="success">सफलता!</string>
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/values-id/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<string name="title_install">Instal</string>
<string name="title_settings">Pengaturan</string>
<string name="button_dismiss">Hilangkan</string>
<string name="button_fine">Ok</string>
<!-- Home Page -->
<string name="changelogs">Catatan perubahan</string>
<string name="downloading_file">Mengunduh %1$s</string>
Expand Down Expand Up @@ -71,8 +70,6 @@
<string name="hold_on">Tahan!</string>
<string name="miui_one_title">Pengguna MiUI terdeteksi!</string>
<string name="miui_one">Hai! Sepertinya kamu pengguna MiUI. Untuk dapat menggunakan Vanced Manager dengan benar, anda harus menonaktifkan optimisasi MiUI di pengaturan developer. Walaupun demikian, jika anda berada di ROM versi 20.2.20 berdasarkan xiaomi.eu, anda dapat mengabaikan peringatan ini.</string>
<string name="miui_two_title">Aku akan memberhentikanmu disitu!</string>
<string name="miui_two">Sepertinya kamu TIDAK menonaktifkan optimisasi MiUI. Tolong nonaktifkan itu. Walaupun demikian, jika anda mempunyai ROM versi 20.2.20 berdasarkan xiaomi.eu, anda dapat mengabaikan peringatan ini.</string>
<string name="error">Terjadi kesalahan</string>
<string name="security_context">Pastikan anda mengunduh aplikasi hanya dari vanced.app, Vanced Discord server atau GitHub</string>
<string name="success">Berhasil!</string>
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/values-in/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<string name="title_install">Instal</string>
<string name="title_settings">Pengaturan</string>
<string name="button_dismiss">Hilangkan</string>
<string name="button_fine">Ok</string>
<!-- Home Page -->
<string name="changelogs">Catatan perubahan</string>
<string name="downloading_file">Mengunduh %1$s</string>
Expand Down Expand Up @@ -71,8 +70,6 @@
<string name="hold_on">Tahan!</string>
<string name="miui_one_title">Pengguna MiUI terdeteksi!</string>
<string name="miui_one">Hai! Sepertinya kamu pengguna MiUI. Untuk dapat menggunakan Vanced Manager dengan benar, anda harus menonaktifkan optimisasi MiUI di pengaturan developer. Walaupun demikian, jika anda berada di ROM versi 20.2.20 berdasarkan xiaomi.eu, anda dapat mengabaikan peringatan ini.</string>
<string name="miui_two_title">Aku akan memberhentikanmu disitu!</string>
<string name="miui_two">Sepertinya kamu TIDAK menonaktifkan optimisasi MiUI. Tolong nonaktifkan itu. Walaupun demikian, jika anda mempunyai ROM versi 20.2.20 berdasarkan xiaomi.eu, anda dapat mengabaikan peringatan ini.</string>
<string name="error">Terjadi kesalahan</string>
<string name="security_context">Pastikan anda mengunduh aplikasi hanya dari vanced.app, Vanced Discord server atau GitHub</string>
<string name="success">Berhasil!</string>
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<string name="title_install">Installa</string>
<string name="title_settings">Impostazioni</string>
<string name="button_dismiss">Scarta</string>
<string name="button_fine">OK</string>
<!-- Home Page -->
<string name="changelogs">Note di rilascio</string>
<string name="downloading_file">Download in corso di %1$s</string>
Expand Down Expand Up @@ -70,8 +69,6 @@
<string name="hold_on">Aspetta!</string>
<string name="miui_one_title">Rilevata l\'interfaccia MiUI!</string>
<string name="miui_one">Ehi! Sembra che tu sia un utente MiUI. Per poter utilizzare correttamente Vanced Manager, devi disattivare le ottimizzazioni di MiUI nelle impostazioni per sviluppatore.\nSe stai utilizzando la ROM 20.2.20 basata su xiaomi.eu, puoi ignorare questo avviso.</string>
<string name="miui_two_title">Devo fermarti per un momento di riflessione!</string>
<string name="miui_two">Sembra che tu NON abbia disattivato le ottimizzazioni di MiUI. Per favore, disattivale. Se stai utilizzando la ROM 20.2.20 basata su xiaomi.eu, puoi ignorare questo avviso.</string>
<string name="error">Errore</string>
<string name="security_context">Assicurati di aver scaricato l\'app da vanced.app, dal server di Discord di Vanced o da GitHub</string>
<string name="success">Fatto!</string>
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<string name="title_install">インストール</string>
<string name="title_settings">設定</string>
<string name="button_dismiss">閉じる</string>
<string name="button_fine">良好</string>
<!-- Home Page -->
<string name="changelogs">更新履歴</string>
<string name="downloading_file">%1$s をダウンロードしています</string>
Expand Down Expand Up @@ -70,8 +69,6 @@
<string name="hold_on">ちょっと待った!</string>
<string name="miui_one_title">MIUI ユーザーを検知しました!</string>
<string name="miui_one">あなたは MIUI ユーザーのようです。Vanced Manager を適切に利用するには、開発者向けオプションから MIUI の最適化を無効にする必要があります。\nただし、xiaomi.eu ベースの 20.2.20 ROM をお使いの場合は、この警告を無視しても問題ありません。</string>
<string name="miui_two_title">I\'m gonna stop you right there!</string>
<string name="miui_two">MIUI の最適化を無効にしていないようです。無効化してください。ただし、xiaomi.eu ベースの 20.2.20 ROM を使用している場合、この警告を無視しても問題ありません。</string>
<string name="error">エラー</string>
<string name="security_context">vanced.app、Vanced の Discord サーバーまたは GitHub からアプリをダウンロードしたことを確認してください</string>
<string name="success">成功!</string>
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/values-ka/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,10 @@

<!-- Dialogs -->
<string name="button_dismiss">დახურვა</string>
<string name="button_fine">კარგი</string>
<string name="guide">ინსტრუქცია</string>
<string name="hold_on">დაიცა!</string>
<string name="miui_one_title">აღმოჩენილია MIUI-ის მომხმარებელი!</string>
<string name="miui_one">როგორც ჩანს ტქვენ MIUI-ის მომხმარებელი ხართ. იმისთვის რომ მენეჯერმა სწორედ იმუშავოს, თქვენ უნდა გამორთოთ MIUI-ის ოპტიმიზაციები დეველოპერის პარამეტრებიდან.\n მაგრამ, თუ თქვენ ხართ სისტემის 20.2.20 (ან უფრო მაღალ) ვერსიაზე რომელიც დაფუძნებულია xiaomi.eu-ზე, შეგიძლიათ დააიგნოროთ ეს გაფრთხილება.</string>
<string name="miui_two_title">I\'m gonna stop you right there!</string>
<string name="miui_two">როგორც ჩანს თქვენ არ გამორთეთ MIUI-ის ოპტიმიზაციები. გთოხოვთ გამორთოთ იგი. მაგრამ, თუ თქვენ ხართ სისტემის 20.2.20 (ან უფრო მაღალ) ვერსიაზე რომელიც დაფუძნებულია xiaomi.eu-ზე, შეგიძლიათ დააიგნოროთ ეს გაფრთხილება.</string>
<string name="error">შეცდომა</string>
<string name="security_context">გთხოვთ დარწმუნდით რომ აპი გადმოწერეთ vanced.app-იდან, Vanced Discord სერვერიდან ან GitHub-იდან</string>
<string name="success">წარმატება!</string>
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<string name="title_install">Установить</string>
<string name="title_settings">Настройки</string>
<string name="button_dismiss">Отклонить</string>
<string name="button_fine">Хорошо</string>
<!-- Home Page -->
<string name="changelogs">Список изменений</string>
<string name="downloading_file">Загрузка %1$s</string>
Expand Down Expand Up @@ -70,8 +69,6 @@
<string name="hold_on">Внимание!</string>
<string name="miui_one_title">Обнаружен пользователь MIUI!</string>
<string name="miui_one">Привет! Похоже, вы пользователь MIUI. для правильного использования Vanced Manager вам придется отключить оптимизацию MIUI в настройках разработчика\nЕсли вы используете прошивку версии 20.2.20, основанную на xiaomi.eu, вы можете спокойно проигнорировать это предупреждение.</string>
<string name="miui_two_title">Я остановлю тебя!</string>
<string name="miui_two">Похоже, вы НЕ отключили оптимизацию MIUI. Пожалуйста, отключите её. Однако, если вы используете прошивку версии 20.2.20, основанную на xiaomi.eu, вы можете спокойно проигнорировать это предупреждение.</string>
<string name="error">Ошибка</string>
<string name="security_context">Пожалуйста, убедитесь, что вы скачали это приложение с vanced.app, сервера Discord Vanced или GitHub</string>
<string name="success">Успешно!</string>
Expand Down
Loading

0 comments on commit 029958d

Please sign in to comment.