From 0be5fa3868991e02bb3c94192703e366e5557947 Mon Sep 17 00:00:00 2001 From: Amanpal Singh <87360222+aman-alfresco@users.noreply.github.com> Date: Wed, 18 Sep 2024 16:10:04 +0530 Subject: [PATCH] invoke config api --- .../content/actions/ContextualActionsState.kt | 7 ++-- .../actions/ContextualActionsViewModel.kt | 2 -- app/build.gradle | 3 +- browse/build.gradle | 3 +- build.gradle | 3 -- component/build.gradle | 3 +- data/build.gradle | 6 ++-- .../alfresco/content/data/AppConfigUtils.kt | 5 --- .../alfresco/content/data/CommonRepository.kt | 2 -- .../content/data/ContextualActionData.kt | 2 +- .../content/data/MobileConfigDataEntry.kt | 2 -- gradle/libs.versions.toml | 33 +++---------------- search/build.gradle | 3 +- session/build.gradle | 5 +-- settings.gradle | 2 -- 15 files changed, 18 insertions(+), 63 deletions(-) diff --git a/actions/src/main/kotlin/com/alfresco/content/actions/ContextualActionsState.kt b/actions/src/main/kotlin/com/alfresco/content/actions/ContextualActionsState.kt index 88547db82..0409caac6 100644 --- a/actions/src/main/kotlin/com/alfresco/content/actions/ContextualActionsState.kt +++ b/actions/src/main/kotlin/com/alfresco/content/actions/ContextualActionsState.kt @@ -15,6 +15,9 @@ data class ContextualActionsState( val fetch: Async = Uninitialized, val mobileConfigDataEntry: MobileConfigDataEntry? = null, ) : MavericksState { - constructor(target: ContextualActionData) : this(entries = target.entries, isMultiSelection = target.isMultiSelection, - mobileConfigDataEntry = target.mobileConfigData) + constructor(target: ContextualActionData) : this( + entries = target.entries, + isMultiSelection = target.isMultiSelection, + mobileConfigDataEntry = target.mobileConfigData, + ) } diff --git a/actions/src/main/kotlin/com/alfresco/content/actions/ContextualActionsViewModel.kt b/actions/src/main/kotlin/com/alfresco/content/actions/ContextualActionsViewModel.kt index ce548f8ce..31001c66a 100644 --- a/actions/src/main/kotlin/com/alfresco/content/actions/ContextualActionsViewModel.kt +++ b/actions/src/main/kotlin/com/alfresco/content/actions/ContextualActionsViewModel.kt @@ -8,13 +8,11 @@ import com.airbnb.mvrx.Success import com.airbnb.mvrx.ViewModelContext import com.alfresco.content.common.EntryListener import com.alfresco.content.data.BrowseRepository -import com.alfresco.content.data.CommonRepository.Companion.KEY_FEATURES_MOBILE import com.alfresco.content.data.Entry import com.alfresco.content.data.FavoritesRepository import com.alfresco.content.data.SearchRepository import com.alfresco.content.data.SearchRepository.Companion.SERVER_VERSION_NUMBER import com.alfresco.content.data.Settings -import com.alfresco.content.data.getJsonFromSharedPrefs import com.alfresco.coroutines.asFlow import com.alfresco.events.on import kotlinx.coroutines.GlobalScope diff --git a/app/build.gradle b/app/build.gradle index ec309d68a..77012168f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -102,8 +102,7 @@ dependencies { implementation project(':move') implementation project(':process-app') implementation project(':data') -// implementation libs.alfresco.content - implementation project(':content') + implementation libs.alfresco.content implementation libs.kotlin.stdlib diff --git a/browse/build.gradle b/browse/build.gradle index 43bedcaec..eee08ae6d 100644 --- a/browse/build.gradle +++ b/browse/build.gradle @@ -34,8 +34,7 @@ dependencies { implementation project(':component') implementation project(':process-app') -// implementation libs.alfresco.content - implementation project(':content') + implementation libs.alfresco.content implementation libs.alfresco.process implementation libs.kotlin.reflect implementation libs.androidx.core diff --git a/build.gradle b/build.gradle index b9ad323f1..8b0580709 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,3 @@ - buildscript { repositories { google() @@ -7,14 +6,12 @@ buildscript { dependencies { classpath libs.android.gradle classpath libs.kotlin.gradle - classpath libs.kotlin.serialization.plugin classpath libs.objectbox classpath libs.google.services.gradle classpath libs.firebase.crashlytics.gradle - classpath libs.dokka classpath libs.spotless classpath libs.gradleVersionsPlugin classpath libs.gradleLicensePlugin diff --git a/component/build.gradle b/component/build.gradle index ab7771120..fe94e69a8 100644 --- a/component/build.gradle +++ b/component/build.gradle @@ -32,8 +32,7 @@ dependencies { implementation project(':data') implementation project(':theme') -// implementation libs.alfresco.content - implementation project(':content') + implementation libs.alfresco.content implementation libs.coroutines.core implementation libs.androidx.appcompat diff --git a/data/build.gradle b/data/build.gradle index 63f97ac39..a67d0bd21 100644 --- a/data/build.gradle +++ b/data/build.gradle @@ -21,10 +21,8 @@ dependencies { implementation libs.alfresco.auth -// implementation libs.alfresco.content -// implementation libs.alfresco.contentKtx - implementation project(':content') - implementation project(':content-ktx') + implementation libs.alfresco.content + implementation libs.alfresco.contentKtx implementation libs.alfresco.process implementation libs.androidx.preference diff --git a/data/src/main/kotlin/com/alfresco/content/data/AppConfigUtils.kt b/data/src/main/kotlin/com/alfresco/content/data/AppConfigUtils.kt index e8e6f0953..f6146f9ec 100644 --- a/data/src/main/kotlin/com/alfresco/content/data/AppConfigUtils.kt +++ b/data/src/main/kotlin/com/alfresco/content/data/AppConfigUtils.kt @@ -154,8 +154,6 @@ private val formatter = DateTimeFormatterBuilder() .optionalStart().appendOffset("+HHMM", "Z").optionalEnd() .toFormatter() - - // Function to store a JSON object fun saveJsonToSharedPrefs(context: Context, key: String, obj: Any) { val sharedPreferences: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) @@ -170,7 +168,6 @@ fun saveJsonToSharedPrefs(context: Context, key: String, obj: Any) { editor.apply() } - // Function to retrieve a JSON object inline fun getJsonFromSharedPrefs(context: Context, key: String): T? { val sharedPreferences: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) @@ -186,5 +183,3 @@ inline fun getJsonFromSharedPrefs(context: Context, key: String): T? null } } - - diff --git a/data/src/main/kotlin/com/alfresco/content/data/CommonRepository.kt b/data/src/main/kotlin/com/alfresco/content/data/CommonRepository.kt index 8f3c63fd5..da4cfffbf 100644 --- a/data/src/main/kotlin/com/alfresco/content/data/CommonRepository.kt +++ b/data/src/main/kotlin/com/alfresco/content/data/CommonRepository.kt @@ -9,7 +9,6 @@ import com.alfresco.events.EventBus import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch -import retrofit2.http.Url import java.net.URL class CommonRepository(otherSession: Session? = null) { @@ -35,7 +34,6 @@ class CommonRepository(otherSession: Session? = null) { } suspend fun getMobileConfigData() { - val data = MobileConfigDataEntry.with(service.getMobileConfig("https://${URL(session.account.serverUrl).host}/app-config.json")) saveJsonToSharedPrefs(context, KEY_FEATURES_MOBILE, data) diff --git a/data/src/main/kotlin/com/alfresco/content/data/ContextualActionData.kt b/data/src/main/kotlin/com/alfresco/content/data/ContextualActionData.kt index 06797b00b..e8b72c3b7 100644 --- a/data/src/main/kotlin/com/alfresco/content/data/ContextualActionData.kt +++ b/data/src/main/kotlin/com/alfresco/content/data/ContextualActionData.kt @@ -15,7 +15,7 @@ data class ContextualActionData( return ContextualActionData( entries = entries, isMultiSelection = isMultiSelection, - mobileConfigData = mobileConfigData + mobileConfigData = mobileConfigData, ) } } diff --git a/data/src/main/kotlin/com/alfresco/content/data/MobileConfigDataEntry.kt b/data/src/main/kotlin/com/alfresco/content/data/MobileConfigDataEntry.kt index 832077582..827bb63bc 100644 --- a/data/src/main/kotlin/com/alfresco/content/data/MobileConfigDataEntry.kt +++ b/data/src/main/kotlin/com/alfresco/content/data/MobileConfigDataEntry.kt @@ -41,14 +41,12 @@ data class MobileFeatures( @Parcelize data class AppMenu( val id: String, - val name: String, val enabled: Boolean, ) : Parcelable { companion object { fun with(menuData: DynamicMenu): AppMenu { return AppMenu( id = menuData.id ?: "", - name = menuData.name ?: "", enabled = menuData.enabled ?: false, ) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a41362eed..01b928bed 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,4 +1,3 @@ - [versions] camera = "1.2.3" coil = "2.4.0" @@ -13,15 +12,14 @@ test = "1.5.0" activity-compose = "1.7.0" compose-bom = "2023.10.01" ui-tooling = "1.5.4" +appcompat = "1.6.1" +material = "1.11.0" constraintlayout = "2.1.4" -auth0 = "2.10.2" -moshi = "1.15.0" -retrofit = "2.9.0" [libraries] alfresco-auth = "com.alfresco.android:auth:0.8.1-SNAPSHOT" -#alfresco-content = "com.alfresco.android:content:0.3.4-SNAPSHOT" -#alfresco-contentKtx = "com.alfresco.android:content-ktx:0.3.2-SNAPSHOT" +alfresco-content = "com.alfresco.android:content:0.3.5-SNAPSHOT" +alfresco-contentKtx = "com.alfresco.android:content-ktx:0.3.2-SNAPSHOT" alfresco-process = "com.alfresco.android:process:0.1.3-SNAPSHOT" android-desugar = "com.android.tools:desugar_jdk_libs:2.0.3" @@ -138,25 +136,4 @@ ui-compose-viewbinding = "androidx.compose.ui:ui-viewbinding:1.6.3" navigation-compose = "androidx.navigation:navigation-compose:2.7.6" compose-runtime = "androidx.compose.runtime:runtime:1.5.4" androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling", version.ref = "ui-tooling" } -constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" } - -kotlin-serialization-plugin = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" } -kotlin-serialization-json = "org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0" -dokka = "org.jetbrains.dokka:dokka-gradle-plugin:1.8.10" - -appauth = "net.openid:appauth:0.11.1" - -auth0 = { module = "com.auth0.android:auth0", version.ref = "auth0" } - -jwtdecode = "com.auth0.android:jwtdecode:2.0.2" -androidx-lifecycle-viewmodelKtx = "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1" -androidx-browser = "androidx.browser:browser:1.5.0" -okhttp = "com.squareup.okhttp3:okhttp:4.11.0" - -moshi-adapters = { module = "com.squareup.moshi:moshi-adapters", version.ref = "moshi" } -moshi-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version.ref = "moshi" } -moshi-core = { module = "com.squareup.moshi:moshi-kotlin", version.ref = "moshi" } - -retrofit-converter-moshi = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "retrofit" } -retrofit-converter-scalars = { module = "com.squareup.retrofit2:converter-scalars", version.ref = "retrofit" } -retrofit-core = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } \ No newline at end of file +constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" } \ No newline at end of file diff --git a/search/build.gradle b/search/build.gradle index 4eac41f19..58278fe1e 100644 --- a/search/build.gradle +++ b/search/build.gradle @@ -27,8 +27,7 @@ dependencies { implementation project(':listview') implementation project(':component') -// implementation libs.alfresco.content - implementation project(':content') + implementation libs.alfresco.content implementation libs.coroutines.core implementation libs.androidx.appcompat diff --git a/session/build.gradle b/session/build.gradle index b235ea397..2a46f2d63 100644 --- a/session/build.gradle +++ b/session/build.gradle @@ -12,10 +12,7 @@ dependencies { api project(':account') implementation libs.alfresco.auth -// implementation libs.alfresco.content - implementation project(':content') - - implementation libs.retrofit.core + implementation libs.alfresco.content implementation libs.kotlin.stdlib diff --git a/settings.gradle b/settings.gradle index 1168e956e..6a63b7730 100644 --- a/settings.gradle +++ b/settings.gradle @@ -24,8 +24,6 @@ include ':move' include ':component' include ':app' include ':process-app' -include ':content' -include ':content-ktx' // Enable Gradle's version catalog support // Ref: https://docs.gradle.org/current/userguide/platforms.html