Skip to content

Commit 7cec703

Browse files
committed
Move alerts to separate files
1 parent 8a1ae6c commit 7cec703

4 files changed

Lines changed: 68 additions & 51 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// SPDX-FileCopyrightText: 2026 Davide De Rosa
2+
//
3+
// SPDX-License-Identifier: GPL-3.0
4+
5+
package com.algoritmico.passepartout.ui
6+
7+
import androidx.compose.material3.AlertDialog
8+
import androidx.compose.material3.Text
9+
import androidx.compose.material3.TextButton
10+
import androidx.compose.runtime.Composable
11+
12+
@Composable
13+
fun FailureAlert(
14+
title: String,
15+
message: String,
16+
onDismiss: () -> Unit
17+
) {
18+
AlertDialog(
19+
onDismissRequest = onDismiss,
20+
title = {
21+
Text(title)
22+
},
23+
text = {
24+
Text(message)
25+
},
26+
confirmButton = {
27+
TextButton(onClick = onDismiss) {
28+
Text("OK")
29+
}
30+
}
31+
)
32+
}

app-android/app/src/main/kotlin/com/algoritmico/passepartout/ui/PassepartoutApp.kt

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@ package com.algoritmico.passepartout.ui
66

77
import androidx.compose.foundation.isSystemInDarkTheme
88
import androidx.compose.foundation.layout.fillMaxSize
9-
import androidx.compose.material3.AlertDialog
109
import androidx.compose.material3.MaterialTheme
1110
import androidx.compose.material3.Surface
12-
import androidx.compose.material3.Text
13-
import androidx.compose.material3.TextButton
1411
import androidx.compose.material3.darkColorScheme
1512
import androidx.compose.material3.lightColorScheme
1613
import androidx.compose.runtime.Composable
@@ -104,25 +101,3 @@ fun PassepartoutApp(
104101
}
105102
}
106103
}
107-
108-
@Composable
109-
private fun FailureAlert(
110-
title: String,
111-
message: String,
112-
onDismiss: () -> Unit
113-
) {
114-
AlertDialog(
115-
onDismissRequest = onDismiss,
116-
title = {
117-
Text(title)
118-
},
119-
text = {
120-
Text(message)
121-
},
122-
confirmButton = {
123-
TextButton(onClick = onDismiss) {
124-
Text("OK")
125-
}
126-
}
127-
)
128-
}

app-android/app/src/main/kotlin/com/algoritmico/passepartout/ui/ProfileContainerView.kt

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -263,32 +263,6 @@ fun ProfileContainerView(
263263
)
264264
}
265265

266-
@Composable
267-
private fun VpnPermissionDeniedAlert(
268-
onDismiss: () -> Unit,
269-
onOpenSettings: () -> Unit
270-
) {
271-
AlertDialog(
272-
onDismissRequest = onDismiss,
273-
title = {
274-
Text("VPN permission required")
275-
},
276-
text = {
277-
Text("Passepartout needs VPN permission to start a connection.")
278-
},
279-
confirmButton = {
280-
TextButton(onClick = onOpenSettings) {
281-
Text("Open VPN settings")
282-
}
283-
},
284-
dismissButton = {
285-
TextButton(onClick = onDismiss) {
286-
Text("OK")
287-
}
288-
}
289-
)
290-
}
291-
292266
@Composable
293267
private fun MobileProfilesView(
294268
modifier: Modifier,
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// SPDX-FileCopyrightText: 2026 Davide De Rosa
2+
//
3+
// SPDX-License-Identifier: GPL-3.0
4+
5+
package com.algoritmico.passepartout.ui
6+
7+
import androidx.compose.material3.AlertDialog
8+
import androidx.compose.material3.Text
9+
import androidx.compose.material3.TextButton
10+
import androidx.compose.runtime.Composable
11+
12+
@Composable
13+
fun VpnPermissionDeniedAlert(
14+
onDismiss: () -> Unit,
15+
onOpenSettings: () -> Unit
16+
) {
17+
AlertDialog(
18+
onDismissRequest = onDismiss,
19+
title = {
20+
Text("VPN permission required")
21+
},
22+
text = {
23+
Text("Passepartout needs VPN permission to start a connection.")
24+
},
25+
confirmButton = {
26+
TextButton(onClick = onOpenSettings) {
27+
Text("Open VPN settings")
28+
}
29+
},
30+
dismissButton = {
31+
TextButton(onClick = onDismiss) {
32+
Text("OK")
33+
}
34+
}
35+
)
36+
}

0 commit comments

Comments
 (0)