Skip to content

Instantly share code, notes, and snippets.

Avatar
🇦🇷
https://feresr.github.io/

Fernando Raviola feresr

🇦🇷
https://feresr.github.io/
View GitHub Profile
View rxcoroutines.kt
package com.glovoapp.notification.in_app_notification
import io.reactivex.Observable
import io.reactivex.Single
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.coroutineScope
View ImageView.kt
fun ImageView.loadFromCloudinary(
resource: String,
onSuccess: () -> Unit = {},
onError: () -> Unit = {},
configure: (RequestBuilder<Drawable>) -> Unit = {},
mediaManager : MediaManager = MediaManager.get()
) = doOnLayout {
val transformation: EagerTransformation? = EagerTransformation().fetchFormat("webp")
val cloudinaryUrl = mediaManager.url().transformation(transformation)
mediaManager.responsiveUrl(ResponsiveUrl.Preset.AUTO_FILL)
View EditorVM.kt
class EditorViewModel : ViewModel() {
private var appliedFilters = MutableStateFlow(sortedMapOf<FILTER, FloatArray>())
val lightContextualViewModel = SliderContextualViewModel(
onFilterChanged = ::onValueChanged,
filterFlow = appliedFilters.map {
it.filterKeys { listOf(FILTER.EXPOSURE, FILTER.GRAIN, FILTER.VIBRANCE).contains(it) }
},
onFilterCommitted = history::onCommit
View SliderContextualViewModel.kt
open class SliderContextualViewModel(
val filterFlow: StateFlow<Map<FILTER, FloatArray>>,
val onFilterChanged: (FILTER, FloatArray) -> Unit,
val onFilterCommitted: () -> Unit = {}
)
@Composable
fun SliderContextual(modifier: Modifier, viewModel: SliderContextualViewModel) {
val sliding = remember { mutableStateOf(false) }
Card(
View presets.json
{
"home": {
"packOfTheDay": 212,
"featured": [
1,
4,
5,
9,
11,
13,
@feresr
feresr / MainActivity.kt
Created Jun 1, 2021
Android update underlying bitmap
View MainActivity.kt
package com.feresr.composebitmap
import android.graphics.Bitmap
import android.graphics.Color
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.material.Button
View gist:0529faa95aa28a7e1c877490f695c72c
Once I’ve updated the dependencies I set off to test it:
= I set my user Feature flags to be on
= Connected to the VPN and reset the user idverification  data from the database using this guide
= Try to login, wasn’t able to because of some backend problem affecting other devs as well
= Took a few hours to fix the problem, but only for my specific user, not sure if the more general problem is fixed (I think backend is investigating)
= But now I’m also getting an error while refreshing profile, it’s showing a message to the user “Unknown error” (started debugging, after a while I found out this courier has no cc and that might be the reason)
= Added a credit card using glovotest.com , but the issue wasn’t resolved
= Logged out to try logging in again and now I’m getting an empty toast in the screen, can’t log back in (empty message showing up, recorded a video and let the team know about it)
View JumioAuthCrash.xml
//manifest.xml
...
<activity
android:name="com.jumio.nv.NetverifyActivity"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|uiMode|layoutDirection"
android:hardwareAccelerated="true"
android:theme="@style/CustomNetverifyTheme"
android:windowSoftInputMode="adjustResize" />
...
View DP.kt
package com.feresr.threedp
import android.os.Bundle
import android.view.MotionEvent
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.layout.size
import androidx.compose.material.Surface
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
View Test.kt
// One of the strenghts of MVI is testing!
// 1) I'd love to use the VM API `viewModel.startOnBoarding()` instead of `handleIntents` :(
// 2) Why do we need to `handleIntent` before we can subscribe to the VM, how do I test a sequence of intenets?
@Test
fun `start onBoarding`() {
val testSubscriber = TestSubscriber<Any>() // Why <ANY> we shold be getting states?