feat(Settings): add manager install info

This commit is contained in:
rushiiMachine 2025-06-20 22:11:13 -07:00
parent b2219f078b
commit dd29d5de2f
No known key found for this signature in database
GPG key ID: DCBE5952BB3B6420
4 changed files with 61 additions and 2 deletions

View file

@ -4,12 +4,12 @@ import android.app.Application
import androidx.compose.runtime.*
import cafe.adriel.voyager.core.model.ScreenModel
import cafe.adriel.voyager.core.model.screenModelScope
import com.aliucord.manager.BuildConfig
import com.aliucord.manager.R
import com.aliucord.manager.manager.PathManager
import com.aliucord.manager.manager.PreferencesManager
import com.aliucord.manager.ui.theme.Theme
import com.aliucord.manager.util.launchBlock
import com.aliucord.manager.util.showToast
import com.aliucord.manager.util.*
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
@ -18,6 +18,8 @@ class SettingsModel(
private val paths: PathManager,
val preferences: PreferencesManager,
) : ScreenModel {
val installInfo = InstallInfo
var showThemeDialog by mutableStateOf(false)
private set
@ -50,4 +52,21 @@ class SettingsModel(
paths.clearCache()
application.showToast(R.string.action_cleared_cache)
}
fun copyInstallInfo() {
application.copyToClipboard(installInfo)
application.showToast(R.string.action_copied)
}
companion object {
@Suppress("KotlinConstantConditions")
private val InstallInfo: String = """
Aliucord Manager
Version: ${BuildConfig.VERSION_NAME}
Version Code: ${BuildConfig.VERSION_CODE}
Git Branch: ${BuildConfig.GIT_BRANCH}
Git Commit: ${BuildConfig.GIT_COMMIT}
Git Changes: ${if (BuildConfig.GIT_LOCAL_CHANGES) "Yes" else "No"}
""".trimIndent()
}
}

View file

@ -12,7 +12,9 @@ import androidx.compose.foundation.layout.*
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
@ -137,6 +139,34 @@ class SettingsScreen : Screen, Parcelable {
.fillMaxWidth()
)
}
SettingsHeader(stringResource(R.string.settings_header_info))
Row(
horizontalArrangement = Arrangement.spacedBy(12.dp),
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.padding(horizontal = 36.dp, vertical = 12.dp),
) {
Text(
text = model.installInfo,
style = MaterialTheme.typography.bodySmall.copy(
color = MaterialTheme.colorScheme.onSurface.copy(0.6f),
),
)
Spacer(Modifier.weight(1f, fill = true))
IconButton(onClick = model::copyInstallInfo) {
Icon(
painter = painterResource(R.drawable.ic_copy),
contentDescription = stringResource(R.string.action_copy),
modifier = Modifier
.size(28.dp)
.alpha(.8f),
)
}
}
}
}
}

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="#aaaab1"
android:pathData="M360,720q-33,0 -56.5,-23.5T280,640v-480q0,-33 23.5,-56.5T360,80h360q33,0 56.5,23.5T800,160v480q0,33 -23.5,56.5T720,720L360,720ZM360,640h360v-480L360,160v480ZM200,880q-33,0 -56.5,-23.5T120,800v-520q0,-17 11.5,-28.5T160,240q17,0 28.5,11.5T200,280v520h400q17,0 28.5,11.5T640,840q0,17 -11.5,28.5T600,880L200,880ZM360,640v-480,480Z" />
</vector>

View file

@ -45,6 +45,7 @@
<string name="settings_header_advanced">Advanced</string>
<string name="settings_header_appearance">Appearance</string>
<string name="settings_header_info">Info</string>
<string name="setting_theme">Theme</string>
<string name="setting_theme_desc">The theme to apply to this app</string>
<string name="setting_dynamic_color">Dynamic color</string>