Merge remote-tracking branch 'upstream/main'
This commit is contained in:
commit
4f96d33abd
13 changed files with 42 additions and 285 deletions
|
|
@ -0,0 +1,18 @@
|
|||
package com.aliucord.manager.network.models
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class Developer(
|
||||
val username: String,
|
||||
val avatarUrl: String,
|
||||
val commits: Int,
|
||||
val repositories: List<Repository>,
|
||||
val role: String? = null
|
||||
) {
|
||||
@Serializable
|
||||
data class Repository(
|
||||
val name: String,
|
||||
val commits: Int
|
||||
)
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@ import androidx.compose.ui.res.stringResource
|
|||
import androidx.compose.ui.text.font.FontStyle
|
||||
import androidx.compose.ui.unit.dp
|
||||
import coil3.compose.SubcomposeAsyncImage
|
||||
import com.aliucord.manager.network.models.Contributor
|
||||
import com.aliucord.manager.network.models.Developer
|
||||
import com.valentinilk.shimmer.shimmer
|
||||
import dev.goon.manager.R
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
package com.aliucord.manager.ui.previews.dialogs
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.aliucord.manager.ui.screens.plugins.components.dialogs.UninstallPluginDialog
|
||||
import com.aliucord.manager.ui.theme.ManagerTheme
|
||||
|
||||
@Composable
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||
private fun UninstallPluginDialogPreview() {
|
||||
ManagerTheme {
|
||||
UninstallPluginDialog(
|
||||
pluginName = "FakeNitro",
|
||||
onConfirm = {},
|
||||
onDismiss = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
package com.aliucord.manager.ui.previews.screens.about
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.tooling.preview.*
|
||||
import com.aliucord.manager.network.models.Contributor
|
||||
import com.aliucord.manager.ui.screens.about.AboutScreenContent
|
||||
import com.aliucord.manager.ui.screens.about.AboutScreenState
|
||||
import com.aliucord.manager.ui.theme.ManagerTheme
|
||||
import com.aliucord.manager.ui.util.emptyImmutableList
|
||||
import com.aliucord.manager.util.serialization.ImmutableListSerializer
|
||||
import kotlinx.collections.immutable.*
|
||||
import kotlinx.serialization.json.Json
|
||||
|
||||
// This preview has scrollable content that cannot be properly viewed from an IDE preview
|
||||
|
||||
@Composable
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||
private fun AboutScreenLoadedPreview(
|
||||
@PreviewParameter(ContributorsProvider::class) contributors: ImmutableList<Contributor>,
|
||||
) {
|
||||
ManagerTheme {
|
||||
AboutScreenContent(
|
||||
state = remember { mutableStateOf(AboutScreenState.Loaded(contributors)) },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private class ContributorsProvider : PreviewParameterProvider<ImmutableList<Contributor>> {
|
||||
private val realDataRaw =
|
||||
"[{\"username\":\"maisymoe\",\"avatarUrl\":\"https://avatars.githubusercontent.com/u/61095277?v=4\",\"repositories\":]"
|
||||
private val realData =
|
||||
Json.decodeFromString(ImmutableListSerializer(Contributor.serializer()), realDataRaw)
|
||||
|
||||
override val values =
|
||||
sequenceOf(
|
||||
emptyImmutableList<Contributor>(),
|
||||
persistentListOf(
|
||||
Contributor(
|
||||
username =
|
||||
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz",
|
||||
avatarUrl = "UNUSED",
|
||||
commits = Int.MAX_VALUE,
|
||||
repositories =
|
||||
(realData[0].repositories + realData[0].repositories)
|
||||
.toImmutableList(),
|
||||
)
|
||||
),
|
||||
realData,
|
||||
)
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
package com.aliucord.manager.ui.previews.screens.plugins
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.aliucord.manager.ui.screens.plugins.PluginsScreenContent
|
||||
import com.aliucord.manager.ui.theme.ManagerTheme
|
||||
import com.aliucord.manager.ui.util.emptyImmutableList
|
||||
|
||||
// This preview has interactable content that cannot be tested from an IDE preview
|
||||
|
||||
@Composable
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||
private fun PluginsScreenFailedPreview() {
|
||||
val filterState = remember { mutableStateOf("") }
|
||||
|
||||
ManagerTheme {
|
||||
PluginsScreenContent(
|
||||
searchText = filterState,
|
||||
setSearchText = filterState::value::set,
|
||||
isError = true,
|
||||
plugins = emptyImmutableList(),
|
||||
onPluginUninstall = {},
|
||||
onPluginChangelog = {},
|
||||
onPluginToggle = { name, enabled -> },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
package com.aliucord.manager.ui.previews.screens.plugins
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.aliucord.manager.ui.screens.plugins.PluginsScreenContent
|
||||
import com.aliucord.manager.ui.screens.plugins.model.PluginItem
|
||||
import com.aliucord.manager.ui.screens.plugins.model.PluginManifest
|
||||
import com.aliucord.manager.ui.theme.ManagerTheme
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import java.util.UUID
|
||||
|
||||
// This preview has scrollable/interactable content that cannot be tested from an IDE preview
|
||||
|
||||
@Composable
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||
private fun PluginsScreenLoadedPreview() {
|
||||
val filterState = remember { mutableStateOf("test") }
|
||||
|
||||
ManagerTheme {
|
||||
PluginsScreenContent(
|
||||
searchText = filterState,
|
||||
setSearchText = filterState::value::set,
|
||||
isError = false,
|
||||
plugins = plugins,
|
||||
onPluginUninstall = {},
|
||||
onPluginChangelog = {},
|
||||
onPluginToggle = { name, enabled -> },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private val plugins: ImmutableList<PluginItem> = persistentListOf(
|
||||
PluginItem(
|
||||
path = UUID.randomUUID().toString(),
|
||||
manifest = PluginManifest(
|
||||
name = "CloseDMs",
|
||||
authors = persistentListOf(
|
||||
PluginManifest.Author(name = "Diamond", id = 0L),
|
||||
),
|
||||
description = "Shortcut to close DMs in the DM context menu.",
|
||||
version = "1.0.0",
|
||||
updateUrl = "",
|
||||
changelog = "",
|
||||
changelogMedia = null,
|
||||
)
|
||||
),
|
||||
PluginItem(
|
||||
path = UUID.randomUUID().toString(),
|
||||
manifest = PluginManifest(
|
||||
name = "ConfigurableStickerSizes",
|
||||
authors = persistentListOf(
|
||||
PluginManifest.Author(name = "rushii", id = 0L, hyperlink = false),
|
||||
),
|
||||
description = "Makes sticker sizes configurable.",
|
||||
version = "1.1.5",
|
||||
updateUrl = "",
|
||||
changelog = "",
|
||||
changelogMedia = null,
|
||||
)
|
||||
),
|
||||
PluginItem(
|
||||
path = UUID.randomUUID().toString(),
|
||||
manifest = PluginManifest(
|
||||
name = "AudioPlayer",
|
||||
authors = persistentListOf(
|
||||
PluginManifest.Author(name = "rushii", id = 0L, hyperlink = false),
|
||||
),
|
||||
description = "Makes audio files playable.",
|
||||
version = "0.0.1",
|
||||
updateUrl = "",
|
||||
changelog = "",
|
||||
changelogMedia = null,
|
||||
)
|
||||
),
|
||||
PluginItem(
|
||||
path = UUID.randomUUID().toString(),
|
||||
manifest = PluginManifest(
|
||||
name = "TypingIndicators",
|
||||
authors = persistentListOf(
|
||||
PluginManifest.Author(name = "rushii", id = 0L, hyperlink = false),
|
||||
),
|
||||
description = "Adds typing indicators to channels that people are currently typing in.",
|
||||
version = "1.1.0",
|
||||
updateUrl = "",
|
||||
changelog = "",
|
||||
changelogMedia = null,
|
||||
)
|
||||
),
|
||||
)
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
package com.aliucord.manager.ui.previews.screens.plugins
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.aliucord.manager.ui.screens.plugins.PluginsScreenContent
|
||||
import com.aliucord.manager.ui.theme.ManagerTheme
|
||||
import com.aliucord.manager.ui.util.emptyImmutableList
|
||||
|
||||
// This preview has interactable content that cannot be tested from an IDE preview
|
||||
|
||||
@Composable
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||
private fun PluginsScreenNonePreview() {
|
||||
val filterState = remember { mutableStateOf("") }
|
||||
|
||||
ManagerTheme {
|
||||
PluginsScreenContent(
|
||||
searchText = filterState,
|
||||
setSearchText = filterState::value::set,
|
||||
isError = false,
|
||||
plugins = emptyImmutableList(),
|
||||
onPluginUninstall = {},
|
||||
onPluginChangelog = {},
|
||||
onPluginToggle = { name, enabled -> },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
package com.aliucord.manager.ui.screens.plugins.model
|
||||
|
||||
import androidx.compose.runtime.*
|
||||
|
||||
@Stable
|
||||
data class PluginItem(
|
||||
val manifest: PluginManifest,
|
||||
val path: String,
|
||||
) {
|
||||
// Plugins are enabled by default unless disabled
|
||||
var enabled by mutableStateOf(true)
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
package com.aliucord.manager.ui.screens.plugins.model
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import com.aliucord.manager.util.serialization.ImmutableListSerializer
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Immutable
|
||||
@Serializable
|
||||
data class PluginManifest(
|
||||
val name: String,
|
||||
@Serializable(with = ImmutableListSerializer::class)
|
||||
val authors: ImmutableList<Author>,
|
||||
val description: String,
|
||||
val version: String,
|
||||
val updateUrl: String,
|
||||
val changelog: String?,
|
||||
val changelogMedia: String?,
|
||||
) {
|
||||
val repositoryUrl: String
|
||||
get() = updateUrl
|
||||
.replace("raw.githubusercontent.com", "github.com")
|
||||
.replaceFirst("/builds.*".toRegex(), "")
|
||||
|
||||
@Immutable
|
||||
@Serializable
|
||||
data class Author(
|
||||
val name: String,
|
||||
val id: Long,
|
||||
val hyperlink: Boolean = true,
|
||||
) {
|
||||
val discordUrl: String
|
||||
get() = "https://discord.com/users/$id"
|
||||
}
|
||||
}
|
||||
|
|
@ -159,8 +159,8 @@ class SettingsScreen : Screen, Parcelable {
|
|||
painter = painterResource(
|
||||
when (preferences.installer) {
|
||||
InstallerSetting.PM -> R.drawable.ic_android
|
||||
InstallerSetting.ROOT -> R.drawable.ic_code
|
||||
InstallerSetting.Shizuku -> R.drawable.ic_tools
|
||||
InstallerSetting.ROOT -> R.drawable.ic_hashtag
|
||||
InstallerSetting.Shizuku -> R.drawable.ic_shizuku
|
||||
}
|
||||
),
|
||||
contentDescription = null,
|
||||
|
|
|
|||
|
|
@ -56,8 +56,8 @@ fun InstallerDialog(
|
|||
painter = painterResource(
|
||||
when (installer) {
|
||||
InstallerSetting.PM -> R.drawable.ic_android
|
||||
InstallerSetting.ROOT -> R.drawable.ic_code
|
||||
InstallerSetting.Shizuku -> R.drawable.ic_tools
|
||||
InstallerSetting.ROOT -> R.drawable.ic_hashtag
|
||||
InstallerSetting.Shizuku -> R.drawable.ic_shizuku
|
||||
}
|
||||
),
|
||||
contentDescription = null,
|
||||
|
|
|
|||
17
app/src/main/res/drawable/ic_shizuku.xml
Normal file
17
app/src/main/res/drawable/ic_shizuku.xml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108"
|
||||
>
|
||||
<path
|
||||
android:fillAlpha="0.45"
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M85.8,15.3H59.3L46,38.2l13.2,22.9h2.7c-0.9,-0.6 -1,-1.8 -0.4,-2.7c0.6,-0.9 1.8,-1 2.7,-0.4c0.9,0.6 1,1.8 0.4,2.7c-0.1,0.1 -0.3,0.3 -0.4,0.4h21.5L99,38.2L85.8,15.3z"
|
||||
/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M85.5,42.7c-1.7,-0.5 -3.4,-1 -5.2,-1.3c-3.9,-0.5 -7.9,-0.3 -11.7,0.6c-3.4,-3 -7.4,-5.2 -11.7,-6.5c-2.1,-0.6 -4.3,-1 -6.5,-1.3c-2.7,-5.6 -7,-10.4 -12.3,-13.6c-4.1,3.6 -7.1,8.3 -8.4,13.6c-5.6,2.1 -10.5,5.7 -14.3,10.4c-2.3,2.9 -6.4,8 -6.5,14.3c-0.3,13 16.6,22.3 23.3,25.9C40,89 48.3,91.6 57,92.7c4,0.4 8.2,-0.5 11.7,-2.6c5.7,-3.4 7.6,-8.9 9.1,-13c1.9,-5.8 2.5,-12.1 1.3,-18.2c2.2,-3.2 4,-6.6 5.2,-10.4C84.7,46.6 85.1,44.7 85.5,42.7zM39.1,50.3c-1,0 -1.9,-0.9 -1.9,-1.9s0.9,-1.9 1.9,-1.9s1.9,0.9 1.9,1.9S40.3,50.3 39.1,50.3L39.1,50.3zM63.1,61.5c-1,0 -1.9,-0.9 -1.9,-1.9c0,-1 0.9,-1.9 1.9,-1.9c1,0 1.9,0.9 1.9,1.9C65,60.6 64.2,61.5 63.1,61.5z"
|
||||
/>
|
||||
</vector>
|
||||
|
|
@ -73,28 +73,19 @@
|
|||
<string name="theme_dark">Dark</string>
|
||||
<string name="theme_light">Light</string>
|
||||
|
||||
<string name="plugins_title">Plugins</string>
|
||||
<string name="plugins_view_changelog">View changelog</string>
|
||||
<string name="plugins_delete_plugin">Uninstall %s</string>
|
||||
<string name="plugins_delete_plugin_body">Are you sure you want to uninstall the %s plugin?</string>
|
||||
<string name="plugins_none_installed">No plugins installed!</string>
|
||||
<string name="plugins_changelog_media">Changelog Media</string>
|
||||
<string name="plugins_error">An error occurred while processing plugins!</string>
|
||||
|
||||
<string name="navigation_back">Back</string>
|
||||
<string name="navigation_about">About</string>
|
||||
<string name="navigation_about_manager">About Manager</string>
|
||||
<string name="navigation_logs">Open logs</string>
|
||||
<string name="navigation_settings">Settings</string>
|
||||
|
||||
<string name="contributors_lead">Lead Developers</string>
|
||||
<string name="contributors_contributions">%d contributions</string>
|
||||
<string name="contributors">Contributors</string>
|
||||
<string name="lead_role_kettu">Kettu - Creator</string>
|
||||
<string name="lead_role_shiggycord">GoonCord - Creator</string>
|
||||
<string name="lead_role_bunny">Bunny - Creator</string>
|
||||
<string name="role_creator_vendetta">Creator of Vendetta</string>
|
||||
<string name="role_original_manager_creator">Original Manager Creator</string>
|
||||
<string name="contributors">Other Developers</string>
|
||||
<string name="contributors_contributions">%s contributions</string>
|
||||
|
||||
<string name="network_load_fail">Failed to load</string>
|
||||
<string name="network_warning_title">Metered network</string>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue