Skip to content

Commit

Permalink
Move user to developer options to enable demo mode option
Browse files Browse the repository at this point in the history
  • Loading branch information
AlirezaIvaz committed Jun 21, 2023
1 parent 2246492 commit 62fc3a7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
17 changes: 11 additions & 6 deletions app/src/main/java/com/franco/demomode/activities/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.franco.demomode.activities

import android.content.DialogInterface
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AlertDialog
import android.provider.Settings
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.lifecycleScope
import com.franco.demomode.R
Expand Down Expand Up @@ -37,10 +37,15 @@ class MainActivity : AppCompatActivity() {

if (!isDemoModeAllowed) {
MaterialAlertDialogBuilder(this@MainActivity)
.setTitle(R.string.demo_mode_allowed_title)
.setMessage(R.string.demo_mode_allowed_message)
.setPositiveButton(android.R.string.ok) { dialog: DialogInterface, _: Int -> dialog.dismiss() }
.show()
.setTitle(R.string.demo_mode_allowed_title)
.setMessage(R.string.demo_mode_allowed_message)
.setPositiveButton(R.string.ok) { _, _ ->
startActivity(
Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS)
)
}
.setNegativeButton(R.string.cancel, null)
.show()
}
}
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-fa/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<string name="dump_permission_msg">برای کارکردن این برنامه به دسترسی DUMP نیاز دارد.شوربختانه این تنها از طریق adb shell رایانهٔ شما امکان‌پذیر است:\n\nadb -d shell pm grant com.franco.demomode android.permission.DUMP\n\nبرای شفافیت متن منبع این برنامه در دسترس است.</string>
<string name="write_secure_settings_permission_msg">برای کارکردن این برنامه به دسترسی WRITE_SECURE_SETTINGS نیاز دارد. شوربختانه این تنها از طریق adb shell رایانهٔ شما امکان‌پذیر است:\n\nadb -d shell pm grant com.franco.demomode android.permission.WRITE_SECURE_SETTINGS\n\nبرای شفافیت، متن منبع این برنامه در دسترس است.</string>
<string name="ok">باشه</string>
<string name="cancel">انصراف</string>
<string name="dump_permission">DUMP</string>
<string name="write_secure_settings_permission">WRITE_SECURE_SETTINGS</string>
<string name="not_granted">اعطا نشده</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<string name="dump_permission_msg">For this app to work it needs DUMP permission to be granted. Unfortunately that is only possible through adb shell from your computer:\n\nadb -d shell pm grant com.franco.demomode android.permission.DUMP\n\nFor transparency this app\'s source code is available.</string>
<string name="write_secure_settings_permission_msg">For this app to work it needs WRITE_SECURE_SETTINGS permission to be granted. Unfortunately that is only possible through adb shell from your computer:\n\nadb -d shell pm grant com.franco.demomode android.permission.WRITE_SECURE_SETTINGS\n\nFor transparency this app\'s source code is available.</string>
<string name="ok">OK</string>
<string name="cancel">Cancel</string>
<string name="dump_permission">DUMP</string>
<string name="write_secure_settings_permission">WRITE_SECURE_SETTINGS</string>
<string name="not_granted">Not granted</string>
Expand Down

0 comments on commit 62fc3a7

Please sign in to comment.