Skip to content

Commit

Permalink
Merge pull request #678 from KovalevAndrey/2.x-remove-utils-classes-f…
Browse files Browse the repository at this point in the history
…rom-publication

Appyx-interactions cleanup
  • Loading branch information
zsoltk authored Feb 12, 2024
2 parents bf13c67 + 59de12d commit 0bd6e47
Show file tree
Hide file tree
Showing 45 changed files with 178 additions and 146 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ dependencies {

implementation(project(":demos:common"))

implementation(project(":appyx-interactions:android"))
implementation(project(":appyx-interactions:appyx-interactions"))
implementation(project(":appyx-interactions:android-utils"))
implementation(project(":appyx-components:experimental:cards:cards"))
implementation(composeBom)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import com.bumble.appyx.demos.common.profile.ProfileCard
import com.bumble.appyx.interactions.core.AppyxInteractionsContainer
import com.bumble.appyx.interactions.core.gesture.GestureValidator.Companion.permissiveValidator
import com.bumble.appyx.interactions.core.ui.helper.AppyxComponentSetup
import com.bumble.appyx.interactions.theme.appyx_dark
import com.bumble.appyx.interactions.utils.ui.theme.appyx_dark
import kotlin.math.roundToInt

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ appyx {

dependencies {
val composeBom = platform(libs.compose.bom)

api(project(":appyx-interactions:android"))
api(project(":appyx-interactions:android-utils"))

implementation(project(":appyx-interactions:appyx-interactions"))
implementation(project(":appyx-components:experimental:promoter:promoter"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ import com.bumble.appyx.interactions.core.AppyxInteractionsContainer
import com.bumble.appyx.interactions.core.model.transition.Operation.Mode.IMMEDIATE
import com.bumble.appyx.interactions.core.model.transition.Operation.Mode.KEYFRAME
import com.bumble.appyx.interactions.core.ui.helper.AppyxComponentSetup
import com.bumble.appyx.interactions.sample.InteractionTarget
import com.bumble.appyx.interactions.sample.InteractionTarget.Child1
import com.bumble.appyx.interactions.sample.InteractionTarget.Child2
import com.bumble.appyx.interactions.sample.InteractionTarget.Child3
import com.bumble.appyx.interactions.sample.InteractionTarget.Child4
import com.bumble.appyx.interactions.sample.android.Element
import com.bumble.appyx.interactions.utils.ui.Element
import com.bumble.appyx.interactions.utils.testing.TestTarget
import com.bumble.appyx.interactions.utils.testing.TestTarget.Child1
import com.bumble.appyx.interactions.utils.testing.TestTarget.Child2
import com.bumble.appyx.interactions.utils.testing.TestTarget.Child3
import com.bumble.appyx.interactions.utils.testing.TestTarget.Child4
import kotlin.math.roundToInt


Expand All @@ -47,7 +47,7 @@ fun PromoterExperiment(modifier: Modifier = Modifier) {
val promoter = remember {
Promoter(
scope = coroutineScope,
model = PromoterModel<InteractionTarget>(savedStateMap = null),
model = PromoterModel<TestTarget>(savedStateMap = null),
visualisation = {
PromoterVisualisation(
uiContext = it
Expand Down Expand Up @@ -100,13 +100,13 @@ fun PromoterExperiment(modifier: Modifier = Modifier) {
horizontalArrangement = Arrangement.Center
) {
Button(
onClick = { promoter.addFirst(InteractionTarget.values().random(), KEYFRAME) }
onClick = { promoter.addFirst(TestTarget.entries.random(), KEYFRAME) }
) {
Text("KEYFRAME")
}
Spacer(Modifier.size(24.dp))
Button(
onClick = { promoter.addFirst(InteractionTarget.values().random(), IMMEDIATE) }
onClick = { promoter.addFirst(TestTarget.entries.random(), IMMEDIATE) }
) {
Text("IMMEDIATE")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ appyx {

dependencies {
implementation(project(":appyx-components:experimental:puzzle15:puzzle15"))
implementation(project(":appyx-interactions:android"))
implementation(project(":appyx-interactions:android-utils"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalDensity
import com.bumble.appyx.components.experimental.puzzle15.ui.Puzzle15Ui
import com.bumble.appyx.interactions.theme.appyx_dark
import com.bumble.appyx.interactions.utils.ui.theme.appyx_dark
import kotlin.math.roundToInt

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ appyx {

dependencies {
implementation(project(":appyx-components:internal:test-drive:test-drive"))
implementation(project(":appyx-interactions:android"))
implementation(project(":appyx-interactions:android-utils"))

androidTestImplementation(libs.compose.ui.test.junit4)
debugRuntimeOnly(libs.compose.ui.test.manifest)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import androidx.compose.ui.test.performTouchInput
import androidx.compose.ui.unit.dp
import com.bumble.appyx.components.internal.testdrive.TEST_DRIVE_EXPERIMENT_TEST_HELPER
import com.bumble.appyx.components.internal.testdrive.android.helper.createTestDrive
import com.bumble.appyx.interactions.testing.snapshot
import com.bumble.appyx.interactions.utils.testing.snapshot
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TestName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import androidx.compose.ui.test.performClick
import com.bumble.appyx.components.internal.testdrive.android.helper.createTestDrive
import com.bumble.appyx.components.internal.testdrive.operation.Next
import com.bumble.appyx.interactions.core.model.transition.Operation
import com.bumble.appyx.interactions.testing.snapshot
import com.bumble.appyx.interactions.utils.testing.snapshot
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import androidx.compose.ui.test.junit4.createComposeRule
import com.bumble.appyx.components.internal.testdrive.android.helper.createTestDrive
import com.bumble.appyx.components.internal.testdrive.operation.Next
import com.bumble.appyx.interactions.core.model.transition.Operation
import com.bumble.appyx.interactions.testing.snapshot
import com.bumble.appyx.interactions.utils.testing.snapshot
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TestName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import androidx.compose.ui.test.junit4.createComposeRule
import com.bumble.appyx.components.internal.testdrive.android.helper.createTestDrive
import com.bumble.appyx.components.internal.testdrive.operation.Next
import com.bumble.appyx.interactions.core.model.transition.Operation
import com.bumble.appyx.interactions.testing.snapshot
import com.bumble.appyx.interactions.utils.testing.snapshot
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TestName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import androidx.compose.ui.test.junit4.createComposeRule
import com.bumble.appyx.components.internal.testdrive.android.helper.createTestDrive
import com.bumble.appyx.components.internal.testdrive.operation.Next
import com.bumble.appyx.interactions.core.model.transition.Operation
import com.bumble.appyx.interactions.testing.snapshot
import com.bumble.appyx.interactions.utils.testing.snapshot
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TestName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import com.bumble.appyx.components.internal.testdrive.TestDriveUi
import com.bumble.appyx.components.internal.testdrive.ui.simple.TestDriveSimpleVisualisation
import com.bumble.appyx.interactions.core.gesture.GestureValidator.Companion.permissiveValidator
import com.bumble.appyx.interactions.core.ui.helper.AppyxComponentSetup
import com.bumble.appyx.interactions.sample.InteractionTarget
import com.bumble.appyx.interactions.theme.appyx_dark
import com.bumble.appyx.interactions.utils.testing.TestTarget
import com.bumble.appyx.interactions.utils.ui.theme.appyx_dark
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlin.math.roundToInt
Expand All @@ -30,9 +30,9 @@ fun ComposeContentTestRule.createTestDrive(
easing = LinearEasing
),
uiAnimationSpec: SpringSpec<Float> = spring()
): TestDrive<InteractionTarget> {
): TestDrive<TestTarget> {
val model = TestDriveModel(
element = InteractionTarget.Child1,
element = TestTarget.Child1,
savedStateMap = null
)
return TestDrive(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalDensity
import com.bumble.appyx.components.internal.testdrive.TestDriveExperiment
import com.bumble.appyx.interactions.sample.InteractionTarget
import com.bumble.appyx.interactions.theme.appyx_dark
import com.bumble.appyx.interactions.utils.testing.TestTarget
import com.bumble.appyx.interactions.utils.ui.theme.appyx_dark
import kotlin.math.roundToInt

@Composable
fun TestDriveExperiment(modifier: Modifier = Modifier) {
TestDriveExperiment(
screenWidthPx = (LocalConfiguration.current.screenWidthDp * LocalDensity.current.density).roundToInt(),
screenHeightPx = (LocalConfiguration.current.screenHeightDp * LocalDensity.current.density).roundToInt(),
element = InteractionTarget.Child1,
element = TestTarget.Child1,
modifier = modifier.fillMaxSize().background(appyx_dark),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies {

androidTestImplementation(composeBom)
androidTestImplementation(project(":appyx-components:standard:backstack:backstack"))
androidTestImplementation(project(":appyx-interactions:android"))
androidTestImplementation(project(":appyx-interactions:android-utils"))
androidTestImplementation(project(":appyx-interactions:appyx-interactions"))
androidTestImplementation(libs.compose.ui.test.junit4)
androidTestImplementation(libs.junit.api)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import com.bumble.appyx.components.backstack.ui.stack3d.BackStack3D
import com.bumble.appyx.interactions.core.model.transition.Operation
import com.bumble.appyx.interactions.core.ui.Visualisation
import com.bumble.appyx.interactions.core.ui.context.UiContext
import com.bumble.appyx.interactions.testing.TestTarget
import com.bumble.appyx.interactions.testing.setupAppyxComponent
import com.bumble.appyx.interactions.testing.waitUntilAnimationEnded
import com.bumble.appyx.interactions.testing.waitUntilAnimationStarted
import com.bumble.appyx.interactions.utils.testing.setupAppyxComponent
import com.bumble.appyx.interactions.utils.testing.waitUntilAnimationEnded
import com.bumble.appyx.interactions.utils.testing.waitUntilAnimationStarted
import com.bumble.appyx.interactions.utils.testing.TestTarget
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import org.junit.Assert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import com.bumble.appyx.components.backstack.BackStack
import com.bumble.appyx.components.backstack.BackStackModel
import com.bumble.appyx.components.backstack.operation.push
import com.bumble.appyx.interactions.core.model.transition.Update
import com.bumble.appyx.interactions.testing.TestTarget
import com.bumble.appyx.interactions.testing.setupAppyxComponent
import com.bumble.appyx.interactions.utils.testing.setupAppyxComponent
import com.bumble.appyx.interactions.utils.testing.TestTarget
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import org.junit.Assert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependencies {
androidTestImplementation(composeBom)

androidTestImplementation(project(":appyx-components:standard:spotlight:spotlight"))
androidTestImplementation(project(":appyx-interactions:android"))
androidTestImplementation(project(":appyx-interactions:android-utils"))
androidTestImplementation(libs.compose.ui.test.junit4)
androidTestImplementation(libs.junit.api)
androidTestImplementation(libs.compose.ui.test.manifest)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import com.bumble.appyx.components.spotlight.SpotlightModel
import com.bumble.appyx.components.spotlight.operation.last
import com.bumble.appyx.components.spotlight.ui.slider.SpotlightSlider
import com.bumble.appyx.interactions.core.model.transition.Operation
import com.bumble.appyx.interactions.testing.TestTarget
import com.bumble.appyx.interactions.testing.setupAppyxComponent
import com.bumble.appyx.interactions.testing.waitUntilAnimationEnded
import com.bumble.appyx.interactions.utils.testing.TestTarget
import com.bumble.appyx.interactions.utils.testing.setupAppyxComponent
import com.bumble.appyx.interactions.utils.testing.waitUntilAnimationEnded
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import org.junit.Assert.assertEquals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.test.hasContentDescription
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.performTouchInput
import com.bumble.appyx.components.spotlight.operation.next
import com.bumble.appyx.components.spotlight.android.utils.SPOTLIGHT_EXPERIMENT_TEST_HELPER
import com.bumble.appyx.components.spotlight.android.utils.createSpotlight
import com.bumble.appyx.components.spotlight.operation.next
import com.bumble.appyx.interactions.core.model.transition.Operation
import com.bumble.appyx.interactions.sample.InteractionTarget.Child1
import com.bumble.appyx.interactions.sample.InteractionTarget.Child2
import com.bumble.appyx.interactions.sample.InteractionTarget.Child3
import com.bumble.appyx.interactions.sample.InteractionTarget.Child4
import com.bumble.appyx.interactions.sample.InteractionTarget.Child5
import com.bumble.appyx.interactions.sample.InteractionTarget.Child6
import com.bumble.appyx.interactions.testing.snapshot
import com.bumble.appyx.interactions.utils.testing.TestTarget.Child1
import com.bumble.appyx.interactions.utils.testing.TestTarget.Child2
import com.bumble.appyx.interactions.utils.testing.TestTarget.Child3
import com.bumble.appyx.interactions.utils.testing.TestTarget.Child4
import com.bumble.appyx.interactions.utils.testing.TestTarget.Child5
import com.bumble.appyx.interactions.utils.testing.TestTarget.Child6
import com.bumble.appyx.interactions.utils.testing.snapshot
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ import com.bumble.appyx.components.spotlight.Spotlight
import com.bumble.appyx.components.spotlight.SpotlightModel
import com.bumble.appyx.components.spotlight.ui.slider.SpotlightSlider
import com.bumble.appyx.interactions.core.ui.helper.AppyxComponentSetup
import com.bumble.appyx.interactions.sample.InteractionTarget
import com.bumble.appyx.interactions.sample.android.Element
import com.bumble.appyx.interactions.sample.android.SampleAppyxContainer
import com.bumble.appyx.interactions.theme.appyx_dark
import com.bumble.appyx.interactions.utils.testing.TestTarget
import com.bumble.appyx.interactions.utils.ui.Element
import com.bumble.appyx.interactions.utils.ui.SampleAppyxContainer
import com.bumble.appyx.interactions.utils.ui.theme.appyx_dark
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers

fun ComposeContentTestRule.createSpotlight(
items: List<InteractionTarget>,
items: List<TestTarget>,
animationSpec: AnimationSpec<Float> = tween(
durationMillis = 1000,
easing = LinearEasing
)
): Spotlight<InteractionTarget> {
): Spotlight<TestTarget> {
val model = SpotlightModel(
items = items,
savedStateMap = null
Expand Down
26 changes: 26 additions & 0 deletions appyx-interactions/android-utils/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
plugins {
id("com.bumble.appyx.android.library")
}

appyx {
namespace.set("com.bumble.appyx.interactions.utils")

buildFeatures {
compose.set(true)
kotlinParcelize.set(true)
}
}

dependencies {

api(project(":appyx-interactions:appyx-interactions"))
api(libs.compose.material3)

val composeBom = platform(libs.compose.bom)

implementation(composeBom)
implementation(libs.androidx.lifecycle.java8)
implementation(libs.compose.foundation)
implementation(libs.compose.ui.test.junit4)
implementation(libs.androidx.test.espresso.core)
}
4 changes: 4 additions & 0 deletions appyx-interactions/android-utils/lint-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="6" by="lint 8.2.1" type="baseline" client="gradle" dependencies="false" name="AGP (8.2.1)" variant="all" version="8.2.1">

</issues>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.bumble.appyx.interactions.testing
package com.bumble.appyx.interactions.utils.testing

import androidx.compose.ui.test.junit4.ComposeContentTestRule
import com.bumble.appyx.interactions.core.model.BaseAppyxComponent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.bumble.appyx.interactions.testing
package com.bumble.appyx.interactions.utils.testing

import android.os.Build
import androidx.annotation.RequiresApi
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.bumble.appyx.interactions.testing
package com.bumble.appyx.interactions.utils.testing

enum class TestTarget {
Child1, Child2, Child3, Child4, Child5, Child6, Child7, Child8, Child9, Child10
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.bumble.appyx.interactions.testing
package com.bumble.appyx.interactions.utils.testing

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
Expand All @@ -14,8 +14,8 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.test.junit4.ComposeContentTestRule
import com.bumble.appyx.interactions.core.model.BaseAppyxComponent
import com.bumble.appyx.interactions.core.ui.helper.AppyxComponentSetup
import com.bumble.appyx.interactions.sample.android.SampleAppyxContainer
import com.bumble.appyx.interactions.theme.appyx_dark
import com.bumble.appyx.interactions.utils.ui.SampleAppyxContainer
import com.bumble.appyx.interactions.utils.ui.theme.appyx_dark
import kotlin.random.Random

fun <InteractionTarget : Any, ModelState : Any> ComposeContentTestRule.setupAppyxComponent(
Expand Down
Loading

0 comments on commit 0bd6e47

Please sign in to comment.