Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 43 additions & 35 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'org.jetbrains.kotlin.plugin.compose' version '2.2.0'
id 'com.google.gms.google-services'
id "com.google.devtools.ksp"
id "org.sonarqube" version "4.2.1.3168"
Expand All @@ -26,6 +27,8 @@ android {
namespace 'com.xpeho.xpeapp'
compileSdk 36

ndkVersion '28.2.13676358'

defaultConfig {
applicationId "com.xpeho.xpeapp"
minSdk 26
Expand All @@ -39,6 +42,12 @@ android {
}
}

packagingOptions {
jniLibs {
useLegacyPackaging = false
}
}

testOptions {
unitTests.all {
jacoco {
Expand Down Expand Up @@ -80,10 +89,9 @@ android {
}
buildFeatures {
compose true
buildConfig = true
buildConfig = true // déplacé depuis gradle.properties
}
composeOptions {
kotlinCompilerExtensionVersion = '1.5.1'
}
packagingOptions {
resources {
Expand Down Expand Up @@ -153,68 +161,68 @@ sonar {
}

dependencies {

implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.6'
implementation 'androidx.activity:activity-compose:1.9.2'
implementation "androidx.compose.ui:ui:$compose_ui_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_ui_version"
implementation("androidx.compose.material3:material3-android:1.3.0")
implementation('org.jetbrains.kotlin:kotlin-stdlib:2.2.0')
implementation 'androidx.core:core-ktx:1.17.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.9.4'
implementation 'androidx.activity:activity-compose:1.11.0'
implementation "androidx.compose.ui:ui:1.9.2"
implementation "androidx.compose.ui:ui-tooling-preview:1.9.2"
implementation('androidx.compose.material3:material3-android:1.4.0')
implementation("androidx.core:core-splashscreen:1.0.1")
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.constraintlayout:constraintlayout-compose:1.0.1'
implementation 'androidx.core:core-ktx:1.17.0'
implementation 'androidx.constraintlayout:constraintlayout-compose:1.1.1'
implementation "androidx.compose.material:material-icons-core:1.7.3"
implementation "androidx.compose.material:material-icons-extended:1.7.3"
implementation "androidx.compose.animation:animation-core:$compose_ui_version"
implementation 'androidx.fragment:fragment:1.3.0'
implementation 'androidx.compose.material:material-icons-extended:1.7.8'
implementation "androidx.compose.animation:animation-core:1.9.2"
implementation 'androidx.fragment:fragment:1.8.9'

// Test
implementation 'androidx.lifecycle:lifecycle-runtime-compose:2.8.6'
testImplementation 'junit:junit:4.13.2'
testImplementation "io.mockk:mockk:1.13.13"
testImplementation 'io.mockk:mockk:1.14.5'

// Android Test
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_ui_version"
androidTestImplementation 'androidx.test.ext:junit:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.9.2"

// Debug implementation
debugImplementation "androidx.compose.ui:ui-tooling:$compose_ui_version"
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_ui_version"
debugImplementation "androidx.compose.ui:ui-tooling:1.9.2"
debugImplementation "androidx.compose.ui:ui-test-manifest:1.9.2"

// Import the BoM for the Firebase platform
implementation platform("com.google.firebase:firebase-bom:33.4.0")
implementation platform('com.google.firebase:firebase-bom:34.3.0')

// Firebase
implementation("com.google.firebase:firebase-auth-ktx")
implementation 'com.google.firebase:firebase-firestore-ktx:25.1.0'
implementation 'com.google.firebase:firebase-messaging:24.0.2'
implementation 'com.google.firebase:firebase-storage-ktx:21.0.1'
implementation("com.google.firebase:firebase-auth-ktx:22.3.0")
implementation 'com.google.firebase:firebase-firestore-ktx:25.1.4'
implementation 'com.google.firebase:firebase-messaging:25.0.1'
implementation 'com.google.firebase:firebase-storage-ktx:21.0.2'
implementation "com.google.firebase:firebase-analytics"

// Navigation
implementation "androidx.navigation:navigation-compose:2.8.2"
implementation 'androidx.navigation:navigation-compose:2.9.5'

// Use Json
implementation "com.google.code.gson:gson:2.10.1"
implementation 'com.google.code.gson:gson:2.13.2'

//ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.8.6"
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.9.4'

//Retrofit for http requests
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
implementation 'com.squareup.retrofit2:retrofit:3.0.0'
implementation 'com.squareup.retrofit2:converter-gson:3.0.0'
implementation 'com.squareup.okhttp3:logging-interceptor:5.1.0'
implementation 'com.squareup.okhttp3:okhttp:5.1.0'

//Local data storage
implementation "androidx.datastore:datastore-preferences:1.1.1"
implementation 'androidx.datastore:datastore-preferences:1.1.7'
implementation "androidx.security:security-crypto:1.0.0"
implementation "androidx.security:security-identity-credential:1.0.0-alpha03"

//Notifications
implementation("com.google.accompanist:accompanist-systemuicontroller:0.27.0")
implementation("com.google.accompanist:accompanist-permissions:0.31.1-alpha")
implementation('com.google.accompanist:accompanist-systemuicontroller:0.36.0')
implementation('com.google.accompanist:accompanist-permissions:0.37.3')

//XpehoUI
implementation "com.xpeho.packages:xpeho_ui_android:1.7.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.xpeho.xpeapp.data.entity
data class QvstCampaignEntity(
val id: String,
val name: String,
val themeName: String,
val themeNames: List<String>,
val status: String,
val outdated: Boolean,
val completed: Boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.google.gson.annotations.SerializedName
data class QvstCampaign(
val id: String,
val name: String,
val theme: QvstTheme,
@SerializedName("themes") val themes: List<QvstTheme> = emptyList(),
val status: String,
@SerializedName("start_date") val startDate: String,
@SerializedName("end_date") val endDate: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ class WordpressRepository(

val completed = campaignProgress?.let {
it.answeredQuestions >= it.totalQuestions
} ?: false
} == true

return QvstCampaignEntity(
id = campaign.id,
name = campaign.name,
themeName = campaign.theme.name,
themeNames = campaign.themes.map { it.name },
status = campaign.status,
outdated = remainingDays <= 0,
completed = completed,
Expand Down Expand Up @@ -414,4 +414,3 @@ class WordpressRepository(
return today.format(formatter)
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.launch
import okhttp3.internal.toImmutableMap
import java.io.IOException

class FeatureFlippingManager(
Expand Down Expand Up @@ -62,7 +61,7 @@ class FeatureFlippingManager(
}
}

_featuresState.value = FeatureFlippingState.SUCCESS(featureEnabled.toImmutableMap())
_featuresState.value = FeatureFlippingState.SUCCESS(featureEnabled.toMap())
}
}

Expand Down
22 changes: 15 additions & 7 deletions app/src/main/java/com/xpeho/xpeapp/ui/components/qvst/QvstCard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ package com.xpeho.xpeapp.ui.components.qvst

import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.runtime.key
Expand Down Expand Up @@ -108,12 +111,17 @@ private fun SeeResultButton(campaign: QvstCampaignEntity) {
private fun getTagsList(campaign: QvstCampaignEntity): @Composable() (() -> Unit) {

// Init the tagsList depending the data that we got
val tagPillTheme: @Composable() () -> Unit = {
TagPill(
label = campaign.themeName,
backgroundColor = XpehoColors.GREEN_DARK_COLOR,
size = 9.sp
)
val tagPillThemes: @Composable() () -> Unit = {
Row {
campaign.themeNames.forEach { theme ->
TagPill(
label = theme,
backgroundColor = XpehoColors.GREEN_DARK_COLOR,
size = 9.sp
)
Spacer(modifier = Modifier.width(8.dp))
}
}
}

var tagPillDeadline: @Composable() () -> Unit
Expand Down Expand Up @@ -175,7 +183,7 @@ private fun getTagsList(campaign: QvstCampaignEntity): @Composable() (() -> Unit
}

return {
tagPillTheme.invoke()
tagPillThemes.invoke()
tagPillDeadline.invoke()
tagPillCompletion.invoke()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ fun QvstCampaignDetailPage(
Column {
campaign?.let {
Title(
label = it.themeName
label = it.name
)
}
Spacer(modifier = Modifier.height(40.dp))
Expand Down Expand Up @@ -294,4 +294,14 @@ fun redirectOnSuccess(
)
}
}
}
}

// Extension pour remplacer la dernière virgule par " et "
fun String.replaceLastCommaWithEt(): String {
val lastComma = this.lastIndexOf(", ")
return if (lastComma != -1) {
this.substring(0, lastComma) + " et " + this.substring(lastComma + 2)
} else {
this
}
}
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<string name="qvst_answers_saved_title">QVST</string>
<string name="qvst_campaign_detail_all_questions_answered">Vous avez répondu à toutes les questions</string>
<string name="qvst_campaign_detail_questions_answered">
Vous avez répondu à %s questions sur %s
Vous avez répondu à %1$s questions sur %2$s
</string>
<string name="qvst_campaign_detail_answered_questions">Questions répondues</string>
<string name="qvst_campaign_detail_answer">Réponse : %s</string>
Expand Down
Loading
Loading