mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-07-25 02:45:20 +00:00
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/),
|
||||
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]
|
||||
|
||||
### Added
|
||||
|
||||
@@ -124,9 +124,6 @@ class MainActivity : ComponentActivity() {
|
||||
onContinue = {
|
||||
onboardingState = OnboardingState.PERMISSION_REQUESTING
|
||||
onboardingCoordinator.requestPermissions()
|
||||
},
|
||||
onCancel = {
|
||||
finish()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -21,16 +21,20 @@ import androidx.compose.ui.unit.sp
|
||||
@Composable
|
||||
fun PermissionExplanationScreen(
|
||||
permissionCategories: List<PermissionCategory>,
|
||||
onContinue: () -> Unit,
|
||||
onCancel: () -> Unit
|
||||
onContinue: () -> Unit
|
||||
) {
|
||||
val colorScheme = MaterialTheme.colorScheme
|
||||
val scrollState = rememberScrollState()
|
||||
|
||||
Box(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
// Scrollable content
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(horizontal = 24.dp)
|
||||
.padding(bottom = 88.dp) // Leave space for the fixed button
|
||||
.verticalScroll(scrollState),
|
||||
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
|
||||
Column(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalArrangement = Arrangement.spacedBy(12.dp)
|
||||
// Fixed button at bottom
|
||||
Surface(
|
||||
modifier = Modifier
|
||||
.align(Alignment.BottomCenter)
|
||||
.fillMaxWidth(),
|
||||
color = colorScheme.surface,
|
||||
shadowElevation = 8.dp
|
||||
) {
|
||||
Button(
|
||||
onClick = onContinue,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 24.dp, vertical = 16.dp),
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
containerColor = colorScheme.primary
|
||||
)
|
||||
@@ -148,25 +158,8 @@ fun PermissionExplanationScreen(
|
||||
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
|
||||
|
||||
@@ -116,7 +116,7 @@ class PermissionManager(private val context: Context) {
|
||||
categories.add(
|
||||
PermissionCategory(
|
||||
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,
|
||||
isGranted = bluetoothPermissions.all { isPermissionGranted(it) },
|
||||
systemDescription = "Allow bitchat to connect to nearby devices"
|
||||
@@ -132,10 +132,10 @@ class PermissionManager(private val context: Context) {
|
||||
categories.add(
|
||||
PermissionCategory(
|
||||
name = "Precise Location",
|
||||
description = "Required by Android for Bluetooth scanning.",
|
||||
description = "Required by Android to discover nearby bitchat users via Bluetooth",
|
||||
permissions = locationPermissions,
|
||||
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(
|
||||
PermissionCategory(
|
||||
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),
|
||||
isGranted = isPermissionGranted(Manifest.permission.POST_NOTIFICATIONS),
|
||||
systemDescription = "Allow bitchat to send you notifications"
|
||||
|
||||
Reference in New Issue
Block a user