mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 23:51:21 +02:00
Dev: use build product flavors for app store release (#1205)
## Description Instead of applying a code patch, this PR uses build time [product flavors](https://developer.android.com/build/build-variants#product-flavors) to define the existing default and an app store variant. This is more robust than maintaining a patch file and making sure it is applied before building. The app store variant applies the same code changes (removing install permission, requiring leanback, & setting `UpdateChecker.ACTIVE`), but via manifest placeholders/merging and `BuildConfig` entries. There are no user facing changes. ### Related issues None ### Testing Built the variants and verified manifest changes via aapt ## Screenshots N/A ## AI or LLM usage None
This commit is contained in:
parent
9a3af225a4
commit
31465051ff
11 changed files with 91 additions and 165 deletions
|
|
@ -1,5 +1,7 @@
|
|||
package com.github.damontecres.wholphin.ui
|
||||
|
||||
import android.app.Application
|
||||
import android.content.pm.ActivityInfo
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.input.key.Key
|
||||
|
|
@ -14,6 +16,7 @@ import androidx.compose.ui.test.performTextInput
|
|||
import androidx.compose.ui.test.pressKey
|
||||
import androidx.compose.ui.test.requestFocus
|
||||
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
|
||||
import androidx.test.core.app.ApplicationProvider
|
||||
import com.github.damontecres.wholphin.services.ScreensaverService
|
||||
import com.github.damontecres.wholphin.services.ScreensaverState
|
||||
import com.github.damontecres.wholphin.services.SetupDestination
|
||||
|
|
@ -49,8 +52,11 @@ import org.junit.Assert
|
|||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.TestWatcher
|
||||
import org.junit.runner.Description
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.Shadows.shadowOf
|
||||
import org.robolectric.annotation.Config
|
||||
import javax.inject.Inject
|
||||
|
||||
|
|
@ -61,7 +67,23 @@ class BasicUiTests {
|
|||
@get:Rule(order = 0)
|
||||
var hiltRule = HiltAndroidRule(this)
|
||||
|
||||
// From https://github.com/robolectric/robolectric/pull/4736#issuecomment-1831034882
|
||||
@get:Rule(order = 1)
|
||||
val addActivityToRobolectricRule =
|
||||
object : TestWatcher() {
|
||||
override fun starting(description: Description?) {
|
||||
super.starting(description)
|
||||
val appContext: Application = ApplicationProvider.getApplicationContext()
|
||||
val activityInfo =
|
||||
ActivityInfo().apply {
|
||||
name = TestActivity::class.java.name
|
||||
packageName = appContext.packageName
|
||||
}
|
||||
shadowOf(appContext.packageManager).addOrUpdateActivity(activityInfo)
|
||||
}
|
||||
}
|
||||
|
||||
@get:Rule(order = 2)
|
||||
val composeTestRule = createAndroidComposeRule<TestActivity>()
|
||||
|
||||
@Inject
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue