fork: silence sideload dialog and don't force default-SMS-app role
Two personal-fork-only tweaks for daily use: - checkAppSideloading() commented out. It surfaces a "this app is corrupted, get the original" dialog when applicationId differs from the official Fossify one — which is precisely the case for a fork. - loadMessages() no longer triggers the RoleManager / ACTION_CHANGE_DEFAULT prompt on first launch. Read-only SMS permissions are enough to browse and translate. The user can opt in to be the default through the system settings later if they want. Not for upstream. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8234578b8b
commit
06ac901366
1 changed files with 11 additions and 25 deletions
|
|
@ -101,9 +101,12 @@ class MainActivity : SimpleActivity() {
|
|||
loadMessages()
|
||||
}
|
||||
|
||||
if (checkAppSideloading()) {
|
||||
return
|
||||
}
|
||||
// [fork] checkAppSideloading() shows a "this app is corrupted, get the
|
||||
// original" dialog when the applicationId differs from the official
|
||||
// Fossify one. Suppressed here because this is intentionally a fork.
|
||||
// if (checkAppSideloading()) {
|
||||
// return
|
||||
// }
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
|
|
@ -215,28 +218,11 @@ class MainActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
private fun loadMessages() {
|
||||
if (isQPlus()) {
|
||||
val roleManager = getSystemService(RoleManager::class.java)
|
||||
if (roleManager!!.isRoleAvailable(RoleManager.ROLE_SMS)) {
|
||||
if (roleManager.isRoleHeld(RoleManager.ROLE_SMS)) {
|
||||
askPermissions()
|
||||
} else {
|
||||
val intent = roleManager.createRequestRoleIntent(RoleManager.ROLE_SMS)
|
||||
startActivityForResult(intent, MAKE_DEFAULT_APP_REQUEST)
|
||||
}
|
||||
} else {
|
||||
toast(org.fossify.commons.R.string.unknown_error_occurred)
|
||||
finish()
|
||||
}
|
||||
} else {
|
||||
if (Telephony.Sms.getDefaultSmsPackage(this) == packageName) {
|
||||
askPermissions()
|
||||
} else {
|
||||
val intent = Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT)
|
||||
intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, packageName)
|
||||
startActivityForResult(intent, MAKE_DEFAULT_APP_REQUEST)
|
||||
}
|
||||
}
|
||||
// [fork] Don't force the user to make this app the default SMS app
|
||||
// on first launch. Read-only access via permissions is enough to
|
||||
// browse and translate; the user can opt in to be the default
|
||||
// through the system settings later if they want.
|
||||
askPermissions()
|
||||
}
|
||||
|
||||
// while SEND_SMS and READ_SMS permissions are mandatory, READ_CONTACTS is optional.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue