Skip to content

Commit 1db1765

Browse files
committed
fix lint
1 parent c52c5de commit 1db1765

25 files changed

Lines changed: 57 additions & 259 deletions

app/src/main/AndroidManifest.xml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@
6464
<category android:name="android.intent.category.LAUNCHER" />
6565
</intent-filter>
6666

67-
<!-- Splits -->
67+
<!-- Splits + single APK by file extension -->
6868
<intent-filter>
6969
<action android:name="android.intent.action.VIEW" />
70-
70+
<action android:name="android.intent.action.INSTALL_PACKAGE" />
7171
<category android:name="android.intent.category.DEFAULT" />
7272
<category android:name="android.intent.category.BROWSABLE" />
7373

@@ -76,6 +76,17 @@
7676
<data android:host="*" />
7777
<data android:mimeType="*/*" />
7878

79+
<data android:pathPattern=".*\\.apk" />
80+
<data android:pathPattern=".*\\..*\\.apk" />
81+
<data android:pathPattern=".*\\..*\\..*\\.apk" />
82+
<data android:pathPattern=".*\\..*\\..*\\..*\\.apk" />
83+
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.apk" />
84+
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.apk" />
85+
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\.apk" />
86+
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\.apk" />
87+
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\.apk" />
88+
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\.apk" />
89+
7990
<data android:pathPattern=".*\\.apks" />
8091
<data android:pathPattern=".*\\..*\\.apks" />
8192
<data android:pathPattern=".*\\..*\\..*\\.apks" />

app/src/main/java/app/pwhs/universalinstaller/data/remote/PackageDownloadService.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import io.ktor.http.HttpHeaders
88
import io.ktor.http.contentLength
99
import io.ktor.http.isSuccess
1010
import io.ktor.utils.io.ByteReadChannel
11-
import io.ktor.utils.io.core.isEmpty
12-
import io.ktor.utils.io.core.readBytes
1311
import io.ktor.utils.io.readRemaining
1412
import kotlinx.coroutines.Dispatchers
1513
import kotlinx.coroutines.withContext

app/src/main/java/app/pwhs/universalinstaller/data/remote/VirusTotalService.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,7 @@ class VirusTotalService(
230230

231231
private fun parseAnalysisResponse(body: String, analysisId: String): VtResult = try {
232232
val attributes = JSONObject(body).getJSONObject("data").getJSONObject("attributes")
233-
val apiStatus = attributes.optString("status", "queued")
234-
when (apiStatus) {
233+
when (val apiStatus = attributes.optString("status", "queued")) {
235234
"queued" -> VtResult(status = VtStatus.QUEUED, analysisId = analysisId)
236235
"in-progress" -> VtResult(status = VtStatus.ANALYZING, analysisId = analysisId)
237236
"completed" -> {

app/src/main/java/app/pwhs/universalinstaller/presentation/composable/AppScaffold.kt

Lines changed: 0 additions & 28 deletions
This file was deleted.

app/src/main/java/app/pwhs/universalinstaller/presentation/composable/SessionCard.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ import java.io.File
4545

4646
@Composable
4747
fun SessionCard(
48+
modifier: Modifier = Modifier,
4849
sessionData: SessionData,
4950
sessionProgress: SessionProgress?,
5051
onCancel: () -> Unit,
5152
onRetry: () -> Unit = {},
52-
modifier: Modifier = Modifier,
5353
) {
5454
val context = LocalContext.current
5555
val errorText = sessionData.error.resolve(context)

app/src/main/java/app/pwhs/universalinstaller/presentation/download/DownloadHistoryScreen.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import androidx.compose.ui.Alignment
5050
import androidx.compose.ui.Modifier
5151
import androidx.compose.ui.input.nestedscroll.nestedScroll
5252
import androidx.compose.ui.platform.LocalContext
53+
import androidx.compose.ui.platform.LocalResources
5354
import androidx.compose.ui.res.stringResource
5455
import androidx.compose.ui.text.style.TextOverflow
5556
import androidx.compose.ui.unit.dp
@@ -76,6 +77,7 @@ fun DownloadHistoryScreen(
7677
viewModel: DownloadHistoryViewModel = koinViewModel(),
7778
) {
7879
val context = LocalContext.current
80+
val resource = LocalResources.current
7981
val items by viewModel.items.collectAsState()
8082
val scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior()
8183
var showClearDialog by remember { mutableStateOf(false) }
@@ -165,7 +167,7 @@ fun DownloadHistoryScreen(
165167
if (!file.exists()) {
166168
Toast.makeText(
167169
context,
168-
context.getString(R.string.download_history_file_missing),
170+
resource.getString(R.string.download_history_file_missing),
169171
Toast.LENGTH_SHORT,
170172
).show()
171173
return@DownloadRow
@@ -184,7 +186,7 @@ fun DownloadHistoryScreen(
184186
cb?.setPrimaryClip(ClipData.newPlainText("url", entry.url))
185187
Toast.makeText(
186188
context,
187-
context.getString(R.string.download_history_url_copied),
189+
resource.getString(R.string.download_history_url_copied),
188190
Toast.LENGTH_SHORT,
189191
).show()
190192
},

app/src/main/java/app/pwhs/universalinstaller/presentation/install/ApkScanner.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import android.provider.Settings
99
import androidx.core.content.ContextCompat
1010
import androidx.core.net.toUri
1111
import kotlinx.coroutines.Dispatchers
12+
import kotlinx.coroutines.currentCoroutineContext
1213
import kotlinx.coroutines.ensureActive
1314
import kotlinx.coroutines.withContext
1415
import java.io.File
15-
import kotlin.coroutines.coroutineContext
1616

1717
data class FoundPackageFile(
1818
val path: String,
@@ -66,12 +66,12 @@ object ApkScanner {
6666
depth: Int,
6767
maxDepth: Int,
6868
) {
69-
coroutineContext.ensureActive()
69+
currentCoroutineContext().ensureActive()
7070
if (depth > maxDepth) return
7171
if (!dir.exists() || !dir.canRead()) return
7272
val children = runCatching { dir.listFiles() }.getOrNull() ?: return
7373
for (child in children) {
74-
coroutineContext.ensureActive()
74+
currentCoroutineContext().ensureActive()
7575
if (child.isDirectory) {
7676
val name = child.name
7777
// Skip dotfiles, app-scoped dirs (restricted even with MANAGE access), and thumbnails.

app/src/main/java/app/pwhs/universalinstaller/presentation/install/BatchInstallSheet.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ import androidx.compose.material3.ModalBottomSheet
4242
import androidx.compose.material3.OutlinedButton
4343
import androidx.compose.material3.Surface
4444
import androidx.compose.material3.Text
45-
import androidx.compose.material3.TextButton
4645
import androidx.compose.material3.rememberModalBottomSheetState
4746
import androidx.compose.runtime.Composable
4847
import androidx.compose.ui.Alignment
@@ -357,7 +356,7 @@ private fun EntryRow(
357356
)
358357
Text(
359358
text = when {
360-
failed -> entry.parseError.orEmpty()
359+
failed -> entry.parseError
361360
warning -> "${entry.conflictLabel} · ${entry.apkInfo.packageName}"
362361
else -> entry.apkInfo.packageName
363362
},

app/src/main/java/app/pwhs/universalinstaller/presentation/install/DownloadNotifier.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class DownloadNotifier(private val context: Context) {
4545
val nm = nm ?: return
4646
val now = android.os.SystemClock.elapsedRealtime()
4747
// Always let the first (0 B) and last (complete) updates through; throttle the middle.
48-
val isEdge = bytesRead == 0L || (totalBytes > 0 && bytesRead >= totalBytes)
48+
val isEdge = bytesRead == 0L || (totalBytes in 1..bytesRead)
4949
if (!isEdge && now - lastProgressMs < 500L) return
5050
lastProgressMs = now
5151
val indeterminate = totalBytes <= 0L

app/src/main/java/app/pwhs/universalinstaller/presentation/install/InstallViewModel.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,7 @@ class InstallViewModel(
267267
_obbCopyState.value = ObbCopyState.Running(appName, packageName, 0L, combinedTotal)
268268
pendingObbCopyJob = ObbCopyJob(sourceUri, entries, attached, packageName, appName)
269269

270-
val strategy = selectObbStrategy(packageName)
271-
when (strategy) {
270+
when (val strategy = selectObbStrategy(packageName)) {
272271
ObbStrategy.Direct -> enqueueObbWorker(
273272
ObbCopyWorker.STRATEGY_DIRECT, null, sourceUri, entries, attached, packageName, appName,
274273
)
@@ -462,7 +461,7 @@ class InstallViewModel(
462461
} else 0L
463462
} ?: 0L
464463
} catch (_: Exception) { 0L }
465-
_attachedObbFiles.value = _attachedObbFiles.value + AttachedObb(uri, displayName, size)
464+
_attachedObbFiles.value += AttachedObb(uri, displayName, size)
466465
}
467466

468467
fun removeAttachedObb(uri: Uri) {
@@ -685,7 +684,7 @@ class InstallViewModel(
685684
private fun uniqueFileName(dir: File, desired: String): String {
686685
if (!File(dir, desired).exists()) return desired
687686
val dot = desired.lastIndexOf('.')
688-
val stem = if (dot > 0) desired.substring(0, dot) else desired
687+
val stem = if (dot > 0) desired.take(dot) else desired
689688
val ext = if (dot > 0) desired.substring(dot) else ""
690689
var i = 1
691690
while (File(dir, "$stem ($i)$ext").exists()) i++

0 commit comments

Comments
 (0)