Skip to content

Commit

Permalink
Merge pull request #6 from Merseyside/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Merseyside authored Mar 9, 2022
2 parents 11215cd + 4a94cce commit 8be6501
Show file tree
Hide file tree
Showing 19 changed files with 86 additions and 149 deletions.
1 change: 0 additions & 1 deletion archy-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ val androidLibraries = listOf(
androidLibs.appCompat,
androidLibs.fragment,
androidLibs.lifecycleViewModelSavedState,
androidLibs.annotation,
androidLibs.koin
)

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ abstract class BaseVMFragment<B : ViewDataBinding, M : BaseViewModel>

protected open fun loadingObserver(isLoading: Boolean) {}

private fun showErrorMsg(textMessage: BaseViewModel.TextMessage) {
fun showErrorMsg(textMessage: BaseViewModel.TextMessage) {
if (textMessage.actionMsg.isNullOrEmpty()) {
showErrorMsg(textMessage.msg)
} else {
Expand Down
17 changes: 6 additions & 11 deletions archy-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ plugins {
`maven-publish-config`
}

kotlin {
android {
publishLibraryVariants("release", "debug")
publishLibraryVariantsGroupedByFlavor = true
}
}

multiplatformResources {
multiplatformResourcesPackage = Application.applicationId // required
}
Expand All @@ -25,6 +18,7 @@ val mppLibs = listOf(
multiplatformLibs.serialization,
multiplatformLibs.moko.mvvm,
multiplatformLibs.moko.mvvm.livedata,
multiplatformLibs.moko.resources,
multiplatformLibs.koin
)

Expand All @@ -33,13 +27,14 @@ val mppModules = listOf(
)

dependencies {
mppModules.forEach { module -> commonMainImplementation(module) }
mppModules.forEach { module -> commonMainApi(module) }
mppLibs.forEach { commonMainApi(it) }

compileOnly("javax.annotation:jsr250-api:1.0")
}

framework {
mppModules.forEach { export(it) }
//mppLibs.forEach { export(it.toProvider()) }

export(multiplatformLibs.moko.mvvm.asProvider())
export(multiplatformLibs.moko.mvvm.livedata)
export(multiplatformLibs.moko.resources)
}
5 changes: 1 addition & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ allprojects {

google()

maven { url = uri("https://jitpack.io") }
maven { url = uri("https://raw.githubusercontent.com/guardianproject/gpmaven/master") }
maven { url = uri("https://maven.fabric.io/public") }
maven { url = uri("https://plugins.gradle.org/m2/") }
maven("https://jitpack.io")
}
}

Expand Down
10 changes: 4 additions & 6 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
plugins {
`kotlin-dsl`
kotlin("jvm") version "1.6.0"
kotlin("plugin.serialization") version "1.6.0"
}

repositories {
Expand All @@ -12,12 +10,12 @@ repositories {
}

val multiplatform = "0.12.0"
val kotlin = "1.6.0"
val gradle = "7.0.3"
val resources = "0.15.1"
val kotlin = "1.6.20-RC"
val gradle = "7.3.0-alpha05"
val resources = "0.18.0"
val sqldelight = "1.5.3"
val nexus = "1.1.0"
val navigation = "2.4.0-beta02"
val navigation = "2.5.0-alpha01"

dependencies {
implementation("dev.icerock:mobile-multiplatform:$multiplatform")
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ object Application {
const val applicationId = "com.merseyside.merseyLib"

const val version = Metadata.version
const val versionCode = 141
const val versionCode = 146

const val compileSdk = 30
const val targetSdk = 30
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ android {

lint {
lintConfig = rootProject.file(".lint/config.xml")
isCheckAllWarnings = true
isWarningsAsErrors = true
isAbortOnError = false
}

compileOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@ plugins {
id("org.jetbrains.kotlin.multiplatform")
}

kotlin {

android {
publishLibraryVariants("release", "debug")
publishLibraryVariantsGroupedByFlavor = true
}

ios()
// Add the ARM64 simulator target
iosSimulatorArm64()

val iosMain by sourceSets.getting
val iosSimulatorArm64Main by sourceSets.getting

// Set up dependencies between the source sets
iosSimulatorArm64Main.dependsOn(iosMain)
}

tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "11"
Expand Down
19 changes: 12 additions & 7 deletions buildSrc/src/main/kotlin/extensions/GradleExtensions.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import dev.icerock.gradle.FrameworkConfig
import org.gradle.api.Project
import org.gradle.api.artifacts.MinimalExternalModuleDependency
import org.gradle.api.internal.catalog.ExternalModuleDependencyFactory
Expand All @@ -15,7 +16,7 @@ inline fun <reified T> Project.findTypedProperty(propertyName: String): T {
Float::class -> stringProperty
else -> it
}
} as? T ?: throw NotFoundException("Property $propertyName not found")
} as? T ?: throw Exception("Property $propertyName not found")
}

fun Project.isLocalDependencies(): Boolean =
Expand All @@ -27,10 +28,14 @@ fun Project.isLocalAndroidDependencies(): Boolean =
fun Project.isLocalKotlinExtLibrary(): Boolean =
findTypedProperty("build.localKotlinExtLibrary")

inline fun <reified T: MinimalExternalModuleDependency> Any.toProvider(): Provider<T> {
return when (this) {
is Provider<*> -> this as Provider<T>
is ExternalModuleDependencyFactory.ProviderConvertible<*> -> this.asProvider() as Provider<T>
else -> throw Exception("Wrong type")
fun FrameworkConfig.exportVersionCatalogLib(library: Any) {
when(library) {
is Provider<*> -> {
if (library.get() is MinimalExternalModuleDependency) export(library as Provider<MinimalExternalModuleDependency>)
else throw IllegalArgumentException()
}

is ExternalModuleDependencyFactory.DependencyNotationSupplier -> library.asProvider()
else -> throw Exception()
}
}
}
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/publication/Metadata.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object Metadata {
const val groupId = "io.github.merseyside"
const val version = "1.4.5"
const val version = "1.4.6"
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Feb 04 15:25:14 NOVT 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencyResolutionManagement {
mavenLocal()
}

val catalogVersions = "1.2.2"
val catalogVersions = "1.3.2"
val group = "io.github.merseyside"
versionCatalogs {
val multiplatformLibs by creating {
Expand Down
13 changes: 4 additions & 9 deletions utils-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ android {
}
}

kotlin {
android {
publishLibraryVariants("release", "debug")
publishLibraryVariantsGroupedByFlavor = true
}
}

val mppLibs = listOf(
common.merseyLib.time,
multiplatformLibs.serialization,
Expand All @@ -47,13 +40,15 @@ dependencies {
} else {
commonMainApi(common.merseyLib.kotlin.ext)
}
commonMainImplementation(multiplatformLibs.bundles.moko.mvvm)
commonMainApi(multiplatformLibs.bundles.moko.mvvm)
mppLibs.forEach { commonMainImplementation(it) }

android.forEach { lib -> implementation(lib) }
merseyLibs.forEach { lib -> implementation(lib) }
}

framework {
//mppLibs.forEach { export(it.toProvider()) }
export(multiplatformLibs.moko.mvvm.asProvider())
export(multiplatformLibs.moko.mvvm.livedata)
export(multiplatformLibs.moko.resources)
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@ package com.merseyside.merseyLib.utils.core.coroutines
*/

import com.merseyside.merseyLib.kotlin.Logger
import com.merseyside.merseyLib.time.Seconds
import com.merseyside.merseyLib.time.TimeUnit
import com.merseyside.merseyLib.time.minus
import com.merseyside.merseyLib.time.units.Seconds
import com.merseyside.merseyLib.time.units.TimeUnit
import com.merseyside.merseyLib.time.units.minus
import com.merseyside.merseyLib.utils.core.ext.delay
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.*
import kotlinx.coroutines.withContext

class CountDownTimer(
private val listener: CoroutineTimerListener,
private val delay: TimeUnit = Seconds(1),
private val scope: CoroutineScope = CoroutineScope(Job() + Dispatchers.Unconfined)) {
private val scope: CoroutineScope = CoroutineScope(Job() + Dispatchers.Unconfined)
) {

private var timerJob: Job? = null
private var countDownTimer: TimeUnit = TimeUnit.getEmpty()
Expand Down Expand Up @@ -48,7 +51,9 @@ class CountDownTimer(
fun stopTimer() {
val error = if (state == CurrentTimerState.STOPPED) {
TimerException(TimerErrorTypes.NO_TIMER_RUNNING)
} else { null }
} else {
null
}
timerJob?.cancel()
state = CurrentTimerState.STOPPED
listener.onStop(error)
Expand Down Expand Up @@ -77,6 +82,7 @@ class CountDownTimer(

private fun timerCanStart() {
timerJob = scope.launch {

withContext(Dispatchers.Unconfined) {
state = CurrentTimerState.RUNNING

Expand Down Expand Up @@ -106,9 +112,10 @@ class CountDownTimer(
}
}

private suspend fun onTick(timeLeft: TimeUnit, error: Exception? = null) = withContext(Dispatchers.Main) {
listener.onTick(timeLeft, error)
}
private suspend fun onTick(timeLeft: TimeUnit, error: Exception? = null) =
withContext(Dispatchers.Main) {
listener.onTick(timeLeft, error)
}

companion object {
const val TAG = "CoroutineTimer"
Expand All @@ -134,4 +141,4 @@ enum class TimerErrorTypes(val message: String) {
DESTROYED("This timer is destroyed and can't be used anymore")
}

private class TimerException(val type: TimerErrorTypes): Exception(type.message)
private class TimerException(val type: TimerErrorTypes) : Exception(type.message)

This file was deleted.

Loading

0 comments on commit 8be6501

Please sign in to comment.