This file contains hidden or 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 |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
import io.ktor.client.plugins.api.ClientPlugin | |
import io.ktor.client.plugins.api.createClientPlugin | |
class AuthenticationPlugin(private val settingsRepository: SettingsRepository) { | |
fun createPlugin(): ClientPlugin<Unit> { | |
val token = settingsRepository.getToken() | |
return createClientPlugin(PLUGIN_NAME) { | |
onRequest { request, _ -> |
This file contains hidden or 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
import androidx.compose.foundation.background | |
import androidx.compose.foundation.layout.Arrangement | |
import androidx.compose.foundation.layout.Box | |
import androidx.compose.foundation.layout.Column | |
import androidx.compose.foundation.layout.fillMaxSize | |
import androidx.compose.foundation.layout.fillMaxWidth | |
import androidx.compose.foundation.layout.height | |
import androidx.compose.foundation.layout.padding | |
import androidx.compose.foundation.shape.RoundedCornerShape | |
import androidx.compose.material3.Text |