Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
alias(libs.plugins.apollo)
alias(libs.plugins.google.services)
alias(libs.plugins.firebase.crashlytics)
alias(libs.plugins.aboutlibraries)
}

android {
Expand All @@ -27,7 +28,7 @@
defaultConfig {
applicationId = "pub.hackers.android"
minSdk = 26
targetSdk = 36

Check warning on line 31 in app/build.gradle.kts

View workflow job for this annotation

GitHub Actions / lint

Not targeting the latest versions of Android; compatibility modes apply. Consider testing and updating this version. Consult the `android.os.Build.VERSION_CODES` javadoc for details. [OldTargetApi]
versionCode = 9
versionName = "1.4.2"

Expand Down Expand Up @@ -132,6 +133,8 @@
implementation(libs.androidx.credentials)
implementation(libs.androidx.credentials.play.services.auth)

implementation(libs.aboutlibraries.compose.m3)

testImplementation(libs.junit)
testImplementation(libs.robolectric)
testImplementation(libs.compose.ui.test.junit4)
Expand Down
13 changes: 13 additions & 0 deletions app/src/main/java/pub/hackers/android/ui/HackersPubApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import pub.hackers.android.ui.screens.profile.ProfileScreen
import pub.hackers.android.ui.screens.recommendedactors.RecommendedActorsScreen
import pub.hackers.android.ui.screens.search.SearchScreen
import pub.hackers.android.ui.screens.licenses.LicensesScreen
import pub.hackers.android.ui.screens.settings.SettingsScreen
import pub.hackers.android.ui.screens.timeline.TimelineScreen
import pub.hackers.android.ui.screens.webview.WebViewScreen
Expand Down Expand Up @@ -150,6 +151,7 @@
return "webview?url=$encoded"
}
}
data object Licenses : DetailScreen("licenses")
}

@Composable
Expand All @@ -158,7 +160,7 @@
navigationIntent: pub.hackers.android.NavigationIntent? = null,
onDeepLinkConsumed: () -> Unit = {},
onNavigationIntentConsumed: () -> Unit = {},
viewModel: AppViewModel = hiltViewModel()

Check warning on line 163 in app/src/main/java/pub/hackers/android/ui/HackersPubApp.kt

View workflow job for this annotation

GitHub Actions / lint

'fun <reified VM : ViewModel> hiltViewModel(viewModelStoreOwner: ViewModelStoreOwner = ..., key: String? = ...): VM' is deprecated. Moved to package: androidx.hilt.lifecycle.viewmodel.compose.
) {
val navController = rememberNavController()
val isLoggedInState by viewModel.isLoggedIn.collectAsState(initial = null as Boolean?)
Expand Down Expand Up @@ -445,6 +447,9 @@
onDraftsClick = {
navController.navigate(DetailScreen.Drafts.route)
},
onLicensesClick = {
navController.navigate(DetailScreen.Licenses.route)
},
isLoggedIn = isLoggedIn
)
}
Expand Down Expand Up @@ -667,6 +672,14 @@
}
)
}

composable(DetailScreen.Licenses.route) {
LicensesScreen(
onNavigateBack = {
navController.popBackStack()
}
)
}
}
}
} // CompositionLocalProvider
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package pub.hackers.android.ui.screens.licenses

import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.mikepenz.aboutlibraries.ui.compose.android.produceLibraries
import com.mikepenz.aboutlibraries.ui.compose.m3.LibrariesContainer
import pub.hackers.android.R

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun LicensesScreen(
onNavigateBack: () -> Unit
) {
Scaffold(
contentWindowInsets = WindowInsets(0),
topBar = {
TopAppBar(
title = { Text(text = stringResource(R.string.licenses)) },
navigationIcon = {
IconButton(onClick = onNavigateBack) {
Icon(
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = stringResource(R.string.back)
)
}
}
)
}
) { innerPadding ->
val libraries by produceLibraries()
Comment thread
dalinaum marked this conversation as resolved.
LibrariesContainer(
libraries = libraries,
modifier = Modifier
.fillMaxSize()
.padding(innerPadding),
contentPadding = PaddingValues(vertical = 8.dp)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.automirrored.filled.Logout
import androidx.compose.material.icons.automirrored.outlined.Article
import androidx.compose.material.icons.automirrored.outlined.LibraryBooks
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material.icons.filled.Fingerprint
Expand Down Expand Up @@ -66,8 +67,9 @@
onProfileClick: (String) -> Unit,
onNavigateBack: () -> Unit,
onDraftsClick: () -> Unit = {},
onLicensesClick: () -> Unit = {},
isLoggedIn: Boolean,
viewModel: SettingsViewModel = hiltViewModel()

Check warning on line 72 in app/src/main/java/pub/hackers/android/ui/screens/settings/SettingsScreen.kt

View workflow job for this annotation

GitHub Actions / lint

'fun <reified VM : ViewModel> hiltViewModel(viewModelStoreOwner: ViewModelStoreOwner = ..., key: String? = ...): VM' is deprecated. Moved to package: androidx.hilt.lifecycle.viewmodel.compose.
) {
val uiState by viewModel.uiState.collectAsState()
val snackbarHostState = remember { SnackbarHostState() }
Expand Down Expand Up @@ -320,7 +322,7 @@
verticalAlignment = Alignment.CenterVertically
) {
Icon(
imageVector = Icons.Filled.Login,

Check warning on line 325 in app/src/main/java/pub/hackers/android/ui/screens/settings/SettingsScreen.kt

View workflow job for this annotation

GitHub Actions / lint

'val Icons.Filled.Login: ImageVector' is deprecated. Use the AutoMirrored version at Icons.AutoMirrored.Filled.Login.
contentDescription = null,
tint = colors.textSecondary
)
Expand Down Expand Up @@ -386,6 +388,28 @@

HorizontalDivider(color = colors.divider, thickness = 1.dp)

Row(
modifier = Modifier
.fillMaxWidth()
.clickable { onLicensesClick() }
.padding(16.dp),
verticalAlignment = Alignment.CenterVertically
) {
Icon(
imageVector = Icons.AutoMirrored.Outlined.LibraryBooks,
contentDescription = null,
tint = colors.textSecondary
)
Spacer(modifier = Modifier.width(16.dp))
Text(
text = stringResource(R.string.licenses),
style = typography.bodyLarge,
color = colors.textPrimary
)
}

HorizontalDivider(color = colors.divider, thickness = 1.dp)

Row(
modifier = Modifier
.fillMaxWidth()
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<string name="verification_description">Enter the verification code sent to your email.</string>
<string name="send_code">Send Code</string>
<string name="verify">Verify</string>
<string name="account_not_found">Account not found</string>

Check warning on line 19 in app/src/main/res/values/strings.xml

View workflow job for this annotation

GitHub Actions / lint

The resource `R.string.account_not_found` appears to be unused [UnusedResources]
<string name="or">or</string>
<string name="sign_in_with_passkey">Sign in with Passkey</string>
<string name="passkeys">Passkeys</string>
Expand All @@ -30,11 +30,11 @@
<string name="no_passkey_registered">No passkey found. Sign in with your username first, then register a passkey in Settings.</string>

<!-- Timeline -->
<string name="local_timeline">Hackers\' Pub</string>

Check warning on line 33 in app/src/main/res/values/strings.xml

View workflow job for this annotation

GitHub Actions / lint

The resource `R.string.local_timeline` appears to be unused [UnusedResources]
<string name="global_timeline">Fediverse</string>

Check warning on line 34 in app/src/main/res/values/strings.xml

View workflow job for this annotation

GitHub Actions / lint

The resource `R.string.global_timeline` appears to be unused [UnusedResources]
<string name="personal_timeline">Home</string>
<string name="no_posts">No posts yet</string>
<string name="load_more">Load more</string>

Check warning on line 37 in app/src/main/res/values/strings.xml

View workflow job for this annotation

GitHub Actions / lint

The resource `R.string.load_more` appears to be unused [UnusedResources]
<string name="refresh">Refresh</string>

<!-- Compose -->
Expand All @@ -42,8 +42,8 @@
<string name="compose_hint">What\'s on your mind?</string>
<string name="post">Post</string>
<string name="cancel">Cancel</string>
<string name="compose_edit">Edit</string>

Check warning on line 45 in app/src/main/res/values/strings.xml

View workflow job for this annotation

GitHub Actions / lint

The resource `R.string.compose_edit` appears to be unused [UnusedResources]
<string name="compose_preview">Preview</string>

Check warning on line 46 in app/src/main/res/values/strings.xml

View workflow job for this annotation

GitHub Actions / lint

The resource `R.string.compose_preview` appears to be unused [UnusedResources]
<string name="compose_preview_empty">Write something to see the preview</string>
<string name="quote_load_failed">Unable to load quoted post</string>
<string name="visibility_public">Public</string>
Expand Down Expand Up @@ -155,6 +155,7 @@
<string name="settings_theme_dark">Dark</string>
<string name="settings_theme_dynamic">Dynamic color (Material You)</string>
<string name="settings_theme_dynamic_unavailable">Requires Android 12+</string>
<string name="licenses">Open-source Licenses</string>
Comment thread
dalinaum marked this conversation as resolved.
<string name="back">Back</string>

<!-- Profile -->
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
alias(libs.plugins.apollo) apply false
alias(libs.plugins.google.services) apply false
alias(libs.plugins.firebase.crashlytics) apply false
alias(libs.plugins.aboutlibraries) apply false
}

allprojects {
Expand Down
4 changes: 4 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ firebaseBom = "34.12.0"
paging = "3.4.2"
mockk = "1.14.9"
turbine = "1.2.1"
aboutLibraries = "14.0.1"

[libraries]
androidx-browser = { module = "androidx.browser:browser", version.ref = "browser" }
Expand Down Expand Up @@ -84,6 +85,8 @@ mockk = { group = "io.mockk", name = "mockk", version.ref = "mockk" }
turbine = { group = "app.cash.turbine", name = "turbine", version.ref = "turbine" }
kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "coroutines" }

aboutlibraries-compose-m3 = { group = "com.mikepenz", name = "aboutlibraries-compose-m3", version.ref = "aboutLibraries" }

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
Expand All @@ -92,3 +95,4 @@ ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
apollo = { id = "com.apollographql.apollo", version.ref = "apollo" }
google-services = { id = "com.google.gms.google-services", version.ref = "googleServices" }
firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "firebaseCrashlyticsPlugin" }
aboutlibraries = { id = "com.mikepenz.aboutlibraries.plugin", version.ref = "aboutLibraries" }
Loading