forked from KasperskyLab/Kaspresso
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KasperskyLab#310 separate compose module
- Loading branch information
Showing
29 changed files
with
138 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
plugins { | ||
id("convention.android-library") | ||
id("convention.publication-android-lib") | ||
} | ||
|
||
publish { | ||
artifactId.set("kaspresso-compose-support") | ||
} | ||
|
||
dependencies { | ||
api(libs.kakaoCompose) | ||
api(libs.composeUiTest) | ||
|
||
implementation(projects.kaspresso) | ||
implementation(libs.kotlinStdlib) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<manifest package="com.kaspersky.components.composesupport" /> |
27 changes: 27 additions & 0 deletions
27
...port/src/main/java/com/kaspersky/components/composesupport/ComposeInterceptorsInjector.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.kaspersky.components.composesupport | ||
|
||
import com.kaspersky.components.composesupport.interceptors.behavior.SemanticsBehaviorInterceptor | ||
import com.kaspersky.components.composesupport.interceptors.tolibrary.ComposeSemanticsInterceptor | ||
import com.kaspersky.components.composesupport.interceptors.watcher.SemanticsWatcherInterceptor | ||
import io.github.kakaocup.compose.KakaoCompose | ||
|
||
object ComposeInterceptorsInjector { | ||
|
||
fun injectKaspressoInKakaoCompose( | ||
semanticsBehaviorInterceptors: List<SemanticsBehaviorInterceptor>, | ||
semanticsWatcherInterceptors: List<SemanticsWatcherInterceptor> | ||
) { | ||
val composeInterceptor = | ||
ComposeSemanticsInterceptor( | ||
semanticsBehaviorInterceptors, | ||
semanticsWatcherInterceptors | ||
) | ||
|
||
KakaoCompose.intercept { | ||
onComposeInteraction { | ||
onCheck(isOverride = true, interceptor = composeInterceptor::interceptCheck) | ||
onPerform(isOverride = true, interceptor = composeInterceptor::interceptPerform) | ||
} | ||
} | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
...t/src/main/java/com/kaspersky/components/composesupport/ComposeSupportKaspressoBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.kaspersky.components.composesupport | ||
|
||
import com.kaspersky.components.composesupport.interceptors.behavior.SemanticsBehaviorInterceptor | ||
import com.kaspersky.components.composesupport.interceptors.behavior.impl.autoscroll.AutoScrollSemanticsBehaviorInterceptor | ||
import com.kaspersky.components.composesupport.interceptors.behavior.impl.elementloader.ElementLoaderSemanticsBehaviorInterceptor | ||
import com.kaspersky.components.composesupport.interceptors.behavior.impl.failure.FailureLoggingSemanticsBehaviorInterceptor | ||
import com.kaspersky.components.composesupport.interceptors.behavior.impl.flakysafety.FlakySafeSemanticsBehaviorInterceptor | ||
import com.kaspersky.components.composesupport.interceptors.behavior.impl.systemsafety.SystemDialogSafetySemanticsBehaviorInterceptor | ||
import com.kaspersky.components.composesupport.interceptors.watcher.SemanticsWatcherInterceptor | ||
import com.kaspersky.components.composesupport.interceptors.watcher.impl.LoggingSemanticsWatcherInterceptor | ||
import com.kaspersky.kaspresso.interceptors.behavior.impl.systemsafety.SystemDialogSafetyViewBehaviorInterceptor | ||
import com.kaspersky.kaspresso.kaspresso.Kaspresso | ||
|
||
/** | ||
* Kaspresso Builder that includes all appropriate interceptors to support Jetpack Compose. | ||
*/ | ||
fun Kaspresso.Builder.Companion.withComposeSupport( | ||
customize: Kaspresso.Builder.() -> Unit = {} | ||
): Kaspresso.Builder = simple(customize).addComposeSupport() | ||
|
||
/** | ||
* Kaspresso Builder that includes all appropriate interceptors to support Jetpack Compose. | ||
*/ | ||
fun Kaspresso.Builder.addComposeSupport(): Kaspresso.Builder = apply { | ||
val semanticsWatcherInterceptors: List<SemanticsWatcherInterceptor> = listOf( | ||
LoggingSemanticsWatcherInterceptor(libLogger) | ||
) | ||
|
||
val semanticsBehaviorInterceptors: List<SemanticsBehaviorInterceptor> = | ||
if (isAndroidRuntime) { | ||
listOf( | ||
AutoScrollSemanticsBehaviorInterceptor(libLogger, autoScrollParams), | ||
SystemDialogSafetySemanticsBehaviorInterceptor( | ||
libLogger, | ||
instrumentalDependencyProviderFactory.getInterceptorProvider<SystemDialogSafetySemanticsBehaviorInterceptor>(instrumentation), | ||
adbServer | ||
), | ||
ElementLoaderSemanticsBehaviorInterceptor(libLogger, elementLoaderParams), | ||
FlakySafeSemanticsBehaviorInterceptor(flakySafetyParams, libLogger), | ||
FailureLoggingSemanticsBehaviorInterceptor(libLogger) | ||
) | ||
} else { | ||
listOf( | ||
AutoScrollSemanticsBehaviorInterceptor(libLogger, autoScrollParams), | ||
ElementLoaderSemanticsBehaviorInterceptor(libLogger, elementLoaderParams), | ||
FlakySafeSemanticsBehaviorInterceptor(flakySafetyParams, libLogger), | ||
FailureLoggingSemanticsBehaviorInterceptor(libLogger) | ||
) | ||
} | ||
|
||
ComposeInterceptorsInjector.injectKaspressoInKakaoCompose( | ||
semanticsBehaviorInterceptors, | ||
semanticsWatcherInterceptors | ||
) | ||
} |
3 changes: 2 additions & 1 deletion
3
...scroll/SemanticsAutoScrollProviderImpl.kt → ...scroll/SemanticsAutoScrollProviderImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...viorcompose/ComposeBehaviorInterceptor.kt → ...rs/behavior/ComposeBehaviorInterceptor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...AutoScrollSemanticsBehaviorInterceptor.kt → ...AutoScrollSemanticsBehaviorInterceptor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...mentLoaderSemanticsBehaviorInterceptor.kt → ...mentLoaderSemanticsBehaviorInterceptor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ureLoggingSemanticsBehaviorInterceptor.kt → ...ureLoggingSemanticsBehaviorInterceptor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
.../FlakySafeSemanticsBehaviorInterceptor.kt → .../FlakySafeSemanticsBehaviorInterceptor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...alogSafetySemanticsBehaviorInterceptor.kt → ...alogSafetySemanticsBehaviorInterceptor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...ry/compose/ComposeSemanticsInterceptor.kt → .../tolibrary/ComposeSemanticsInterceptor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...cher/compose/ComposeWatcherInterceptor.kt → ...tors/watcher/ComposeWatcherInterceptor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ing/LoggingSemanticsWatcherInterceptor.kt → ...mpl/LoggingSemanticsWatcherInterceptor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.