Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
jeryjs committed Jun 29, 2024
2 parents 0631dea + c1c0043 commit 11156c8
Show file tree
Hide file tree
Showing 51 changed files with 1,783 additions and 5 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
97 changes: 97 additions & 0 deletions app/dev/release/output-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "eu.kanade.tachiyomi.sy",
"variantName": "devRelease",
"elements": [
{
"type": "UNIVERSAL",
"filters": [],
"attributes": [],
"versionCode": 67,
"versionName": "1.10.5",
"outputFile": "app-dev-universal-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "x86"
}
],
"attributes": [],
"versionCode": 67,
"versionName": "1.10.5",
"outputFile": "app-dev-x86-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "arm64-v8a"
}
],
"attributes": [],
"versionCode": 67,
"versionName": "1.10.5",
"outputFile": "app-dev-arm64-v8a-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "armeabi-v7a"
}
],
"attributes": [],
"versionCode": 67,
"versionName": "1.10.5",
"outputFile": "app-dev-armeabi-v7a-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "x86_64"
}
],
"attributes": [],
"versionCode": 67,
"versionName": "1.10.5",
"outputFile": "app-dev-x86_64-release.apk"
}
],
"elementType": "File",
"baselineProfiles": [
{
"minApi": 28,
"maxApi": 30,
"baselineProfiles": [
"baselineProfiles/1/app-dev-universal-release.dm",
"baselineProfiles/1/app-dev-x86-release.dm",
"baselineProfiles/1/app-dev-arm64-v8a-release.dm",
"baselineProfiles/1/app-dev-armeabi-v7a-release.dm",
"baselineProfiles/1/app-dev-x86_64-release.dm"
]
},
{
"minApi": 31,
"maxApi": 2147483647,
"baselineProfiles": [
"baselineProfiles/0/app-dev-universal-release.dm",
"baselineProfiles/0/app-dev-x86-release.dm",
"baselineProfiles/0/app-dev-arm64-v8a-release.dm",
"baselineProfiles/0/app-dev-armeabi-v7a-release.dm",
"baselineProfiles/0/app-dev-x86_64-release.dm"
]
}
],
"minSdkVersionForDexing": 23
}
27 changes: 27 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,33 @@
android:label="EHentaiLogin"
android:exported="false"/>

<activity android:label="Discord Login"
android:name=".ui.setting.connections.DiscordLoginActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="false"
tools:ignore="AppLinkUrlError">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="https" android:host="account.samsung.com" android:path="/accounts/oauth/callback"/>
</intent-filter>
</activity>
<service
android:name=".data.connections.discord.DiscordRPCService"
android:foregroundServiceType="dataSync"
android:enabled="true"
android:exported="false">
<intent-filter>
<action android:name ="android.intent.action.VIEW"/>
<category android:name ="android.intent.category.DEFAULT"/>
<category android:name ="android.intent.category.BROWSABLE"/>
<data android:scheme="https"
android:host="account.samsung.com"
android:path="/accounts/oauth/callback"/>
</intent-filter>
</service>

<receiver
android:name=".data.notification.NotificationReceiver"
android:exported="false" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package eu.kanade.domain.connections.service

import eu.kanade.tachiyomi.data.connections.ConnectionsService
import tachiyomi.core.common.preference.PreferenceStore

class ConnectionsPreferences(
private val preferenceStore: PreferenceStore,
) {
fun connectionsUsername(sync: ConnectionsService) = preferenceStore.getString(
connectionsUsername(sync.id),
"",
)

fun connectionsPassword(sync: ConnectionsService) = preferenceStore.getString(
connectionsPassword(sync.id),
"",
)

fun setConnectionsCredentials(sync: ConnectionsService, username: String, password: String) {
connectionsUsername(sync).set(username)
connectionsPassword(sync).set(password)
}

fun connectionsToken(sync: ConnectionsService) = preferenceStore.getString(connectionsToken(sync.id), "")

fun enableDiscordRPC() = preferenceStore.getBoolean("pref_enable_discord_rpc", false)

fun discordRPCStatus() = preferenceStore.getInt("pref_discord_rpc_status", 1)

fun discordRPCIncognito() = preferenceStore.getBoolean("pref_discord_rpc_incognito", false)

fun discordRPCIncognitoCategories() = preferenceStore.getStringSet("discord_rpc_incognito_categories", emptySet())

fun useChapterTitles() = preferenceStore.getBoolean("pref_discord_rpc_use_chapter_titles", true)

companion object {

fun connectionsUsername(syncId: Long) = "pref_connections_username_$syncId"

private fun connectionsPassword(syncId: Long) = "pref_connections_password_$syncId"

private fun connectionsToken(syncId: Long) = "connection_token_$syncId"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package eu.kanade.presentation.components

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import eu.kanade.tachiyomi.data.connections.ConnectionsService
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.clickableNoIndication

@Composable
fun ConnectionsLogoIcon(
service: ConnectionsService,
onClick: (() -> Unit)? = null,
) {
val modifier = if (onClick != null) {
Modifier.clickableNoIndication(onClick = onClick)
} else {
Modifier
}

Box(
modifier = modifier
.size(48.dp)
.background(color = Color(service.getLogoColor()), shape = MaterialTheme.shapes.medium)
.padding(4.dp),
contentAlignment = Alignment.Center,
) {
Image(
painter = painterResource(service.getLogo()),
contentDescription = stringResource(service.nameRes()),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package eu.kanade.presentation.more.settings
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.graphics.vector.ImageVector
import eu.kanade.tachiyomi.data.connections.ConnectionsService
import eu.kanade.tachiyomi.data.track.Tracker
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.ImmutableMap
Expand Down Expand Up @@ -154,6 +155,21 @@ sealed class Preference {
override val onValueChanged: suspend (newValue: String) -> Boolean = { true }
}

/**
* A [PreferenceItem] for individual connections service.
*/
data class ConnectionsPreference(
val service: ConnectionsService,
override val title: String,
val login: () -> Unit,
val openSettings: () -> Unit,
) : PreferenceItem<String>() {
override val enabled: Boolean = true
override val subtitle: String? = null
override val icon: ImageVector? = null
override val onValueChanged: suspend (newValue: String) -> Boolean = { true }
}

data class InfoPreference(
override val title: String,
) : PreferenceItem<String>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.structuralEqualityPolicy
import androidx.compose.ui.unit.dp
import eu.kanade.domain.connections.service.ConnectionsPreferences
import eu.kanade.domain.track.service.TrackPreferences
import eu.kanade.presentation.more.settings.widget.ConnectionsPreferenceWidget
import eu.kanade.presentation.more.settings.widget.EditTextPreferenceWidget
import eu.kanade.presentation.more.settings.widget.InfoWidget
import eu.kanade.presentation.more.settings.widget.ListPreferenceWidget
Expand All @@ -21,6 +23,7 @@ import eu.kanade.presentation.more.settings.widget.SwitchPreferenceWidget
import eu.kanade.presentation.more.settings.widget.TextPreferenceWidget
import eu.kanade.presentation.more.settings.widget.TrackingPreferenceWidget
import kotlinx.coroutines.launch
import tachiyomi.core.common.preference.PreferenceStore
import tachiyomi.presentation.core.components.SliderItem
import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt
Expand Down Expand Up @@ -167,6 +170,18 @@ internal fun PreferenceItem(
)
}
}
is Preference.PreferenceItem.ConnectionsPreference -> {
val uName by Injekt.get<PreferenceStore>()
.getString(ConnectionsPreferences.connectionsUsername(item.service.id))
.collectAsState()
item.service.run {
ConnectionsPreferenceWidget(
service = this,
checked = uName.isNotEmpty(),
onClick = { if (isLogged) item.openSettings() else item.login() },
)
}
}
is Preference.PreferenceItem.InfoPreference -> {
InfoWidget(text = item.title)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,26 @@ fun getCategoriesLabel(
return stringResource(MR.strings.include, includedItemsText) + "\n" +
stringResource(MR.strings.exclude, excludedItemsText)
}

@ReadOnlyComposable
@Composable
fun getCategoriesLabel(
allCategories: List<Category>,
included: Set<String>,
): String {
val context = LocalContext.current

val includedCategories = included
.mapNotNull { id -> allCategories.find { it.id == id.toLong() } }
.sortedBy { it.order }

val includedItemsText = when {
// Some selected, but not all
includedCategories.isNotEmpty() && includedCategories.size != allCategories.size -> includedCategories.joinToString { it.visualName(context) }
// All explicitly selected
includedCategories.size == allCategories.size -> stringResource(MR.strings.all)
includedCategories.isEmpty() -> stringResource(MR.strings.none)
else -> stringResource(MR.strings.all)
}
return stringResource(MR.strings.include, includedItemsText)
}
Loading

0 comments on commit 11156c8

Please sign in to comment.