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

replace package from vivid.money to money.vivid #254

Merged
merged 2 commits into from
Jan 24, 2024
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
2 changes: 1 addition & 1 deletion elmslie-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

android {
namespace = "vivid.money.elmslie.android"
namespace = "money.vivid.elmslie.android"
}

dependencies {
Expand Down
4 changes: 2 additions & 2 deletions elmslie-android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
android:exported="false"
tools:node="merge">
<meta-data
android:name="vivid.money.elmslie.android.logger.DefaultLoggerInitializer"
android:name="money.vivid.elmslie.android.logger.DefaultLoggerInitializer"
android:value="androidx.startup" />
<meta-data
android:name="vivid.money.elmslie.android.processdeath.ProcessDeathDetectorInitializer"
android:name="money.vivid.elmslie.android.processdeath.ProcessDeathDetectorInitializer"
android:value="androidx.startup" />
</provider>
</application>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivid.money.elmslie.android
package money.vivid.elmslie.android

import android.os.Bundle
import androidx.activity.ComponentActivity
Expand All @@ -11,8 +11,8 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.ViewModelStoreOwner
import androidx.savedstate.SavedStateRegistryOwner
import vivid.money.elmslie.core.store.Store
import vivid.money.elmslie.core.store.toCachedStore
import money.vivid.elmslie.core.store.Store
import money.vivid.elmslie.core.store.toCachedStore

/**
* In order to access previously saved state (via [saveState]) in [storeFactory] one must use
Expand All @@ -31,7 +31,7 @@ fun <
saveState: Bundle.(State) -> Unit = {},
storeFactory: SavedStateHandle.() -> Store<Event, Effect, State>,
): Lazy<Store<Event, Effect, State>> =
vivid.money.elmslie.android.elmStore(
money.vivid.elmslie.android.elmStore(
storeFactory = storeFactory,
key = key,
viewModelStoreOwner = viewModelStoreOwner,
Expand All @@ -57,7 +57,7 @@ fun <
saveState: Bundle.(State) -> Unit = {},
storeFactory: SavedStateHandle.() -> Store<Event, Effect, State>,
): Lazy<Store<Event, Effect, State>> =
vivid.money.elmslie.android.elmStore(
money.vivid.elmslie.android.elmStore(
storeFactory = storeFactory,
key = key,
viewModelStoreOwner = viewModelStoreOwner,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package money.vivid.elmslie.android.logger

import money.vivid.elmslie.android.logger.strategy.AndroidLog
import money.vivid.elmslie.android.logger.strategy.Crash
import money.vivid.elmslie.core.config.ElmslieConfig
import money.vivid.elmslie.core.logger.strategy.IgnoreLog

fun ElmslieConfig.defaultReleaseLogger() = logger {
fatal(Crash)
nonfatal(IgnoreLog)
debug(IgnoreLog)
}

fun ElmslieConfig.defaultDebugLogger() = logger {
fatal(Crash)
nonfatal(AndroidLog.E)
debug(AndroidLog.E)
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package vivid.money.elmslie.android.logger
package money.vivid.elmslie.android.logger

import android.content.Context
import android.content.pm.ApplicationInfo
import androidx.startup.Initializer
import vivid.money.elmslie.core.config.ElmslieConfig
import money.vivid.elmslie.core.config.ElmslieConfig

class DefaultLoggerInitializer : Initializer<Unit> {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivid.money.elmslie.android.logger
package money.vivid.elmslie.android.logger

import android.content.ContentProvider
import android.content.ContentValues
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package vivid.money.elmslie.android.logger.strategy
package money.vivid.elmslie.android.logger.strategy

import android.util.Log
import vivid.money.elmslie.core.logger.strategy.LogStrategy
import money.vivid.elmslie.core.logger.strategy.LogStrategy

/** Uses default android logging mechanism for reporting */
object AndroidLog {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package vivid.money.elmslie.android.logger.strategy
package money.vivid.elmslie.android.logger.strategy

import android.os.Handler
import android.os.Looper
import android.os.Message
import vivid.money.elmslie.core.logger.LogSeverity
import vivid.money.elmslie.core.logger.strategy.LogStrategy
import money.vivid.elmslie.core.logger.LogSeverity
import money.vivid.elmslie.core.logger.strategy.LogStrategy

/** Strategy that performs a crash on every log event it receives. Use wisely. */
object Crash : LogStrategy {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivid.money.elmslie.android.processdeath
package money.vivid.elmslie.android.processdeath

import android.app.Activity
import android.app.Application
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivid.money.elmslie.android.processdeath
package money.vivid.elmslie.android.processdeath

import android.app.Activity
import android.app.Application
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivid.money.elmslie.android.processdeath
package money.vivid.elmslie.android.processdeath

import android.app.Application
import android.content.Context
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivid.money.elmslie.android.renderer
package money.vivid.elmslie.android.renderer

import android.os.Bundle
import androidx.activity.ComponentActivity
Expand All @@ -21,8 +21,9 @@ import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.launch
import vivid.money.elmslie.core.config.ElmslieConfig
import vivid.money.elmslie.core.store.Store
import money.vivid.elmslie.android.elmStore
import money.vivid.elmslie.core.config.ElmslieConfig
import money.vivid.elmslie.core.store.Store

@Suppress("LongParameterList")
@MainThread
Expand All @@ -40,7 +41,7 @@ fun <
saveState: Bundle.(State) -> Unit = {},
storeFactory: SavedStateHandle.() -> Store<Event, Effect, State>,
): Lazy<Store<Event, Effect, State>> {
val lazyStore = vivid.money.elmslie.android.elmStore(
val lazyStore = elmStore(
storeFactory = storeFactory,
key = key,
viewModelStoreOwner = viewModelStoreOwner,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivid.money.elmslie.android.renderer
package money.vivid.elmslie.android.renderer

@Suppress("OptionalUnit")
interface ElmRendererDelegate<Effect : Any, State : Any> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivid.money.elmslie.android.util
package money.vivid.elmslie.android.util

/**
* Lazy initialization without synchronization
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package vivid.money.elmslie.core
package money.vivid.elmslie.core

import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.CoroutineName
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.SupervisorJob
import vivid.money.elmslie.core.config.ElmslieConfig
import money.vivid.elmslie.core.config.ElmslieConfig

@SuppressWarnings("detekt.FunctionNaming")
fun ElmScope(name: String): CoroutineScope =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package vivid.money.elmslie.core.config
package money.vivid.elmslie.core.config

import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import vivid.money.elmslie.core.logger.ElmslieLogConfiguration
import vivid.money.elmslie.core.logger.ElmslieLogger
import vivid.money.elmslie.core.logger.strategy.IgnoreLog
import vivid.money.elmslie.core.store.StoreListener
import money.vivid.elmslie.core.logger.ElmslieLogConfiguration
import money.vivid.elmslie.core.logger.ElmslieLogger
import money.vivid.elmslie.core.logger.strategy.IgnoreLog
import money.vivid.elmslie.core.store.StoreListener

object ElmslieConfig {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package vivid.money.elmslie.core.logger
package money.vivid.elmslie.core.logger

import vivid.money.elmslie.core.logger.strategy.LogStrategy
import money.vivid.elmslie.core.logger.strategy.LogStrategy

class ElmslieLogConfiguration {

Expand All @@ -23,7 +23,7 @@ class ElmslieLogConfiguration {

/** Apply the same logging strategy to all log levels */
fun always(strategy: LogStrategy) = apply {
LogSeverity.entries.forEach { strategies[it] = strategy }
LogSeverity.values().forEach { strategies[it] = strategy }
}

internal fun build() = ElmslieLogger(strategies)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package vivid.money.elmslie.core.logger
package money.vivid.elmslie.core.logger

import vivid.money.elmslie.core.logger.strategy.IgnoreLog
import vivid.money.elmslie.core.logger.strategy.LogStrategy
import money.vivid.elmslie.core.logger.strategy.IgnoreLog
import money.vivid.elmslie.core.logger.strategy.LogStrategy

/** Logs events happening in the Elmslie library */
class ElmslieLogger(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivid.money.elmslie.core.logger
package money.vivid.elmslie.core.logger

enum class LogSeverity {
Fatal,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivid.money.elmslie.core.logger.strategy
package money.vivid.elmslie.core.logger.strategy

/** Ignores all log events */
object IgnoreLog : LogStrategy by LogStrategy({ _, _, _, _ -> })
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package vivid.money.elmslie.core.logger.strategy
package money.vivid.elmslie.core.logger.strategy

import vivid.money.elmslie.core.logger.LogSeverity
import money.vivid.elmslie.core.logger.LogSeverity

/** Allows to provide custom logic for error handling */
fun interface LogStrategy {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivid.money.elmslie.core.store
package money.vivid.elmslie.core.store

import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.catch
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivid.money.elmslie.core.store
package money.vivid.elmslie.core.store

import kotlinx.coroutines.cancel
import kotlinx.coroutines.flow.Flow
Expand All @@ -7,7 +7,7 @@ import kotlinx.coroutines.flow.onSubscription
import kotlinx.coroutines.launch
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import vivid.money.elmslie.core.ElmScope
import money.vivid.elmslie.core.ElmScope

/**
* Caches effects until there is at least one collector.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivid.money.elmslie.core.store
package money.vivid.elmslie.core.store

import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.cancel
Expand All @@ -15,8 +15,8 @@ import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import vivid.money.elmslie.core.ElmScope
import vivid.money.elmslie.core.config.ElmslieConfig
import money.vivid.elmslie.core.ElmScope
import money.vivid.elmslie.core.config.ElmslieConfig

@Suppress("TooGenericExceptionCaught")
class ElmStore<Event : Any, State : Any, Effect : Any, Command : Any>(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivid.money.elmslie.core.store
package money.vivid.elmslie.core.store

import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.emptyFlow
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivid.money.elmslie.core.store
package money.vivid.elmslie.core.store

/**
* Reducer that doesn't change state, and doesn't emit commands or effects
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivid.money.elmslie.core.store
package money.vivid.elmslie.core.store

/** Represents result of reduce function */
data class Result<State : Any, Effect : Any, Command : Any>(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivid.money.elmslie.core.store
package money.vivid.elmslie.core.store

fun interface StateReducer<Event : Any, State : Any, Effect : Any, Command : Any> {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivid.money.elmslie.core.store
package money.vivid.elmslie.core.store

import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.Flow
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivid.money.elmslie.core.store
package money.vivid.elmslie.core.store

interface StoreListener<Event : Any, State : Any, Effect : Any, Command : Any> {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package vivid.money.elmslie.core.store.dsl
package money.vivid.elmslie.core.store.dsl

import vivid.money.elmslie.core.store.StateReducer
import money.vivid.elmslie.core.store.StateReducer

abstract class DslReducer<Event : Any, State : Any, Effect : Any, Command : Any> :
StateReducer<Event, State, Effect, Command> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vivid.money.elmslie.core.store.dsl
package money.vivid.elmslie.core.store.dsl

@DslMarker
internal annotation class OperationsBuilderDsl
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package vivid.money.elmslie.core.store.dsl
package money.vivid.elmslie.core.store.dsl

import vivid.money.elmslie.core.store.Result
import money.vivid.elmslie.core.store.Result

open class ResultBuilder<State : Any, Effect : Any, Command : Any>(
val initialState: State
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package vivid.money.elmslie.core.store.dsl
package money.vivid.elmslie.core.store.dsl

import vivid.money.elmslie.core.store.StateReducer
import money.vivid.elmslie.core.store.Result
import money.vivid.elmslie.core.store.StateReducer
import kotlin.reflect.KClass

abstract class ScreenDslReducer<Event : Any, Ui : Any, Internal : Any, State : Any, Effect : Any, Command : Any>(
Expand All @@ -17,7 +18,7 @@ abstract class ScreenDslReducer<Event : Any, Ui : Any, Internal : Any, State : A
final override fun reduce(
event: Event,
state: State
): vivid.money.elmslie.core.store.Result<State, Effect, Command> {
): money.vivid.elmslie.core.store.Result<State, Effect, Command> {
val body = Result(state)
@Suppress("UNCHECKED_CAST")
when {
Expand Down
Loading
Loading