fix: various bugs (#223, #221, #217)

This commit is contained in:
BinTianqi
2026-01-03 23:43:15 +08:00
parent 20a422ba51
commit 2b58e56bbf
4 changed files with 23 additions and 21 deletions

View File

@@ -72,12 +72,6 @@ jobs:
with: with:
path: artifacts path: artifacts
- name: Download telegram-bot-api
run: |
mkdir ./binaries
wget "https://github.com/jakbin/telegram-bot-api-binary/releases/download/latest/telegram-bot-api" -O ./binaries/telegram-bot-api
chmod +x ./binaries/telegram-bot-api
- name: Start API Server & Upload - name: Start API Server & Upload
env: env:
COMMIT_MESSAGE: |+ COMMIT_MESSAGE: |+
@@ -91,8 +85,7 @@ jobs:
mv ./$RELEASE_TEST_PWD/app-release.apk ./$RELEASE_TEST_PWD.apk && rm -rf ./$RELEASE_TEST_PWD mv ./$RELEASE_TEST_PWD/app-release.apk ./$RELEASE_TEST_PWD.apk && rm -rf ./$RELEASE_TEST_PWD
export RELEASE_SIGNED_PWD=$(find . -name "*release-signed*") export RELEASE_SIGNED_PWD=$(find . -name "*release-signed*")
mv ./$RELEASE_SIGNED_PWD/app-release.apk ./$RELEASE_SIGNED_PWD.apk && rm -rf ./$RELEASE_SIGNED_PWD mv ./$RELEASE_SIGNED_PWD/app-release.apk ./$RELEASE_SIGNED_PWD.apk && rm -rf ./$RELEASE_SIGNED_PWD
../binaries/telegram-bot-api --api-id=${{ secrets.TELEGRAM_API_APP_ID }} --api-hash=${{ secrets.TELEGRAM_API_HASH }} --local 2>&1 > /dev/null &
export token=${{ secrets.TELEGRAM_BOT_KEY }} export token=${{ secrets.TELEGRAM_BOT_KEY }}
curl -v "http://127.0.0.1:8081/bot$token/sendMediaGroup?chat_id=-1002203528169&media=%5B%7B%22type%22%3A%22document%22%2C%22media%22%3A%22attach%3A%2F%2FreleaseTest%22%7D%2C%7B%22type%22%3A%22document%22%2C%22media%22%3A%22attach%3A%2F%2FreleaseSigned%22%2C%22parse_mode%22%3A%22HTML%22%2C%22caption%22%3A${ESCAPED}%7D%5D" \ curl -v "http://api.telegram.org/bot$token/sendMediaGroup?chat_id=-1002203528169&media=%5B%7B%22type%22%3A%22document%22%2C%22media%22%3A%22attach%3A%2F%2FreleaseTest%22%7D%2C%7B%22type%22%3A%22document%22%2C%22media%22%3A%22attach%3A%2F%2FreleaseSigned%22%2C%22parse_mode%22%3A%22HTML%22%2C%22caption%22%3A${ESCAPED}%7D%5D" \
-F releaseTest="@$RELEASE_TEST_PWD.apk" \ -F releaseTest="@$RELEASE_TEST_PWD.apk" \
-F releaseSigned="@$RELEASE_SIGNED_PWD.apk" -F releaseSigned="@$RELEASE_SIGNED_PWD.apk"

View File

@@ -689,16 +689,16 @@ class MyViewModel(application: Application): AndroidViewModel(application) {
statusBarDisabled = if (VERSION.SDK_INT >= 34 && statusBarDisabled = if (VERSION.SDK_INT >= 34 &&
privilege.run { device || (profile && affiliated) }) privilege.run { device || (profile && affiliated) })
DPM.isStatusBarDisabled else false, DPM.isStatusBarDisabled else false,
autoTimeEnabled = if (VERSION.SDK_INT >= 30 && privilege.run { device || org }) autoTimeEnabled = if (VERSION.SDK_INT >= 30 && (privilege.device || privilege.org))
DPM.getAutoTimeEnabled(DAR) else false, DPM.getAutoTimeEnabled(DAR) else false,
autoTimeZoneEnabled = if (VERSION.SDK_INT >= 30 && privilege.run { device || org }) autoTimeZoneEnabled = if (VERSION.SDK_INT >= 30 && (privilege.device || privilege.org))
DPM.getAutoTimeZoneEnabled(DAR) else false, DPM.getAutoTimeZoneEnabled(DAR) else false,
autoTimeRequired = if (VERSION.SDK_INT < 30) DPM.autoTimeRequired else false, autoTimeRequired = if (VERSION.SDK_INT < 30) DPM.autoTimeRequired else false,
masterVolumeMuted = DPM.isMasterVolumeMuted(DAR), masterVolumeMuted = DPM.isMasterVolumeMuted(DAR),
backupServiceEnabled = if (VERSION.SDK_INT >= 26) DPM.isBackupServiceEnabled(DAR) else false, backupServiceEnabled = if (VERSION.SDK_INT >= 26) DPM.isBackupServiceEnabled(DAR) else false,
btContactSharingDisabled = if (privilege.work) btContactSharingDisabled = if (privilege.work)
DPM.getBluetoothContactSharingDisabled(DAR) else false, DPM.getBluetoothContactSharingDisabled(DAR) else false,
commonCriteriaMode = if (VERSION.SDK_INT >= 30 && privilege.run { device || org }) commonCriteriaMode = if (VERSION.SDK_INT >= 30 && (privilege.device || privilege.org))
DPM.isCommonCriteriaModeEnabled(DAR) else false, DPM.isCommonCriteriaModeEnabled(DAR) else false,
usbSignalEnabled = if (VERSION.SDK_INT >= 31) DPM.isUsbDataSignalingEnabled else false, usbSignalEnabled = if (VERSION.SDK_INT >= 31) DPM.isUsbDataSignalingEnabled else false,
canDisableUsbSignal = if (VERSION.SDK_INT >= 31) DPM.canUsbDataSignalingBeDisabled() else false canDisableUsbSignal = if (VERSION.SDK_INT >= 31) DPM.canUsbDataSignalingBeDisabled() else false
@@ -1346,6 +1346,7 @@ class MyViewModel(application: Application): AndroidViewModel(application) {
DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME, DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME,
MyAdminComponent MyAdminComponent
) )
if (options.migrateAccount) {
intent.putExtra( intent.putExtra(
DevicePolicyManager.EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE, DevicePolicyManager.EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE,
Account(options.accountName, options.accountType) Account(options.accountName, options.accountType)
@@ -1356,6 +1357,7 @@ class MyViewModel(application: Application): AndroidViewModel(application) {
options.keepAccount options.keepAccount
) )
} }
}
if (VERSION.SDK_INT >= 24) { if (VERSION.SDK_INT >= 24) {
intent.putExtra( intent.putExtra(
DevicePolicyManager.EXTRA_PROVISIONING_SKIP_ENCRYPTION, DevicePolicyManager.EXTRA_PROVISIONING_SKIP_ENCRYPTION,
@@ -1927,7 +1929,12 @@ class MyViewModel(application: Application): AndroidViewModel(application) {
} }
@RequiresApi(26) @RequiresApi(26)
fun setRpToken(token: String): Boolean { fun setRpToken(token: String): Boolean {
return DPM.setResetPasswordToken(DAR, token.encodeToByteArray()) return try {
DPM.setResetPasswordToken(DAR, token.encodeToByteArray())
} catch (e: Exception) {
e.printStackTrace()
false
}
} }
@RequiresApi(26) @RequiresApi(26)
fun clearRpToken(): Boolean { fun clearRpToken(): Boolean {

View File

@@ -242,7 +242,7 @@ fun AppChooserScreen(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.combinedClickable(onLongClick = { .combinedClickable(onLongClick = {
if (params.multiSelect) { if (params.multiSelect && it !in selectedPackages) {
selectedPackages += it selectedPackages += it
hf.performHapticFeedback(HapticFeedbackType.LongPress) hf.performHapticFeedback(HapticFeedbackType.LongPress)
} }

View File

@@ -97,8 +97,10 @@ fun PasswordScreen(vm: MyViewModel,onNavigateUp: () -> Unit, onNavigate: (Any) -
if(privilege.device) { if(privilege.device) {
FunctionItem(R.string.max_time_to_lock, icon = R.drawable.schedule_fill0) { dialog = 1 } FunctionItem(R.string.max_time_to_lock, icon = R.drawable.schedule_fill0) { dialog = 1 }
FunctionItem(R.string.pwd_expiration_timeout, icon = R.drawable.lock_clock_fill0) { dialog = 3 } FunctionItem(R.string.pwd_expiration_timeout, icon = R.drawable.lock_clock_fill0) { dialog = 3 }
if (SP.displayDangerousFeatures) {
FunctionItem(R.string.max_pwd_fail, icon = R.drawable.no_encryption_fill0) { dialog = 4 } FunctionItem(R.string.max_pwd_fail, icon = R.drawable.no_encryption_fill0) { dialog = 4 }
} }
}
if(VERSION.SDK_INT >= 26) { if(VERSION.SDK_INT >= 26) {
FunctionItem(R.string.required_strong_auth_timeout, icon = R.drawable.fingerprint_off_fill0) { dialog = 2 } FunctionItem(R.string.required_strong_auth_timeout, icon = R.drawable.fingerprint_off_fill0) { dialog = 2 }
} }