diff --git a/.cicdtemplate/.github/workflows/config/changelog-release.json b/.cicdtemplate/.github/workflows/config/changelog-release.json new file mode 100644 index 000000000..34c629417 --- /dev/null +++ b/.cicdtemplate/.github/workflows/config/changelog-release.json @@ -0,0 +1,35 @@ +{ + "categories": [ + { + "title": "## โœจ Features", + "labels": [ + "type : feature" + ], + "empty_content": "N/A" + }, + { + "title": "## ๐Ÿ› Bug fixes", + "labels": [ + "type : bug" + ], + "empty_content": "N/A" + }, + { + "title": "## ๐Ÿงน Chores", + "labels": [ + "type : chore" + ], + "empty_content": "N/A" + }, + { + "title": "## Others", + "exclude_labels": [ + "type : feature", + "type : bug", + "type : chore", + "type : release" + ] + } + ], + "max_pull_requests": 200 +} diff --git a/.cicdtemplate/.github/workflows/create_release_pull_request.yml b/.cicdtemplate/.github/workflows/create_release_pull_request.yml new file mode 100644 index 000000000..91ea40fa2 --- /dev/null +++ b/.cicdtemplate/.github/workflows/create_release_pull_request.yml @@ -0,0 +1,25 @@ +name: Create the Release pull request + +on: + workflow_dispatch: + +jobs: + create_release_pull_request: + name: Create the Release pull request + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - name: Check out the latest code + uses: actions/checkout@v4 + + - name: Read the current version + id: version + run: echo "version=$(perl -nle 'print $1 if /ANDROID_VERSION_NAME = \"(.*)\"$/' buildSrc/src/main/java/Versions.kt)" >> $GITHUB_OUTPUT + + - uses: nimblehq/github-actions-workflows/create_release_pull_request@0.1.10 + with: + release_version: ${{ steps.version.outputs.version }} + changelog_configuration: ".github/workflows/config/changelog-release.json" + assignee: bot-nimble diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 393c6dcba..5ebe17102 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,6 +1,6 @@ # Team # @ryan-conway is the Team Lead and the others are team members -* @AVI5HEK @chornerman @doannimble @hoangnguyen92dn @kaungkhantsoe @luongvo @lydiasama @manh-t @minhnimble @ryan-conway @sleepylee @thiennguyen0196 @toby-thanathip @Wadeewee +* @AVI5HEK @chornerman @doannimble @hoangnguyen92dn @Johnsonmaung @kaungkhantsoe @luongvo @manh-t @minhnimble @ryan-conway @sleepylee @thiennguyen0196 @toby-thanathip # Engineering Leads CODEOWNERS @nimblehq/engineering-leads diff --git a/.github/workflows/config/changelog-release.json b/.github/workflows/config/changelog-release.json new file mode 100644 index 000000000..34c629417 --- /dev/null +++ b/.github/workflows/config/changelog-release.json @@ -0,0 +1,35 @@ +{ + "categories": [ + { + "title": "## โœจ Features", + "labels": [ + "type : feature" + ], + "empty_content": "N/A" + }, + { + "title": "## ๐Ÿ› Bug fixes", + "labels": [ + "type : bug" + ], + "empty_content": "N/A" + }, + { + "title": "## ๐Ÿงน Chores", + "labels": [ + "type : chore" + ], + "empty_content": "N/A" + }, + { + "title": "## Others", + "exclude_labels": [ + "type : feature", + "type : bug", + "type : chore", + "type : release" + ] + } + ], + "max_pull_requests": 200 +} diff --git a/.github/workflows/create_release_pull_request.yml b/.github/workflows/create_release_pull_request.yml new file mode 100644 index 000000000..3c3a31325 --- /dev/null +++ b/.github/workflows/create_release_pull_request.yml @@ -0,0 +1,28 @@ +name: Create the Release pull request + +on: + workflow_dispatch: + +jobs: + create_release_pull_request: + name: Create the Release pull request + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - name: Check out the latest code + uses: actions/checkout@v4 + + - name: Read the current version + id: version + uses: christian-draeger/read-properties@1.1.1 + with: + path: "version.properties" + properties: "templateScriptVersion" + + - uses: nimblehq/github-actions-workflows/create_release_pull_request@0.1.10 + with: + release_version: ${{ steps.version.outputs.templateScriptVersion }} + changelog_configuration: ".github/workflows/config/changelog-release.json" + assignee: bot-nimble diff --git a/sample-compose/app/build.gradle.kts b/sample-compose/app/build.gradle.kts index 1ddb5fd9e..38739b5d8 100644 --- a/sample-compose/app/build.gradle.kts +++ b/sample-compose/app/build.gradle.kts @@ -132,7 +132,8 @@ dependencies { implementation("androidx.compose.material:material") implementation("androidx.navigation:navigation-compose:${Versions.COMPOSE_NAVIGATION_VERSION}") - implementation("com.google.accompanist:accompanist-permissions:${Versions.ACCOMPANIST_PERMISSIONS_VERSION}") + implementation("com.google.accompanist:accompanist-permissions:${Versions.ACCOMPANIST_VERSION}") + implementation("com.google.accompanist:accompanist-systemuicontroller:${Versions.ACCOMPANIST_VERSION}") implementation("androidx.datastore:datastore-preferences:${Versions.ANDROIDX_DATASTORE_PREFERENCES_VERSION}") diff --git a/sample-compose/app/src/main/java/co/nimblehq/sample/compose/ui/base/BaseScreen.kt b/sample-compose/app/src/main/java/co/nimblehq/sample/compose/ui/base/BaseScreen.kt new file mode 100644 index 000000000..e2255c0e3 --- /dev/null +++ b/sample-compose/app/src/main/java/co/nimblehq/sample/compose/ui/base/BaseScreen.kt @@ -0,0 +1,21 @@ +package co.nimblehq.sample.compose.ui.base + +import androidx.compose.runtime.Composable +import androidx.compose.ui.res.colorResource +import co.nimblehq.sample.compose.R +import co.nimblehq.sample.compose.util.setStatusBarColor + +@Composable +fun BaseScreen( + isDarkStatusBarIcons: Boolean? = null, + content: @Composable () -> Unit, +) { + if (isDarkStatusBarIcons != null) { + setStatusBarColor( + color = colorResource(id = R.color.statusBarColor), + darkIcons = isDarkStatusBarIcons, + ) + } + + content() +} diff --git a/sample-compose/app/src/main/java/co/nimblehq/sample/compose/ui/screens/main/home/HomeScreen.kt b/sample-compose/app/src/main/java/co/nimblehq/sample/compose/ui/screens/main/home/HomeScreen.kt index b63436bcc..6f5689d74 100644 --- a/sample-compose/app/src/main/java/co/nimblehq/sample/compose/ui/screens/main/home/HomeScreen.kt +++ b/sample-compose/app/src/main/java/co/nimblehq/sample/compose/ui/screens/main/home/HomeScreen.kt @@ -16,6 +16,7 @@ import co.nimblehq.sample.compose.extensions.collectAsEffect import co.nimblehq.sample.compose.extensions.showToast import co.nimblehq.sample.compose.lib.IsLoading import co.nimblehq.sample.compose.ui.base.BaseDestination +import co.nimblehq.sample.compose.ui.base.BaseScreen import co.nimblehq.sample.compose.ui.common.AppBar import co.nimblehq.sample.compose.ui.models.UiModel import co.nimblehq.sample.compose.ui.showToast @@ -28,6 +29,8 @@ fun HomeScreen( viewModel: HomeViewModel = hiltViewModel(), navigator: (destination: BaseDestination) -> Unit, isResultOk: Boolean = false, +) = BaseScreen( + isDarkStatusBarIcons = true, ) { val context = LocalContext.current viewModel.error.collectAsEffect { e -> e.showToast(context) } diff --git a/sample-compose/app/src/main/java/co/nimblehq/sample/compose/ui/screens/main/second/SecondScreen.kt b/sample-compose/app/src/main/java/co/nimblehq/sample/compose/ui/screens/main/second/SecondScreen.kt index 605d093db..5fc0172d1 100644 --- a/sample-compose/app/src/main/java/co/nimblehq/sample/compose/ui/screens/main/second/SecondScreen.kt +++ b/sample-compose/app/src/main/java/co/nimblehq/sample/compose/ui/screens/main/second/SecondScreen.kt @@ -15,6 +15,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.hilt.navigation.compose.hiltViewModel import co.nimblehq.sample.compose.R import co.nimblehq.sample.compose.ui.base.BaseDestination +import co.nimblehq.sample.compose.ui.base.BaseScreen import co.nimblehq.sample.compose.ui.base.KeyResultOk import co.nimblehq.sample.compose.ui.common.AppBar import co.nimblehq.sample.compose.ui.theme.AppTheme.dimensions @@ -25,6 +26,8 @@ fun SecondScreen( viewModel: SecondViewModel = hiltViewModel(), navigator: (destination: BaseDestination) -> Unit, id: String, +) = BaseScreen( + isDarkStatusBarIcons = false, ) { SecondScreenContent( id = id, diff --git a/sample-compose/app/src/main/java/co/nimblehq/sample/compose/ui/screens/main/third/ThirdScreen.kt b/sample-compose/app/src/main/java/co/nimblehq/sample/compose/ui/screens/main/third/ThirdScreen.kt index 05d20cfa6..6e47f5209 100644 --- a/sample-compose/app/src/main/java/co/nimblehq/sample/compose/ui/screens/main/third/ThirdScreen.kt +++ b/sample-compose/app/src/main/java/co/nimblehq/sample/compose/ui/screens/main/third/ThirdScreen.kt @@ -14,6 +14,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.hilt.navigation.compose.hiltViewModel import co.nimblehq.sample.compose.R import co.nimblehq.sample.compose.ui.base.BaseDestination +import co.nimblehq.sample.compose.ui.base.BaseScreen import co.nimblehq.sample.compose.ui.common.AppBar import co.nimblehq.sample.compose.ui.models.UiModel import co.nimblehq.sample.compose.ui.theme.ComposeTheme @@ -23,6 +24,8 @@ fun ThirdScreen( viewModel: ThirdViewModel = hiltViewModel(), navigator: (destination: BaseDestination) -> Unit, model: UiModel?, +) = BaseScreen( + isDarkStatusBarIcons = true, ) { ThirdScreenContent(data = model) } diff --git a/sample-compose/app/src/main/java/co/nimblehq/sample/compose/util/ComposableUtil.kt b/sample-compose/app/src/main/java/co/nimblehq/sample/compose/util/ComposableUtil.kt new file mode 100644 index 000000000..f4830423f --- /dev/null +++ b/sample-compose/app/src/main/java/co/nimblehq/sample/compose/util/ComposableUtil.kt @@ -0,0 +1,22 @@ +package co.nimblehq.sample.compose.util + +import android.annotation.SuppressLint +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.ui.graphics.Color +import com.google.accompanist.systemuicontroller.rememberSystemUiController + +@SuppressLint("ComposableNaming") +@Composable +fun setStatusBarColor( + color: Color, + darkIcons: Boolean, +) { + val systemUiController = rememberSystemUiController() + LaunchedEffect(key1 = darkIcons) { + systemUiController.setStatusBarColor( + color = color, + darkIcons = darkIcons, + ) + } +} diff --git a/sample-compose/app/src/main/res/values/colors.xml b/sample-compose/app/src/main/res/values/colors.xml index 764d6f58e..cd0fde27d 100644 --- a/sample-compose/app/src/main/res/values/colors.xml +++ b/sample-compose/app/src/main/res/values/colors.xml @@ -1,4 +1,4 @@ - #FF669900 + #FF669900 diff --git a/sample-compose/app/src/main/res/values/styles.xml b/sample-compose/app/src/main/res/values/styles.xml index c82a3c111..380abe9eb 100644 --- a/sample-compose/app/src/main/res/values/styles.xml +++ b/sample-compose/app/src/main/res/values/styles.xml @@ -1,6 +1,6 @@ diff --git a/sample-compose/buildSrc/src/main/java/Versions.kt b/sample-compose/buildSrc/src/main/java/Versions.kt index cf87e968b..b3ac0e98c 100644 --- a/sample-compose/buildSrc/src/main/java/Versions.kt +++ b/sample-compose/buildSrc/src/main/java/Versions.kt @@ -6,10 +6,10 @@ object Versions { const val ANDROID_TARGET_SDK_VERSION = 33 const val ANDROID_VERSION_CODE = 1 - const val ANDROID_VERSION_NAME = "3.27.0" + const val ANDROID_VERSION_NAME = "3.29.0" // Dependencies (Alphabet sorted) - const val ACCOMPANIST_PERMISSIONS_VERSION = "0.30.1" + const val ACCOMPANIST_VERSION = "0.30.1" const val ANDROID_COMMON_KTX_VERSION = "0.1.1" const val ANDROID_CRYPTO_VERSION = "1.0.0" const val ANDROIDX_CORE_KTX_VERSION = "1.10.1" diff --git a/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/base/BaseScreen.kt b/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/base/BaseScreen.kt new file mode 100644 index 000000000..713fab898 --- /dev/null +++ b/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/base/BaseScreen.kt @@ -0,0 +1,13 @@ +package co.nimblehq.template.compose.ui.base + +import androidx.compose.runtime.Composable + +@Composable +fun BaseScreen( + // TODO Base parameters to request on all screens here + content: @Composable () -> Unit, +) { + // TODO Base logic for all screens here + + content() +} diff --git a/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/main/home/HomeScreen.kt b/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/main/home/HomeScreen.kt index dda7bd4d4..c45fe8e2a 100644 --- a/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/main/home/HomeScreen.kt +++ b/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/main/home/HomeScreen.kt @@ -18,6 +18,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import co.nimblehq.template.compose.R import co.nimblehq.template.compose.extensions.collectAsEffect import co.nimblehq.template.compose.ui.base.BaseDestination +import co.nimblehq.template.compose.ui.base.BaseScreen import co.nimblehq.template.compose.ui.models.UiModel import co.nimblehq.template.compose.ui.showToast import co.nimblehq.template.compose.ui.theme.AppTheme.dimensions @@ -28,7 +29,7 @@ import timber.log.Timber fun HomeScreen( viewModel: HomeViewModel = hiltViewModel(), navigator: (destination: BaseDestination) -> Unit, -) { +) = BaseScreen { val context = LocalContext.current viewModel.error.collectAsEffect { e -> e.showToast(context) } viewModel.navigator.collectAsEffect { destination -> navigator(destination) } diff --git a/version.properties b/version.properties index 01c96840e..59413f152 100644 --- a/version.properties +++ b/version.properties @@ -1,3 +1,3 @@ kotlinVersion=1.6.21 kscriptVersion=4.0.3 -templateScriptVersion=3.27.0 +templateScriptVersion=3.29.0