This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class BaseFlowUseCase<out Type, in Params> { | |
abstract suspend fun execute(param: Params): Flow<Type> | |
} | |
override suspend fun getNumberInvites(): Flow<Int> { | |
return local.getNumberInvites() | |
} | |
override suspend fun getNumberInvites(): Flow<Int> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GoalDataSource(private val getReactGoalsUseCase: GetReactGoalsUseCase) : | |
PositionalDataSource<Goal>() { | |
override fun loadRange(params: LoadRangeParams, callback: LoadRangeCallback<Goal>) { | |
CoroutineScope(Dispatchers.Main).launch { | |
getReactGoalsUseCase.invoke(this, GetReactGoalsUseCase.Param(params.startPosition)) { | |
it.either({}, { goals: List<Goal> -> | |
callback.onResult(goals) | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class BaseUseCase<in Param, out Type> where Type : Any { | |
abstract suspend fun run(param: Param): Either<Failure, Type> | |
open val dispatcher: CoroutineDispatcher = Dispatchers.Main | |
open operator fun invoke( | |
scope: CoroutineScope, | |
param: Param, | |
result: (Either<Failure, Type>) -> Unit = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun showPopupMenu() { | |
val wrapper = ContextThemeWrapper(requireContext(), R.style.AppTheme) | |
val popup = PopupMenu(wrapper, ANCHOR_VIEW) | |
try { | |
val fields = popup::class.java.declaredFields | |
fields.forEach { | |
if ("mPopup" == it.name) { | |
it.isAccessible = true | |
val helper = it.get(popup) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X POST \ | |
-H "Authorization: key=<SERVER_KEY>" \ | |
-H "Content-Type: application/json" \ | |
-d '{"to":"<DEVICE_ID>","collapse_key":"type_a","data":{"body":"Notification body","title":"Notification title","key1":"Your value","key2":"Your other value"}}' \ | |
https://fcm.googleapis.com/fcm/send |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Demo |