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

chore: log states via redux #421

Merged
merged 6 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ object Dependencies {
const val mockKAndroid = "io.mockk:mockk-android:${Versions.MOCKK}"
const val moshiCodeGen = "com.squareup.moshi:moshi-kotlin-codegen:${Versions.MOSHI}"
const val robolectric = "org.robolectric:robolectric:${Versions.ROBOLECTRIC}"
const val reduxKotlin = "org.reduxkotlin:redux-kotlin-threadsafe-jvm:${Versions.REDUX_KOTLIN}"
const val retrofit = "com.squareup.retrofit2:retrofit:${Versions.RETROFIT}"
const val retrofitMoshiConverter = "com.squareup.retrofit2:converter-moshi:${Versions.RETROFIT}"
const val okhttp = "com.squareup.okhttp3:okhttp:${Versions.OKHTTP}"
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/io.customer/android/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ object Versions {
internal const val MOSHI = "1.14.0"
internal const val SEGMENT = "1.16.3"
internal const val TIMBER = "5.0.0"
internal const val REDUX_KOTLIN = "0.6.0"
internal const val ROBOLECTRIC = "4.9"
internal const val OKHTTP = "4.11.0"
internal const val RETROFIT = "2.9.0"
Expand Down
4 changes: 2 additions & 2 deletions core/api/core.api
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ public final class io/customer/sdk/core/di/AndroidSDKComponentImpl : io/customer

public abstract class io/customer/sdk/core/di/DiGraph {
public fun <init> ()V
public final fun getOverrides ()Ljava/util/Map;
public final fun getSingletons ()Ljava/util/Map;
public final fun getOverrides ()Ljava/util/concurrent/ConcurrentHashMap;
public final fun getSingletons ()Ljava/util/concurrent/ConcurrentHashMap;
public final fun overrideDependency (Ljava/lang/Class;Ljava/lang/Object;)V
public fun reset ()V
}
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/kotlin/io/customer/sdk/core/di/DiGraph.kt
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package io.customer.sdk.core.di

import androidx.annotation.CallSuper
import java.util.concurrent.ConcurrentHashMap

abstract class DiGraph {
/**
* Map of dependencies that can be overridden with mocks in test functions.
*/
val overrides: MutableMap<String, Any> = mutableMapOf()
val overrides = ConcurrentHashMap<String, Any>()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To ensure synchronization.


/**
* Map of singleton instances of dependencies in the graph.
*/
val singletons: MutableMap<String, Any> = mutableMapOf()
val singletons = ConcurrentHashMap<String, Any>()

/**
* Internal function to get the key for a dependency in the graph based on its class.
Expand Down
205 changes: 205 additions & 0 deletions messaginginapp/api/messaginginapp.api
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,211 @@ public final class io/customer/messaginginapp/di/DIGraphMessagingInAppKt {
public static final fun inAppMessaging (Lio/customer/sdk/core/di/SDKComponent;)Lio/customer/messaginginapp/ModuleMessagingInApp;
}

public final class io/customer/messaginginapp/domain/InAppMessageReducerKt {
public static final fun getInAppMessagingReducer ()Lkotlin/jvm/functions/Function2;
}

public final class io/customer/messaginginapp/domain/InAppMessageStoreKt {
public static final fun loggerMiddleware (Lio/customer/sdk/core/util/Logger;)Lkotlin/jvm/functions/Function1;
}

public abstract class io/customer/messaginginapp/domain/InAppMessagingAction {
}

public final class io/customer/messaginginapp/domain/InAppMessagingAction$CancelModal : io/customer/messaginginapp/domain/InAppMessagingAction {
public fun <init> (Lio/customer/messaginginapp/gist/data/model/Message;)V
public final fun component1 ()Lio/customer/messaginginapp/gist/data/model/Message;
public final fun copy (Lio/customer/messaginginapp/gist/data/model/Message;)Lio/customer/messaginginapp/domain/InAppMessagingAction$CancelModal;
public static synthetic fun copy$default (Lio/customer/messaginginapp/domain/InAppMessagingAction$CancelModal;Lio/customer/messaginginapp/gist/data/model/Message;ILjava/lang/Object;)Lio/customer/messaginginapp/domain/InAppMessagingAction$CancelModal;
public fun equals (Ljava/lang/Object;)Z
public final fun getMessage ()Lio/customer/messaginginapp/gist/data/model/Message;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class io/customer/messaginginapp/domain/InAppMessagingAction$ClearUser : io/customer/messaginginapp/domain/InAppMessagingAction {
public static final field INSTANCE Lio/customer/messaginginapp/domain/InAppMessagingAction$ClearUser;
}

public final class io/customer/messaginginapp/domain/InAppMessagingAction$DismissModal : io/customer/messaginginapp/domain/InAppMessagingAction {
public fun <init> (Lio/customer/messaginginapp/gist/data/model/Message;)V
public final fun component1 ()Lio/customer/messaginginapp/gist/data/model/Message;
public final fun copy (Lio/customer/messaginginapp/gist/data/model/Message;)Lio/customer/messaginginapp/domain/InAppMessagingAction$DismissModal;
public static synthetic fun copy$default (Lio/customer/messaginginapp/domain/InAppMessagingAction$DismissModal;Lio/customer/messaginginapp/gist/data/model/Message;ILjava/lang/Object;)Lio/customer/messaginginapp/domain/InAppMessagingAction$DismissModal;
public fun equals (Ljava/lang/Object;)Z
public final fun getMessage ()Lio/customer/messaginginapp/gist/data/model/Message;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class io/customer/messaginginapp/domain/InAppMessagingAction$DismissPersistentMessage : io/customer/messaginginapp/domain/InAppMessagingAction {
public fun <init> (Lio/customer/messaginginapp/gist/data/model/Message;)V
public final fun component1 ()Lio/customer/messaginginapp/gist/data/model/Message;
public final fun copy (Lio/customer/messaginginapp/gist/data/model/Message;)Lio/customer/messaginginapp/domain/InAppMessagingAction$DismissPersistentMessage;
public static synthetic fun copy$default (Lio/customer/messaginginapp/domain/InAppMessagingAction$DismissPersistentMessage;Lio/customer/messaginginapp/gist/data/model/Message;ILjava/lang/Object;)Lio/customer/messaginginapp/domain/InAppMessagingAction$DismissPersistentMessage;
public fun equals (Ljava/lang/Object;)Z
public final fun getMessage ()Lio/customer/messaginginapp/gist/data/model/Message;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class io/customer/messaginginapp/domain/InAppMessagingAction$EmbedMessage : io/customer/messaginginapp/domain/InAppMessagingAction {
public fun <init> (Lio/customer/messaginginapp/gist/data/model/Message;Ljava/lang/String;)V
public final fun component1 ()Lio/customer/messaginginapp/gist/data/model/Message;
public final fun component2 ()Ljava/lang/String;
public final fun copy (Lio/customer/messaginginapp/gist/data/model/Message;Ljava/lang/String;)Lio/customer/messaginginapp/domain/InAppMessagingAction$EmbedMessage;
public static synthetic fun copy$default (Lio/customer/messaginginapp/domain/InAppMessagingAction$EmbedMessage;Lio/customer/messaginginapp/gist/data/model/Message;Ljava/lang/String;ILjava/lang/Object;)Lio/customer/messaginginapp/domain/InAppMessagingAction$EmbedMessage;
public fun equals (Ljava/lang/Object;)Z
public final fun getElementId ()Ljava/lang/String;
public final fun getMessage ()Lio/customer/messaginginapp/gist/data/model/Message;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class io/customer/messaginginapp/domain/InAppMessagingAction$EngineStartLoading : io/customer/messaginginapp/domain/InAppMessagingAction {
public static final field INSTANCE Lio/customer/messaginginapp/domain/InAppMessagingAction$EngineStartLoading;
}

public final class io/customer/messaginginapp/domain/InAppMessagingAction$EngineStopLoading : io/customer/messaginginapp/domain/InAppMessagingAction {
public static final field INSTANCE Lio/customer/messaginginapp/domain/InAppMessagingAction$EngineStopLoading;
}

public final class io/customer/messaginginapp/domain/InAppMessagingAction$Initialize : io/customer/messaginginapp/domain/InAppMessagingAction {
public static final field INSTANCE Lio/customer/messaginginapp/domain/InAppMessagingAction$Initialize;
}

public final class io/customer/messaginginapp/domain/InAppMessagingAction$LogEvent : io/customer/messaginginapp/domain/InAppMessagingAction {
public fun <init> (Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;)Lio/customer/messaginginapp/domain/InAppMessagingAction$LogEvent;
public static synthetic fun copy$default (Lio/customer/messaginginapp/domain/InAppMessagingAction$LogEvent;Ljava/lang/String;ILjava/lang/Object;)Lio/customer/messaginginapp/domain/InAppMessagingAction$LogEvent;
public fun equals (Ljava/lang/Object;)Z
public final fun getEvent ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class io/customer/messaginginapp/domain/InAppMessagingAction$OnShowError : io/customer/messaginginapp/domain/InAppMessagingAction {
public fun <init> (Lio/customer/messaginginapp/gist/data/model/Message;)V
public final fun component1 ()Lio/customer/messaginginapp/gist/data/model/Message;
public final fun copy (Lio/customer/messaginginapp/gist/data/model/Message;)Lio/customer/messaginginapp/domain/InAppMessagingAction$OnShowError;
public static synthetic fun copy$default (Lio/customer/messaginginapp/domain/InAppMessagingAction$OnShowError;Lio/customer/messaginginapp/gist/data/model/Message;ILjava/lang/Object;)Lio/customer/messaginginapp/domain/InAppMessagingAction$OnShowError;
public fun equals (Ljava/lang/Object;)Z
public final fun getMessage ()Lio/customer/messaginginapp/gist/data/model/Message;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class io/customer/messaginginapp/domain/InAppMessagingAction$PollingInterval : io/customer/messaginginapp/domain/InAppMessagingAction {
public fun <init> (J)V
public final fun component1 ()J
public final fun copy (J)Lio/customer/messaginginapp/domain/InAppMessagingAction$PollingInterval;
public static synthetic fun copy$default (Lio/customer/messaginginapp/domain/InAppMessagingAction$PollingInterval;JILjava/lang/Object;)Lio/customer/messaginginapp/domain/InAppMessagingAction$PollingInterval;
public fun equals (Ljava/lang/Object;)Z
public final fun getInterval ()J
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class io/customer/messaginginapp/domain/InAppMessagingAction$ProcessMessage : io/customer/messaginginapp/domain/InAppMessagingAction {
public fun <init> (Lio/customer/messaginginapp/gist/data/model/Message;Lio/customer/messaginginapp/gist/data/model/GistProperties;)V
public final fun component1 ()Lio/customer/messaginginapp/gist/data/model/Message;
public final fun component2 ()Lio/customer/messaginginapp/gist/data/model/GistProperties;
public final fun copy (Lio/customer/messaginginapp/gist/data/model/Message;Lio/customer/messaginginapp/gist/data/model/GistProperties;)Lio/customer/messaginginapp/domain/InAppMessagingAction$ProcessMessage;
public static synthetic fun copy$default (Lio/customer/messaginginapp/domain/InAppMessagingAction$ProcessMessage;Lio/customer/messaginginapp/gist/data/model/Message;Lio/customer/messaginginapp/gist/data/model/GistProperties;ILjava/lang/Object;)Lio/customer/messaginginapp/domain/InAppMessagingAction$ProcessMessage;
public fun equals (Ljava/lang/Object;)Z
public final fun getMessage ()Lio/customer/messaginginapp/gist/data/model/Message;
public final fun getProperties ()Lio/customer/messaginginapp/gist/data/model/GistProperties;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class io/customer/messaginginapp/domain/InAppMessagingAction$SetCurrentRoute : io/customer/messaginginapp/domain/InAppMessagingAction {
public fun <init> (Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;)Lio/customer/messaginginapp/domain/InAppMessagingAction$SetCurrentRoute;
public static synthetic fun copy$default (Lio/customer/messaginginapp/domain/InAppMessagingAction$SetCurrentRoute;Ljava/lang/String;ILjava/lang/Object;)Lio/customer/messaginginapp/domain/InAppMessagingAction$SetCurrentRoute;
public fun equals (Ljava/lang/Object;)Z
public final fun getRoute ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class io/customer/messaginginapp/domain/InAppMessagingAction$SetUser : io/customer/messaginginapp/domain/InAppMessagingAction {
public fun <init> (Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;)Lio/customer/messaginginapp/domain/InAppMessagingAction$SetUser;
public static synthetic fun copy$default (Lio/customer/messaginginapp/domain/InAppMessagingAction$SetUser;Ljava/lang/String;ILjava/lang/Object;)Lio/customer/messaginginapp/domain/InAppMessagingAction$SetUser;
public fun equals (Ljava/lang/Object;)Z
public final fun getUser ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class io/customer/messaginginapp/domain/InAppMessagingAction$SetupGistView : io/customer/messaginginapp/domain/InAppMessagingAction {
public fun <init> (Lio/customer/messaginginapp/gist/data/model/Message;)V
public final fun component1 ()Lio/customer/messaginginapp/gist/data/model/Message;
public final fun copy (Lio/customer/messaginginapp/gist/data/model/Message;)Lio/customer/messaginginapp/domain/InAppMessagingAction$SetupGistView;
public static synthetic fun copy$default (Lio/customer/messaginginapp/domain/InAppMessagingAction$SetupGistView;Lio/customer/messaginginapp/gist/data/model/Message;ILjava/lang/Object;)Lio/customer/messaginginapp/domain/InAppMessagingAction$SetupGistView;
public fun equals (Ljava/lang/Object;)Z
public final fun getMessage ()Lio/customer/messaginginapp/gist/data/model/Message;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class io/customer/messaginginapp/domain/InAppMessagingAction$ShowModal : io/customer/messaginginapp/domain/InAppMessagingAction {
public fun <init> (Lio/customer/messaginginapp/gist/data/model/Message;)V
public final fun component1 ()Lio/customer/messaginginapp/gist/data/model/Message;
public final fun copy (Lio/customer/messaginginapp/gist/data/model/Message;)Lio/customer/messaginginapp/domain/InAppMessagingAction$ShowModal;
public static synthetic fun copy$default (Lio/customer/messaginginapp/domain/InAppMessagingAction$ShowModal;Lio/customer/messaginginapp/gist/data/model/Message;ILjava/lang/Object;)Lio/customer/messaginginapp/domain/InAppMessagingAction$ShowModal;
public fun equals (Ljava/lang/Object;)Z
public final fun getMessage ()Lio/customer/messaginginapp/gist/data/model/Message;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class io/customer/messaginginapp/domain/InAppMessagingAction$UpdateMessages : io/customer/messaginginapp/domain/InAppMessagingAction {
public fun <init> (Ljava/util/List;Ljava/util/List;)V
public final fun component1 ()Ljava/util/List;
public final fun component2 ()Ljava/util/List;
public final fun copy (Ljava/util/List;Ljava/util/List;)Lio/customer/messaginginapp/domain/InAppMessagingAction$UpdateMessages;
public static synthetic fun copy$default (Lio/customer/messaginginapp/domain/InAppMessagingAction$UpdateMessages;Ljava/util/List;Ljava/util/List;ILjava/lang/Object;)Lio/customer/messaginginapp/domain/InAppMessagingAction$UpdateMessages;
public fun equals (Ljava/lang/Object;)Z
public final fun getNew ()Ljava/util/List;
public final fun getPrevious ()Ljava/util/List;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class io/customer/messaginginapp/domain/InAppMessagingState {
public fun <init> ()V
public fun <init> (ZJLjava/lang/String;Ljava/lang/String;Ljava/util/List;ZZLio/customer/messaginginapp/gist/data/model/Message;Lio/customer/messaginginapp/gist/data/model/Message;)V
public synthetic fun <init> (ZJLjava/lang/String;Ljava/lang/String;Ljava/util/List;ZZLio/customer/messaginginapp/gist/data/model/Message;Lio/customer/messaginginapp/gist/data/model/Message;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Z
public final fun component2 ()J
public final fun component3 ()Ljava/lang/String;
public final fun component4 ()Ljava/lang/String;
public final fun component5 ()Ljava/util/List;
public final fun component6 ()Z
public final fun component7 ()Z
public final fun component8 ()Lio/customer/messaginginapp/gist/data/model/Message;
public final fun component9 ()Lio/customer/messaginginapp/gist/data/model/Message;
public final fun copy (ZJLjava/lang/String;Ljava/lang/String;Ljava/util/List;ZZLio/customer/messaginginapp/gist/data/model/Message;Lio/customer/messaginginapp/gist/data/model/Message;)Lio/customer/messaginginapp/domain/InAppMessagingState;
public static synthetic fun copy$default (Lio/customer/messaginginapp/domain/InAppMessagingState;ZJLjava/lang/String;Ljava/lang/String;Ljava/util/List;ZZLio/customer/messaginginapp/gist/data/model/Message;Lio/customer/messaginginapp/gist/data/model/Message;ILjava/lang/Object;)Lio/customer/messaginginapp/domain/InAppMessagingState;
public fun equals (Ljava/lang/Object;)Z
public final fun getCurrentMessageBeingProcessed ()Lio/customer/messaginginapp/gist/data/model/Message;
public final fun getCurrentModalMessage ()Lio/customer/messaginginapp/gist/data/model/Message;
public final fun getCurrentRoute ()Ljava/lang/String;
public final fun getCurrentUser ()Ljava/lang/String;
public final fun getMessages ()Ljava/util/List;
public final fun getPollingInterval ()J
public fun hashCode ()I
public final fun isInitialized ()Z
public final fun isLoading ()Z
public final fun isModalVisible ()Z
public fun toString ()Ljava/lang/String;
}

public abstract class io/customer/messaginginapp/gist/GistEnvironment : java/lang/Enum, io/customer/messaginginapp/gist/GistEnvironmentEndpoints {
public static final field DEV Lio/customer/messaginginapp/gist/GistEnvironment;
public static final field LOCAL Lio/customer/messaginginapp/gist/GistEnvironment;
Expand Down
2 changes: 1 addition & 1 deletion messaginginapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ dependencies {

implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.3.1"

implementation 'com.squareup.retrofit2:converter-gson:2.9.0'

implementation Dependencies.reduxKotlin
implementation Dependencies.coroutinesCore
implementation Dependencies.coroutinesAndroid
implementation Dependencies.androidxAppCompat
Expand Down
Loading
Loading