Skip to content

Commit

Permalink
Merge pull request #98 from michaelbel/develop
Browse files Browse the repository at this point in the history
1.4.2
  • Loading branch information
michaelbel authored Dec 19, 2022
2 parents 7907226 + c324112 commit 0706e5a
Show file tree
Hide file tree
Showing 141 changed files with 2,401 additions and 798 deletions.
5 changes: 5 additions & 0 deletions .github/pull_request_template
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
**Task:**

**Screenshots:**

<div style="dispaly:flex">
<!-- <img src="URL" width="40%"> -->
<!-- <img src="URL" width="40%"> -->
</div>
14 changes: 14 additions & 0 deletions .github/workflows/check_pr.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
name: Check PR

on:
# push:
# branches:
# '**'
# paths-ignore:
# - '**.md'
# - '.idea/**'
# - '.github/**'
pull_request:
branches:
'**'
paths-ignore:
- '**.md'
- '.idea/**'
- '.github/**'
workflow_dispatch:

concurrency:
Expand Down Expand Up @@ -60,5 +71,8 @@ jobs:
- name: Spotless
run: ./gradlew spotlessCheck

- name: Test
run: ./gradlew testDebug

- name: Build
run: ./gradlew compileDebugKotlin
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ jobs:
- uses: actions/checkout@v2
- uses: ncipollo/release-action@v1
with:
artifacts: "release.tar.gz,foo/*.txt"
artifacts: "release.tar.gz,foo/*.txt"
artifactErrorsFailBuild: false
generateReleaseNotes: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/buildSrc/build/classes/kotlin/main/org/michaelbel/moviemade/plugins/AndroidLibraryConventionPlugin.class
/buildSrc/build/classes/kotlin/main/org/michaelbel/moviemade/plugins/AndroidApplicationConventionPlugin.class
/.idea/kotlinc.xml
/.idea/assetWizardSettings.xml.xml
/buildSrc/build/classes/kotlin/main/org/michaelbel/moviemade/plugins/AndroidComposeLibraryConventionPlugin$$special$$inlined$getByType$1.class
/buildSrc/build/classes/kotlin/main/org/michaelbel/moviemade/plugins/AndroidComposeLibraryConventionPlugin.class
/buildSrc/build/classes/kotlin/main/org/michaelbel/moviemade/plugins/AndroidHiltConventionPlugin$$special$$inlined$getByType$1.class
Expand Down
57 changes: 44 additions & 13 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
import java.io.FileInputStream
import org.apache.commons.io.output.ByteArrayOutputStream
import org.jetbrains.kotlin.konan.properties.Properties
import org.michaelbel.moviemade.App
import org.michaelbel.moviemade.App.ApplicationId
import org.michaelbel.moviemade.App.BuildTools
import org.michaelbel.moviemade.App.VersionName

plugins {
id("movies-android-application")
Expand All @@ -15,9 +11,10 @@ plugins {
id("com.google.gms.google-services")
id("com.google.firebase.appdistribution")
id("com.google.firebase.crashlytics")
id("com.palantir.git-version")
}

val gitVersion: Int by lazy {
val gitCommitsCount: Int by lazy {
val stdout = ByteArrayOutputStream()
rootProject.exec {
commandLine("git", "rev-list", "--count", "HEAD")
Expand All @@ -38,6 +35,10 @@ val admobBannerId: String by lazy {
gradleLocalProperties(rootDir).getProperty("ADMOB_BANNER_ID")
}

val gitVersion: groovy.lang.Closure<String> by extra
val versionDetails: groovy.lang.Closure<com.palantir.gradle.gitversion.VersionDetails> by extra
val versionLastTag: String = versionDetails().lastTag

tasks.register("prepareReleaseNotes") {
doLast {
exec {
Expand All @@ -54,13 +55,15 @@ afterEvaluate {

android {
namespace = "org.michaelbel.moviemade"
buildToolsVersion = BuildTools

defaultConfig {
applicationId = ApplicationId
versionCode = gitVersion
versionName = VersionName
testInstrumentationRunner = App.TestInstrumentationRunner
applicationId = "org.michaelbel.moviemade"
minSdk = libs.versions.min.sdk.get().toInt()
compileSdk = libs.versions.compile.sdk.get().toInt()
targetSdk = libs.versions.target.sdk.get().toInt()
versionCode = gitCommitsCount
versionName = versionLastTag
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
resourceConfigurations.addAll(listOf("en", "ru"))

Expand Down Expand Up @@ -116,19 +119,39 @@ android {
isShrinkResources = false
applicationIdSuffix = ".debug"
}
create("benchmark") {
initWith(getByName("release"))
signingConfig = signingConfigs.getByName("debug")
matchingFallbacks.add("release")
proguardFiles("benchmark-rules.pro")
isDebuggable = false
}
}

buildFeatures {
viewBinding = true
compose = true
}

kotlinOptions {
freeCompilerArgs = freeCompilerArgs + listOf(
"-Xopt-in=androidx.compose.material3.ExperimentalMaterial3Api",
"-Xopt-in=androidx.lifecycle.compose.ExperimentalLifecycleComposeApi",
"-Xopt-in=androidx.compose.animation.ExperimentalAnimationApi"
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api",
"-opt-in=androidx.lifecycle.compose.ExperimentalLifecycleComposeApi",
"-opt-in=androidx.compose.animation.ExperimentalAnimationApi"
)
}

composeOptions {
kotlinCompilerExtensionVersion = libs.versions.kotlin.compiler.extension.get()
}

lint {
quiet = true
abortOnError = false
ignoreWarnings = true
checkDependencies = true
lintConfig = file("${project.rootDir}/config/codestyle/lint.xml")
}
}

dependencies {
Expand All @@ -139,4 +162,12 @@ dependencies {
implementation(project(":feature:details"))
implementation(project(":feature:feed"))
implementation(project(":feature:settings"))

implementation(libs.androidx.profile.installer)

testImplementation(libs.junit)
androidTestImplementation(libs.androidx.test.ext.junit.ktx)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(libs.androidx.compose.ui.test.junit4)
androidTestImplementation(libs.androidx.benchmark.junit)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package org.michaelbel.movies

import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.ui.Modifier
import androidx.compose.ui.test.assert
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.hasClickAction
import androidx.compose.ui.test.hasNoClickAction
import androidx.compose.ui.test.junit4.ComposeContentTestRule
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.unit.dp
import org.junit.Rule
import org.junit.Test
import org.michaelbel.movies.settings.ui.SettingsDynamicColorsBox
import org.michaelbel.movies.ui.theme.MoviesTheme

class SettingsDynamicColorsBoxTest {

@get:Rule
val composeTestRule: ComposeContentTestRule = createComposeRule()

@Test
fun testSettingsDynamicColorsBox() {
composeTestRule.setContent {
MoviesTheme {
SettingsDynamicColorsBox(
modifier = Modifier
.fillMaxWidth()
.height(48.dp)
.clickable {},
isDynamicColorsEnabled = IS_DYNAMIC_COLORS_ENABLED
)
}
}

composeTestRule
.onNodeWithTag(testTag = "ConstraintLayout", useUnmergedTree = true)
.assert(hasClickAction())

composeTestRule
.onNodeWithTag(testTag = "Text", useUnmergedTree = true)
.assertIsDisplayed()
.assert(hasNoClickAction())

composeTestRule
.onNodeWithTag(testTag = "Switch", useUnmergedTree = true)
.assertIsDisplayed()
.assert(hasNoClickAction())
}

private companion object {
private const val IS_DYNAMIC_COLORS_ENABLED = true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package org.michaelbel.movies

import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.ui.Modifier
import androidx.compose.ui.test.assert
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.hasClickAction
import androidx.compose.ui.test.hasNoClickAction
import androidx.compose.ui.test.junit4.ComposeContentTestRule
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.unit.dp
import org.junit.Rule
import org.junit.Test
import org.michaelbel.movies.settings.ui.SettingsLanguageBox
import org.michaelbel.movies.ui.language.model.AppLanguage
import org.michaelbel.movies.ui.theme.MoviesTheme

class SettingsLanguageBoxTest {

@get:Rule
val composeTestRule: ComposeContentTestRule = createComposeRule()

@Test
fun testSettingsLanguageBox() {
composeTestRule.setContent {
MoviesTheme {
SettingsLanguageBox(
modifier = Modifier
.fillMaxWidth()
.height(48.dp)
.clickable {},
currentLanguage = CURRENT_LANGUAGE
)
}
}

composeTestRule
.onNodeWithTag(testTag = "ConstraintLayout", useUnmergedTree = true)
.assert(hasClickAction())

composeTestRule
.onNodeWithTag(testTag = "TitleText", useUnmergedTree = true)
.assertIsDisplayed()
.assert(hasNoClickAction())

composeTestRule
.onNodeWithTag(testTag = "ValueText", useUnmergedTree = true)
.assertIsDisplayed()
.assert(hasNoClickAction())
}

private companion object {
private val CURRENT_LANGUAGE = AppLanguage.English
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package org.michaelbel.movies

import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.ui.Modifier
import androidx.compose.ui.test.assert
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.hasClickAction
import androidx.compose.ui.test.hasNoClickAction
import androidx.compose.ui.test.junit4.ComposeContentTestRule
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.unit.dp
import org.junit.Rule
import org.junit.Test
import org.michaelbel.movies.settings.ui.SettingsPostNotificationsBox
import org.michaelbel.movies.ui.theme.MoviesTheme

class SettingsPostNotificationsBoxTest {

@get:Rule
val composeTestRule: ComposeContentTestRule = createComposeRule()

@Test
fun testSettingsPostNotificationsBox() {
composeTestRule.setContent {
MoviesTheme {
SettingsPostNotificationsBox(
modifier = Modifier
.fillMaxWidth()
.height(48.dp)
.clickable {},
areNotificationsEnabled = ARE_NOTIFICATIONS_ENABLED
)
}
}

composeTestRule
.onNodeWithTag(testTag = "ConstraintLayout", useUnmergedTree = true)
.assert(hasClickAction())

composeTestRule
.onNodeWithTag(testTag = "Text", useUnmergedTree = true)
.assertIsDisplayed()
.assert(hasNoClickAction())

composeTestRule
.onNodeWithTag(testTag = "Switch", useUnmergedTree = true)
.assertIsDisplayed()
.assert(hasNoClickAction())
}

private companion object {
private const val ARE_NOTIFICATIONS_ENABLED = true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package org.michaelbel.movies

import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.ui.Modifier
import androidx.compose.ui.test.assert
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.hasClickAction
import androidx.compose.ui.test.hasNoClickAction
import androidx.compose.ui.test.junit4.ComposeContentTestRule
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.unit.dp
import org.junit.Rule
import org.junit.Test
import org.michaelbel.movies.settings.ui.SettingsReviewBox
import org.michaelbel.movies.ui.theme.MoviesTheme

class SettingsReviewBoxTest {

@get:Rule
val composeTestRule: ComposeContentTestRule = createComposeRule()

@Test
fun testSettingsReviewBox() {
composeTestRule.setContent {
MoviesTheme {
SettingsReviewBox(
modifier = Modifier
.fillMaxWidth()
.height(48.dp)
.clickable {}
)
}
}

composeTestRule
.onNodeWithTag(testTag = "ConstraintLayout", useUnmergedTree = true)
.assert(hasClickAction())

composeTestRule
.onNodeWithTag(testTag = "Text", useUnmergedTree = true)
.assertIsDisplayed()
.assert(hasNoClickAction())
}
}
Loading

0 comments on commit 0706e5a

Please sign in to comment.