Skip to content

Commit

Permalink
invoke config api
Browse files Browse the repository at this point in the history
  • Loading branch information
aman-alfresco committed Sep 18, 2024
1 parent e0f2b1a commit 0be5fa3
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ data class ContextualActionsState(
val fetch: Async<Entry> = 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,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions browse/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

buildscript {
repositories {
google()
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions component/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions data/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -170,7 +168,6 @@ fun saveJsonToSharedPrefs(context: Context, key: String, obj: Any) {
editor.apply()
}


// Function to retrieve a JSON object
inline fun <reified T> getJsonFromSharedPrefs(context: Context, key: String): T? {
val sharedPreferences: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
Expand All @@ -186,5 +183,3 @@ inline fun <reified T> getJsonFromSharedPrefs(context: Context, key: String): T?
null
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ data class ContextualActionData(
return ContextualActionData(
entries = entries,
isMultiSelection = isMultiSelection,
mobileConfigData = mobileConfigData
mobileConfigData = mobileConfigData,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
}
Expand Down
33 changes: 5 additions & 28 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

[versions]
camera = "1.2.3"
coil = "2.4.0"
Expand All @@ -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"
Expand Down Expand Up @@ -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" }
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
3 changes: 1 addition & 2 deletions search/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions session/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0be5fa3

Please sign in to comment.