Skip to content

Commit

Permalink
Merge branch 'main' into fdroid
Browse files Browse the repository at this point in the history
  • Loading branch information
lihenggui committed Aug 23, 2023
2 parents 6682d32 + 2c1607b commit 5db6da8
Show file tree
Hide file tree
Showing 98 changed files with 9,266 additions and 3,541 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/Build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v2.7.0
uses: gradle/gradle-build-action@v2.7.1

- name: Accept Android licenses
run: yes | "$ANDROID_HOME"/cmdline-tools/latest/bin/sdkmanager --licenses || true
Expand Down Expand Up @@ -158,7 +158,7 @@ jobs:
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v2.7.0
uses: gradle/gradle-build-action@v2.7.1

- name: Run instrumentation tests
uses: reactivecircus/android-emulator-runner@v2
Expand Down Expand Up @@ -198,7 +198,7 @@ jobs:
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v2.7.0
uses: gradle/gradle-build-action@v2.7.1

- name: Setup Android SDK
uses: android-actions/setup-android@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v2.7.0
uses: gradle/gradle-build-action@v2.7.1

- name: Accept Android licenses
run: yes | "$ANDROID_HOME"/cmdline-tools/latest/bin/sdkmanager --licenses || true
Expand Down
23 changes: 23 additions & 0 deletions .run/spotlessApply.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="spotlessApply" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--init-script=gradle/init.gradle.kts" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="spotlessApply" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>
3 changes: 3 additions & 0 deletions app-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ dependencies {
implementation(projects.core.model)
implementation(projects.core.provider)

implementation(projects.sync.work)

androidTestImplementation(projects.core.testing)
androidTestImplementation(projects.core.datastoreTest)
androidTestImplementation(projects.core.dataTest)
Expand All @@ -131,6 +133,7 @@ dependencies {
implementation(libs.androidx.window.manager)
implementation(libs.androidx.work.ktx)
implementation(libs.androidx.profileinstaller)
implementation(libs.accompanist.navigation.material)
implementation(libs.coil.kt)
implementation(libs.coil.kt.svg)
implementation(libs.hilt.ext.work)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import androidx.navigation.compose.ComposeNavigator
import androidx.navigation.compose.composable
import androidx.navigation.createGraph
import androidx.navigation.testing.TestNavHostController
import com.google.accompanist.navigation.material.ExperimentalMaterialNavigationApi
import com.google.accompanist.navigation.material.rememberBottomSheetNavigator
import com.merxury.blocker.core.testing.util.TestNetworkMonitor
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
Expand All @@ -48,7 +50,7 @@ import kotlin.test.assertTrue
* Note: This could become an unit test if Robolectric is added to the project and the Context
* is faked.
*/
@OptIn(ExperimentalMaterial3WindowSizeClassApi::class)
@OptIn(ExperimentalMaterial3WindowSizeClassApi::class, ExperimentalMaterialNavigationApi::class)
class BlockerAppStateTest {

@get:Rule
Expand All @@ -65,10 +67,12 @@ class BlockerAppStateTest {
var currentDestination: String? = null

composeTestRule.setContent {
val bottomSheetNavigator = rememberBottomSheetNavigator()
val navController = rememberTestNavController()
state = remember(navController) {
BlockerAppState(
windowSizeClass = getCompactWindowClass(),
bottomSheetNavigator = bottomSheetNavigator,
navController = navController,
networkMonitor = networkMonitor,
coroutineScope = backgroundScope,
Expand Down Expand Up @@ -105,8 +109,10 @@ class BlockerAppStateTest {
@Test
fun blockerAppState_showBottomBar_compact() = runTest {
composeTestRule.setContent {
val bottomSheetNavigator = rememberBottomSheetNavigator()
state = BlockerAppState(
windowSizeClass = getCompactWindowClass(),
bottomSheetNavigator = bottomSheetNavigator,
navController = NavHostController(LocalContext.current),
networkMonitor = networkMonitor,
coroutineScope = backgroundScope,
Expand All @@ -120,8 +126,10 @@ class BlockerAppStateTest {
@Test
fun blockerAppState_showNavRail_medium() = runTest {
composeTestRule.setContent {
val bottomSheetNavigator = rememberBottomSheetNavigator()
state = BlockerAppState(
windowSizeClass = WindowSizeClass.calculateFromSize(DpSize(800.dp, 800.dp)),
bottomSheetNavigator = bottomSheetNavigator,
navController = NavHostController(LocalContext.current),
networkMonitor = networkMonitor,
coroutineScope = backgroundScope,
Expand All @@ -135,8 +143,10 @@ class BlockerAppStateTest {
@Test
fun blockerAppState_showNavRail_large() = runTest {
composeTestRule.setContent {
val bottomSheetNavigator = rememberBottomSheetNavigator()
state = BlockerAppState(
windowSizeClass = WindowSizeClass.calculateFromSize(DpSize(900.dp, 1200.dp)),
bottomSheetNavigator = bottomSheetNavigator,
navController = NavHostController(LocalContext.current),
networkMonitor = networkMonitor,
coroutineScope = backgroundScope,
Expand All @@ -150,8 +160,10 @@ class BlockerAppStateTest {
@Test
fun stateIsOfflineWhenNetworkMonitorIsOffline() = runTest(UnconfinedTestDispatcher()) {
composeTestRule.setContent {
val bottomSheetNavigator = rememberBottomSheetNavigator()
state = BlockerAppState(
windowSizeClass = WindowSizeClass.calculateFromSize(DpSize(900.dp, 1200.dp)),
bottomSheetNavigator = bottomSheetNavigator,
navController = NavHostController(LocalContext.current),
networkMonitor = networkMonitor,
coroutineScope = backgroundScope,
Expand Down
Loading

0 comments on commit 5db6da8

Please sign in to comment.