mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-07-25 18:25:21 +00:00
Merge pull request #85 from permissionlesstech/improve-onboarding-ui
permissions layout
This commit is contained in:
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Permission onboarding screen UX: removed "Exit App" button and fixed "Grant Permissions" button positioning to always be visible
|
||||||
|
|
||||||
## [0.6]
|
## [0.6]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -124,9 +124,6 @@ class MainActivity : ComponentActivity() {
|
|||||||
onContinue = {
|
onContinue = {
|
||||||
onboardingState = OnboardingState.PERMISSION_REQUESTING
|
onboardingState = OnboardingState.PERMISSION_REQUESTING
|
||||||
onboardingCoordinator.requestPermissions()
|
onboardingCoordinator.requestPermissions()
|
||||||
},
|
|
||||||
onCancel = {
|
|
||||||
finish()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,16 +21,20 @@ import androidx.compose.ui.unit.sp
|
|||||||
@Composable
|
@Composable
|
||||||
fun PermissionExplanationScreen(
|
fun PermissionExplanationScreen(
|
||||||
permissionCategories: List<PermissionCategory>,
|
permissionCategories: List<PermissionCategory>,
|
||||||
onContinue: () -> Unit,
|
onContinue: () -> Unit
|
||||||
onCancel: () -> Unit
|
|
||||||
) {
|
) {
|
||||||
val colorScheme = MaterialTheme.colorScheme
|
val colorScheme = MaterialTheme.colorScheme
|
||||||
val scrollState = rememberScrollState()
|
val scrollState = rememberScrollState()
|
||||||
|
|
||||||
|
Box(
|
||||||
|
modifier = Modifier.fillMaxSize()
|
||||||
|
) {
|
||||||
|
// Scrollable content
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.padding(horizontal = 24.dp)
|
.padding(horizontal = 24.dp)
|
||||||
|
.padding(bottom = 88.dp) // Leave space for the fixed button
|
||||||
.verticalScroll(scrollState),
|
.verticalScroll(scrollState),
|
||||||
verticalArrangement = Arrangement.spacedBy(16.dp)
|
verticalArrangement = Arrangement.spacedBy(16.dp)
|
||||||
) {
|
) {
|
||||||
@@ -125,16 +129,22 @@ fun PermissionExplanationScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(24.dp))
|
||||||
|
}
|
||||||
|
|
||||||
// Action buttons
|
// Fixed button at bottom
|
||||||
Column(
|
Surface(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier
|
||||||
verticalArrangement = Arrangement.spacedBy(12.dp)
|
.align(Alignment.BottomCenter)
|
||||||
|
.fillMaxWidth(),
|
||||||
|
color = colorScheme.surface,
|
||||||
|
shadowElevation = 8.dp
|
||||||
) {
|
) {
|
||||||
Button(
|
Button(
|
||||||
onClick = onContinue,
|
onClick = onContinue,
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = 24.dp, vertical = 16.dp),
|
||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.buttonColors(
|
||||||
containerColor = colorScheme.primary
|
containerColor = colorScheme.primary
|
||||||
)
|
)
|
||||||
@@ -148,25 +158,8 @@ fun PermissionExplanationScreen(
|
|||||||
modifier = Modifier.padding(vertical = 4.dp)
|
modifier = Modifier.padding(vertical = 4.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
OutlinedButton(
|
|
||||||
onClick = onCancel,
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
colors = ButtonDefaults.outlinedButtonColors(
|
|
||||||
contentColor = colorScheme.onSurface.copy(alpha = 0.7f)
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = "Exit App",
|
|
||||||
style = MaterialTheme.typography.bodyMedium.copy(
|
|
||||||
fontFamily = FontFamily.Monospace
|
|
||||||
),
|
|
||||||
modifier = Modifier.padding(vertical = 4.dp)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Spacer(modifier = Modifier.height(24.dp))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ class PermissionManager(private val context: Context) {
|
|||||||
categories.add(
|
categories.add(
|
||||||
PermissionCategory(
|
PermissionCategory(
|
||||||
name = "Nearby Devices",
|
name = "Nearby Devices",
|
||||||
description = "Required to discover and connect to other bitchat users via Bluetooth",
|
description = "Required to discover bitchat users via Bluetooth",
|
||||||
permissions = bluetoothPermissions,
|
permissions = bluetoothPermissions,
|
||||||
isGranted = bluetoothPermissions.all { isPermissionGranted(it) },
|
isGranted = bluetoothPermissions.all { isPermissionGranted(it) },
|
||||||
systemDescription = "Allow bitchat to connect to nearby devices"
|
systemDescription = "Allow bitchat to connect to nearby devices"
|
||||||
@@ -132,10 +132,10 @@ class PermissionManager(private val context: Context) {
|
|||||||
categories.add(
|
categories.add(
|
||||||
PermissionCategory(
|
PermissionCategory(
|
||||||
name = "Precise Location",
|
name = "Precise Location",
|
||||||
description = "Required by Android for Bluetooth scanning.",
|
description = "Required by Android to discover nearby bitchat users via Bluetooth",
|
||||||
permissions = locationPermissions,
|
permissions = locationPermissions,
|
||||||
isGranted = locationPermissions.all { isPermissionGranted(it) },
|
isGranted = locationPermissions.all { isPermissionGranted(it) },
|
||||||
systemDescription = "Allow bitchat to access this device's location"
|
systemDescription = "bitchat needs this to scan for nearby devices"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ class PermissionManager(private val context: Context) {
|
|||||||
categories.add(
|
categories.add(
|
||||||
PermissionCategory(
|
PermissionCategory(
|
||||||
name = "Notifications",
|
name = "Notifications",
|
||||||
description = "Show notifications when you receive private messages while the app is in background",
|
description = "Notifications to keep you updated",
|
||||||
permissions = listOf(Manifest.permission.POST_NOTIFICATIONS),
|
permissions = listOf(Manifest.permission.POST_NOTIFICATIONS),
|
||||||
isGranted = isPermissionGranted(Manifest.permission.POST_NOTIFICATIONS),
|
isGranted = isPermissionGranted(Manifest.permission.POST_NOTIFICATIONS),
|
||||||
systemDescription = "Allow bitchat to send you notifications"
|
systemDescription = "Allow bitchat to send you notifications"
|
||||||
|
|||||||
Reference in New Issue
Block a user