Skip to content

Commit aa9678e

Browse files
committed
new version with logging
1 parent 3f320a3 commit aa9678e

File tree

9 files changed

+29
-16
lines changed

9 files changed

+29
-16
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
ext.kotlin_version = '1.3.71'
4+
ext.kotlin_version = '1.3.72'
55
repositories {
66
google()
77
jcenter()
88

99
}
1010
dependencies {
11-
classpath 'com.android.tools.build:gradle:3.6.3'
11+
classpath 'com.android.tools.build:gradle:4.0.0'
1212
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1313

1414
// NOTE: Do not place your application dependencies here; they belong

commandbasedarchitecture_coroutine/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
}
66

77
dependencies {
8-
classpath 'com.android.tools.build:gradle:3.6.3'
8+
classpath 'com.android.tools.build:gradle:4.0.0'
99
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4"
1010
classpath "com.github.dcendents:android-maven-gradle-plugin:2.1"
1111
classpath "com.github.dcendents:android-maven-plugin:1.2"
@@ -25,7 +25,7 @@ group = "io.scal"
2525
final def siteUrl = 'https://github.com/scalio/command-based-architecture'
2626
final def gitUrl = "https://github.com/scalio/command-based-architecture.git"
2727
// This is the library version used when deploying the artifact
28-
version = "0.5.1"
28+
version = "0.5.2"
2929

3030
final Properties properties = new Properties()
3131
properties.load(project.rootProject.file('local.properties').newDataInputStream())

commandbasedarchitecture_coroutine/src/main/java/io/scal/commandbasedarchitecture/broadcast/BaseBroadcastCommandViewModel.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ data class DataState<ChildKey, ChildState>(
7575
* ViewModel that will store all child view models and return already existing one with the same key.
7676
*/
7777
abstract class BaseBroadcastCommandViewModel<ChildKey, ChildState, ChildModel : ChildViewModel<ChildState>>(
78-
private val loggerCallback: ((message: String) -> Unit)? = null
78+
private val loggerCallback: ((message: String) -> Unit)? = null,
79+
private val errorLoggerCallback: ((message: String, error: Throwable) -> Unit)? = null
7980
) {
8081

8182
protected open val mutableDataState =
@@ -89,7 +90,7 @@ abstract class BaseBroadcastCommandViewModel<ChildKey, ChildState, ChildModel :
8990
protected open val viewModelScope = CoroutineScope(Dispatchers.Main)
9091

9192
protected open fun createCommandManager(mutableDataState: MutableLiveData<DataState<ChildKey, ChildState>>): CommandManager<DataState<ChildKey, ChildState>> =
92-
CommandManagerImpl(mutableDataState, viewModelScope, loggerCallback)
93+
CommandManagerImpl(mutableDataState, viewModelScope, loggerCallback, errorLoggerCallback)
9394

9495
/**
9596
* Will get existing view model with the same key or create a new one

commandbasedarchitecture_rxjava/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
}
66

77
dependencies {
8-
classpath 'com.android.tools.build:gradle:3.6.3'
8+
classpath 'com.android.tools.build:gradle:4.0.0'
99
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4"
1010
classpath "com.github.dcendents:android-maven-gradle-plugin:2.1"
1111
classpath "com.github.dcendents:android-maven-plugin:1.2"
@@ -25,7 +25,7 @@ group = "io.scal"
2525
final def siteUrl = 'https://github.com/scalio/command-based-architecture'
2626
final def gitUrl = "https://github.com/scalio/command-based-architecture.git"
2727
// This is the library version used when deploying the artifact
28-
version = "0.5.1"
28+
version = "0.5.2"
2929

3030
final Properties properties = new Properties()
3131
properties.load(project.rootProject.file('local.properties').newDataInputStream())

commandbasedarchitecture_rxjava/src/main/java/io/scal/commandbasedarchitecture/broadcast/BaseBroadcastCommandViewModel.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ data class DataState<ChildKey, ChildState>(
7676
*/
7777
abstract class BaseBroadcastCommandViewModel<ChildKey, ChildState, ChildModel : ChildViewModel<ChildState>>(
7878
private val mainThreadScheduler: Scheduler,
79-
private val loggerCallback: ((message: String) -> Unit)? = null
79+
private val loggerCallback: ((message: String) -> Unit)? = null,
80+
private val errorLoggerCallback: ((message: String, error: Throwable) -> Unit)? = null
8081
) {
8182

8283
protected open val mutableDataState =
@@ -94,7 +95,8 @@ abstract class BaseBroadcastCommandViewModel<ChildKey, ChildState, ChildModel :
9495
mutableDataState,
9596
mainThreadScheduler,
9697
compositeDisposable,
97-
loggerCallback
98+
loggerCallback,
99+
errorLoggerCallback
98100
)
99101

100102
/**
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Mon Mar 23 10:43:55 NOVT 2020
1+
#Tue Jun 02 12:42:20 NOVT 2020
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

sample_coroutine/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ dependencies {
3838
implementation fileTree(dir: 'libs', include: ['*.jar'])
3939

4040
// implementation project(path: ':commandbasedarchitecture_coroutine')
41-
implementation 'io.scal:commandbasedarchitecture_coroutine:0.5.1'
41+
implementation 'io.scal:commandbasedarchitecture_coroutine:0.5.2'
4242

4343
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
4444

@@ -47,7 +47,7 @@ dependencies {
4747
implementation "androidx.constraintlayout:constraintlayout:2.0.0-beta6"
4848
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
4949

50-
implementation "androidx.core:core-ktx:1.2.0"
50+
implementation "androidx.core:core-ktx:1.3.0"
5151
implementation "androidx.fragment:fragment-ktx:1.2.4"
5252

5353
implementation "androidx.lifecycle:lifecycle-livedata-ktx:${rootProject.architectureComponentsVersion}"

sample_coroutine/src/main/java/io/scal/commandbasedarchitecture/sample_coroutine/ui/details/SimpleDetailsViewModel.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ class SimpleDetailsViewModel(application: Application) : DetailsViewModel(applic
2424
override val screenState: LiveData<DetailsScreenState> = mutableScreenState
2525

2626
private val commandManager: CommandManager<DetailsScreenState> by lazy {
27-
CommandManagerImpl(mutableScreenState, viewModelScope) { Log.w("SimpleViewModel", it) }
27+
CommandManagerImpl(
28+
mutableScreenState,
29+
viewModelScope,
30+
{ Log.w("SimpleViewModel", it) },
31+
{ message, error -> Log.w("SimpleViewModel", message, error) }
32+
)
2833
}
2934

3035

sample_coroutine/src/main/java/io/scal/commandbasedarchitecture/sample_coroutine/ui/list/SimpleListViewModel.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ class SimpleListViewModel(application: Application) : ListViewModel(application)
2424
)
2525
override val screenState: LiveData<ListScreenState> = mutableScreenState
2626
override val commandManager: CommandManager<ListScreenState> by lazy {
27-
CommandManagerImpl(mutableScreenState, viewModelScope) { Log.w("SimpleViewModel", it) }
27+
CommandManagerImpl(
28+
mutableScreenState,
29+
viewModelScope,
30+
{ Log.w("SimpleViewModel", it) },
31+
{ message, error -> Log.w("SimpleViewModel", message, error) }
32+
)
2833
}
2934

3035
init {

0 commit comments

Comments
 (0)