Skip to content

Commit

Permalink
Merge pull request #60 from rees46/feat/in-app-notification
Browse files Browse the repository at this point in the history
Feat/in app notification
  • Loading branch information
TorinAsakura authored Sep 20, 2024
2 parents f3a4c1f + d1e1fd4 commit 8ff10b3
Show file tree
Hide file tree
Showing 29 changed files with 976 additions and 137 deletions.
20 changes: 18 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,29 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
android.enableJetifier=true
org.gradle.jvmargs=-Xmx8g
org.gradle.configureondemand=false
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.daemon=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
ossrhUsername=""
publishUrl=""
sonataUsername=""
sonataPassword=""
variantName=""
url=""
ossrhPassword=""
signing_keyId=""
signing_password=""
signing_secretKeyRingFile=""
sonatype_rees46=""
sonatype_personaclick=""
10 changes: 6 additions & 4 deletions personalization-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ version='2.0.25'
android {
compileSdkVersion 34
flavorDimensions += 'default'

viewBinding {
enabled = true
}
defaultConfig {
minSdkVersion 19
targetSdkVersion 34
Expand All @@ -27,12 +29,12 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_22
targetCompatibility JavaVersion.VERSION_22
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = '22'
jvmTarget = '17'
}

sourceSets {
Expand Down
32 changes: 25 additions & 7 deletions personalization-sdk/src/main/kotlin/com/personalization/SDK.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,27 @@ import com.google.firebase.messaging.RemoteMessage
import com.personalization.Params.InternalParameter
import com.personalization.Params.TrackEvent
import com.personalization.api.OnApiCallbackListener
import com.personalization.api.managers.TrackEventManager
import com.personalization.api.managers.InAppNotificationManager
import com.personalization.api.managers.RecommendationManager
import com.personalization.api.managers.SearchManager
import com.personalization.api.managers.TrackEventManager
import com.personalization.di.DaggerSdkComponent
import com.personalization.sdk.domain.usecases.preferences.GetPreferencesValueUseCase
import com.personalization.sdk.domain.usecases.preferences.InitPreferencesUseCase
import com.personalization.notification.NotificationHandler
import com.personalization.notification.NotificationHelper
import com.personalization.sdk.domain.usecases.network.AddTaskToQueueUseCase
import com.personalization.sdk.domain.usecases.network.InitNetworkUseCase
import com.personalization.sdk.domain.usecases.network.SendNetworkMethodUseCase
import com.personalization.sdk.domain.usecases.notification.GetAllNotificationsUseCase
import com.personalization.sdk.domain.usecases.preferences.GetPreferencesValueUseCase
import com.personalization.sdk.domain.usecases.preferences.InitPreferencesUseCase
import com.personalization.sdk.domain.usecases.userSettings.GetUserSettingsValueUseCase
import com.personalization.sdk.domain.usecases.userSettings.InitUserSettingsUseCase
import com.personalization.stories.StoriesManager
import com.personalization.stories.views.StoriesView
import org.json.JSONException
import org.json.JSONObject
import java.util.Locale
import javax.inject.Inject
import org.json.JSONException
import org.json.JSONObject

open class SDK {

Expand All @@ -39,31 +40,46 @@ open class SDK {

@Inject
lateinit var notificationHandler: NotificationHandler

@Inject
lateinit var registerManager: RegisterManager

@Inject
lateinit var storiesManager: StoriesManager

@Inject
lateinit var recommendationManager: RecommendationManager

@Inject
lateinit var trackEventManager: TrackEventManager

@Inject
lateinit var searchManager: SearchManager

@Inject
lateinit var inAppNotificationManager: InAppNotificationManager

@Inject
lateinit var initPreferencesUseCase: InitPreferencesUseCase

@Inject
lateinit var initUserSettingsUseCase: InitUserSettingsUseCase

@Inject
lateinit var initNetworkUseCase: InitNetworkUseCase

@Inject
lateinit var getPreferencesValueUseCase: GetPreferencesValueUseCase

@Inject
lateinit var getUserSettingsValueUseCase: GetUserSettingsValueUseCase

@Inject
lateinit var addTaskToQueueUseCase: AddTaskToQueueUseCase

@Inject
lateinit var sendNetworkMethodUseCase: SendNetworkMethodUseCase

@Inject
lateinit var getAllNotificationsUseCase: GetAllNotificationsUseCase

Expand Down Expand Up @@ -717,8 +733,10 @@ open class SDK {

var TAG = "SDK"

private const val SUBSCRIPTION_UNSUBSCRIBE_PRICE = "subscriptions/unsubscribe_from_product_price"
private const val SUBSCRIPTION_UNSUBSCRIBE = "subscriptions/unsubscribe_from_product_available"
private const val SUBSCRIPTION_UNSUBSCRIBE_PRICE =
"subscriptions/unsubscribe_from_product_price"
private const val SUBSCRIPTION_UNSUBSCRIBE =
"subscriptions/unsubscribe_from_product_available"
private const val SUBSCRIPTION_SUBSCRIBE_PRICE = "subscriptions/subscribe_for_product_price"
private const val SUBSCRIPTION_SUBSCRIBE = "subscriptions/subscribe_for_product_available"
private const val SUBSCRIPTION_MANAGE = "subscriptions/manage"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.personalization.api.managers

import android.view.View
import androidx.fragment.app.FragmentManager

interface InAppNotificationManager {

fun showAlertDialog(
fragmentManager: FragmentManager,
title: String,
message: String,
buttonText: String
)

fun showFullScreenDialog(
fragmentManager: FragmentManager,
title: String,
message: String,
imageUrl: String?,
buttonPositiveText: String,
buttonNegativeText: String,
onPositiveClick: () -> Unit,
onNegativeClick: () -> Unit
)

fun showBottomSheetDialog(
fragmentManager: FragmentManager,
title: String,
message: String,
imageUrl: String?,
buttonPositiveText: String,
buttonNegativeText: String,
onPositiveClick: () -> Unit,
onNegativeClick: () -> Unit
)

fun showSnackBar(
view: View,
message: String,
buttonPositiveText: String,
buttonNegativeText: String,
onPositiveClick: () -> Unit,
onNegativeClick: () -> Unit
)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.personalization.di

import androidx.fragment.app.FragmentManager
import com.personalization.RegisterManager
import com.personalization.api.managers.InAppNotificationManager
import com.personalization.api.managers.RecommendationManager
import com.personalization.api.managers.SearchManager
import com.personalization.api.managers.TrackEventManager
Expand All @@ -11,6 +13,7 @@ import com.personalization.sdk.domain.usecases.recommendation.SetRecommendedByUs
import com.personalization.features.recommendation.impl.RecommendationManagerImpl
import com.personalization.features.search.impl.SearchManagerImpl
import com.personalization.features.trackEvent.impl.TrackEventManagerImpl
import com.personalization.features.inAppNotification.impl.InAppNotificationManagerImpl
import com.personalization.sdk.domain.usecases.network.ExecuteQueueTasksUseCase
import com.personalization.sdk.domain.usecases.network.SendNetworkMethodUseCase
import com.personalization.sdk.domain.usecases.userSettings.GetUserSettingsValueUseCase
Expand All @@ -32,55 +35,56 @@ class SdkModule {
getUserSettingsValueUseCase: GetUserSettingsValueUseCase,
sendNetworkMethodUseCase: SendNetworkMethodUseCase,
executeQueueTasksUseCase: ExecuteQueueTasksUseCase
): RegisterManager =
RegisterManager(
getPreferencesValueUseCase = getPreferencesValueUseCase,
savePreferencesValueUseCase = savePreferencesValueUseCase,
updateUserSettingsValueUseCase = updateUserSettingsValueUseCase,
getUserSettingsValueUseCase = getUserSettingsValueUseCase,
sendNetworkMethodUseCase = sendNetworkMethodUseCase,
executeQueueTasksUseCase = executeQueueTasksUseCase
)
): RegisterManager = RegisterManager(
getPreferencesValueUseCase = getPreferencesValueUseCase,
savePreferencesValueUseCase = savePreferencesValueUseCase,
updateUserSettingsValueUseCase = updateUserSettingsValueUseCase,
getUserSettingsValueUseCase = getUserSettingsValueUseCase,
sendNetworkMethodUseCase = sendNetworkMethodUseCase,
executeQueueTasksUseCase = executeQueueTasksUseCase
)

@Singleton
@Provides
fun provideRecommendationManager(
sendNetworkMethodUseCase: SendNetworkMethodUseCase
): RecommendationManager =
RecommendationManagerImpl(
sendNetworkMethodUseCase = sendNetworkMethodUseCase
)
): RecommendationManager = RecommendationManagerImpl(
sendNetworkMethodUseCase = sendNetworkMethodUseCase
)

@Singleton
@Provides
fun provideTrackEventManager(
getRecommendedByUseCase: GetRecommendedByUseCase,
setRecommendedByUseCase: SetRecommendedByUseCase,
sendNetworkMethodUseCase: SendNetworkMethodUseCase
): TrackEventManager =
TrackEventManagerImpl(
getRecommendedByUseCase = getRecommendedByUseCase,
setRecommendedByUseCase = setRecommendedByUseCase,
sendNetworkMethodUseCase = sendNetworkMethodUseCase
)
): TrackEventManager = TrackEventManagerImpl(
getRecommendedByUseCase = getRecommendedByUseCase,
setRecommendedByUseCase = setRecommendedByUseCase,
sendNetworkMethodUseCase = sendNetworkMethodUseCase
)

@Singleton
@Provides
fun provideStoriesManager(
setRecommendedByUseCase: SetRecommendedByUseCase,
sendNetworkMethodUseCase: SendNetworkMethodUseCase
): StoriesManager =
StoriesManager(
setRecommendedByUseCase = setRecommendedByUseCase,
sendNetworkMethodUseCase = sendNetworkMethodUseCase
)
): StoriesManager = StoriesManager(
setRecommendedByUseCase = setRecommendedByUseCase,
sendNetworkMethodUseCase = sendNetworkMethodUseCase
)

@Singleton
@Provides
fun provideSearchManager(
sendNetworkMethodUseCase: SendNetworkMethodUseCase
): SearchManager =
SearchManagerImpl(
sendNetworkMethodUseCase = sendNetworkMethodUseCase
)
): SearchManager = SearchManagerImpl(
sendNetworkMethodUseCase = sendNetworkMethodUseCase
)

@Singleton
@Provides
fun provideInAppNotificationManager(

): InAppNotificationManager = InAppNotificationManagerImpl()
}
Loading

0 comments on commit 8ff10b3

Please sign in to comment.