├── nutshellfcm
├── rxworker
│ ├── gradle.properties
│ ├── src
│ │ ├── main
│ │ │ ├── res
│ │ │ │ └── values
│ │ │ │ │ └── strings.xml
│ │ │ ├── AndroidManifest.xml
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── nutshellfcm
│ │ │ │ └── rxworkframework
│ │ │ │ ├── Subscriber.kt
│ │ │ │ ├── CancelledObserver.kt
│ │ │ │ ├── Cancelable.kt
│ │ │ │ ├── Observer.kt
│ │ │ │ ├── works
│ │ │ │ ├── WorkEmitter.kt
│ │ │ │ ├── runnables
│ │ │ │ │ ├── EmittedRunnable.kt
│ │ │ │ │ ├── WorkRunnable.kt
│ │ │ │ │ ├── NotifyObserversRunnable.kt
│ │ │ │ │ ├── WorkMapRunnable.kt
│ │ │ │ │ ├── WorkFilterRunnable.kt
│ │ │ │ │ ├── NotifyOnCancelledRunnable.kt
│ │ │ │ │ └── BlockingRunnable.kt
│ │ │ │ ├── ParentWork.kt
│ │ │ │ ├── CompositeCancellable.kt
│ │ │ │ ├── MapWork.kt
│ │ │ │ ├── ScheduledWork.kt
│ │ │ │ ├── FilterWork.kt
│ │ │ │ ├── BlockingWork.kt
│ │ │ │ ├── FlatMapWork.kt
│ │ │ │ └── Work.kt
│ │ │ │ ├── scheudlers
│ │ │ │ ├── Scheduler.kt
│ │ │ │ ├── Schedulers.kt
│ │ │ │ ├── MainScheduler.kt
│ │ │ │ └── FuturesScheduler.kt
│ │ │ │ ├── RxWorkCreator.kt
│ │ │ │ ├── tasks
│ │ │ │ ├── HandlerTask.kt
│ │ │ │ └── FutureTask.kt
│ │ │ │ └── RxWorkerThreadFactory.kt
│ │ └── test
│ │ │ └── java
│ │ │ └── com
│ │ │ └── nutshellfcm
│ │ │ └── rxworkframework
│ │ │ └── ExampleUnitTest.java
│ ├── proguard-rules.pro
│ └── build.gradle
├── nuthsellfcm-common
│ ├── gradle.properties
│ ├── src
│ │ ├── main
│ │ │ ├── res
│ │ │ │ └── values
│ │ │ │ │ └── strings.xml
│ │ │ ├── AndroidManifest.xml
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── nutshellfcm
│ │ │ │ └── common
│ │ │ │ └── PersistentAdapterContract.kt
│ │ └── test
│ │ │ └── java
│ │ │ └── com
│ │ │ └── nutshellfcm
│ │ │ └── persistentadapters
│ │ │ └── ExampleUnitTest.java
│ ├── build.gradle
│ └── proguard-rules.pro
├── gradle
│ ├── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── java_mvn_push.gradle
│ └── android_mvn_push.gradle
├── nuthsellfcm-framework
│ ├── gradle.properties
│ ├── src
│ │ ├── main
│ │ │ ├── res
│ │ │ │ └── values
│ │ │ │ │ └── strings.xml
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── nutshellfcm
│ │ │ │ │ └── framework
│ │ │ │ │ ├── DefaultCaseProvider.kt
│ │ │ │ │ ├── DefaultForegroundServicesBinder.kt
│ │ │ │ │ ├── NutshellHandler.kt
│ │ │ │ │ ├── CleanupCase.kt
│ │ │ │ │ ├── application
│ │ │ │ │ ├── contexts
│ │ │ │ │ │ ├── ContextContract.kt
│ │ │ │ │ │ ├── ActivityContext.kt
│ │ │ │ │ │ └── ApplicationContext.kt
│ │ │ │ │ ├── ApplicationLifeCycleWrapper.kt
│ │ │ │ │ ├── ActivityLifecycleCallback.kt
│ │ │ │ │ └── ForegroundService.kt
│ │ │ │ │ ├── extensions
│ │ │ │ │ └── CommonExtensions.kt
│ │ │ │ │ ├── NutshellNotificationHandler.kt
│ │ │ │ │ ├── NutshellLocalMessagesNotifier.kt
│ │ │ │ │ ├── model
│ │ │ │ │ ├── NotificationMessage.kt
│ │ │ │ │ └── AndroidNotification.kt
│ │ │ │ │ ├── NotificationsRouterBroadcastReceiver.kt
│ │ │ │ │ ├── SilentNotificationHandleService.kt
│ │ │ │ │ ├── ImportanceTranslator.kt
│ │ │ │ │ ├── DefaultNotificationFactory.kt
│ │ │ │ │ ├── sources
│ │ │ │ │ ├── CacheSource.kt
│ │ │ │ │ └── PersistedSource.kt
│ │ │ │ │ ├── NotificationsRepository.kt
│ │ │ │ │ ├── NutshellFCMEngine.kt
│ │ │ │ │ ├── NotificationCasesManager.kt
│ │ │ │ │ ├── AndroidNotificationBuilder.kt
│ │ │ │ │ ├── NutshellFirebaseMessagingService.kt
│ │ │ │ │ ├── PersistedMessageToNotificationMessageConverter.kt
│ │ │ │ │ ├── NotificationNotifier.kt
│ │ │ │ │ ├── NotificationsMessageRouter.kt
│ │ │ │ │ ├── NotificationsReceiversRegisterer.kt
│ │ │ │ │ ├── NotificationsConsumer.kt
│ │ │ │ │ ├── di
│ │ │ │ │ ├── NutshellFirebaseComponents.kt
│ │ │ │ │ └── Injections.kt
│ │ │ │ │ ├── NotificationsInteractor.kt
│ │ │ │ │ ├── AndroidNotificationsManager.kt
│ │ │ │ │ └── NutshellFCMContract.kt
│ │ │ └── AndroidManifest.xml
│ │ └── test
│ │ │ └── java
│ │ │ └── com
│ │ │ └── nutshellfcm
│ │ │ └── framework
│ │ │ └── ExampleUnitTest.java
│ ├── proguard-rules.pro
│ └── build.gradle
├── samples
│ └── app
│ │ ├── src
│ │ ├── main
│ │ │ ├── res
│ │ │ │ ├── values
│ │ │ │ │ ├── strings.xml
│ │ │ │ │ ├── colors.xml
│ │ │ │ │ └── styles.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-anydpi-v26
│ │ │ │ │ ├── ic_launcher.xml
│ │ │ │ │ └── ic_launcher_round.xml
│ │ │ │ ├── layout
│ │ │ │ │ └── example_activity_layout.xml
│ │ │ │ ├── drawable-v24
│ │ │ │ │ └── ic_launcher_foreground.xml
│ │ │ │ └── drawable
│ │ │ │ │ └── ic_launcher_background.xml
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── nutshellfcm
│ │ │ │ │ └── sample_app
│ │ │ │ │ ├── ExampleForegroundServicesBinder.kt
│ │ │ │ │ ├── notifications_use_cases
│ │ │ │ │ ├── Action4ExampleCase.kt
│ │ │ │ │ ├── Action1ExampleCase.kt
│ │ │ │ │ └── Action2Action3ExampleCase.kt
│ │ │ │ │ ├── ExampleForegroundService.kt
│ │ │ │ │ ├── ExampleApplication.kt
│ │ │ │ │ ├── ExampleCaseProvider.kt
│ │ │ │ │ ├── ExampleActivity.kt
│ │ │ │ │ └── ExampleNotificationFactory.kt
│ │ │ └── AndroidManifest.xml
│ │ └── test
│ │ │ └── java
│ │ │ └── com
│ │ │ └── nutshellfcm
│ │ │ └── framework
│ │ │ └── ExampleUnitTest.kt
│ │ ├── proguard-rules.pro
│ │ ├── google-services.json
│ │ └── build.gradle
├── nuthsellfcm-room-persistent-adapter
│ ├── src
│ │ ├── main
│ │ │ ├── res
│ │ │ │ └── values
│ │ │ │ │ └── strings.xml
│ │ │ ├── AndroidManifest.xml
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── nutshellfcm
│ │ │ │ └── room_persistent_adapter
│ │ │ │ ├── converters
│ │ │ │ ├── DateTimeConverter.kt
│ │ │ │ └── MapConverter.kt
│ │ │ │ ├── NutshellPersistentRoomAdapter.kt
│ │ │ │ ├── Database.kt
│ │ │ │ ├── RoomAdapterContract.kt
│ │ │ │ ├── PersistNotificationMessageToRoomNotificationMessageConverter.kt
│ │ │ │ ├── dao
│ │ │ │ └── RoomNotificationMessageDao.kt
│ │ │ │ ├── RoomAdapter.kt
│ │ │ │ └── model
│ │ │ │ └── RoomNotificationMessage.kt
│ │ └── test
│ │ │ └── java
│ │ │ └── com
│ │ │ └── nutshellfcm
│ │ │ └── room_persistent_adapter
│ │ │ └── ExampleUnitTest.java
│ ├── gradle.properties
│ ├── proguard-rules.pro
│ └── build.gradle
├── settings.gradle
├── versions.gradle
├── build.gradle
├── gradle.properties
├── gradlew.bat
└── gradlew
├── CODE_OF_CONDUCT.md
├── README.md
└── LICENSE
/nutshellfcm/rxworker/gradle.properties:
--------------------------------------------------------------------------------
1 | POM_ARTIFACT_ID=rxworker
2 | POM_NAME=RxWorker
3 | POM_PACKAGING=aar
4 |
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-common/gradle.properties:
--------------------------------------------------------------------------------
1 | POM_ARTIFACT_ID=nuthsellfcm-common
2 | POM_NAME=NuthsellFCMCommon
3 | POM_PACKAGING=aar
4 |
--------------------------------------------------------------------------------
/nutshellfcm/rxworker/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | rxworkframework
3 |
4 |
--------------------------------------------------------------------------------
/nutshellfcm/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dor558/NutshellFCM/HEAD/nutshellfcm/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-common/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | roomadapter
3 |
4 |
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-framework/gradle.properties:
--------------------------------------------------------------------------------
1 | POM_ARTIFACT_ID=nutshellfcm-framework
2 | POM_NAME=NutshellFCMFramework
3 | POM_PACKAGING=aar
4 |
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-framework/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | framework
3 |
4 |
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | FirebaseNotifications
3 |
4 |
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-room-persistent-adapter/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | room_persistent_adapter
3 |
4 |
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-common/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/nutshellfcm/rxworker/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dor558/NutshellFCM/HEAD/nutshellfcm/samples/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dor558/NutshellFCM/HEAD/nutshellfcm/samples/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dor558/NutshellFCM/HEAD/nutshellfcm/samples/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dor558/NutshellFCM/HEAD/nutshellfcm/samples/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dor558/NutshellFCM/HEAD/nutshellfcm/samples/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-room-persistent-adapter/gradle.properties:
--------------------------------------------------------------------------------
1 | POM_ARTIFACT_ID=nuthsellfcm-room-persistent-adapter
2 | POM_NAME=NuthsellFCMRoomPersistentAdapter
3 | POM_PACKAGING=aar
4 |
--------------------------------------------------------------------------------
/nutshellfcm/rxworker/src/main/java/com/nutshellfcm/rxworkframework/Subscriber.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.rxworkframework
2 |
3 |
4 | internal data class Subscriber(val onSubscribe: () -> Unit)
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dor558/NutshellFCM/HEAD/nutshellfcm/samples/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dor558/NutshellFCM/HEAD/nutshellfcm/samples/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dor558/NutshellFCM/HEAD/nutshellfcm/samples/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dor558/NutshellFCM/HEAD/nutshellfcm/samples/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dor558/NutshellFCM/HEAD/nutshellfcm/samples/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/nutshellfcm/rxworker/src/main/java/com/nutshellfcm/rxworkframework/CancelledObserver.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.rxworkframework
2 |
3 |
4 | internal data class CancelledObserver(val onCancelled: () -> Unit)
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-room-persistent-adapter/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/nutshellfcm/rxworker/src/main/java/com/nutshellfcm/rxworkframework/Cancelable.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.rxworkframework
2 |
3 |
4 | interface Cancelable {
5 |
6 | val isCancelled: Boolean
7 | fun cancel()
8 | }
--------------------------------------------------------------------------------
/nutshellfcm/rxworker/src/main/java/com/nutshellfcm/rxworkframework/Observer.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.rxworkframework
2 |
3 |
4 | internal data class Observer(val onResult: (T) -> Unit, val onError: (Throwable) -> Unit)
--------------------------------------------------------------------------------
/nutshellfcm/rxworker/src/main/java/com/nutshellfcm/rxworkframework/works/WorkEmitter.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.rxworkframework.works
2 |
3 | interface WorkEmitter {
4 | fun onResult(result: T)
5 | fun onError(error: Throwable)
6 | }
--------------------------------------------------------------------------------
/nutshellfcm/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':nuthsellfcm-framework', ':nuthsellfcm-common', ':nuthsellfcm-room-persistent-adapter', ':rxworker'
2 | project(':rxworker').projectDir = file('rxworker')
3 | project(':app').projectDir = file('samples/app')
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/nutshellfcm/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Aug 19 15:26:15 IDT 2019
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
7 |
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-framework/src/main/java/com/nutshellfcm/framework/DefaultCaseProvider.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.framework
2 |
3 |
4 | class DefaultCaseProvider : NutshellFCMContract.CasesProvider {
5 |
6 | override val cases: List
7 | get() = emptyList()
8 | }
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-framework/src/main/java/com/nutshellfcm/framework/DefaultForegroundServicesBinder.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.framework
2 |
3 |
4 | class DefaultForegroundServicesBinder : NutshellFCMContract.ForegroundServicesBinder {
5 |
6 | override fun bind(actionId: String): Class<*>? = null
7 | }
--------------------------------------------------------------------------------
/nutshellfcm/rxworker/src/main/java/com/nutshellfcm/rxworkframework/works/runnables/EmittedRunnable.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.rxworkframework.works.runnables
2 |
3 | import com.nutshellfcm.rxworkframework.works.WorkEmitter
4 |
5 |
6 | internal interface EmittedRunnable: Runnable {
7 | var emitter: WorkEmitter?
8 | }
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-framework/src/main/java/com/nutshellfcm/framework/NutshellHandler.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.framework
2 |
3 | import android.os.Handler
4 | import android.os.HandlerThread
5 |
6 |
7 | internal object NutshellHandler: Handler(HandlerThread("NutshellHandler", Thread.MAX_PRIORITY)
8 | .also { it.start() }.looper)
--------------------------------------------------------------------------------
/nutshellfcm/rxworker/src/main/java/com/nutshellfcm/rxworkframework/scheudlers/Scheduler.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.rxworkframework.scheudlers
2 |
3 | import com.nutshellfcm.rxworkframework.Cancelable
4 |
5 |
6 | interface Scheduler {
7 |
8 | fun start()
9 | fun shutdown()
10 | fun schedule(runnable: Runnable): Cancelable
11 | }
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-framework/src/main/java/com/nutshellfcm/framework/CleanupCase.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.framework
2 |
3 | import com.nutshellfcm.framework.model.NotificationMessage
4 |
5 |
6 | internal class CleanupCase : NutshellFCMContract.Case {
7 |
8 | override val actionIds: List = emptyList()
9 |
10 | override fun consume(caseMessages: List) {}
11 | }
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-framework/src/main/java/com/nutshellfcm/framework/application/contexts/ContextContract.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.framework.application.contexts
2 |
3 | import android.content.Context
4 |
5 |
6 | interface ContextContract {
7 |
8 | interface AndroidContext {
9 | fun get(): Context
10 | fun getApplicationContext(): ApplicationContext
11 | }
12 |
13 | }
--------------------------------------------------------------------------------
/nutshellfcm/versions.gradle:
--------------------------------------------------------------------------------
1 | ext {
2 | MAJOR_VERSION = 0
3 | MINOR_VERSION = 1
4 | HOTFIX_VERSION = 14
5 |
6 | VERSION_NAME = "${MAJOR_VERSION}.${MINOR_VERSION}.${HOTFIX_VERSION}"
7 | VERSION_CODE = MAJOR_VERSION * 10000 + MINOR_VERSION * 100 + HOTFIX_VERSION
8 |
9 | // Android SDK
10 | COMPILE_SDK_VERSION = 28
11 | MIN_SDK_VERSION = 16
12 | TARGET_SDK_VERSION = 28
13 | }
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-framework/src/main/java/com/nutshellfcm/framework/extensions/CommonExtensions.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.framework.extensions
2 |
3 | import android.os.Bundle
4 |
5 |
6 | val Any.TAG: String get() = this::class.java.simpleName
7 |
8 | fun Map.toBundle(): Bundle {
9 | val bundle = Bundle()
10 | this.keys.forEach { key ->
11 | bundle.putString(key, this.getValue(key))
12 | }
13 |
14 | return bundle
15 | }
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-room-persistent-adapter/src/main/java/com/nutshellfcm/room_persistent_adapter/converters/DateTimeConverter.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.room_persistent_adapter.converters
2 |
3 | import androidx.room.TypeConverter
4 | import java.util.*
5 |
6 | class DateTimeConverter {
7 | @TypeConverter
8 | fun dateTimeToMillis(dataTime: Date): Long = dataTime.time
9 |
10 | @TypeConverter
11 | fun millisToDateTime(value: Long): Date = Date(value)
12 | }
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-framework/src/main/java/com/nutshellfcm/framework/NutshellNotificationHandler.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.framework
2 |
3 | import androidx.lifecycle.LiveData
4 | import androidx.lifecycle.MutableLiveData
5 | import com.nutshellfcm.framework.model.NotificationMessage
6 |
7 |
8 | object NutshellNotificationHandler : NutshellFCMContract.HandledNotificationsNotifier {
9 |
10 | override val handledNotifications: LiveData> = MutableLiveData()
11 | }
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/test/java/com/nutshellfcm/framework/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.framework
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/main/java/com/nutshellfcm/sample_app/ExampleForegroundServicesBinder.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.sample_app
2 |
3 | import com.nutshellfcm.framework.NutshellFCMContract
4 |
5 |
6 | class ExampleForegroundServicesBinder : NutshellFCMContract.ForegroundServicesBinder {
7 |
8 | override fun bind(actionId: String): Class<*>? {
9 | return when (actionId) {
10 | "Action 4" -> ExampleForegroundService::class.java
11 | else -> null
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-framework/src/main/java/com/nutshellfcm/framework/application/contexts/ActivityContext.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.framework.application.contexts
2 |
3 | import android.content.Context
4 | import androidx.appcompat.app.AppCompatActivity
5 |
6 |
7 | class ActivityContext(private val activity: AppCompatActivity): ContextContract.AndroidContext {
8 |
9 | override fun get(): Context = activity
10 |
11 | override fun getApplicationContext() = ApplicationContext(activity.applicationContext)
12 | }
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-framework/src/main/java/com/nutshellfcm/framework/application/contexts/ApplicationContext.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.framework.application.contexts
2 |
3 | import android.content.Context
4 |
5 | class ApplicationContext(private val context: Context) : ContextContract.AndroidContext {
6 |
7 | override fun get(): Context = context.applicationContext
8 |
9 | override fun getApplicationContext(): ApplicationContext {
10 | return ApplicationContext(context.applicationContext)
11 | }
12 | }
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-framework/src/test/java/com/nutshellfcm/framework/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.framework;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/nutshellfcm/rxworker/src/test/java/com/nutshellfcm/rxworkframework/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.rxworkframework;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/main/java/com/nutshellfcm/sample_app/notifications_use_cases/Action4ExampleCase.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.sample_app.notifications_use_cases
2 |
3 | import com.nutshellfcm.framework.NutshellFCMContract
4 | import com.nutshellfcm.framework.model.NotificationMessage
5 |
6 |
7 | class Action4ExampleCase : NutshellFCMContract.Case {
8 |
9 | override val actionIds: List = listOf("Action 4")
10 |
11 | override fun consume(caseMessages: List) {
12 | //Do something
13 | }
14 | }
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-common/src/test/java/com/nutshellfcm/persistentadapters/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.persistentadapters;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/nutshellfcm/rxworker/src/main/java/com/nutshellfcm/rxworkframework/works/ParentWork.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.rxworkframework.works
2 |
3 | import com.nutshellfcm.rxworkframework.scheudlers.Scheduler
4 | import com.nutshellfcm.rxworkframework.works.runnables.EmittedRunnable
5 |
6 |
7 | internal interface ParentWork: ScheduledWork {
8 | var subscribeOnScheduler: Scheduler
9 | var observeOnScheduler: Scheduler
10 | val compositeCancellable: CompositeCancellable
11 | val emittedRunnable: EmittedRunnable
12 |
13 | fun onWorkCancelled()
14 | }
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-room-persistent-adapter/src/test/java/com/nutshellfcm/room_persistent_adapter/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.room_persistent_adapter;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/nutshellfcm/rxworker/src/main/java/com/nutshellfcm/rxworkframework/RxWorkCreator.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.rxworkframework
2 |
3 | import com.nutshellfcm.rxworkframework.works.ScheduledWork
4 | import com.nutshellfcm.rxworkframework.works.Work
5 | import com.nutshellfcm.rxworkframework.works.WorkEmitter
6 | import com.nutshellfcm.rxworkframework.works.runnables.WorkRunnable
7 |
8 |
9 | object RxWorkCreator {
10 |
11 | fun create(workEmitterInvokable: (WorkEmitter) -> Unit): ScheduledWork {
12 | return Work(WorkRunnable(workEmitterInvokable))
13 | }
14 | }
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/main/java/com/nutshellfcm/sample_app/ExampleForegroundService.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.sample_app
2 |
3 | import android.content.Intent
4 | import android.os.Bundle
5 | import android.os.IBinder
6 | import com.nutshellfcm.framework.application.ForegroundService
7 |
8 |
9 | class ExampleForegroundService : ForegroundService() {
10 |
11 | override fun onForegroundStarted(payload: Bundle) {
12 | //Do something with the payload
13 | }
14 |
15 | override fun onBind(intent: Intent?): IBinder? {
16 | return null
17 | }
18 | }
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-framework/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
6 |
7 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/main/java/com/nutshellfcm/sample_app/ExampleApplication.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.sample_app
2 |
3 | import android.app.Application
4 | import com.nutshellfcm.framework.NutshellFCMEngine
5 |
6 | class ExampleApplication : Application() {
7 |
8 |
9 | override fun onCreate() {
10 | super.onCreate()
11 | NutshellFCMEngine.start(this,
12 | ExampleNotificationFactory(this),
13 | ExampleCaseProvider(),
14 | ExampleForegroundServicesBinder())
15 | }
16 |
17 |
18 | }
--------------------------------------------------------------------------------
/nutshellfcm/rxworker/src/main/java/com/nutshellfcm/rxworkframework/tasks/HandlerTask.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.rxworkframework.tasks
2 |
3 | import android.os.Handler
4 | import com.nutshellfcm.rxworkframework.Cancelable
5 |
6 | internal class HandlerTask(private val runnable: Runnable,
7 | private val handler: Handler) : Runnable, Cancelable {
8 |
9 | override var isCancelled: Boolean = false
10 |
11 | override fun run() {
12 | runnable.run()
13 | }
14 |
15 | override fun cancel() {
16 | handler.removeCallbacks(this)
17 | isCancelled = true
18 | }
19 | }
--------------------------------------------------------------------------------
/nutshellfcm/rxworker/src/main/java/com/nutshellfcm/rxworkframework/works/runnables/WorkRunnable.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.rxworkframework.works.runnables
2 |
3 | import com.nutshellfcm.rxworkframework.works.WorkEmitter
4 |
5 | internal class WorkRunnable(
6 | val workEmitterInvokable: (WorkEmitter) -> Unit) :
7 | EmittedRunnable {
8 |
9 | override var emitter: WorkEmitter? = null
10 |
11 | override fun run() {
12 | runCatching {
13 | workEmitterInvokable.invoke(emitter!!)
14 | }.getOrElse {
15 | emitter!!.onError(it)
16 | }
17 |
18 | }
19 | }
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-framework/src/main/java/com/nutshellfcm/framework/NutshellLocalMessagesNotifier.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.framework
2 |
3 | import com.nutshellfcm.framework.model.NotificationMessage
4 | import com.nutshellfcm.framework.di.NutshellFirebaseComponents
5 |
6 |
7 | object NutshellLocalMessagesNotifier {
8 |
9 | fun notify(notificationMessage: NotificationMessage) {
10 | NutshellFirebaseComponents.notificationNotifier.notifyMessage(notificationMessage)
11 | }
12 |
13 | fun notifyDismiss(actionId: String) {
14 | NutshellFirebaseComponents.notificationsConsumer.consume(actionId)
15 | }
16 |
17 | }
--------------------------------------------------------------------------------
/nutshellfcm/rxworker/src/main/java/com/nutshellfcm/rxworkframework/tasks/FutureTask.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.rxworkframework.tasks
2 |
3 | import com.nutshellfcm.rxworkframework.Cancelable
4 | import java.util.concurrent.Callable
5 | import java.util.concurrent.Future
6 |
7 |
8 | internal class FutureTask(private val runnable: Runnable) : Callable , Cancelable {
9 |
10 | lateinit var future: Future
11 |
12 | override val isCancelled by lazy { future.isCancelled }
13 |
14 | override fun call() {
15 | runnable.run()
16 | }
17 |
18 | override fun cancel() {
19 | future.cancel(true)
20 | }
21 | }
--------------------------------------------------------------------------------
/nutshellfcm/rxworker/src/main/java/com/nutshellfcm/rxworkframework/scheudlers/Schedulers.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.rxworkframework.scheudlers
2 |
3 | import com.nutshellfcm.rxworkframework.scheudlers.FuturesScheduler.Companion.Type.*
4 |
5 | object Schedulers {
6 |
7 | val main = MainScheduler().apply { start() }
8 | val single = FuturesScheduler(FIXED_SINGLE).apply { start() }
9 | val unbounded = FuturesScheduler(UNBOUNDED_CACHE).apply { start() }
10 | val bounded = FuturesScheduler(BOUNDED_CACHE).apply { start() }
11 |
12 | internal val defaultScheduler = FuturesScheduler(UNBOUNDED_CACHE).apply { start() }
13 | }
14 |
15 |
16 |
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/main/java/com/nutshellfcm/sample_app/notifications_use_cases/Action1ExampleCase.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.sample_app.notifications_use_cases
2 |
3 | import com.nutshellfcm.framework.NutshellFCMContract
4 | import com.nutshellfcm.framework.model.NotificationMessage
5 |
6 | class Action1ExampleCase : NutshellFCMContract.Case {
7 |
8 | override val actionIds: List = listOf("Action 1")
9 |
10 | override fun consume(caseMessages: List) {
11 | caseMessages.forEach {
12 | val payload = it.payload
13 | //Do something with the payload
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/main/java/com/nutshellfcm/sample_app/ExampleCaseProvider.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.sample_app
2 |
3 | import com.nutshellfcm.sample_app.notifications_use_cases.Action1ExampleCase
4 | import com.nutshellfcm.sample_app.notifications_use_cases.Action2Action3ExampleCase
5 | import com.nutshellfcm.sample_app.notifications_use_cases.Action4ExampleCase
6 | import com.nutshellfcm.framework.NutshellFCMContract
7 |
8 | class ExampleCaseProvider : NutshellFCMContract.CasesProvider {
9 |
10 | override val cases: List =
11 | listOf(Action1ExampleCase(), Action2Action3ExampleCase(), Action4ExampleCase())
12 | }
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-framework/src/main/java/com/nutshellfcm/framework/model/NotificationMessage.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.framework.model
2 |
3 | import com.nutshellfcm.framework.NutshellFCMContract.Companion.KEY_ACTION_ID
4 | import com.nutshellfcm.framework.NutshellFCMContract.NotificationType
5 | import java.util.*
6 |
7 | data class NotificationMessage(
8 |
9 | val actionId: String,
10 |
11 | val type: NotificationType = NotificationType.NOTIFICATION,
12 |
13 | val payload: Map = mapOf(KEY_ACTION_ID to actionId),
14 |
15 | val timeStamp: Date = Date()
16 | ) {
17 |
18 | val notificationId = actionId.hashCode()
19 | }
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-framework/src/main/java/com/nutshellfcm/framework/application/ApplicationLifeCycleWrapper.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.framework.application
2 |
3 | import android.app.Application
4 |
5 | internal class ApplicationLifeCycleWrapper(private val application: Application) {
6 |
7 | fun registerLifecycle(activityLifecycleCallback: ActivityLifecycleCallback) {
8 | application.registerActivityLifecycleCallbacks(activityLifecycleCallback)
9 | }
10 |
11 | fun unregisterLifeCycle(activityLifecycleCallback: ActivityLifecycleCallback) {
12 | application.unregisterActivityLifecycleCallbacks(activityLifecycleCallback)
13 | }
14 |
15 | }
--------------------------------------------------------------------------------
/nutshellfcm/rxworker/src/main/java/com/nutshellfcm/rxworkframework/works/runnables/NotifyObserversRunnable.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.rxworkframework.works.runnables
2 |
3 | import com.nutshellfcm.rxworkframework.Observer
4 |
5 | internal class NotifyObserversRunnable(private val observers: Set>): Runnable {
6 |
7 | var result: T? = null
8 |
9 | var throwable: Throwable? = null
10 |
11 | override fun run() {
12 | if (result != null) {
13 | observers.forEach { it.onResult(result!!) }
14 | }
15 |
16 | if (throwable != null) {
17 | observers.forEach { it.onError(throwable!!) }
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/main/java/com/nutshellfcm/sample_app/notifications_use_cases/Action2Action3ExampleCase.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.sample_app.notifications_use_cases
2 |
3 | import com.nutshellfcm.framework.NutshellFCMContract
4 | import com.nutshellfcm.framework.model.NotificationMessage
5 |
6 |
7 | class Action2Action3ExampleCase : NutshellFCMContract.Case {
8 |
9 | override val actionIds: List = listOf("Action 2", "Action 3")
10 |
11 | override fun consume(caseMessages: List) {
12 | caseMessages.forEach {
13 | val payload = it.payload
14 | //Do something with the payload
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/nutshellfcm/samples/app/src/main/res/layout/example_activity_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
15 |
16 |
--------------------------------------------------------------------------------
/nutshellfcm/rxworker/src/main/java/com/nutshellfcm/rxworkframework/works/CompositeCancellable.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.rxworkframework.works
2 |
3 | import com.nutshellfcm.rxworkframework.Cancelable
4 |
5 |
6 | internal class CompositeCancellable(private val parentWork: ParentWork<*>) : Cancelable {
7 |
8 | private val set: MutableSet = mutableSetOf()
9 |
10 | override val isCancelled: Boolean = set.all { it.isCancelled }
11 |
12 | override fun cancel() {
13 | set.forEach { it.cancel() }
14 | set.clear()
15 | parentWork.onWorkCancelled()
16 | }
17 |
18 | fun append(cancelable: Cancelable) {
19 | set.add(cancelable)
20 | }
21 | }
--------------------------------------------------------------------------------
/nutshellfcm/nuthsellfcm-room-persistent-adapter/src/main/java/com/nutshellfcm/room_persistent_adapter/converters/MapConverter.kt:
--------------------------------------------------------------------------------
1 | package com.nutshellfcm.room_persistent_adapter.converters
2 |
3 | import androidx.room.TypeConverter
4 | import com.google.common.reflect.TypeToken
5 | import com.google.gson.Gson
6 |
7 |
8 | class MapConverter {
9 |
10 | @TypeConverter
11 | fun toJson(map: Map): String {
12 | return Gson().toJson(map)
13 | }
14 |
15 | @TypeConverter
16 | fun toMap(json: String): Map {
17 | val typeOfHashMap = object : TypeToken