@@ -19,6 +19,7 @@ import androidx.compose.runtime.remember
1919import androidx.compose.runtime.setValue
2020import androidx.compose.ui.Alignment
2121import androidx.compose.ui.Modifier
22+ import androidx.compose.ui.platform.LocalContext
2223import androidx.compose.ui.res.stringResource
2324import androidx.compose.ui.text.style.TextAlign
2425import androidx.compose.ui.unit.dp
@@ -34,6 +35,7 @@ import org.andbootmgr.app.util.SDUtils
3435import org.json.JSONObject
3536import org.json.JSONTokener
3637import java.io.File
38+ import java.io.FileNotFoundException
3739import java.io.IOException
3840import java.net.URL
3941
@@ -93,12 +95,17 @@ private fun Start(vm: WizardState) {
9395fun LoadDroidBootJson (vm : WizardState , update : Boolean , content : @Composable () -> Unit ) {
9496 var loading by remember { mutableStateOf(! vm.deviceInfo.isBooted(vm.logic) || vm.deviceInfo.postInstallScript || update) }
9597 var error by remember { mutableStateOf(false ) }
98+ val ctx = LocalContext .current
9699 LaunchedEffect (Unit ) {
97100 if (! loading) return @LaunchedEffect
98101 CoroutineScope (Dispatchers .IO ).launch {
99102 try {
100- val jsonText =
101- URL (" https://raw.githubusercontent.com/Android-Boot-Manager/ABM-json/master/devices/" + vm.codename + " .json" ).readText()
103+ val jsonText = try {
104+ ctx.assets.open(" abm.json" ).readBytes().toString(Charsets .UTF_8 )
105+ } catch (e: FileNotFoundException ) {
106+ URL (" https://raw.githubusercontent.com/Android-Boot-Manager/ABM-json/master/devices/" + vm.codename + " .json" ).readText()
107+ }
108+
102109 val json = JSONTokener (jsonText).nextValue() as JSONObject
103110 if (BuildConfig .VERSION_CODE < json.getInt(" minAppVersion" ))
104111 throw IllegalStateException (" please upgrade app" )
0 commit comments