Skip to content

Commit 810a3c9

Browse files
committed
android: add troubleshooter for easier log access
1 parent 0611509 commit 810a3c9

File tree

10 files changed

+1338
-2
lines changed

10 files changed

+1338
-2
lines changed

android/app/src/main/AndroidManifest.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<uses-permission android:name="android.permission.ANSWER_PHONE_CALLS" />
3232
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
3333
<uses-permission android:name="android.permission.INTERNET" />
34+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
3435

3536
<protected-broadcast android:name="batterywidget.impl.action.update_bluetooth_data" />
3637

@@ -126,6 +127,16 @@
126127
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
127128
</intent-filter>
128129
</receiver>
130+
131+
<provider
132+
android:name="androidx.core.content.FileProvider"
133+
android:authorities="${applicationId}.provider"
134+
android:exported="false"
135+
android:grantUriPermissions="true">
136+
<meta-data
137+
android:name="android.support.FILE_PROVIDER_PATHS"
138+
android:resource="@xml/file_paths" />
139+
</provider>
129140
</application>
130141

131142
</manifest>

android/app/src/main/java/me/kavishdevar/librepods/MainActivity.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ import me.kavishdevar.librepods.screens.HeadTrackingScreen
107107
import me.kavishdevar.librepods.screens.LongPress
108108
import me.kavishdevar.librepods.screens.Onboarding
109109
import me.kavishdevar.librepods.screens.RenameScreen
110+
import me.kavishdevar.librepods.screens.TroubleshootingScreen
110111
import me.kavishdevar.librepods.services.AirPodsService
111112
import me.kavishdevar.librepods.ui.theme.LibrePodsTheme
112113
import me.kavishdevar.librepods.utils.AirPodsNotifications
@@ -277,6 +278,9 @@ fun Main() {
277278
composable("app_settings") {
278279
AppSettingsScreen(navController)
279280
}
281+
composable("troubleshooting") {
282+
TroubleshootingScreen(navController)
283+
}
280284
composable("head_tracking") {
281285
HeadTrackingScreen(navController)
282286
}

android/app/src/main/java/me/kavishdevar/librepods/screens/AirPodsSettingsScreen.kt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,15 @@ import androidx.compose.foundation.layout.fillMaxSize
3636
import androidx.compose.foundation.layout.fillMaxWidth
3737
import androidx.compose.foundation.layout.height
3838
import androidx.compose.foundation.layout.padding
39+
import androidx.compose.foundation.layout.width
3940
import androidx.compose.foundation.rememberScrollState
41+
import androidx.compose.foundation.shape.RoundedCornerShape
4042
import androidx.compose.foundation.verticalScroll
4143
import androidx.compose.material.icons.Icons
4244
import androidx.compose.material.icons.filled.Info
4345
import androidx.compose.material.icons.filled.Settings
46+
import androidx.compose.material3.Button
47+
import androidx.compose.material3.ButtonDefaults
4448
import androidx.compose.material3.CenterAlignedTopAppBar
4549
import androidx.compose.material3.ExperimentalMaterial3Api
4650
import androidx.compose.material3.Icon
@@ -414,6 +418,24 @@ fun AirPodsSettingsScreen(dev: BluetoothDevice?, service: AirPodsService,
414418
textAlign = TextAlign.Center,
415419
modifier = Modifier.fillMaxWidth()
416420
)
421+
Spacer(Modifier.height(32.dp))
422+
Button(
423+
onClick = { navController.navigate("troubleshooting") },
424+
shape = RoundedCornerShape(10.dp),
425+
colors = ButtonDefaults.buttonColors(
426+
containerColor = if (isSystemInDarkTheme()) Color(0xFF1C1C1E) else Color(0xFFF2F2F7),
427+
contentColor = if (isSystemInDarkTheme()) Color.White else Color.Black,
428+
)
429+
) {
430+
Text(
431+
text = "Troubleshoot Connection",
432+
style = TextStyle(
433+
fontSize = 16.sp,
434+
fontWeight = FontWeight.Medium,
435+
fontFamily = FontFamily(Font(R.font.sf_pro))
436+
)
437+
)
438+
}
417439
}
418440
}
419441
}

android/app/src/main/java/me/kavishdevar/librepods/screens/AppSettingsScreen.kt

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,49 @@ fun AppSettingsScreen(navController: NavController) {
618618
modifier = Modifier.padding(8.dp, bottom = 2.dp, top = 24.dp)
619619
)
620620

621+
Spacer(modifier = Modifier.height(2.dp))
622+
623+
Column(
624+
modifier = Modifier
625+
.fillMaxWidth()
626+
.background(
627+
backgroundColor,
628+
RoundedCornerShape(14.dp)
629+
)
630+
.padding(horizontal = 16.dp, vertical = 4.dp)
631+
) {
632+
Row(
633+
modifier = Modifier
634+
.fillMaxWidth()
635+
.clickable {
636+
navController.navigate("troubleshooting")
637+
},
638+
verticalAlignment = Alignment.CenterVertically
639+
) {
640+
Column(
641+
modifier = Modifier
642+
.weight(1f)
643+
.padding(vertical = 8.dp)
644+
.padding(end = 4.dp)
645+
) {
646+
Text(
647+
text = stringResource(R.string.troubleshooting),
648+
fontSize = 16.sp,
649+
color = textColor
650+
)
651+
Spacer(modifier = Modifier.height(4.dp))
652+
Text(
653+
text = stringResource(R.string.troubleshooting_description),
654+
fontSize = 14.sp,
655+
color = textColor.copy(0.6f),
656+
lineHeight = 16.sp,
657+
)
658+
}
659+
}
660+
}
661+
662+
Spacer(modifier = Modifier.height(16.dp))
663+
621664
Button(
622665
onClick = { showResetDialog = true },
623666
modifier = Modifier

0 commit comments

Comments
 (0)