parent
c97bf42cb6
commit
304508fa8c
@ -1,105 +0,0 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'org.jetbrains.kotlin.android'
|
||||
id "kotlin-kapt"
|
||||
id "dagger.hilt.android.plugin"
|
||||
}
|
||||
|
||||
def keystorePropertiesFile = rootProject.file("app/keys/keystore.properties")
|
||||
def keystoreProperties = new Properties()
|
||||
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
||||
|
||||
android {
|
||||
signingConfigs {
|
||||
release {
|
||||
storeFile file(keystoreProperties['store'])
|
||||
storePassword keystoreProperties['password']
|
||||
keyPassword keystoreProperties['password']
|
||||
}
|
||||
}
|
||||
namespace 'fr.iut.alldev.allin'
|
||||
compileSdk 34
|
||||
|
||||
defaultConfig {
|
||||
applicationId "fr.iut.alldev.allin"
|
||||
minSdk 26
|
||||
targetSdk 34
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "fr.iut.alldev.allin.TestRunner"
|
||||
vectorDrawables {
|
||||
useSupportLibrary true
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
|
||||
debug {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
buildFeatures {
|
||||
compose true
|
||||
}
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion '1.2.0'
|
||||
}
|
||||
packagingOptions {
|
||||
resources {
|
||||
excludes += '/META-INF/{AL2.0,LGPL2.1}'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(path: ':data')
|
||||
|
||||
implementation 'androidx.core:core-ktx:1.12.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
|
||||
implementation 'androidx.activity:activity-compose:1.7.2'
|
||||
implementation "androidx.compose.ui:ui:$compose_version"
|
||||
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
|
||||
implementation 'androidx.compose.material3:material3:1.2.0-alpha08'
|
||||
implementation "androidx.compose.material:material:1.5.3"
|
||||
implementation "androidx.navigation:navigation-compose:2.7.3"
|
||||
implementation 'androidx.compose.material:material-icons-core'
|
||||
implementation 'androidx.compose.material:material-icons-extended'
|
||||
|
||||
//Tests
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
|
||||
androidTestImplementation "com.google.dagger:hilt-android-testing:$hilt_version"
|
||||
kaptAndroidTest "com.google.dagger:hilt-android-compiler:$hilt_version"
|
||||
|
||||
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
|
||||
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
|
||||
implementation("androidx.core:core-splashscreen:1.0.1")
|
||||
|
||||
//Hilt
|
||||
implementation "com.google.dagger:hilt-android:$hilt_version"
|
||||
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
|
||||
implementation "androidx.hilt:hilt-navigation-compose:1.0.0"
|
||||
|
||||
// Smooth Corners
|
||||
implementation 'com.github.racra:smooth-corner-rect-android-compose:v1.0.0'
|
||||
|
||||
//Timber
|
||||
implementation 'com.jakewharton.timber:timber:5.0.1'
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
import org.gradle.language.nativeplatform.internal.BuildType
|
||||
import java.io.FileInputStream
|
||||
import java.util.Properties
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("kotlin-android")
|
||||
id("kotlin-kapt")
|
||||
id("dagger.hilt.android.plugin")
|
||||
}
|
||||
|
||||
// Keystore
|
||||
val keystorePropertiesFile = rootProject.file("app/keys/keystore.properties")
|
||||
val keystoreProperties = Properties()
|
||||
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
|
||||
|
||||
android {
|
||||
namespace = "fr.iut.alldev.allin"
|
||||
compileSdk = libs.versions.compileSdk.get().toInt()
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "fr.iut.alldev.allin"
|
||||
|
||||
minSdk = libs.versions.minSdk.get().toInt()
|
||||
targetSdk = libs.versions.targetSdk.get().toInt()
|
||||
|
||||
versionCode = 1
|
||||
versionName = "1.0"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
useSupportLibrary = true
|
||||
}
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
register(BuildType.RELEASE.name) {
|
||||
storeFile = file(keystoreProperties["store"].toString())
|
||||
storePassword = keystoreProperties["password"].toString()
|
||||
keyPassword = keystoreProperties["password"].toString()
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
isMinifyEnabled = false
|
||||
versionNameSuffix = "-debug"
|
||||
applicationIdSuffix = ".debug"
|
||||
signingConfig = signingConfigs.getByName(BuildType.DEBUG.name)
|
||||
}
|
||||
release {
|
||||
isMinifyEnabled = true
|
||||
isShrinkResources = true
|
||||
signingConfig = signingConfigs.getByName(BuildType.RELEASE.name)
|
||||
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
|
||||
}
|
||||
}
|
||||
buildFeatures {
|
||||
compose = true
|
||||
buildConfig = true
|
||||
}
|
||||
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get()
|
||||
}
|
||||
|
||||
packaging {
|
||||
resources {
|
||||
excludes += "/META-INF/{AL2.0,LGPL2.1}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":data"))
|
||||
|
||||
// Android
|
||||
implementation(libs.bundles.android)
|
||||
|
||||
// Lifecycle
|
||||
implementation(libs.bundles.androidx.lifecycle)
|
||||
|
||||
// Compose
|
||||
implementation(platform(libs.compose.bom))
|
||||
implementation(libs.bundles.compose)
|
||||
|
||||
// Hilt
|
||||
implementation(libs.hilt.android)
|
||||
kapt(libs.hilt.compiler)
|
||||
implementation(libs.hilt.navigation.compose)
|
||||
|
||||
// Timber
|
||||
implementation(libs.timber)
|
||||
|
||||
// Squircle
|
||||
implementation(libs.smoothCornerRect)
|
||||
|
||||
// Tests
|
||||
testImplementation(libs.test.junit)
|
||||
androidTestImplementation(libs.test.junit)
|
||||
androidTestImplementation(libs.test.espresso)
|
||||
androidTestImplementation(libs.test.androidx.junit)
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package fr.iut.alldev.allin.ui.betcreation
|
||||
package fr.iut.alldev.allin.ui.betCreation
|
||||
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.lifecycle.ViewModel
|
@ -1,4 +1,4 @@
|
||||
package fr.iut.alldev.allin.ui.betcreation.components
|
||||
package fr.iut.alldev.allin.ui.betCreation.components
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.layout.Arrangement
|
@ -1,4 +1,4 @@
|
||||
package fr.iut.alldev.allin.ui.betcreation.tabs.sections
|
||||
package fr.iut.alldev.allin.ui.betCreation.tabs.sections
|
||||
|
||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
@ -0,0 +1,65 @@
|
||||
package fr.iut.alldev.allin.ui.betHistory
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import fr.iut.alldev.allin.R
|
||||
import fr.iut.alldev.allin.data.ext.formatToMediumDateNoYear
|
||||
import fr.iut.alldev.allin.data.ext.formatToTime
|
||||
import fr.iut.alldev.allin.theme.AllInTheme
|
||||
import fr.iut.alldev.allin.ui.betHistory.components.BetHistoryScreenCard
|
||||
|
||||
@Composable
|
||||
fun BetHistoryScreen(
|
||||
isCurrent: Boolean,
|
||||
viewModel: BetHistoryViewModel = hiltViewModel(),
|
||||
) {
|
||||
val bets by viewModel.bets.collectAsState()
|
||||
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentPadding = PaddingValues(horizontal = 24.dp, vertical = 18.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(18.dp),
|
||||
) {
|
||||
item {
|
||||
Text(
|
||||
text = stringResource(
|
||||
id = if (isCurrent) R.string.bet_history_current_title
|
||||
else R.string.bet_history_title
|
||||
),
|
||||
style = AllInTheme.typography.h1,
|
||||
color = AllInTheme.colors.allInGrey,
|
||||
fontSize = 24.sp,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
}
|
||||
|
||||
bets?.let { bets ->
|
||||
items(bets) {
|
||||
BetHistoryScreenCard(
|
||||
title = it.phrase,
|
||||
creator = "creator",
|
||||
category = it.theme,
|
||||
date = it.endBetDate.formatToMediumDateNoYear(),
|
||||
time = it.endBetDate.formatToTime(),
|
||||
status = it.betStatus,
|
||||
nbCoins = 230
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package fr.iut.alldev.allin.ui.betHistory
|
||||
|
||||
import androidx.lifecycle.SavedStateHandle
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import fr.iut.alldev.allin.data.model.bet.Bet
|
||||
import fr.iut.alldev.allin.data.repository.BetRepository
|
||||
import fr.iut.alldev.allin.ui.navigation.NavArguments
|
||||
import kotlinx.coroutines.flow.SharingStarted
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.filterNotNull
|
||||
import kotlinx.coroutines.flow.flatMapConcat
|
||||
import kotlinx.coroutines.flow.flowOf
|
||||
import kotlinx.coroutines.flow.stateIn
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
class BetHistoryViewModel @Inject constructor(
|
||||
savedStateHandle: SavedStateHandle,
|
||||
private val betRepository: BetRepository,
|
||||
) : ViewModel() {
|
||||
private val isCurrent: Boolean? = savedStateHandle[NavArguments.ARG_BET_HISTORY_IS_CURRENT]
|
||||
|
||||
val bets: StateFlow<List<Bet>?> by lazy {
|
||||
flowOf(isCurrent).filterNotNull().flatMapConcat {
|
||||
if (it) betRepository.getCurrentBets()
|
||||
else betRepository.getHistory()
|
||||
}.stateIn(
|
||||
viewModelScope,
|
||||
SharingStarted.WhileSubscribed(5_000L),
|
||||
null
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package fr.iut.alldev.allin.ui.betHistory.components
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.text.InlineTextContent
|
||||
import androidx.compose.foundation.text.appendInlineContent
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.Placeholder
|
||||
import androidx.compose.ui.text.PlaceholderVerticalAlign
|
||||
import androidx.compose.ui.text.buildAnnotatedString
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import fr.iut.alldev.allin.data.model.bet.BetStatus
|
||||
import fr.iut.alldev.allin.ext.getBetHistoryPhrase
|
||||
import fr.iut.alldev.allin.ext.getBetHistoryStatusColor
|
||||
import fr.iut.alldev.allin.theme.AllInTheme
|
||||
import fr.iut.alldev.allin.ui.preview.BetStatusPreviewProvider
|
||||
|
||||
const val betHistoryStatusModId = "allCoinsIcon"
|
||||
val betHistoryStatusInlineContent = mapOf(
|
||||
Pair(
|
||||
betHistoryStatusModId,
|
||||
InlineTextContent(
|
||||
Placeholder(
|
||||
width = 24.sp,
|
||||
height = 24.sp,
|
||||
placeholderVerticalAlign = PlaceholderVerticalAlign.Center
|
||||
)
|
||||
) {
|
||||
Icon(
|
||||
painter = AllInTheme.icons.allCoins(),
|
||||
tint = AllInTheme.colors.white,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(24.dp)
|
||||
)
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun BetHistoryBetStatus(
|
||||
status: BetStatus,
|
||||
nbCoins: Int,
|
||||
) {
|
||||
val betHistoryPhrase = stringResource(id = status.getBetHistoryPhrase(), nbCoins)
|
||||
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.background(status.getBetHistoryStatusColor())
|
||||
.padding(16.dp),
|
||||
horizontalArrangement = Arrangement.Center,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Text(
|
||||
text = buildAnnotatedString {
|
||||
append(betHistoryPhrase.substringBefore("[icon]"))
|
||||
appendInlineContent(betHistoryStatusModId, "[icon]")
|
||||
append(betHistoryPhrase.substringAfter("[icon]"))
|
||||
},
|
||||
color = AllInTheme.colors.white,
|
||||
inlineContent = betHistoryStatusInlineContent,
|
||||
style = AllInTheme.typography.h1,
|
||||
fontSize = 24.sp
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun BetHistoryBetStatusPreview(
|
||||
@PreviewParameter(BetStatusPreviewProvider::class) betStatus: BetStatus,
|
||||
) {
|
||||
AllInTheme {
|
||||
BetHistoryBetStatus(
|
||||
status = betStatus,
|
||||
nbCoins = 230
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
package fr.iut.alldev.allin.ui.betHistory.components
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.unit.dp
|
||||
import fr.iut.alldev.allin.data.model.bet.BetStatus
|
||||
import fr.iut.alldev.allin.ext.getDateStartLabelId
|
||||
import fr.iut.alldev.allin.theme.AllInTheme
|
||||
import fr.iut.alldev.allin.ui.core.AllInCard
|
||||
import fr.iut.alldev.allin.ui.core.bet.BetDateTimeRow
|
||||
import fr.iut.alldev.allin.ui.core.bet.BetTitleHeader
|
||||
import fr.iut.alldev.allin.ui.preview.BetStatusPreviewProvider
|
||||
|
||||
@Composable
|
||||
fun BetHistoryScreenCard(
|
||||
modifier: Modifier = Modifier,
|
||||
title: String,
|
||||
creator: String,
|
||||
category: String,
|
||||
date: String,
|
||||
time: String,
|
||||
status: BetStatus,
|
||||
nbCoins: Int,
|
||||
) {
|
||||
AllInCard(
|
||||
modifier = modifier.fillMaxWidth(),
|
||||
radius = 16.dp
|
||||
) {
|
||||
Column(
|
||||
Modifier.padding(horizontal = 19.dp, vertical = 11.dp)
|
||||
) {
|
||||
BetTitleHeader(
|
||||
title = title,
|
||||
category = category,
|
||||
creator = creator,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
Spacer(modifier = Modifier.height(11.dp))
|
||||
BetDateTimeRow(
|
||||
label = stringResource(id = status.getDateStartLabelId()),
|
||||
date = date,
|
||||
time = time
|
||||
)
|
||||
}
|
||||
HorizontalDivider(
|
||||
thickness = 1.dp,
|
||||
color = AllInTheme.themeColors.border
|
||||
)
|
||||
BetHistoryBetStatus(
|
||||
status = status,
|
||||
nbCoins = nbCoins
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun BetHistoryScreenCardPreview(
|
||||
@PreviewParameter(BetStatusPreviewProvider::class) betStatus: BetStatus
|
||||
) {
|
||||
AllInTheme {
|
||||
BetHistoryScreenCard(
|
||||
creator = "Creator",
|
||||
category = "Category",
|
||||
title = "Title",
|
||||
date = "Date",
|
||||
time = "Time",
|
||||
status = betStatus,
|
||||
nbCoins = 123
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package fr.iut.alldev.allin.ui.preview
|
||||
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
||||
import fr.iut.alldev.allin.data.model.bet.BetFinishedStatus
|
||||
import fr.iut.alldev.allin.data.model.bet.BetStatus
|
||||
|
||||
class BetStatusPreviewProvider: PreviewParameterProvider<BetStatus> {
|
||||
override val values = sequenceOf(
|
||||
BetStatus.InProgress,
|
||||
BetStatus.Waiting,
|
||||
BetStatus.Finished(BetFinishedStatus.WON),
|
||||
BetStatus.Finished(BetFinishedStatus.LOST)
|
||||
)
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
buildscript {
|
||||
ext {
|
||||
compose_version = '1.2.0'
|
||||
accompanist_version = '0.25.1'
|
||||
hilt_version = "2.45"
|
||||
}
|
||||
|
||||
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id 'com.android.application' version '7.4.2' apply false
|
||||
id 'com.android.library' version '7.4.2' apply false
|
||||
id 'org.jetbrains.kotlin.android' version '1.7.0' apply false
|
||||
id 'com.google.dagger.hilt.android' version "$hilt_version" apply false
|
||||
id 'org.jetbrains.kotlin.plugin.serialization' version '1.7.0' apply false
|
||||
}
|
||||
|
@ -0,0 +1,57 @@
|
||||
buildscript {
|
||||
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven { url = uri("https://www.jitpack.io") }
|
||||
maven { url = uri("https://maven.openium.fr/") }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Gradle
|
||||
classpath(libs.plugin.gradle)
|
||||
|
||||
// Kotlin
|
||||
classpath(libs.plugin.kotlin)
|
||||
|
||||
// Kotlin Serialization
|
||||
classpath(libs.plugin.kotlinSerialization)
|
||||
|
||||
// Hilt
|
||||
classpath(libs.plugin.hilt)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register<Delete>("clean") {
|
||||
delete(rootProject.layout.buildDirectory)
|
||||
}
|
||||
|
||||
subprojects {
|
||||
tasks {
|
||||
withType(JavaCompile::class.java).configureEach {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8.name
|
||||
targetCompatibility = JavaVersion.VERSION_1_8.name
|
||||
}
|
||||
|
||||
withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class.java).configureEach {
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_1_8.toString()
|
||||
freeCompilerArgs += listOf(
|
||||
"-Xallow-result-return-type",
|
||||
"-opt-in=kotlin.RequiresOptIn",
|
||||
"-opt-in=kotlin.ExperimentalStdlibApi",
|
||||
"-opt-in=androidx.compose.foundation.ExperimentalFoundationApi",
|
||||
"-opt-in=androidx.compose.ui.ExperimentalComposeUiApi",
|
||||
"-opt-in=androidx.compose.foundation.layout.ExperimentalLayoutApi",
|
||||
"-opt-in=androidx.compose.material.ExperimentalMaterialApi",
|
||||
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api",
|
||||
"-opt-in=androidx.compose.animation.ExperimentalAnimationApi",
|
||||
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
||||
"-opt-in=kotlin.time.ExperimentalTime",
|
||||
"-opt-in=kotlinx.coroutines.FlowPreview"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
id 'org.jetbrains.kotlin.android'
|
||||
id "kotlin-kapt"
|
||||
id "kotlinx-serialization"
|
||||
}
|
||||
|
||||
def keystorePropertiesFile = rootProject.file("app/keys/keystore.properties")
|
||||
def keystoreProperties = new Properties()
|
||||
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
||||
|
||||
android {
|
||||
signingConfigs {
|
||||
release {
|
||||
storeFile file(keystoreProperties['store'])
|
||||
storePassword keystoreProperties['password']
|
||||
keyPassword keystoreProperties['password']
|
||||
}
|
||||
}
|
||||
namespace 'fr.iut.alldev.allin.data'
|
||||
compileSdk 34
|
||||
|
||||
defaultConfig {
|
||||
minSdk 26
|
||||
targetSdk 34
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
|
||||
debug {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.core:core-ktx:1.12.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
// implementation 'com.google.android.material:material:1.9.0'
|
||||
|
||||
//Tests
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
|
||||
//Hilt
|
||||
implementation "com.google.dagger:hilt-android:$hilt_version"
|
||||
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
|
||||
|
||||
// Retrofit
|
||||
api "com.squareup.retrofit2:retrofit:2.9.0"
|
||||
implementation "com.squareup.okhttp3:okhttp:4.11.0"
|
||||
debugImplementation "com.squareup.okhttp3:logging-interceptor:4.11.0"
|
||||
api "org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1"
|
||||
implementation "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0"
|
||||
|
||||
//Timber
|
||||
implementation 'com.jakewharton.timber:timber:5.0.1'
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
plugins {
|
||||
id("com.android.library")
|
||||
id("kotlin-android")
|
||||
id("kotlin-kapt")
|
||||
id("com.google.dagger.hilt.android")
|
||||
id("kotlinx-serialization")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "fr.iut.alldev.allin.data"
|
||||
compileSdk = libs.versions.compileSdk.get().toInt()
|
||||
|
||||
defaultConfig {
|
||||
minSdk = libs.versions.minSdk.get().toInt()
|
||||
targetSdk = libs.versions.targetSdk.get().toInt()
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles("consumer-rules.pro")
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
isMinifyEnabled = false
|
||||
}
|
||||
release {
|
||||
isMinifyEnabled = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
// Androidx
|
||||
implementation(libs.androidx.core)
|
||||
|
||||
// Hilt
|
||||
implementation(libs.hilt.android)
|
||||
kapt(libs.hilt.compiler)
|
||||
|
||||
// Timber
|
||||
implementation(libs.timber)
|
||||
|
||||
// Retrofit
|
||||
api(libs.retrofit)
|
||||
implementation(libs.okhttp)
|
||||
debugImplementation(libs.okhttpLogging.interceptor)
|
||||
|
||||
// Serialization
|
||||
implementation(libs.kotlinSerialization.json)
|
||||
implementation(libs.kotlinSerialization.retrofit)
|
||||
|
||||
// Tests
|
||||
testImplementation(libs.test.junit)
|
||||
androidTestImplementation(libs.test.androidx.junit)
|
||||
androidTestImplementation(libs.test.espresso)
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
package fr.iut.alldev.allin.data.model.bet
|
||||
|
||||
enum class BetFinishedStatus {
|
||||
WON,
|
||||
LOST
|
||||
}
|
@ -1,7 +1,9 @@
|
||||
package fr.iut.alldev.allin.data.model.bet
|
||||
|
||||
enum class BetStatus {
|
||||
FINISHED,
|
||||
IN_PROGRESS,
|
||||
WAITING
|
||||
sealed class BetStatus {
|
||||
data class Finished(val status: BetFinishedStatus) : BetStatus()
|
||||
|
||||
data object InProgress : BetStatus()
|
||||
|
||||
data object Waiting : BetStatus()
|
||||
}
|
@ -1,9 +1,13 @@
|
||||
package fr.iut.alldev.allin.data.repository
|
||||
|
||||
import fr.iut.alldev.allin.data.model.bet.Bet
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
abstract class BetRepository {
|
||||
abstract suspend fun createBet(
|
||||
bet: Bet,
|
||||
)
|
||||
|
||||
abstract suspend fun getHistory(): Flow<List<Bet>>
|
||||
abstract suspend fun getCurrentBets(): Flow<List<Bet>>
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
[versions]
|
||||
|
||||
# Android
|
||||
compileSdk = "34"
|
||||
targetSdk = "34"
|
||||
minSdk = "26"
|
||||
|
||||
# Libraries
|
||||
kotlin = "1.9.20"
|
||||
|
||||
androidxCore = "1.12.0"
|
||||
androidxActivity = "1.8.2"
|
||||
|
||||
composeBom = "2023.10.01"
|
||||
composePreview = "1.6.0-beta03"
|
||||
composeCompiler = "1.5.5"
|
||||
composeNavigation = "2.7.6"
|
||||
|
||||
hilt = "2.48"
|
||||
hiltNavigation = "1.1.0"
|
||||
|
||||
timber = "5.0.1"
|
||||
lifecycle = "2.6.2"
|
||||
|
||||
junit = "4.13.2"
|
||||
androidxTestExtJunit = "1.1.5"
|
||||
espressoCore = "3.5.1"
|
||||
|
||||
room = "2.6.1"
|
||||
okHttp = "4.11.0"
|
||||
|
||||
# Plugins
|
||||
gradlePlugin = "8.1.2"
|
||||
publishPlugin = "1.1"
|
||||
resgenPlugin = "2.5"
|
||||
|
||||
[libraries]
|
||||
|
||||
# Android
|
||||
androidx-core = { module = "androidx.core:core-ktx", version.ref = "androidxCore" }
|
||||
androidx-activity = { module = "androidx.activity:activity-compose", version.ref = "androidxActivity" }
|
||||
|
||||
# Lifecycle
|
||||
androidx-lifecycle-runtime = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycle" }
|
||||
androidx-lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "lifecycle" }
|
||||
androidx-lifecycle-process = { module = "androidx.lifecycle:lifecycle-process", version.ref = "lifecycle" }
|
||||
androidx-lifecycle-runtime-compose = { module = "androidx.lifecycle:lifecycle-runtime-compose", version.ref = "lifecycle" }
|
||||
|
||||
# Tests
|
||||
test-junit = { group = "junit", name = "junit", version.ref = "junit" }
|
||||
test-androidx-junit = { group = "androidx.test.ext", name = "junit-ktx", version.ref = "androidxTestExtJunit" }
|
||||
test-espresso = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
|
||||
|
||||
|
||||
# Compose
|
||||
compose-bom = { module = "androidx.compose:compose-bom", version.ref = "composeBom" }
|
||||
compose-ui = { module = "androidx.compose.ui:ui" }
|
||||
compose-ui-graphics = { module = "androidx.compose.ui:ui-graphics" }
|
||||
compose-foundation = { module = "androidx.compose.foundation:foundation", version = "1.6.0-beta03" }
|
||||
compose-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "composePreview" }
|
||||
compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
|
||||
compose-ui-googlefonts = { group = "androidx.compose.ui", name = "ui-text-google-fonts" }
|
||||
compose-material = { module = "androidx.compose.material:material" }
|
||||
compose-material3 = { group = "androidx.compose.material3", name = "material3", version = "1.2.0-beta01" }
|
||||
compose-material-icons = { group = "androidx.compose.material", name = "material-icons-core" }
|
||||
compose-material-icons-extended = { group = "androidx.compose.material", name = "material-icons-extended" }
|
||||
compose-navigation = { module = "androidx.navigation:navigation-compose", version.ref = "composeNavigation" }
|
||||
|
||||
# Hilt
|
||||
hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" }
|
||||
hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt" }
|
||||
hilt-navigation-compose = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "hiltNavigation" }
|
||||
|
||||
# Timber
|
||||
timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" }
|
||||
|
||||
# Retrofit
|
||||
retrofit = { group = "com.squareup.retrofit2", name = "retrofit", version = "2.9.0" }
|
||||
okhttp = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okHttp" }
|
||||
okhttpLogging-interceptor = { group = "com.squareup.okhttp3", name = "logging-interceptor", version.ref = "okHttp" }
|
||||
|
||||
# Serialization
|
||||
kotlinSerialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version = "1.6.2" }
|
||||
kotlinSerialization-retrofit = { group = "com.jakewharton.retrofit", name = "retrofit2-kotlinx-serialization-converter", version = "0.8.0" }
|
||||
|
||||
# Squicle
|
||||
smoothCornerRect = { module = "com.github.racra:smooth-corner-rect-android-compose", version = "v1.0.0" }
|
||||
|
||||
# Plugins
|
||||
plugin-gradle = { module = "com.android.tools.build:gradle", version.ref = "gradlePlugin" }
|
||||
plugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
|
||||
plugin-kotlinSerialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" }
|
||||
plugin-hilt = { module = "com.google.dagger:hilt-android-gradle-plugin", version.ref = "hilt" }
|
||||
|
||||
|
||||
[bundles]
|
||||
|
||||
android = ["androidx-core", "androidx-activity"]
|
||||
androidx-lifecycle = ["androidx-lifecycle-runtime", "androidx-lifecycle-viewmodel", "androidx-lifecycle-process", "androidx-lifecycle-runtime-compose"]
|
||||
compose = ["compose-ui", "compose-ui-graphics", "compose-tooling-preview", "compose-ui-tooling", "compose-foundation", "compose-material", "compose-material3", "compose-material-icons", "compose-material-icons-extended", "compose-navigation", "compose-ui-googlefonts"]
|
@ -1,6 +1,7 @@
|
||||
#Mon Sep 25 00:27:11 CEST 2023
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
|
Loading…
Reference in new issue