Skip to content

Commit 070c875

Browse files
fix(deps): update dependency com.pinterest.ktlint:ktlint-cli to v1.4.1 (#1388)
* fix(deps): update dependency com.pinterest.ktlint:ktlint-cli to v1.4.1 * Spotless. --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Absinthe <[email protected]>
1 parent 7f2e941 commit 070c875

25 files changed

+348
-395
lines changed

app/src/main/kotlin/com/absinthe/libchecker/data/app/LocalAppDataSource.kt

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,26 @@ object LocalAppDataSource : AppDataSource {
1616
var apexPackageSet: Set<String> = emptySet()
1717
private set
1818

19-
override fun getApplicationList(ioDispatcher: CoroutineDispatcher): Flow<List<PackageInfo>> =
20-
flow {
21-
val list = getApplicationList()
22-
val listByShell = getAppListByShell()
19+
override fun getApplicationList(ioDispatcher: CoroutineDispatcher): Flow<List<PackageInfo>> = flow {
20+
val list = getApplicationList()
21+
val listByShell = getAppListByShell()
2322

24-
if (listByShell.size > list.size) {
25-
Timber.d("listByShell.size > list.size")
26-
emit(
27-
listByShell.mapNotNull { packageName ->
28-
runCatching {
29-
PackageManagerCompat.getPackageInfo(
30-
packageName,
31-
PackageManager.GET_META_DATA or PackageManager.GET_PERMISSIONS
32-
)
33-
}.getOrNull()
34-
}
35-
)
36-
} else {
37-
emit(list)
38-
}
39-
}.flowOn(ioDispatcher)
23+
if (listByShell.size > list.size) {
24+
Timber.d("listByShell.size > list.size")
25+
emit(
26+
listByShell.mapNotNull { packageName ->
27+
runCatching {
28+
PackageManagerCompat.getPackageInfo(
29+
packageName,
30+
PackageManager.GET_META_DATA or PackageManager.GET_PERMISSIONS
31+
)
32+
}.getOrNull()
33+
}
34+
)
35+
} else {
36+
emit(list)
37+
}
38+
}.flowOn(ioDispatcher)
4039

4140
override fun getApplicationList(): List<PackageInfo> {
4241
Timber.d("getApplicationList start")
@@ -48,16 +47,15 @@ object LocalAppDataSource : AppDataSource {
4847
return list
4948
}
5049

51-
override fun getApplicationMap(ioDispatcher: CoroutineDispatcher): Flow<Map<String, PackageInfo>> =
52-
flow {
53-
getApplicationList(ioDispatcher).collect { list ->
54-
val map = list.asSequence()
55-
.filter { it.applicationInfo?.sourceDir != null || it.applicationInfo?.publicSourceDir != null }
56-
.map { it.packageName to it }
57-
.toMap()
58-
emit(map)
59-
}
60-
}.flowOn(ioDispatcher)
50+
override fun getApplicationMap(ioDispatcher: CoroutineDispatcher): Flow<Map<String, PackageInfo>> = flow {
51+
getApplicationList(ioDispatcher).collect { list ->
52+
val map = list.asSequence()
53+
.filter { it.applicationInfo?.sourceDir != null || it.applicationInfo?.publicSourceDir != null }
54+
.map { it.packageName to it }
55+
.toMap()
56+
emit(map)
57+
}
58+
}.flowOn(ioDispatcher)
6159

6260
override fun getApplicationMap(): Map<String, PackageInfo> {
6361
return getApplicationList().asSequence()

app/src/main/kotlin/com/absinthe/libchecker/database/LCRepository.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,7 @@ class LCRepository(private val lcDao: LCDao) {
166166
lcDao.deleteAllSnapshotDiffItems()
167167
}
168168

169-
suspend fun getSnapshotDiff(packageName: String): SnapshotDiffStoringItem? =
170-
lcDao.getSnapshotDiff(packageName)
169+
suspend fun getSnapshotDiff(packageName: String): SnapshotDiffStoringItem? = lcDao.getSnapshotDiff(packageName)
171170

172171
fun updateFeatures(packageName: String, features: Int) {
173172
if (checkDatabaseStatus().not()) return

app/src/main/kotlin/com/absinthe/libchecker/features/about/ui/AboutActivity.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,5 @@ class AboutActivity :
505505
return String.format("<a href=\"%s\">%s</a>", url, url)
506506
}
507507

508-
private fun getStringByConfiguration(@StringRes res: Int): String =
509-
createConfigurationContext(configuration).resources.getString(res)
508+
private fun getStringByConfiguration(@StringRes res: Int): String = createConfigurationContext(configuration).resources.getString(res)
510509
}

app/src/main/kotlin/com/absinthe/libchecker/features/applist/detail/DetailViewModel.kt

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -344,24 +344,23 @@ class DetailViewModel : ViewModel() {
344344
return chipList
345345
}
346346

347-
private suspend fun getSignatureChipList(context: Context): List<LibStringItemChip> =
348-
withContext(Dispatchers.IO) {
349-
// lazy load signatures
350-
runCatching {
351-
@Suppress("InlinedApi", "DEPRECATION")
352-
val flags = PackageManager.GET_SIGNATURES or PackageManager.GET_SIGNING_CERTIFICATES
353-
if (!isApk) {
354-
PackageUtils.getPackageInfo(packageInfo.packageName, flags).getSignatures(context)
355-
} else {
356-
PackageManagerCompat.getPackageArchiveInfo(packageInfo.applicationInfo!!.sourceDir, flags)!!.getSignatures(context)
357-
}
358-
}.onFailure {
359-
Timber.e(it)
360-
}.getOrDefault(emptySequence())
361-
.map {
362-
LibStringItemChip(it, null)
363-
}.toList()
364-
}
347+
private suspend fun getSignatureChipList(context: Context): List<LibStringItemChip> = withContext(Dispatchers.IO) {
348+
// lazy load signatures
349+
runCatching {
350+
@Suppress("InlinedApi", "DEPRECATION")
351+
val flags = PackageManager.GET_SIGNATURES or PackageManager.GET_SIGNING_CERTIFICATES
352+
if (!isApk) {
353+
PackageUtils.getPackageInfo(packageInfo.packageName, flags).getSignatures(context)
354+
} else {
355+
PackageManagerCompat.getPackageArchiveInfo(packageInfo.applicationInfo!!.sourceDir, flags)!!.getSignatures(context)
356+
}
357+
}.onFailure {
358+
Timber.e(it)
359+
}.getOrDefault(emptySequence())
360+
.map {
361+
LibStringItemChip(it, null)
362+
}.toList()
363+
}
365364

366365
fun initAbilities(context: Context, packageName: String) = viewModelScope.launch(Dispatchers.IO) {
367366
abilitiesMap.put(AbilityType.PAGE, MutableStateFlow(emptyList()))

app/src/main/kotlin/com/absinthe/libchecker/features/applist/detail/ui/AlternativeLaunchBSDFragment.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ class AlternativeLaunchBSDFragment : BaseBottomSheetViewDialogFragment<Alternati
2020

2121
private val packageName by lazy { arguments?.getString(EXTRA_PACKAGE_NAME) }
2222

23-
override fun initRootView(): AlternativeLaunchBSDView =
24-
AlternativeLaunchBSDView(requireContext())
23+
override fun initRootView(): AlternativeLaunchBSDView = AlternativeLaunchBSDView(requireContext())
2524

2625
override fun getHeaderView(): BottomSheetHeaderView = root.getHeaderView()
2726

app/src/main/kotlin/com/absinthe/libchecker/features/applist/detail/ui/AppBundleBottomSheetDialogFragment.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ class AppBundleBottomSheetDialogFragment : BaseBottomSheetViewDialogFragment<App
1616

1717
private val packageInfo by lazy { BundleCompat.getParcelable(requireArguments(), EXTRA_PACKAGE_INFO, PackageInfo::class.java) }
1818

19-
override fun initRootView(): AppBundleBottomSheetView =
20-
AppBundleBottomSheetView(requireContext())
19+
override fun initRootView(): AppBundleBottomSheetView = AppBundleBottomSheetView(requireContext())
2120

2221
override fun getHeaderView(): BottomSheetHeaderView = root.getHeaderView()
2322

app/src/main/kotlin/com/absinthe/libchecker/features/applist/detail/ui/AppInstallSourceBSDFragment.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ class AppInstallSourceBSDFragment :
3434

3535
private val packageName by lazy { arguments?.getString(EXTRA_PACKAGE_NAME) }
3636

37-
override fun initRootView(): AppInstallSourceBottomSheetView =
38-
AppInstallSourceBottomSheetView(requireContext())
37+
override fun initRootView(): AppInstallSourceBottomSheetView = AppInstallSourceBottomSheetView(requireContext())
3938

4039
override fun getHeaderView(): BottomSheetHeaderView = root.getHeaderView()
4140

app/src/main/kotlin/com/absinthe/libchecker/features/applist/detail/ui/AppPropBottomSheetDialogFragment.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ class AppPropBottomSheetDialogFragment : BaseBottomSheetViewDialogFragment<AppPr
2323
)!!
2424
}
2525

26-
override fun initRootView(): AppPropsBottomSheetView =
27-
AppPropsBottomSheetView(requireContext(), packageInfo)
26+
override fun initRootView(): AppPropsBottomSheetView = AppPropsBottomSheetView(requireContext(), packageInfo)
2827

2928
override fun getHeaderView(): BottomSheetHeaderView = root.getHeaderView()
3029

app/src/main/kotlin/com/absinthe/libchecker/features/applist/detail/ui/OverlayDetailBottomSheetDialogFragment.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ const val EXTRA_LC_ITEM = "EXTRA_LC_ITEM"
3737

3838
class OverlayDetailBottomSheetDialogFragment : BaseBottomSheetViewDialogFragment<OverlayDetailBottomSheetView>() {
3939

40-
override fun initRootView(): OverlayDetailBottomSheetView =
41-
OverlayDetailBottomSheetView(requireContext())
40+
override fun initRootView(): OverlayDetailBottomSheetView = OverlayDetailBottomSheetView(requireContext())
4241

4342
override fun getHeaderView(): BottomSheetHeaderView = root.getHeaderView()
4443

app/src/main/kotlin/com/absinthe/libchecker/features/applist/detail/ui/PermissionDetailDialogFragment.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ class PermissionDetailDialogFragment : BaseBottomSheetViewDialogFragment<Permiss
2222
.substringBefore(" ") // remove maxSdkVersion suffix
2323
}
2424

25-
override fun initRootView(): PermissionInfoBottomSheetView =
26-
PermissionInfoBottomSheetView(requireContext())
25+
override fun initRootView(): PermissionInfoBottomSheetView = PermissionInfoBottomSheetView(requireContext())
2726

2827
override fun init() {
2928
root.apply {

0 commit comments

Comments
 (0)