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
@Dao | |
interface LineItemDao { | |
//Get all line item in along with its product | |
@Transaction | |
@Query("SELECT * FROM line_items ") | |
fun getAll(): Flow<List<LineItemAndProduct>> | |
//Get line item in an order by orderId | |
@Transaction | |
@Query("SELECT * FROM line_items WHERE orderId = :orderId") |
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 WeatherItemAdapter : | |
ListAdapter<Weather, WeatherItemAdapter.WeatherItemViewHolder>(DiffCallback) { | |
// Other implementation for DiffCallback | |
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): WeatherItemViewHolder { | |
when (viewType) { | |
WeatherViewType.DAY.ordinal -> { | |
val view = LayoutInflater.from(parent.context).inflate(R.layout.weather_day_item, parent, false) | |
return WeatherDayItemViewHolder(view) |
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
val state = rememberDismissState( | |
confirmStateChange = { | |
if (it == DismissValue.DismissedToStart) { | |
viewModel.onRemoveTag(item) | |
} | |
true | |
} | |
) | |
SwipeToDismiss( | |
state = state, |
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
implementation "io.github.jan-tennert.supabase:postgrest-kt:$supabase_version" | |
implementation "io.github.jan-tennert.supabase:storage-kt:$supabase_version" | |
implementation "io.github.jan-tennert.supabase:gotrue-kt:$supabase_version" | |
implementation "io.ktor:ktor-client-android:$ktor_version" | |
implementation "io.ktor:ktor-client-core:$ktor_version" | |
implementation "io.ktor:ktor-utils:$ktor_version" |
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
plugins { | |
... | |
id 'org.jetbrains.kotlin.plugin.serialization' version '$kotlin_version' | |
... | |
} |
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
implementation "com.google.dagger:hilt-android:$hilt_version" | |
annotationProcessor "com.google.dagger:hilt-compiler:$hilt_version" | |
implementation "androidx.hilt:hilt-navigation-compose:1.0.0" |
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
@InstallIn(SingletonComponent::class) | |
@Module | |
object SupabaseModule { | |
@Provides | |
@Singleton | |
fun provideSupabaseClient(): SupabaseClient { | |
return createSupabaseClient( | |
supabaseUrl = BuildConfig.SUPABASE_URL, | |
supabaseKey = BuildConfig.SUPABASE_ANON_KEY |
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
@Serializable | |
data class ProductDto( | |
@SerialName("name") | |
val name: String, | |
@SerialName("price") | |
val price: Double, | |
@SerialName("image") |
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
data class Product( | |
val id: String, | |
val name: String, | |
val price: Double, | |
val image: String? | |
) |
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
interface ProductRepository { | |
suspend fun createProduct(product: Product): Boolean | |
suspend fun getProducts(): List<ProductDto>? | |
suspend fun getProduct(id: String): ProductDto | |
suspend fun deleteProduct(id: String) | |
suspend fun updateProduct( | |
id: String, name: String, price: Double, imageName: String, imageFile: ByteArray | |
) | |
} |