Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ object BitmapIconResizer : IconResizer {

override fun resize(bytes: ByteArray, width: Int, height: Int): ByteArray {
val baos = ByteArrayOutputStream()
BitmapFactory.decodeByteArray(bytes, 0, bytes.size).apply {
reconfigure(width, height, Bitmap.Config.ARGB_8888)
}.compress(Bitmap.CompressFormat.PNG, 100, baos)
BitmapFactory.decodeByteArray(bytes, 0, bytes.size)
.copy(Bitmap.Config.ARGB_8888, true).apply {
reconfigure(width, height, Bitmap.Config.ARGB_8888)
}.compress(Bitmap.CompressFormat.PNG, 100, baos)
return baos.toByteArray()
}
}
10 changes: 5 additions & 5 deletions composeApp/src/commonMain/composeResources/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
<string name="progress_cleaning">Cleaning up…</string>
<string name="patcher_nav_item">Patcher</string>
<string name="select_version_title">Select version</string>
<string name="you_have_no_versions">You have no versions installed and overport release index is not available.
Check your internet connection.
</string>
<string name="you_have_no_versions">You have no versions installed and overport release index is not available. Check your internet connection.</string>
<string name="tag_experimental">experimental</string>
<string name="tag_latest">latest</string>
<string name="tag_custom">custom</string>
Expand All @@ -28,15 +26,17 @@
<string name="cant_read_apk">Selected APK file cannot be parsed.</string>
<string name="apk_file_exported">APK file has been successfully exported.</string>
<string name="cant_update_overport">overport libraries cannot be downloaded.</string>
<string name="unknown_error">Unknown error has been occurred.</string>
<string name="unknown_error">Unknown error has been occurred</string>
<string name="cant_checkout_title">Can't checkout version</string>
<string name="cant_checkout_message">Selected overport version is unavailable for download. Please, check your internet connection or choose another version.</string>
<string name="update_available">Update available!</string>
<string name="status_unknown">Unknown</string>
<string name="status_playable">Playable</string>
<string name="status_has_problems">Has problems</string>
<string name="status_not_working">Not working</string>
<string name="status_loading">Loading…</string>
<string name="use_at_your_risk">Not recommended, use at your own risk</string>
<string name="patch_copy_libraries">Copy ovrport libraries</string>
<string name="patch_copy_libraries">Copy overport libraries</string>
<string name="patch_copy_ovrplugin_vrapi">Copy OVRPlugin if VrApi is present</string>
<string name="patch_fix_min_android_sdk">Fix minimal Android SDK</string>
<string name="patch_generate_config">Generate ovrport config</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ import androidx.compose.ui.Modifier
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.launch
import moe.crx.overport.app.model.MainViewModel
import moe.crx.overport.utils.CantCheckoutException
import org.jetbrains.compose.resources.getString
import overportapp.composeapp.generated.resources.Res
import overportapp.composeapp.generated.resources.apk_file_exported
import overportapp.composeapp.generated.resources.unknown_error
import overportapp.composeapp.generated.resources.*
import java.io.InputStream
import java.io.OutputStream

Expand Down Expand Up @@ -101,6 +100,10 @@ fun PatcherScreen(
try {
viewModel.checkout(it, name)
viewModel.prepare(stream)
} catch (_: CantCheckoutException) {
viewModel.cancel()
errorMessage =
getString(Res.string.cant_checkout_title) to getString(Res.string.cant_checkout_message)
} catch (ex: Throwable) {
viewModel.cancel()
errorMessage = getString(Res.string.unknown_error) to ex.stackTraceToString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ fun VersionManagerSheet(viewModel: MainViewModel, onSelected: (String) -> Unit,
}

ModalBottomSheet(
modifier = Modifier.fillMaxHeight(),
onDismissRequest = { onCancel() },
) {
if (available == null) {
Row(
modifier = Modifier.fillMaxSize(),
modifier = Modifier.fillMaxWidth().height(240.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Center
) {
Expand Down
5 changes: 1 addition & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
#Kotlin
kotlin.code.style=official
kotlin.daemon.jvmargs=-Xmx2048M

#Gradle
org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8

#Android
android.nonTransitiveRClass=true
android.useAndroidX=true

#Application
appVersion=1.2.0
appVersion=1.2.1
2 changes: 1 addition & 1 deletion overportcli/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group = "moe.crx"
version = "1.2.0"
version = "1.2.1"

dependencies {
implementation(libs.android.tools.build)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.reandroid.archive.ArchiveFile
import com.reandroid.archive.FileInputSource
import com.reandroid.archive.io.ZipFileInput
import moe.crx.overport.config.OverportPatchedInfo
import moe.crx.overport.utils.CantCheckoutException
import moe.crx.overport.utils.NameFormatter
import moe.crx.overport.versions.VersionManager
import org.jf.baksmali.Baksmali
Expand Down Expand Up @@ -51,14 +52,8 @@ class PatcherContext(
}

fun checkout() {
var successful = VersionManager(patcherDirectory).checkout(overportVersion)

if (successful == null) {
successful = VersionManager(patcherDirectory).checkout("latest")
}

checkNotNull(successful)
overportVersion = successful
overportVersion = VersionManager(patcherDirectory).checkout(overportVersion)
?: throw CantCheckoutException("Can't checkout an overport release. Please, check your internet connection or choose another version.")
}

fun prepare(stream: InputStream) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package moe.crx.overport.utils

class CantCheckoutException(message: String) : IllegalStateException(message)
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class VersionManager(val workingDirectory: File) {

companion object {
val json = Json { ignoreUnknownKeys = true }
const val VERSION = "1.2.0"
const val VERSION = "1.2.1"

private fun isVersionLower(left: String, right: String): Boolean {
val (lY, lM, lD) = left.substringBeforeLast('-').split('.').map { it.toInt() }
Expand Down
Loading