Skip to content

Commit

Permalink
style: run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
Axelen123 committed May 19, 2023
1 parent a48faad commit 3283965
Show file tree
Hide file tree
Showing 25 changed files with 124 additions and 160 deletions.
12 changes: 2 additions & 10 deletions app/src/main/java/app/revanced/manager/compose/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,11 @@ import androidx.compose.foundation.isSystemInDarkTheme
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import app.revanced.manager.compose.domain.manager.PreferencesManager
import app.revanced.manager.compose.ui.destination.Destination
import app.revanced.manager.compose.ui.screen.AppSelectorScreen
import app.revanced.manager.compose.ui.screen.DashboardScreen
import app.revanced.manager.compose.ui.screen.PatchesSelectorScreen
import app.revanced.manager.compose.ui.screen.SettingsScreen
import app.revanced.manager.compose.ui.screen.InstallerScreen
import app.revanced.manager.compose.ui.screen.*
import app.revanced.manager.compose.ui.theme.ReVancedManagerTheme
import app.revanced.manager.compose.ui.theme.Theme
import app.revanced.manager.compose.util.PM
import dev.olshevski.navigation.reimagined.AnimatedNavHost
import dev.olshevski.navigation.reimagined.NavBackHandler
import dev.olshevski.navigation.reimagined.navigate
import dev.olshevski.navigation.reimagined.pop
import dev.olshevski.navigation.reimagined.rememberNavController
import dev.olshevski.navigation.reimagined.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.launch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package app.revanced.manager.compose.di

import app.revanced.manager.compose.domain.repository.ReVancedRepositoryImpl
import app.revanced.manager.compose.network.api.ManagerAPI
import app.revanced.manager.compose.patcher.data.repository.*
import app.revanced.manager.compose.patcher.data.repository.PatchesRepository
import org.koin.core.module.dsl.singleOf
import org.koin.dsl.module

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package app.revanced.manager.compose.di

import app.revanced.manager.compose.ui.viewmodel.*
import org.koin.androidx.viewmodel.dsl.viewModelOf
import app.revanced.manager.compose.ui.viewmodel.AppSelectorViewModel
import app.revanced.manager.compose.ui.viewmodel.InstallerScreenViewModel
import app.revanced.manager.compose.ui.viewmodel.PatchesSelectorViewModel
import app.revanced.manager.compose.ui.viewmodel.SettingsViewModel
import org.koin.androidx.viewmodel.dsl.viewModel
import org.koin.androidx.viewmodel.dsl.viewModelOf
import org.koin.dsl.module

val viewModelModule = module {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package app.revanced.manager.compose.patcher

import app.revanced.patcher.Patcher
import app.revanced.patcher.PatcherOptions
import app.revanced.patcher.logging.Logger
import android.util.Log
import app.revanced.manager.compose.patcher.worker.Progress
import app.revanced.patcher.Patcher
import app.revanced.patcher.PatcherOptions
import app.revanced.patcher.data.Context
import app.revanced.patcher.logging.Logger
import app.revanced.patcher.patch.Patch
import java.io.Closeable
import java.io.File
Expand All @@ -22,7 +22,8 @@ class Session(
private val input: File,
private val onProgress: suspend (Progress) -> Unit = { }
) : Closeable {
class PatchFailedException(val patchName: String, cause: Throwable?) : Exception("Got exception while executing $patchName", cause)
class PatchFailedException(val patchName: String, cause: Throwable?) :
Exception("Got exception while executing $patchName", cause)

private val logger = LogcatLogger
private val temporary = File(cacheDir).resolve("manager").also { it.mkdirs() }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package app.revanced.manager.compose.patcher.alignment.zip.structures

import app.revanced.manager.compose.patcher.alignment.zip.*
import app.revanced.manager.compose.patcher.alignment.zip.putUInt
import app.revanced.manager.compose.patcher.alignment.zip.putUShort
import app.revanced.manager.compose.patcher.alignment.zip.readUIntLE
import app.revanced.manager.compose.patcher.alignment.zip.readUShortLE
import java.io.DataInput
import java.nio.ByteBuffer
import java.nio.ByteOrder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.asSharedFlow

class PatchesRepository(private val managerAPI: ManagerAPI) {
private val patchInformation = MutableSharedFlow<List<PatchInfo>>(replay = 1, onBufferOverflow = BufferOverflow.DROP_OLDEST)
private val patchInformation =
MutableSharedFlow<List<PatchInfo>>(replay = 1, onBufferOverflow = BufferOverflow.DROP_OLDEST)
private var bundle: PatchBundle? = null

private val scope = CoroutineScope(Job() + Dispatchers.IO)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ data class PatchInfo(
fun compatibleWith(packageName: String) = compatiblePackages?.any { it.name == packageName } ?: true

fun supportsVersion(versionName: String) =
compatiblePackages?.any { compatiblePackages.any { it.versions.isEmpty() || it.versions.any { version -> version == versionName } } } ?: true
compatiblePackages?.any { compatiblePackages.any { it.versions.isEmpty() || it.versions.any { version -> version == versionName } } }
?: true
}

@Parcelize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import android.content.Context
import android.util.Log
import androidx.work.CoroutineWorker
import androidx.work.WorkerParameters
import app.revanced.manager.compose.patcher.data.repository.PatchesRepository
import app.revanced.manager.compose.patcher.Session
import app.revanced.manager.compose.patcher.aapt.Aapt
import app.revanced.manager.compose.patcher.data.repository.PatchesRepository
import app.revanced.patcher.extensions.PatchExtensions.patchName
import kotlinx.serialization.Serializable
import kotlinx.serialization.decodeFromString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class InstallService : Service() {
this?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
})
}

else -> {
sendBroadcast(Intent().apply {
action = APP_INSTALL_ACTION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class UninstallService : Service() {
this?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
})
}

else -> {
sendBroadcast(Intent().apply {
action = APP_UNINSTALL_ACTION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@ package app.revanced.manager.compose.ui.destination
import android.os.Parcelable
import app.revanced.manager.compose.util.PackageInfo
import kotlinx.parcelize.Parcelize
import java.io.File

sealed interface Destination: Parcelable {
sealed interface Destination : Parcelable {

@Parcelize
object Dashboard: Destination
object Dashboard : Destination

@Parcelize
object AppSelector: Destination
object AppSelector : Destination

@Parcelize
object Settings: Destination
object Settings : Destination

@Parcelize
data class PatchesSelector(val input: PackageInfo): Destination
data class PatchesSelector(val input: PackageInfo) : Destination

@Parcelize
data class Installer(val input: PackageInfo, val selectedPatches: List<String>) : Destination
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@ package app.revanced.manager.compose.ui.destination
import android.os.Parcelable
import kotlinx.parcelize.Parcelize

sealed interface SettingsDestination: Parcelable {
sealed interface SettingsDestination : Parcelable {

@Parcelize
object Settings: SettingsDestination
object Settings : SettingsDestination

@Parcelize
object General: SettingsDestination
object General : SettingsDestination

@Parcelize
object Updates: SettingsDestination
object Updates : SettingsDestination

@Parcelize
object Downloads: SettingsDestination
object Downloads : SettingsDestination

@Parcelize
object ImportExport: SettingsDestination
object ImportExport : SettingsDestination

@Parcelize
object About: SettingsDestination
object About : SettingsDestination

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.*
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.filled.Storage
import androidx.compose.material.icons.outlined.HelpOutline
import androidx.compose.material.icons.outlined.Search
import androidx.compose.material3.*
Expand Down Expand Up @@ -48,12 +49,19 @@ fun AppSelectorScreen(
SearchBar(
query = filterText,
onQueryChange = { filterText = it },
onSearch = { },
onSearch = { },
active = true,
onActiveChange = { search = it },
modifier = Modifier.fillMaxSize(),
placeholder = { Text(stringResource(R.string.search_apps)) },
leadingIcon = { IconButton({ search = false }) { Icon(Icons.Default.ArrowBack, stringResource(R.string.back)) } },
leadingIcon = {
IconButton({ search = false }) {
Icon(
Icons.Default.ArrowBack,
stringResource(R.string.back)
)
}
},
shape = SearchBarDefaults.inputFieldShape,
content = {
if (PM.appList.isNotEmpty()) {
Expand Down Expand Up @@ -93,7 +101,7 @@ fun AppSelectorScreen(
title = stringResource(R.string.select_app),
onBackClick = onBackClick,
actions = {
IconButton(onClick = { }) {
IconButton(onClick = { }) {
Icon(Icons.Outlined.HelpOutline, stringResource(R.string.help))
}
IconButton(onClick = { search = true }) {
Expand All @@ -119,7 +127,15 @@ fun AppSelectorScreen(
modifier = Modifier.clickable {
pickApkLauncher.launch("*/*")
},
leadingContent = { Box(Modifier.size(36.dp), Alignment.Center) { Icon(Icons.Default.Storage, null, modifier = Modifier.size(24.dp)) } },
leadingContent = {
Box(Modifier.size(36.dp), Alignment.Center) {
Icon(
Icons.Default.Storage,
null,
modifier = Modifier.size(24.dp)
)
}
},
headlineContent = { Text(stringResource(R.string.select_from_storage)) }
)

Expand Down Expand Up @@ -150,7 +166,10 @@ fun AppSelectorScreen(
if (PM.appList.isEmpty()) {
item {
Box(Modifier.fillMaxWidth(), Alignment.Center) {
CircularProgressIndicator(Modifier.padding(vertical = 15.dp).size(24.dp), strokeWidth = 3.dp)
CircularProgressIndicator(
Modifier.padding(vertical = 15.dp).size(24.dp),
strokeWidth = 3.dp
)
}
}
}
Expand All @@ -164,28 +183,27 @@ fun AppSelectorScreen(
}



/*Row(
modifier = Modifier.horizontalScroll(rememberScrollState()),
horizontalArrangement = Arrangement.spacedBy(10.dp)
) {
FilterChip(
selected = false,
onClick = {},
label = { Text("Patched apps") },
leadingIcon = { Icon(Icons.Default.Check, null) },
enabled = false
)
FilterChip(
selected = false,
onClick = {},
label = { Text("User apps") },
leadingIcon = { Icon(Icons.Default.Android, null) }
)
FilterChip(
selected = filterSystemApps,
onClick = { filterSystemApps = !filterSystemApps },
label = { Text("System apps") },
leadingIcon = { Icon(Icons.Default.Apps, null) }
)
}*/
/*Row(
modifier = Modifier.horizontalScroll(rememberScrollState()),
horizontalArrangement = Arrangement.spacedBy(10.dp)
) {
FilterChip(
selected = false,
onClick = {},
label = { Text("Patched apps") },
leadingIcon = { Icon(Icons.Default.Check, null) },
enabled = false
)
FilterChip(
selected = false,
onClick = {},
label = { Text("User apps") },
leadingIcon = { Icon(Icons.Default.Android, null) }
)
FilterChip(
selected = filterSystemApps,
onClick = { filterSystemApps = !filterSystemApps },
label = { Text("System apps") },
leadingIcon = { Icon(Icons.Default.Apps, null) }
)
}*/
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,11 @@ import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Android
import androidx.compose.material.icons.outlined.Apps
import androidx.compose.material.icons.outlined.HelpOutline
import androidx.compose.material.icons.outlined.Info
import androidx.compose.material.icons.outlined.Notifications
import androidx.compose.material.icons.outlined.Settings
import androidx.compose.material.icons.outlined.Source
import androidx.compose.material.icons.outlined.Topic
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.FloatingActionButton
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LeadingIconTab
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Tab
import androidx.compose.material3.TabRow
import androidx.compose.material3.Text
import androidx.compose.material3.surfaceColorAtElevation
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ package app.revanced.manager.compose.ui.screen
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.*
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import app.revanced.manager.compose.R
import app.revanced.manager.compose.ui.component.AppScaffold
import app.revanced.manager.compose.ui.component.AppTopBar
import app.revanced.manager.compose.ui.viewmodel.InstallerScreenViewModel
import app.revanced.manager.compose.R

@OptIn(ExperimentalMaterial3Api::class)
@Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
package app.revanced.manager.compose.ui.screen

import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.pager.HorizontalPager
Expand All @@ -15,19 +10,7 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Build
import androidx.compose.material.icons.outlined.HelpOutline
import androidx.compose.material.icons.outlined.Search
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ExtendedFloatingActionButton
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Tab
import androidx.compose.material3.TabRow
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.surfaceColorAtElevation
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.rememberCoroutineScope
Expand Down
Loading

0 comments on commit 3283965

Please sign in to comment.