Skip to content

Commit

Permalink
Create LICENSE, tell users about license and (non-)affiliation, creat…
Browse files Browse the repository at this point in the history
…e about page
  • Loading branch information
HeroBrine1st committed Dec 16, 2022
1 parent 95ca764 commit 6b2b0a1
Show file tree
Hide file tree
Showing 11 changed files with 914 additions and 1 deletion.
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,8 @@ release builds (they use different signing keys), but you can reinstall if you w
- [x] MP4
- [ ] SWF - flash won't be supported neither in near nor far future (but PRs are welcome if they're
safe in terms of vulnerabilities that Adobe Flash had)

# License

This application is released under GNU GPLv3 (see [LICENSE](LICENSE)).
Some of the used libraries are released under different licenses.
8 changes: 8 additions & 0 deletions app/src/main/java/ru/herobrine1st/e621/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import kotlinx.coroutines.launch
import ru.herobrine1st.e621.module.LocalExoPlayer
import ru.herobrine1st.e621.preference.*
import ru.herobrine1st.e621.ui.MainScaffold
import ru.herobrine1st.e621.ui.component.legal.LicenseAndDisclaimerInitialDialogs
import ru.herobrine1st.e621.ui.dialog.BlacklistTogglesDialog
import ru.herobrine1st.e621.ui.snackbar.LocalSnackbar
import ru.herobrine1st.e621.ui.snackbar.SnackbarAdapter
Expand Down Expand Up @@ -85,6 +86,13 @@ class MainActivity : ComponentActivity() {
}
},
onClose = { showBlacklistDialog = false })
LicenseAndDisclaimerInitialDialogs(hasShownBefore = preferences.licenseAndNonAffiliationDisclaimerShown) {
coroutineScope.launch {
context.updatePreferences {
licenseAndNonAffiliationDisclaimerShown = true
}
}
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/ru/herobrine1st/e621/ui/Navigator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import ru.herobrine1st.e621.ui.screen.post.Post
import ru.herobrine1st.e621.ui.screen.posts.Posts
import ru.herobrine1st.e621.ui.screen.search.Search
import ru.herobrine1st.e621.ui.screen.settings.Settings
import ru.herobrine1st.e621.ui.screen.settings.SettingsAbout
import ru.herobrine1st.e621.ui.screen.settings.SettingsBlacklist
import ru.herobrine1st.e621.util.getParcelableCompat

Expand Down Expand Up @@ -135,5 +136,8 @@ fun Navigator(navController: NavHostController) {
navController.popBackStack()
}
}
composable(Screen.SettingsAbout.route) {
SettingsAbout()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package ru.herobrine1st.e621.ui.component.legal

import android.widget.Toast
import androidx.compose.material.Icon
import androidx.compose.material.Text
import androidx.compose.material.TextButton
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.OpenInBrowser
import androidx.compose.runtime.*
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.stringResource
import ru.herobrine1st.e621.R
import ru.herobrine1st.e621.ui.dialog.ActionDialog

@Composable
fun LicenseAndDisclaimerInitialDialogs(
hasShownBefore: Boolean,
onCompletion: () -> Unit
) {
// Why: I want users to know that this application is free software
// Also non-affiliation disclaimer may be useful.. sometimes
val context = LocalContext.current

var showLicenseDialog by remember(hasShownBefore) { mutableStateOf(!hasShownBefore) }
var showNonAffiliationDisclaimerDialog by remember { mutableStateOf(false) }

if (showLicenseDialog) {
val uriHandler = LocalUriHandler.current
val licenseUrl = stringResource(R.string.license_url)
ActionDialog(
title = stringResource(R.string.license_word),
onDismissRequest = {
Toast.makeText(context, R.string.explicitly_click_button, Toast.LENGTH_SHORT).show()
},
actions = {
TextButton(
onClick = {
uriHandler.openUri(licenseUrl)
}
) {
Text(stringResource(R.string.license_name_short))
Icon(
Icons.Default.OpenInBrowser,
contentDescription = stringResource(R.string.open_in_browser)
)
}
TextButton(
onClick = {
showLicenseDialog = false
showNonAffiliationDisclaimerDialog = true
}
) {
Text(stringResource(R.string.i_understand))
}
}
) {
Text(stringResource(R.string.license_brief))
}
}
if (showNonAffiliationDisclaimerDialog) {
ActionDialog(
title = stringResource(R.string.disclaimer),
onDismissRequest = {
Toast.makeText(context, R.string.explicitly_click_button, Toast.LENGTH_SHORT).show()
},
actions = {
TextButton(
onClick = {
showNonAffiliationDisclaimerDialog = false
onCompletion()
}
) {
Text(stringResource(R.string.i_understand))
}
}
) {
Text(stringResource(R.string.non_affiliation_disclaimer))
}
}
}
3 changes: 2 additions & 1 deletion app/src/main/java/ru/herobrine1st/e621/ui/screen/Screen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ enum class Screen(
Icons.Default.Block,
"settings/blacklist",
appBarActions = { SettingsBlacklistAppBarActions() },
floatingActionButton = { SettingsBlacklistFloatingActionButton() });
floatingActionButton = { SettingsBlacklistFloatingActionButton() }),
SettingsAbout(R.string.about, Icons.Default.Copyright, "settings/about");

companion object {
val byRoute: Map<String, Screen> = HashMap<String, Screen>().apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import kotlinx.coroutines.launch
import ru.herobrine1st.e621.R
import ru.herobrine1st.e621.preference.LocalPreferences
import ru.herobrine1st.e621.preference.updatePreferences
import ru.herobrine1st.e621.ui.component.preferences.SettingLink
import ru.herobrine1st.e621.ui.component.preferences.SettingLinkWithSwitch
import ru.herobrine1st.e621.ui.component.preferences.SettingSwitch
import ru.herobrine1st.e621.ui.dialog.AlertDialog
Expand Down Expand Up @@ -82,6 +83,12 @@ fun Settings(navController: NavController) {
}
}
)
SettingLink(
title = stringResource(R.string.about),
icon = Screen.SettingsAbout.icon
) {
navController.navigate(Screen.SettingsAbout.route)
}
}
if (showPrivacyModeDialog) {
AlertDialog(stringResource(R.string.privacy_mode_longdesc)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
package ru.herobrine1st.e621.ui.screen.settings

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.OpenInBrowser
import androidx.compose.runtime.Composable
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
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import ru.herobrine1st.e621.BuildConfig
import ru.herobrine1st.e621.R

@Composable
@Preview
fun SettingsAbout() {
LazyColumn(verticalArrangement = Arrangement.spacedBy(8.dp)) {
item {} // "padding"
item {
Card(Modifier.padding(horizontal = 8.dp)) {
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.fillMaxWidth()
) {
Box {
Image(
painterResource(R.drawable.ic_launcher_foreground),
contentDescription = null,
modifier = Modifier.size(128.dp)
)
}
Column {
Text(
stringResource(R.string.app_name),
style = MaterialTheme.typography.subtitle1
)
Spacer(modifier = Modifier.size(2.dp))
Text(
stringResource(
R.string.app_description,
BuildConfig.DEEP_LINK_BASE_URL
),
Modifier.alpha(ContentAlpha.medium),
style = MaterialTheme.typography.caption
)
}
}
}
}
item {
Card(
modifier = Modifier
.padding(horizontal = 8.dp)
.fillMaxWidth()
) {
Column(
modifier = Modifier
.padding(8.dp)
.fillMaxWidth()
) {
Text(stringResource(R.string.disclaimer), style = MaterialTheme.typography.h6)
Spacer(modifier = Modifier.height(8.dp))
Text(stringResource(R.string.non_affiliation_disclaimer))
}
}
}
item {
Card(
modifier = Modifier
.padding(horizontal = 8.dp)
.fillMaxWidth()
) {
Column(
modifier = Modifier
.padding(8.dp)
.fillMaxWidth()
) {
val uriHandler = LocalUriHandler.current
val licenseUrl = stringResource(R.string.license_url)
Text(stringResource(R.string.license_word), style = MaterialTheme.typography.h6)
Spacer(modifier = Modifier.height(8.dp))
Text(stringResource(R.string.license_brief))
OutlinedButton(
modifier = Modifier
.fillMaxWidth(),
onClick = { uriHandler.openUri(licenseUrl) }) {
Text(stringResource(R.string.license_name))
Icon(
Icons.Default.OpenInBrowser,
contentDescription = stringResource(R.string.open_in_browser)
)
}
}
}
}
item {}
}
}
1 change: 1 addition & 0 deletions app/src/main/proto/Preferences.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ message Preferences {
optional AuthorizationCredentials auth = 6;
optional bool safe_mode_enabled = 7 [default = true];
optional bool safe_mode_disclaimer_shown = 8 [default = false];
optional bool license_and_non_affiliation_disclaimer_shown = 9 [default = false];
}

12 changes: 12 additions & 0 deletions app/src/main/res/values-ru-rRU/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,16 @@
<string name="internal_server_error">Произошла внутренняя серверная ошибка. Попробуйте ещё раз позже.</string>
<string name="api_temporarily_unavailable">API сервер временно недоступен. Попробуйте позже.</string>
<string name="unknown_api_error">Произошла неизвестная ошибка API</string>
<string name="about">О программе</string>
<string name="app_description">Клиент для %s.</string>
<string name="license_brief">"Copyright © 2022 HeroBrine1st Erquilenne

Это приложение является свободным программным обеспечением: вы можете распространять и/или модифицировать его в соответствии с условиями GNU General Public License, опубликованной Free Software Foundation, либо версии 3, либо (по вашему выбору) любой поздней версии.

Это приложение распространяется в надежде, что оно будет полезно, но БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ; даже без подразумеваемой гарантии КОММЕРЧЕСКОЙ ПРИГОДНОСТИ или ПРИГОДНОСТИ ДЛЯ ОПРЕДЕЛЕННОЙ ЦЕЛИ. Дополнительные сведения см. в GNU General Public License."</string>
<string name="license_word">Лицензия</string>
<string name="open_in_browser">Открыть в браузере</string>
<string name="non_affiliation_disclaimer">Разработчики этого приложения и само это приложение не являются аффилированными, связанными, уполномоченными, одобренными или каким-либо образом официально связанными с e621.net и e926.net.</string>
<string name="i_understand">Понял</string>
<string name="explicitly_click_button">Нажмите кнопку, если вы закончили</string>
</resources>
15 changes: 15 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,19 @@
<string name="internal_server_error">An internal server error occurred. Try again later.</string>
<string name="api_temporarily_unavailable">API server temporarily unavailable. Try again later.</string>
<string name="unknown_api_error">An unknown API error occurred</string>
<string name="about">About</string>
<string name="app_description">An android client for %s.</string>
<string name="license_brief">"Copyright © 2022 HeroBrine1st Erquilenne

This application is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This application is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details."</string>
<string name="license_url" translatable="false">https://www.gnu.org/licenses/gpl-3.0.html</string>
<string name="license_name" translatable="false">GNU General Public License</string>
<string name="license_word">License</string>
<string name="open_in_browser">Open in browser</string>
<string name="non_affiliation_disclaimer">Developers of this application, and this application itself are not affiliated, associated, authorized, endorsed by, or in any way officially connected with e621.net and e926.net.</string>
<string name="i_understand">I understand</string>
<string name="explicitly_click_button">Explicitly click button if you\'ve done</string>
<string name="license_name_short" translatable="false">GNU GPL</string>
</resources>

0 comments on commit 6b2b0a1

Please sign in to comment.