Skip to content

Commit

Permalink
[feat]: update v2.0.3
Browse files Browse the repository at this point in the history
* [feat]: finally some logging in debug mode

* [build]: updated libraries and SDK versions

* [build]: fixed fdroid issues

* [build]: renamed data to shared module

* [build]: updated tests screenshots

* [fix]: removed debug logging by default

* [build]: moved code and modules a little

* [build]: refactored app a little once again

* [build]: bumped app version
  • Loading branch information
F0x1d authored Nov 3, 2024
1 parent 4b08421 commit d0ac7d6
Show file tree
Hide file tree
Showing 284 changed files with 2,600 additions and 1,946 deletions.
31 changes: 25 additions & 6 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,38 @@ android {
defaultConfig {
applicationId = logFoxPackageName

versionCode = 62
versionName = "2.0.2"
versionCode = 63
versionName = "2.0.3"
}
}

dependencies {
implementation(projects.feature.crashes)
implementation(projects.feature.filters)
implementation(projects.feature.logging)
implementation(projects.feature.recordings)
implementation(projects.feature.appsPicker.api)
implementation(projects.feature.appsPicker.impl)

implementation(projects.feature.crashes.appsList)
implementation(projects.feature.crashes.details)
implementation(projects.feature.crashes.impl)
implementation(projects.feature.crashes.list)

implementation(projects.feature.filters.edit)
implementation(projects.feature.filters.impl)
implementation(projects.feature.filters.list)

implementation(projects.feature.logging.extendedCopy)
implementation(projects.feature.logging.impl)
implementation(projects.feature.logging.list)
implementation(projects.feature.logging.search)
implementation(projects.feature.logging.service)

implementation(projects.feature.recordings.details)
implementation(projects.feature.recordings.impl)
implementation(projects.feature.recordings.list)

implementation(projects.feature.settings)
implementation(projects.feature.setup)

implementation(libs.timber)
implementation(libs.viewpump)
implementation(libs.coil)

Expand Down
7 changes: 4 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.LogFox"
android:localeConfig="@xml/locales_config">
android:localeConfig="@xml/locales_config"
android:enableOnBackInvokedCallback="true">

<activity
android:name=".ui.activity.MainActivity"
android:name=".presentation.ui.activity.MainActivity"
android:windowSoftInputMode="adjustResize"
android:launchMode="singleInstance"
android:exported="true">
Expand All @@ -29,7 +30,7 @@
</activity>

<activity
android:name=".ui.activity.OpenFileActivity"
android:name=".presentation.ui.activity.OpenFileActivity"
android:documentLaunchMode="always"
android:excludeFromRecents="true"
android:theme="@style/Theme.LogFox.Translucent"
Expand Down
15 changes: 15 additions & 0 deletions app/src/main/kotlin/com/f0x1d/logfox/LogFoxApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ import coil.ImageLoader
import coil.ImageLoaderFactory
import com.f0x1d.logfox.arch.LOGGING_STATUS_CHANNEL_ID
import com.f0x1d.logfox.arch.RECORDING_STATUS_CHANNEL_ID
import com.f0x1d.logfox.arch.logs.TimberFileTree
import com.f0x1d.logfox.arch.notificationManagerCompat
import com.f0x1d.logfox.preferences.shared.AppPreferences
import com.f0x1d.logfox.strings.Strings
import com.google.android.material.color.DynamicColors
import com.google.android.material.color.DynamicColorsOptions
import dagger.hilt.android.HiltAndroidApp
import timber.log.Timber
import javax.inject.Inject

@HiltAndroidApp
Expand All @@ -25,8 +27,17 @@ class LogFoxApp: Application(), ImageLoaderFactory {
@Inject
lateinit var imageLoader: ImageLoader

@Inject
lateinit var timberFileTree: TimberFileTree

override fun onCreate() {
super.onCreate()

if (BuildConfig.DEBUG && LOGGING_ENABLED) {
Timber.plant(timberFileTree)
}
Timber.d("onCreate")

AppCompatDelegate.setDefaultNightMode(appPreferences.nightTheme)
DynamicColors.applyToActivitiesIfAvailable(
this,
Expand Down Expand Up @@ -64,4 +75,8 @@ class LogFoxApp: Application(), ImageLoaderFactory {
}

override fun newImageLoader(): ImageLoader = imageLoader

companion object {
private const val LOGGING_ENABLED = false
}
}
6 changes: 3 additions & 3 deletions app/src/main/kotlin/com/f0x1d/logfox/coil/AppIconFetcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import coil.fetch.FetchResult
import coil.fetch.Fetcher
import coil.request.Options
import com.f0x1d.logfox.arch.di.IODispatcher
import com.f0x1d.logfox.model.InstalledApp
import com.f0x1d.logfox.feature.apps.picker.InstalledApp
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.withContext
Expand All @@ -35,9 +35,9 @@ class AppIconFetcher(
class Factory @Inject constructor(
@ApplicationContext private val context: Context,
@IODispatcher private val ioDispatcher: CoroutineDispatcher,
) : Fetcher.Factory<InstalledApp> {
) : Fetcher.Factory<com.f0x1d.logfox.feature.apps.picker.InstalledApp> {
override fun create(
data: InstalledApp,
data: com.f0x1d.logfox.feature.apps.picker.InstalledApp,
options: Options,
imageLoader: ImageLoader,
): Fetcher = AppIconFetcher(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package com.f0x1d.logfox.di.logs

import android.app.PendingIntent
import android.content.Context
import com.f0x1d.feature.logging.service.MainActivityPendingIntentProvider
import com.f0x1d.logfox.arch.makeActivityPendingIntent
import com.f0x1d.logfox.ui.activity.MainActivity
import com.f0x1d.logfox.feature.logging.service.presentation.MainActivityPendingIntentProvider
import com.f0x1d.logfox.presentation.ui.activity.MainActivity
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.f0x1d.logfox.presentation

sealed interface MainAction {
data object OpenSetup : MainAction
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.f0x1d.logfox.presentation

data object MainState
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package com.f0x1d.logfox.viewmodel
package com.f0x1d.logfox.presentation

import android.app.Application
import android.content.Intent
import com.f0x1d.feature.logging.service.LoggingService
import com.f0x1d.logfox.arch.hasPermissionToReadLogs
import com.f0x1d.logfox.arch.startForegroundServiceAvailable
import com.f0x1d.logfox.arch.viewmodel.BaseViewModel
import com.f0x1d.logfox.arch.viewmodel.Event
import com.f0x1d.logfox.preferences.shared.AppPreferences
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
Expand All @@ -15,8 +13,10 @@ import javax.inject.Inject
class MainViewModel @Inject constructor(
private val appPreferences: AppPreferences,
application: Application,
): BaseViewModel(application) {

) : BaseViewModel<MainState, MainAction>(
initialStateProvider = { MainState },
application = application,
) {
var askedNotificationsPermission
get() = appPreferences.askedNotificationsPermission
set(value) { appPreferences.askedNotificationsPermission = value }
Expand All @@ -29,16 +29,14 @@ class MainViewModel @Inject constructor(

private fun load() {
if (ctx.hasPermissionToReadLogs) {
Intent(ctx, LoggingService::class.java).let {
Intent(ctx, com.f0x1d.logfox.feature.logging.service.presentation.LoggingService::class.java).let {
if (startForegroundServiceAvailable)
ctx.startForegroundService(it)
else
ctx.startService(it)
}
} else {
sendEvent(OpenSetup)
sendAction(MainAction.OpenSetup)
}
}
}

data object OpenSetup : Event
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.f0x1d.logfox.ui.activity
package com.f0x1d.logfox.presentation.ui.activity

import android.Manifest
import android.annotation.SuppressLint
Expand All @@ -23,22 +23,21 @@ import com.f0x1d.logfox.arch.contrastedNavBarAvailable
import com.f0x1d.logfox.arch.gesturesAvailable
import com.f0x1d.logfox.arch.hasNotificationsPermission
import com.f0x1d.logfox.arch.isHorizontalOrientation
import com.f0x1d.logfox.arch.ui.activity.BaseViewModelActivity
import com.f0x1d.logfox.arch.viewmodel.Event
import com.f0x1d.logfox.arch.presentation.ui.activity.BaseActivity
import com.f0x1d.logfox.databinding.ActivityMainBinding
import com.f0x1d.logfox.navigation.Directions
import com.f0x1d.logfox.navigation.NavGraphs
import com.f0x1d.logfox.presentation.MainAction
import com.f0x1d.logfox.presentation.MainViewModel
import com.f0x1d.logfox.strings.Strings
import com.f0x1d.logfox.ui.Icons
import com.f0x1d.logfox.viewmodel.MainViewModel
import com.f0x1d.logfox.viewmodel.OpenSetup
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class MainActivity: BaseViewModelActivity<MainViewModel, ActivityMainBinding>(), NavController.OnDestinationChangedListener {
class MainActivity: BaseActivity<ActivityMainBinding>(), NavController.OnDestinationChangedListener {

override val viewModel by viewModels<MainViewModel>()
private val viewModel by viewModels<MainViewModel>()

private val navController by lazy {
val navHostFragment = supportFragmentManager.findFragmentById(
Expand Down Expand Up @@ -94,6 +93,12 @@ class MainActivity: BaseViewModelActivity<MainViewModel, ActivityMainBinding>(),

viewModel.askedNotificationsPermission = true
}

viewModel.actions.collectWithLifecycle { action ->
when (action) {
is MainAction.OpenSetup -> navController.navigate(Directions.action_global_setupFragment)
}
}
}

private fun ActivityMainBinding.setupNavigation() {
Expand Down Expand Up @@ -139,14 +144,6 @@ class MainActivity: BaseViewModelActivity<MainViewModel, ActivityMainBinding>(),
}
}

override fun onEvent(event: Event) {
super.onEvent(event)

when (event) {
is OpenSetup -> navController.navigate(Directions.action_global_setupFragment)
}
}

override fun onDestinationChanged(controller: NavController, destination: NavDestination, arguments: Bundle?) {
val barShown = when (destination.id) {
Directions.setupFragment -> false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.f0x1d.logfox.ui.activity
package com.f0x1d.logfox.presentation.ui.activity

import android.content.Intent
import android.os.Bundle
Expand All @@ -19,4 +19,4 @@ class OpenFileActivity: AppCompatActivity() {
)
finish()
}
}
}
4 changes: 2 additions & 2 deletions app/src/main/kotlin/com/f0x1d/logfox/receiver/BootReceiver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package com.f0x1d.logfox.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.f0x1d.feature.logging.service.LoggingService
import com.f0x1d.logfox.arch.hasPermissionToReadLogs
import com.f0x1d.logfox.arch.startForegroundServiceAvailable
import com.f0x1d.logfox.arch.toast
import com.f0x1d.logfox.feature.logging.service.presentation.LoggingService
import com.f0x1d.logfox.preferences.shared.AppPreferences
import com.f0x1d.logfox.strings.Strings
import com.f0x1d.logfox.terminals.ShizukuTerminal
Expand All @@ -26,7 +26,7 @@ class BootReceiver: BroadcastReceiver() {
}

if (context.hasPermissionToReadLogs) {
Intent(context, LoggingService::class.java).let {
Intent(context, com.f0x1d.logfox.feature.logging.service.presentation.LoggingService::class.java).let {
if (startForegroundServiceAvailable)
context.startForegroundService(it)
else
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/xml/file_paths.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<files-path name="files" path="." />
<files-path name="recordings" path="recordings" />
<files-path name="dumps" path="dumps" />
</paths>
</paths>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.gradle.kotlin.dsl.DependencyHandlerScope
import org.gradle.kotlin.dsl.project

internal fun DependencyHandlerScope.coreDependencies(withCompose: Boolean = true) {
implementation(project(":data"))
implementation(project(":shared"))
implementation(project(":strings"))

implementation(project(":core:arch"))
Expand Down Expand Up @@ -43,10 +43,7 @@ internal fun DependencyHandlerScope.androidTestImplementation(dependency: Any):
)

internal fun DependencyHandlerScope.implementation(bundle: List<Any>): List<Dependency?> = bundle.map {
add(
configurationName = "implementation",
dependencyNotation = it,
)
implementation(it)
}

internal fun DependencyHandlerScope.ksp(dependency: Any): Dependency? = add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ class AndroidCoreConventionPlugin : Plugin<Project> {
}

dependencies {
implementation(project(":data"))
implementation(project(":shared"))
implementation(project(":strings"))

implementation(library("timber"))

implementation(library("material"))
implementation(bundle("androidx"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class AndroidFeatureConventionPlugin : Plugin<Project> {
dependencies {
coreDependencies(withCompose = false)

implementation(library("timber"))
implementation(library("material"))
implementation(bundle("androidx"))
implementation(bundle("androidx-navigation"))
Expand Down
Loading

0 comments on commit d0ac7d6

Please sign in to comment.