Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#29] 1/2 - Prepare some necessary changes in the shared module before applying the Android submodule #41

Merged
merged 7 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ plugins {
val keystoreProperties = loadProperties("$rootDir/signing.properties")

android {
namespace = "co.nimblehq.kmm.template.android"
compileSdk = Versions.ANDROID_COMPILE_SDK_VERSION
namespace = "co.nimblehq.kmm.template"
compileSdk = Versions.ANDROID_COMPILE_SDK
defaultConfig {
applicationId = "co.nimblehq.kmm.template.android"
minSdk = Versions.ANDROID_MIN_SDK_VERSION
targetSdk = Versions.ANDROID_TARGET_SDK_VERSION
applicationId = "co.nimblehq.kmm.template"
minSdk = Versions.ANDROID_MIN_SDK
targetSdk = Versions.ANDROID_TARGET_SDK
versionCode = Versions.ANDROID_VERSION_CODE
versionName = Versions.ANDROID_VERSION_NAME
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.nimblehq.kmm.template.android.util
package co.nimblehq.kmm.template.util

import timber.log.Timber

Expand Down
4 changes: 2 additions & 2 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="co.nimblehq.kmm.template.android">
package="co.nimblehq.kmm.template">

<uses-permission android:name="android.permission.INTERNET"/>

<application
android:name=".MyApplication"
android:name=".MainApplication"
android:allowBackup="false"
android:label="@string/app_name"
android:supportsRtl="true"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package co.nimblehq.kmm.template.android
package co.nimblehq.kmm.template

import android.app.Application
import co.nimblehq.kmm.template.android.di.androidViewModelModule
import co.nimblehq.kmm.template.android.util.LogUtil
import co.nimblehq.kmm.template.di.androidViewModelModule
import co.nimblehq.kmm.template.util.LogUtil
import co.nimblehq.kmm.template.di.initKoin
import org.koin.android.ext.koin.androidContext

class MyApplication : Application() {
class MainApplication : Application() {

override fun onCreate() {
super.onCreate()
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.nimblehq.kmm.template.android.di
package co.nimblehq.kmm.template.di

import org.koin.core.module.Module
import org.koin.dsl.module
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package co.nimblehq.kmm.template.lib

typealias IsLoading = Boolean
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package co.nimblehq.kmm.template.android.ui.base
package co.nimblehq.kmm.template.ui.base

import androidx.compose.runtime.*
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.launch
import co.nimblehq.kmm.template.android.lib.IsLoading
import co.nimblehq.kmm.template.android.ui.navigation.AppDestination
import co.nimblehq.kmm.template.lib.IsLoading
import co.nimblehq.kmm.template.ui.navigation.AppDestination

@Suppress("PropertyName")
abstract class BaseViewModel : ViewModel() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.nimblehq.kmm.template.android.ui.navigation
package co.nimblehq.kmm.template.ui.navigation

import androidx.navigation.NamedNavArgument

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package co.nimblehq.kmm.template.android.ui.navigation
package co.nimblehq.kmm.template.ui.navigation

import androidx.compose.runtime.Composable
import androidx.navigation.*
import androidx.navigation.compose.*
import co.nimblehq.kmm.template.android.ui.screens.home.HomeScreen
import co.nimblehq.kmm.template.ui.screens.home.HomeScreen

@Composable
fun AppNavigation(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package co.nimblehq.kmm.template.android.ui.screens
package co.nimblehq.kmm.template.ui.screens

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import co.nimblehq.kmm.template.android.ui.navigation.AppNavigation
import co.nimblehq.kmm.template.android.ui.theme.ComposeTheme
import co.nimblehq.kmm.template.ui.navigation.AppNavigation
import co.nimblehq.kmm.template.ui.theme.ComposeTheme

class MainActivity : ComponentActivity() {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package co.nimblehq.kmm.template.android.ui.screens.home
package co.nimblehq.kmm.template.ui.screens.home

import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import co.nimblehq.kmm.template.Greeting
import co.nimblehq.kmm.template.android.ui.theme.ComposeTheme
import co.nimblehq.kmm.template.ui.theme.ComposeTheme

@Composable
fun HomeScreen() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.nimblehq.kmm.template.android.ui.theme
package co.nimblehq.kmm.template.ui.theme

import androidx.compose.material.*
import androidx.compose.runtime.staticCompositionLocalOf
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.nimblehq.kmm.template.android.ui.theme
package co.nimblehq.kmm.template.ui.theme

import androidx.compose.runtime.staticCompositionLocalOf

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.nimblehq.kmm.template.android.ui.theme
package co.nimblehq.kmm.template.ui.theme

import androidx.compose.runtime.staticCompositionLocalOf

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@file:Suppress("MatchingDeclarationName")
package co.nimblehq.kmm.template.android.ui.theme
package co.nimblehq.kmm.template.ui.theme

import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.shape.RoundedCornerShape
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.nimblehq.kmm.template.android.util
package co.nimblehq.kmm.template.util

import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.nimblehq.kmm.template.android.util
package co.nimblehq.kmm.template.util

import timber.log.Timber

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.nimblehq.kmm.template.android.test
package co.nimblehq.kmm.template.test

import kotlinx.coroutines.*
import kotlinx.coroutines.test.*
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions buildSrc/src/main/java/BuildTypes.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
object BuildTypes {
const val DEBUG = "debug"
const val RELEASE = "release"
}
44 changes: 1 addition & 43 deletions buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -1,45 +1,3 @@
object Versions {
const val ANDROID_COMPILE_SDK_VERSION = 33
const val ANDROID_MIN_SDK_VERSION = 24
const val ANDROID_TARGET_SDK_VERSION = 33
const val ANDROID_VERSION_CODE = 1
const val ANDROID_VERSION_NAME = "1.0.0"
const val ANDROIDX_ACTIVITY_COMPOSE = "1.7.1"

const val BUILD_KONFIG = "0.13.3"

const val COMPOSE = "1.4.3"
const val COMPOSE_COMPILER = "1.4.7"
const val COMPOSE_NAVIGATION = "2.6.0"

const val DETEKT = "1.23.0"

const val GRADLE = "8.0.2"

const val JUNIT = "4.13.2"

const val KOIN = "3.3.2"
const val KOIN_ANDROID = "3.3.2"
const val KOIN_ANDROIDX_COMPOSE = "3.4.1"
const val KOTLIN = "1.8.21"
const val KOTLIN_COROUTINES = "1.7.3"
const val KOTEST = "5.5.4"
const val KOTLINX_RESOURCES = "0.2.4"
const val KOVER = "0.7.3"
const val KSP = "1.8.21-1.0.11"
const val KTOR = "2.1.1"

const val MOCKATIVE = "1.3.0"
const val MOCKK = "1.13.3"

const val NAPIER = "2.6.1"

const val ROBOLECTRIC = "4.9.1"

const val TIMBER = "5.0.1"
const val TURBINE = "0.12.1"
}

object Dependencies {

object AndroidX {
Expand Down Expand Up @@ -94,7 +52,7 @@ object Dependencies {

const val JUNIT = "junit:junit:${Versions.JUNIT}"

const val KOTEST_ASSERTIONS = "io.kotest:kotest-assertions-core:${Versions.KOTEST}"
const val KOTEST = "io.kotest:kotest-assertions-core:${Versions.KOTEST}"
const val KOTLINX_RESOURCES = "com.goncalossilva:resources:${Versions.KOTLINX_RESOURCES}"

const val MOCKATIVE = "io.mockative:mockative:${Versions.MOCKATIVE}"
Expand Down
5 changes: 5 additions & 0 deletions buildSrc/src/main/java/Flavors.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
object Flavors {
const val PRODUCTION = "production"
const val STAGING = "staging"
const val DIMENSION_VERSION = "version"
}
3 changes: 3 additions & 0 deletions buildSrc/src/main/java/Modules.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
object Modules {
const val SHARED = ":shared"
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
object Flavors {
const val PRODUCTION = "production"
const val STAGING = "staging"
const val DIMENSION_VERSION = "version"
}

object BuildTypes {
const val DEBUG = "debug"
const val RELEASE = "release"
}

object Modules {
const val SHARED = ":shared"
}

object Plugins {
const val ANDROID = "android"
const val ANDROID_APPLICATION = "com.android.application"
Expand Down
42 changes: 42 additions & 0 deletions buildSrc/src/main/java/Versions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
object Versions {
const val ANDROID_COMPILE_SDK = 33
const val ANDROID_MIN_SDK = 24
const val ANDROID_TARGET_SDK = 33
const val ANDROID_VERSION_CODE = 1
const val ANDROID_VERSION_NAME = "1.0.0"

const val ANDROIDX_ACTIVITY_COMPOSE = "1.7.1"

const val BUILD_KONFIG = "0.13.3"

const val COMPOSE = "1.4.3"
const val COMPOSE_COMPILER = "1.4.7"
const val COMPOSE_NAVIGATION = "2.6.0"

const val DETEKT = "1.23.0"

const val GRADLE = "8.0.2"

const val JUNIT = "4.13.2"

const val KOIN = "3.3.2"
const val KOIN_ANDROID = "3.3.2"
const val KOIN_ANDROIDX_COMPOSE = "3.4.1"
const val KOTLIN = "1.8.21"
const val KOTLIN_COROUTINES = "1.7.3"
const val KOTEST = "5.5.4"
const val KOTLINX_RESOURCES = "0.2.4"
const val KOVER = "0.7.3"
const val KSP = "1.8.21-1.0.11"
const val KTOR = "2.1.1"

const val MOCKATIVE = "1.3.0"
const val MOCKK = "1.13.3"

const val NAPIER = "2.6.1"

const val ROBOLECTRIC = "4.9.1"

const val TIMBER = "5.0.1"
const val TURBINE = "0.12.1"
}
12 changes: 9 additions & 3 deletions make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,8 @@ if ! [[ $minimum_ios_version =~ $version_regex ]]; then
minimum_ios_version="14.0"
fi

# Generate iOS module
sh make_ios.sh -b ${bundle_id_production} -s ${bundle_id_staging} -n ${project_name} -iv ${minimum_ios_version}
rm -rf make_ios.sh
rm -rf make.sh

# =====GENERATE ANDROID AND SHARED MODULES + REST OF COMPONENTS=====
# TODO: Fully generate the KMM project later
Expand All @@ -111,5 +110,12 @@ rsync -av \
--exclude '.git' \
--exclude '.gitmodules' \
--exclude 'make.sh' \
--exclude './sample' \
--exclude 'make_ios.sh' \
--exclude '/sample' \
./ sample/

# Reset all git submodules
cd ios
git add .
git reset --hard
cd ..
5 changes: 5 additions & 0 deletions make_ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ cd ios

echo "=> Removing unnecessary files and folders"
rm -rf {PROJECT_NAME}/sources/data
rm -rf ${project_name}
rm -rf ${project_name}.xcodeproj
rm -rf ${project_name}.xcworkspace
rm -rf ${project_name}KIFUITests
rm -rf ${project_name}Tests

# Bypass this bug in iOS Template: https://github.com/nimblehq/ios-templates/issues/307
rm -f {PROJECT_NAME}KIFUITests/Sources/Specs/Application/ApplicationSpec.swift
Expand Down
10 changes: 5 additions & 5 deletions sample/android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ plugins {
val keystoreProperties = loadProperties("$rootDir/signing.properties")

android {
namespace = "co.nimblehq.kmm.template.android"
compileSdk = Versions.ANDROID_COMPILE_SDK_VERSION
namespace = "co.nimblehq.kmm.template"
compileSdk = Versions.ANDROID_COMPILE_SDK
defaultConfig {
applicationId = "co.nimblehq.kmm.template.android"
minSdk = Versions.ANDROID_MIN_SDK_VERSION
targetSdk = Versions.ANDROID_TARGET_SDK_VERSION
applicationId = "co.nimblehq.kmm.template"
minSdk = Versions.ANDROID_MIN_SDK
targetSdk = Versions.ANDROID_TARGET_SDK
versionCode = Versions.ANDROID_VERSION_CODE
versionName = Versions.ANDROID_VERSION_NAME
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.nimblehq.kmm.template.android.util
package co.nimblehq.kmm.template.util

import timber.log.Timber

Expand Down
4 changes: 2 additions & 2 deletions sample/android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="co.nimblehq.kmm.template.android">
package="co.nimblehq.kmm.template">

<uses-permission android:name="android.permission.INTERNET"/>

<application
android:name=".MyApplication"
android:name=".MainApplication"
android:allowBackup="false"
android:label="@string/app_name"
android:supportsRtl="true"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package co.nimblehq.kmm.template.android
package co.nimblehq.kmm.template

import android.app.Application
import co.nimblehq.kmm.template.android.di.androidViewModelModule
import co.nimblehq.kmm.template.android.util.LogUtil
import co.nimblehq.kmm.template.di.androidViewModelModule
import co.nimblehq.kmm.template.util.LogUtil
import co.nimblehq.kmm.template.di.initKoin
import org.koin.android.ext.koin.androidContext

class MyApplication : Application() {
class MainApplication : Application() {

override fun onCreate() {
super.onCreate()
Expand Down
Loading