Skip to content

Commit

Permalink
feat: remove manually set config menu (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyujin-cho authored Feb 18, 2024
1 parent 8d71000 commit 160a735
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 28 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/build-aab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ jobs:
filename: ${{ steps.build_aab.outputs.upload_filename }}
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
/usr/local/lib/android
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties' )}}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up OpenJDK 17
uses: actions/setup-java@v3
with:
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/build-apk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ jobs:
filename: ${{ steps.build_apk.outputs.upload_filename }}
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
/usr/local/lib/android
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties' )}}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up OpenJDK 17
uses: actions/setup-java@v3
with:
Expand Down Expand Up @@ -65,6 +74,7 @@ jobs:
KEY_ALIAS: ${{ secrets.key-alias }}
KEY_PASSWORD: ${{ secrets.key-password }}
BUILD_TYPE: ${{ inputs.build-type }}
if: ${{ secrets.key-password != '' }}
- name: Upload APK
uses: actions/upload-artifact@v3
with:
Expand Down
28 changes: 0 additions & 28 deletions app/src/main/java/dev/bluehouse/enablevolte/pages/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import android.os.Build.VERSION
import android.os.Build.VERSION_CODES
import android.telephony.CarrierConfigManager
import android.util.Log
import android.widget.Toast
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
Expand All @@ -29,12 +28,10 @@ import dev.bluehouse.enablevolte.CarrierModer
import dev.bluehouse.enablevolte.ClickablePropertyView
import dev.bluehouse.enablevolte.HeaderText
import dev.bluehouse.enablevolte.InfiniteLoadingDialog
import dev.bluehouse.enablevolte.KeyValueEditView
import dev.bluehouse.enablevolte.R
import dev.bluehouse.enablevolte.ShizukuStatus
import dev.bluehouse.enablevolte.SubscriptionModer
import dev.bluehouse.enablevolte.UserAgentPropertyView
import dev.bluehouse.enablevolte.ValueType
import dev.bluehouse.enablevolte.checkShizukuPermission
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -392,31 +389,6 @@ fun Config(navController: NavController, subId: Int) {
}
}
}
KeyValueEditView(label = stringResource(id = R.string.manually_set_config), availableKeys = configurableItems.keys + configurableItems.values) { key, valueType, value ->
val actualKey = configurableItems[key] ?: if (reversedConfigurableItems.containsKey(key)) { key } else { null }
if (actualKey == null) {
Toast.makeText(context, cannotFindKeyText, Toast.LENGTH_SHORT).show()
false
} else {
try {
when (valueType) {
ValueType.Bool -> moder.updateCarrierConfig(actualKey, value == "true")
ValueType.String -> moder.updateCarrierConfig(actualKey, value)
ValueType.Int -> moder.updateCarrierConfig(actualKey, value.toInt())
ValueType.Long -> moder.updateCarrierConfig(actualKey, value.toLong())
ValueType.BoolArray -> moder.updateCarrierConfig(actualKey, (value.split(",").map { it.trim() == "true" }).toBooleanArray())
ValueType.StringArray -> moder.updateCarrierConfig(actualKey, (value.split(",").map { it.trim() }).toTypedArray())
ValueType.IntArray -> moder.updateCarrierConfig(actualKey, (value.split(",").map { it.trim().toInt() }).toIntArray())
ValueType.LongArray -> moder.updateCarrierConfig(actualKey, (value.split(",").map { it.trim().toLong() }).toLongArray())
else -> {}
}
true
} catch (e: Exception) {
Toast.makeText(context, "Error while updating: ${e.message}", Toast.LENGTH_SHORT).show()
false
}
}
}
ClickablePropertyView(
label = stringResource(R.string.expert_mode),
value = "",
Expand Down

0 comments on commit 160a735

Please sign in to comment.