Commits:
-
89c0232b
by clairehurst at 2026-12-02T11:45:53-07:00
fixup! [android] TBA strings
Bug 44637: circuit display
-
9594a7ae
by clairehurst at 2026-12-02T11:45:53-07:00
[android] Bug 44637: Circuit Display
-
08acaf80
by clairehurst at 2026-12-02T11:45:53-07:00
[android] Bug 44637: Circuit Display
# Conflicts:
# mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/trustpanel/ui/CircuitDisplayViewModel.kt
11 changed files:
Changes:
mobile/android/android-components/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngineSession.kt
| ... |
... |
@@ -1808,6 +1808,10 @@ class GeckoEngineSession( |
|
1808
|
1808
|
geckoSession.translationsSessionDelegate = GeckoTranslateSessionDelegate(this)
|
|
1809
|
1809
|
}
|
|
1810
|
1810
|
|
|
|
1811
|
+ fun getTorCircuits(): GeckoResult<JSONObject?> {
|
|
|
1812
|
+ return geckoSession.torCircuits
|
|
|
1813
|
+ }
|
|
|
1814
|
+
|
|
1811
|
1815
|
fun newTorCircuit() {
|
|
1812
|
1816
|
geckoSession.newTorCircuit()
|
|
1813
|
1817
|
}
|
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/trustpanel/TrustPanelFragment.kt
| ... |
... |
@@ -104,9 +104,17 @@ import org.mozilla.fenix.utils.enterSubmenu |
|
104
|
104
|
import org.mozilla.fenix.utils.exitMenu
|
|
105
|
105
|
import org.mozilla.fenix.utils.exitSubmenu
|
|
106
|
106
|
|
|
|
107
|
+import android.util.Log
|
|
|
108
|
+import androidx.fragment.app.viewModels
|
|
|
109
|
+import mozilla.components.browser.engine.gecko.GeckoEngineSession
|
|
|
110
|
+import mozilla.components.browser.state.selector.selectedTab
|
|
|
111
|
+import org.mozilla.fenix.settings.trustpanel.ui.CircuitDisplayViewModel
|
|
|
112
|
+
|
|
107
|
113
|
/** A bottom sheet dialog fragment displaying the unified trust panel. */
|
|
108
|
114
|
class TrustPanelFragment : BottomSheetDialogFragment() {
|
|
109
|
115
|
|
|
|
116
|
+ private val circuitDisplayViewModel by viewModels<CircuitDisplayViewModel>()
|
|
|
117
|
+
|
|
110
|
118
|
private val args by navArgs<TrustPanelFragmentArgs>()
|
|
111
|
119
|
private val trackersBlockedFeature = ViewBoundFeatureWrapper<TrackersBlockedFeature>()
|
|
112
|
120
|
private val ipProtectionMenuBinding = ViewBoundFeatureWrapper<IPProtectionMenuBinding>()
|
| ... |
... |
@@ -380,6 +388,16 @@ class TrustPanelFragment : BottomSheetDialogFragment() { |
|
380
|
388
|
)
|
|
381
|
389
|
store.dispatch(TrustPanelAction.Navigate.IPProtectionSettings)
|
|
382
|
390
|
},
|
|
|
391
|
+ circuitsInfo = circuitDisplayViewModel.circuitsStateFlow.collectAsState().value,
|
|
|
392
|
+ onNewCircuitClick = {
|
|
|
393
|
+ components.core.store.state.selectedTab?.let {
|
|
|
394
|
+ (it.engineState.engineSession as GeckoEngineSession).newTorCircuit()
|
|
|
395
|
+ components.useCases.sessionUseCases.reload.invoke(it.id)
|
|
|
396
|
+ } ?: Log.e(
|
|
|
397
|
+ "TrustPanelFragment",
|
|
|
398
|
+ "selectedTab was null, tab and tor circuit not refreshed",
|
|
|
399
|
+ )
|
|
|
400
|
+ },
|
|
383
|
401
|
onConnectionSettingsClick = {
|
|
384
|
402
|
findNavController().navigate(
|
|
385
|
403
|
TrustPanelFragmentDirections.actionTrustPanelToSettings(
|
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/trustpanel/ui/CircuitDisplay.kt
|
|
1
|
+package org.mozilla.fenix.settings.trustpanel.ui
|
|
|
2
|
+
|
|
|
3
|
+import androidx.compose.foundation.Canvas
|
|
|
4
|
+import androidx.compose.foundation.Image
|
|
|
5
|
+import androidx.compose.foundation.background
|
|
|
6
|
+import androidx.compose.foundation.border
|
|
|
7
|
+import androidx.compose.foundation.clickable
|
|
|
8
|
+import androidx.compose.foundation.layout.Column
|
|
|
9
|
+import androidx.compose.foundation.layout.ColumnScope
|
|
|
10
|
+import androidx.compose.foundation.layout.IntrinsicSize
|
|
|
11
|
+import androidx.compose.foundation.layout.PaddingValues
|
|
|
12
|
+import androidx.compose.foundation.layout.Row
|
|
|
13
|
+import androidx.compose.foundation.layout.Spacer
|
|
|
14
|
+import androidx.compose.foundation.layout.fillMaxHeight
|
|
|
15
|
+import androidx.compose.foundation.layout.fillMaxWidth
|
|
|
16
|
+import androidx.compose.foundation.layout.height
|
|
|
17
|
+import androidx.compose.foundation.layout.padding
|
|
|
18
|
+import androidx.compose.foundation.layout.size
|
|
|
19
|
+import androidx.compose.foundation.layout.width
|
|
|
20
|
+import androidx.compose.foundation.shape.RoundedCornerShape
|
|
|
21
|
+import androidx.compose.material3.HorizontalDivider
|
|
|
22
|
+import androidx.compose.material3.MaterialTheme
|
|
|
23
|
+import androidx.compose.material3.Text
|
|
|
24
|
+import androidx.compose.runtime.Composable
|
|
|
25
|
+import androidx.compose.ui.Alignment
|
|
|
26
|
+import androidx.compose.ui.Modifier
|
|
|
27
|
+import androidx.compose.ui.draw.scale
|
|
|
28
|
+import androidx.compose.ui.geometry.Offset
|
|
|
29
|
+import androidx.compose.ui.geometry.Size
|
|
|
30
|
+import androidx.compose.ui.graphics.Color
|
|
|
31
|
+import androidx.compose.ui.graphics.painter.Painter
|
|
|
32
|
+import androidx.compose.ui.res.painterResource
|
|
|
33
|
+import androidx.compose.ui.res.stringResource
|
|
|
34
|
+import androidx.compose.ui.semantics.Role
|
|
|
35
|
+import androidx.compose.ui.text.TextStyle
|
|
|
36
|
+import androidx.compose.ui.text.font.FontWeight
|
|
|
37
|
+import androidx.compose.ui.text.style.TextAlign
|
|
|
38
|
+import androidx.compose.ui.text.style.TextOverflow
|
|
|
39
|
+import androidx.compose.ui.tooling.preview.Preview
|
|
|
40
|
+import androidx.compose.ui.tooling.preview.PreviewParameter
|
|
|
41
|
+import androidx.compose.ui.unit.Dp
|
|
|
42
|
+import androidx.compose.ui.unit.dp
|
|
|
43
|
+import androidx.compose.ui.unit.sp
|
|
|
44
|
+import mozilla.components.compose.base.button.IconButton
|
|
|
45
|
+import mozilla.components.compose.base.button.TextButton
|
|
|
46
|
+import mozilla.components.compose.base.theme.Theme
|
|
|
47
|
+import mozilla.components.support.ktx.kotlin.isOnionUrl
|
|
|
48
|
+import mozilla.components.ui.colors.NovaColors
|
|
|
49
|
+import mozilla.components.ui.colors.PhotonColors
|
|
|
50
|
+import org.mozilla.fenix.R
|
|
|
51
|
+import org.mozilla.fenix.components.menu.compose.MenuGroup
|
|
|
52
|
+import org.mozilla.fenix.theme.FirefoxTheme
|
|
|
53
|
+
|
|
|
54
|
+@Composable
|
|
|
55
|
+fun CircuitDisplay(
|
|
|
56
|
+ modifier: Modifier,
|
|
|
57
|
+ circuitsInfo: Circuits?,
|
|
|
58
|
+ websiteUrl: String,
|
|
|
59
|
+ onNewCircuitClick: () -> Unit,
|
|
|
60
|
+) {
|
|
|
61
|
+ MenuGroup {
|
|
|
62
|
+ Column(
|
|
|
63
|
+ modifier = modifier,
|
|
|
64
|
+ ) {
|
|
|
65
|
+ Row(Modifier.fillMaxWidth()) {
|
|
|
66
|
+ Column(
|
|
|
67
|
+ modifier = Modifier.padding(top = 12.dp, start = 16.dp, end = 16.dp, bottom = 8.dp),
|
|
|
68
|
+ ) {
|
|
|
69
|
+ Row {
|
|
|
70
|
+ Text(
|
|
|
71
|
+ stringResource(R.string.tor_circuit_display_title),
|
|
|
72
|
+ style =
|
|
|
73
|
+ TextStyle(
|
|
|
74
|
+ fontSize = 16.sp,
|
|
|
75
|
+ lineHeight = 24.sp,
|
|
|
76
|
+ fontWeight = FontWeight(500),
|
|
|
77
|
+ color = PhotonColors.LightGrey05,
|
|
|
78
|
+ letterSpacing = 0.15.sp,
|
|
|
79
|
+ ),
|
|
|
80
|
+ modifier = Modifier.align(Alignment.CenterVertically),
|
|
|
81
|
+ )
|
|
|
82
|
+ Spacer(Modifier.size(8.dp))
|
|
|
83
|
+ if (circuitsInfo?.first == null && circuitsInfo?.second == null) {
|
|
|
84
|
+ PathButton(stringResource(R.string.no_path))
|
|
|
85
|
+ } else if (circuitsInfo.multipleEntryNodes() || circuitsInfo.multipleMiddleNodes()) {
|
|
|
86
|
+ PathButton(stringResource(R.string.multi_path))
|
|
|
87
|
+ } else if (!circuitsInfo.multipleEntryNodes() || !circuitsInfo.multipleMiddleNodes()) {
|
|
|
88
|
+ PathButton(stringResource(R.string.single_path))
|
|
|
89
|
+ }
|
|
|
90
|
+ }
|
|
|
91
|
+ Spacer(Modifier.size(4.dp))
|
|
|
92
|
+ Text(
|
|
|
93
|
+ stringResource(
|
|
|
94
|
+ R.string.tor_circuit_display_description,
|
|
|
95
|
+ ),
|
|
|
96
|
+ style =
|
|
|
97
|
+ TextStyle(
|
|
|
98
|
+ fontSize = 12.sp,
|
|
|
99
|
+ lineHeight = 16.sp,
|
|
|
100
|
+ fontWeight = FontWeight(400),
|
|
|
101
|
+ color = PhotonColors.LightGrey40,
|
|
|
102
|
+ letterSpacing = 0.4.sp,
|
|
|
103
|
+ ),
|
|
|
104
|
+ )
|
|
|
105
|
+ }
|
|
|
106
|
+ IconButton(
|
|
|
107
|
+ onClick = { /* TODO add in circuit display part 2 tb#44637 */ },
|
|
|
108
|
+ contentDescription = null,
|
|
|
109
|
+ ) {
|
|
|
110
|
+ Image(
|
|
|
111
|
+ painter = painterResource(mozilla.components.ui.icons.R.drawable.mozac_ic_chevron_right_24),
|
|
|
112
|
+ contentDescription = null,
|
|
|
113
|
+ )
|
|
|
114
|
+ }
|
|
|
115
|
+ }
|
|
|
116
|
+
|
|
|
117
|
+ HorizontalDivider(Modifier, 2.dp, NovaColors.VioletDesaturated90)
|
|
|
118
|
+
|
|
|
119
|
+ Spacer(Modifier.size(10.dp))
|
|
|
120
|
+
|
|
|
121
|
+ CircuitList(circuitsInfo, websiteUrl)
|
|
|
122
|
+
|
|
|
123
|
+ NewCircuitButton(onNewCircuitClick)
|
|
|
124
|
+
|
|
|
125
|
+ Spacer(Modifier.size(12.dp))
|
|
|
126
|
+ }
|
|
|
127
|
+ }
|
|
|
128
|
+}
|
|
|
129
|
+
|
|
|
130
|
+@Composable
|
|
|
131
|
+private fun PathButton(
|
|
|
132
|
+ text: String,
|
|
|
133
|
+ textColor: Color = PhotonColors.Violet10,
|
|
|
134
|
+) {
|
|
|
135
|
+ Text(
|
|
|
136
|
+ text = text,
|
|
|
137
|
+ style =
|
|
|
138
|
+ TextStyle(
|
|
|
139
|
+ fontSize = 14.sp,
|
|
|
140
|
+ lineHeight = 14.sp,
|
|
|
141
|
+ fontWeight = FontWeight(500),
|
|
|
142
|
+ color = textColor,
|
|
|
143
|
+ textAlign = TextAlign.Center,
|
|
|
144
|
+ letterSpacing = 0.25.sp,
|
|
|
145
|
+ ),
|
|
|
146
|
+ modifier =
|
|
|
147
|
+ Modifier.border(width = 1.dp, color = PhotonColors.LightGrey80, shape = RoundedCornerShape(size = 100.dp))
|
|
|
148
|
+ .padding(horizontal = 12.dp, vertical = 4.dp)
|
|
|
149
|
+ .clickable(
|
|
|
150
|
+ onClick = { /* TODO navigate to circuit info screen */ },
|
|
|
151
|
+ role = Role.Button,
|
|
|
152
|
+ onClickLabel = stringResource(R.string.circuit_display_learn_more_a11y),
|
|
|
153
|
+ ),
|
|
|
154
|
+ )
|
|
|
155
|
+}
|
|
|
156
|
+
|
|
|
157
|
+@Composable
|
|
|
158
|
+private fun ColumnScope.NewCircuitButton(onNewCircuitClick: () -> Unit) {
|
|
|
159
|
+ TextButton(
|
|
|
160
|
+ text = stringResource(R.string.protection_panel_new_circuit_for_this_site),
|
|
|
161
|
+ onClick = onNewCircuitClick,
|
|
|
162
|
+ modifier =
|
|
|
163
|
+ Modifier.border(
|
|
|
164
|
+ width = 1.dp,
|
|
|
165
|
+ color = PhotonColors.LightGrey80,
|
|
|
166
|
+ shape = RoundedCornerShape(size = 100.dp),
|
|
|
167
|
+ )
|
|
|
168
|
+ .fillMaxWidth(.9f)
|
|
|
169
|
+ .align(Alignment.CenterHorizontally),
|
|
|
170
|
+ )
|
|
|
171
|
+}
|
|
|
172
|
+
|
|
|
173
|
+@Composable
|
|
|
174
|
+private fun CircuitList(
|
|
|
175
|
+ circuitsInfo: Circuits?,
|
|
|
176
|
+ websiteUrl: String,
|
|
|
177
|
+ paddingValues: PaddingValues =
|
|
|
178
|
+ PaddingValues(
|
|
|
179
|
+ horizontal = FirefoxTheme.layout.space.dynamic200 - 2.dp,
|
|
|
180
|
+ vertical = 0.dp,
|
|
|
181
|
+ ),
|
|
|
182
|
+) {
|
|
|
183
|
+ Spacer(Modifier.size(6.dp))
|
|
|
184
|
+ if (circuitsInfo?.first == null && circuitsInfo?.second == null) {
|
|
|
185
|
+ return
|
|
|
186
|
+ }
|
|
|
187
|
+ Column(
|
|
|
188
|
+ modifier = Modifier.padding(paddingValues = paddingValues),
|
|
|
189
|
+ ) {
|
|
|
190
|
+ val headlineTextStyle =
|
|
|
191
|
+ TextStyle(
|
|
|
192
|
+ fontSize = 16.sp,
|
|
|
193
|
+ lineHeight = 20.sp,
|
|
|
194
|
+ fontWeight = FontWeight(400),
|
|
|
195
|
+ color = PhotonColors.LightGrey05,
|
|
|
196
|
+ letterSpacing = 0.5.sp,
|
|
|
197
|
+ )
|
|
|
198
|
+
|
|
|
199
|
+ val descriptionTextStyle =
|
|
|
200
|
+ TextStyle(
|
|
|
201
|
+ fontSize = 16.sp,
|
|
|
202
|
+ lineHeight = 24.sp,
|
|
|
203
|
+ fontWeight = FontWeight(400),
|
|
|
204
|
+ color = PhotonColors.LightGrey40,
|
|
|
205
|
+ letterSpacing = 0.5.sp,
|
|
|
206
|
+ )
|
|
|
207
|
+
|
|
|
208
|
+ CircuitNode(
|
|
|
209
|
+ headLine = stringResource(R.string.this_browser),
|
|
|
210
|
+ headlineTextStyle = headlineTextStyle,
|
|
|
211
|
+ firstNode = true,
|
|
|
212
|
+ )
|
|
|
213
|
+
|
|
|
214
|
+ if (circuitsInfo.multipleEntryNodes()) {
|
|
|
215
|
+ HopDiverging()
|
|
|
216
|
+ }
|
|
|
217
|
+
|
|
|
218
|
+ val entryRelayTitle: String =
|
|
|
219
|
+ if (circuitsInfo.first?.entryRelay?.isBridge == true || circuitsInfo.second?.entryRelay?.isBridge == true) {
|
|
|
220
|
+ stringResource(R.string.entry_relay_bridge)
|
|
|
221
|
+ } else {
|
|
|
222
|
+ stringResource(R.string.entry_relay_guard)
|
|
|
223
|
+ }
|
|
|
224
|
+ CircuitNode(
|
|
|
225
|
+ headLine = entryRelayTitle,
|
|
|
226
|
+ headlineTextStyle = headlineTextStyle,
|
|
|
227
|
+ description = stringResource(R.string.your_entrance_to_the_tor_network),
|
|
|
228
|
+ descriptionTextStyle = descriptionTextStyle,
|
|
|
229
|
+ relayInfo = circuitsInfo.getEntryRelayInfo(),
|
|
|
230
|
+ onClick = { /* TODO Navigate to Entry relays info screen */ },
|
|
|
231
|
+ )
|
|
|
232
|
+ if (circuitsInfo.multipleEntryNodes() && !circuitsInfo.multipleMiddleNodes()) {
|
|
|
233
|
+ HopConverging()
|
|
|
234
|
+ } else if (!circuitsInfo.multipleEntryNodes() && circuitsInfo.multipleMiddleNodes()) {
|
|
|
235
|
+ HopDiverging()
|
|
|
236
|
+ }
|
|
|
237
|
+ CircuitNode(
|
|
|
238
|
+ headLine = stringResource(R.string.middle_relay),
|
|
|
239
|
+ headlineTextStyle = headlineTextStyle,
|
|
|
240
|
+ description = stringResource(R.string.adds_an_extra_layer_of_privacy),
|
|
|
241
|
+ descriptionTextStyle = descriptionTextStyle,
|
|
|
242
|
+ relayInfo = circuitsInfo.getMiddleRelayInfo(),
|
|
|
243
|
+ onClick = { /* TODO Navigate to middle relays info screen */ },
|
|
|
244
|
+ )
|
|
|
245
|
+ if (circuitsInfo.multipleMiddleNodes()) {
|
|
|
246
|
+ HopConverging()
|
|
|
247
|
+ }
|
|
|
248
|
+ val exitRelayTitle: String =
|
|
|
249
|
+ if (websiteUrl.isOnionUrl()) {
|
|
|
250
|
+ stringResource(R.string.rendezvous_point)
|
|
|
251
|
+ } else {
|
|
|
252
|
+ stringResource(R.string.exit_relay)
|
|
|
253
|
+ }
|
|
|
254
|
+ val exitRelayDescription: String =
|
|
|
255
|
+ if (websiteUrl.isOnionUrl()) {
|
|
|
256
|
+ stringResource(R.string.rendezvous_point_description)
|
|
|
257
|
+ } else {
|
|
|
258
|
+ stringResource(R.string.how_you_appear_on_the_internet)
|
|
|
259
|
+ }
|
|
|
260
|
+ CircuitNode(
|
|
|
261
|
+ headLine = exitRelayTitle,
|
|
|
262
|
+ headlineTextStyle = headlineTextStyle,
|
|
|
263
|
+ description = exitRelayDescription,
|
|
|
264
|
+ descriptionTextStyle = descriptionTextStyle,
|
|
|
265
|
+ relayInfo = Pair(circuitsInfo.getExitRelayInfo(), null), // There is only ever one exit relay
|
|
|
266
|
+ onClick = { /* TODO Navigate to exit relay info screen */ },
|
|
|
267
|
+ )
|
|
|
268
|
+
|
|
|
269
|
+ if (websiteUrl.isOnionUrl()) {
|
|
|
270
|
+ Column {
|
|
|
271
|
+ Row {
|
|
|
272
|
+ Image(
|
|
|
273
|
+ modifier = Modifier.padding(vertical = 4.dp, horizontal = 6.dp),
|
|
|
274
|
+ painter = painterResource(R.drawable.dots),
|
|
|
275
|
+ contentDescription = null,
|
|
|
276
|
+ )
|
|
|
277
|
+ Spacer(Modifier.size(15.dp))
|
|
|
278
|
+ Text(
|
|
|
279
|
+ text = stringResource(R.string.onion_site_relays),
|
|
|
280
|
+ style = headlineTextStyle,
|
|
|
281
|
+ modifier = Modifier.align(Alignment.CenterVertically),
|
|
|
282
|
+ )
|
|
|
283
|
+ }
|
|
|
284
|
+ VerticalCircuitLine(modifier = Modifier.height(height = 13.dp))
|
|
|
285
|
+ }
|
|
|
286
|
+ }
|
|
|
287
|
+
|
|
|
288
|
+ val websiteDescription: String? =
|
|
|
289
|
+ if (websiteUrl.isOnionUrl()) {
|
|
|
290
|
+ stringResource(R.string.some_parts_of_this_site_may_use_a_different_circuit)
|
|
|
291
|
+ } else null
|
|
|
292
|
+ CircuitNode(
|
|
|
293
|
+ headLine = websiteUrl,
|
|
|
294
|
+ headlineTextStyle = headlineTextStyle,
|
|
|
295
|
+ lastNode = true,
|
|
|
296
|
+ description = websiteDescription,
|
|
|
297
|
+ descriptionTextStyle =
|
|
|
298
|
+ TextStyle(
|
|
|
299
|
+ fontSize = 12.sp,
|
|
|
300
|
+ lineHeight = 16.sp,
|
|
|
301
|
+ fontWeight = FontWeight(400),
|
|
|
302
|
+ color = PhotonColors.LightGrey40,
|
|
|
303
|
+ letterSpacing = 0.4.sp,
|
|
|
304
|
+ ),
|
|
|
305
|
+ )
|
|
|
306
|
+ Spacer(Modifier.size(22.dp))
|
|
|
307
|
+ }
|
|
|
308
|
+}
|
|
|
309
|
+
|
|
|
310
|
+@Composable
|
|
|
311
|
+private fun VerticalCircuitLine(
|
|
|
312
|
+ modifier: Modifier = Modifier,
|
|
|
313
|
+ color: Color = PhotonColors.Violet10,
|
|
|
314
|
+ verticalExtensionUp: Dp = 0.dp,
|
|
|
315
|
+ verticalExtensionDown: Dp = 0.dp,
|
|
|
316
|
+) {
|
|
|
317
|
+ Canvas(
|
|
|
318
|
+ modifier = modifier.width(16.dp).height(IntrinsicSize.Max),
|
|
|
319
|
+ ) {
|
|
|
320
|
+ val lineSize = Size(2.dp.toPx(), size.height + verticalExtensionUp.toPx() + verticalExtensionDown.toPx())
|
|
|
321
|
+ drawRect(
|
|
|
322
|
+ color = color,
|
|
|
323
|
+ size = lineSize,
|
|
|
324
|
+ topLeft =
|
|
|
325
|
+ Offset(
|
|
|
326
|
+ center.x - (lineSize.width / 2),
|
|
|
327
|
+ 0f - verticalExtensionUp.toPx() + verticalExtensionDown.toPx(),
|
|
|
328
|
+ ),
|
|
|
329
|
+ )
|
|
|
330
|
+ }
|
|
|
331
|
+}
|
|
|
332
|
+
|
|
|
333
|
+@Composable
|
|
|
334
|
+private fun HopConverging() {
|
|
|
335
|
+ HopDiverging(modifier = Modifier.scale(scaleX = 1f, scaleY = -1f))
|
|
|
336
|
+}
|
|
|
337
|
+
|
|
|
338
|
+@Composable
|
|
|
339
|
+private fun HopDiverging(
|
|
|
340
|
+ modifier: Modifier = Modifier,
|
|
|
341
|
+ color: Color = PhotonColors.Violet10,
|
|
|
342
|
+) {
|
|
|
343
|
+ Canvas(
|
|
|
344
|
+ modifier = modifier.width(32.dp).height(13.dp),
|
|
|
345
|
+ ) {
|
|
|
346
|
+ // In order to fine tune the display and not have gaps between lines, many of these values are set to be
|
|
|
347
|
+ // slightly higher or lower in order to fine tune them and make them fit together
|
|
|
348
|
+ drawRect(
|
|
|
349
|
+ color = color,
|
|
|
350
|
+ topLeft = Offset(x = 7.dp.toPx(), y = 0f),
|
|
|
351
|
+ size = Size(width = 2.dp.toPx(), height = 13.3.dp.toPx()),
|
|
|
352
|
+ )
|
|
|
353
|
+ drawRect(
|
|
|
354
|
+ color = color,
|
|
|
355
|
+ topLeft = Offset(8.8.dp.toPx(), 7.dp.toPx()),
|
|
|
356
|
+ size = Size(width = 18.5.dp.toPx(), height = 2.dp.toPx()),
|
|
|
357
|
+ )
|
|
|
358
|
+ drawArc(
|
|
|
359
|
+ color = color,
|
|
|
360
|
+ startAngle = -90f,
|
|
|
361
|
+ useCenter = true,
|
|
|
362
|
+ sweepAngle = 90f,
|
|
|
363
|
+ size = Size(width = 4.dp.toPx(), 4.dp.toPx()),
|
|
|
364
|
+ topLeft = Offset(x = 25.dp.toPx(), y = 7.dp.toPx()),
|
|
|
365
|
+ )
|
|
|
366
|
+ drawRect(
|
|
|
367
|
+ color = color,
|
|
|
368
|
+ topLeft = Offset(27.dp.toPx(), 8.85.dp.toPx()),
|
|
|
369
|
+ size = Size(width = 2.dp.toPx(), height = 4.44.dp.toPx()),
|
|
|
370
|
+ )
|
|
|
371
|
+ }
|
|
|
372
|
+}
|
|
|
373
|
+
|
|
|
374
|
+/**
|
|
|
375
|
+ * @param painter painter for the associated node. This could be a pink circle (like for the first or last nodes), a
|
|
|
376
|
+ * region flag, a bridge icon, or anything that should be displayed at a specific node
|
|
|
377
|
+ * @param description The description for the painter. This is primarily used for accessibility
|
|
|
378
|
+ */
|
|
|
379
|
+data class CircuitIcon(val painter: Painter, val description: String?)
|
|
|
380
|
+
|
|
|
381
|
+@Composable
|
|
|
382
|
+fun resolveIcon(relay: Relay?): CircuitIcon {
|
|
|
383
|
+ if (relay == null) {
|
|
|
384
|
+ return CircuitIcon(
|
|
|
385
|
+ painterResource(R.drawable.circuit_circle),
|
|
|
386
|
+ null,
|
|
|
387
|
+ ) // Used for first and last nodes. ("This browser" and the website, not the entry and exit nodes)
|
|
|
388
|
+ }
|
|
|
389
|
+ if (relay.isBridge) {
|
|
|
390
|
+ return CircuitIcon(
|
|
|
391
|
+ painterResource(R.drawable.bridge_acorn),
|
|
|
392
|
+ description = stringResource(R.string.bridge_icon_a11y),
|
|
|
393
|
+ )
|
|
|
394
|
+ }
|
|
|
395
|
+
|
|
|
396
|
+ return when (relay.regionCode) {
|
|
|
397
|
+ // Until we have GeoIP files, we will always need to use the fallback tb#45463
|
|
|
398
|
+ else ->
|
|
|
399
|
+ CircuitIcon(
|
|
|
400
|
+ painterResource(mozilla.components.ui.icons.R.drawable.mozac_ic_globe_16),
|
|
|
401
|
+ null,
|
|
|
402
|
+ ) // fallback for when region not found
|
|
|
403
|
+ }
|
|
|
404
|
+}
|
|
|
405
|
+
|
|
|
406
|
+@Composable
|
|
|
407
|
+private fun CircuitNode(
|
|
|
408
|
+ headLine: String,
|
|
|
409
|
+ headlineTextStyle: TextStyle,
|
|
|
410
|
+ description: String? = null,
|
|
|
411
|
+ descriptionTextStyle: TextStyle? = null,
|
|
|
412
|
+ relayInfo: Pair<Relay?, Relay?>? = null,
|
|
|
413
|
+ firstNode: Boolean = false,
|
|
|
414
|
+ lastNode: Boolean = false,
|
|
|
415
|
+ onClick: () -> Unit = {},
|
|
|
416
|
+) {
|
|
|
417
|
+ Row(
|
|
|
418
|
+ modifier = Modifier.height(IntrinsicSize.Max).fillMaxWidth(),
|
|
|
419
|
+ ) {
|
|
|
420
|
+ PainterLine(resolveIcon(relayInfo?.first), firstNode = firstNode, lastNode = lastNode)
|
|
|
421
|
+ Spacer(Modifier.size(4.dp))
|
|
|
422
|
+ relayInfo?.second?.let {
|
|
|
423
|
+ if (relayInfo.first != relayInfo.second)
|
|
|
424
|
+ PainterLine(resolveIcon(relayInfo.second), firstNode = firstNode, lastNode = lastNode)
|
|
|
425
|
+ }
|
|
|
426
|
+
|
|
|
427
|
+ Spacer(Modifier.size(12.dp))
|
|
|
428
|
+ Column(modifier = Modifier.weight(1f, fill = true)) {
|
|
|
429
|
+ Spacer(Modifier.size(4.dp))
|
|
|
430
|
+ Text(
|
|
|
431
|
+ text = headLine,
|
|
|
432
|
+ style = headlineTextStyle,
|
|
|
433
|
+ maxLines = if (lastNode) 1 else 2,
|
|
|
434
|
+ overflow = TextOverflow.MiddleEllipsis,
|
|
|
435
|
+ )
|
|
|
436
|
+ if (description != null && descriptionTextStyle != null) {
|
|
|
437
|
+ Text(
|
|
|
438
|
+ text = description,
|
|
|
439
|
+ style = descriptionTextStyle,
|
|
|
440
|
+ )
|
|
|
441
|
+ // Stop showing the IP addresses here once we have GeoIP tb#45463
|
|
|
442
|
+ if (relayInfo?.first != null && relayInfo.first?.regionCode.isNullOrBlank()) {
|
|
|
443
|
+ Spacer(Modifier.size(6.dp))
|
|
|
444
|
+ Text(
|
|
|
445
|
+ text = relayInfo.first?.ipAddresses.toString(),
|
|
|
446
|
+ style = descriptionTextStyle,
|
|
|
447
|
+ maxLines = 1,
|
|
|
448
|
+ overflow = TextOverflow.MiddleEllipsis,
|
|
|
449
|
+ )
|
|
|
450
|
+ }
|
|
|
451
|
+ if (relayInfo?.second != null && relayInfo.second?.regionCode.isNullOrBlank() && relayInfo.first != relayInfo.second) {
|
|
|
452
|
+ Spacer(Modifier.size(6.dp))
|
|
|
453
|
+ Text(
|
|
|
454
|
+ text = relayInfo.second!!.ipAddresses.toString(),
|
|
|
455
|
+ style = descriptionTextStyle,
|
|
|
456
|
+ maxLines = 1,
|
|
|
457
|
+ overflow = TextOverflow.MiddleEllipsis,
|
|
|
458
|
+ )
|
|
|
459
|
+ }
|
|
|
460
|
+ }
|
|
|
461
|
+ if (!lastNode) {
|
|
|
462
|
+ Spacer(Modifier.size(12.dp))
|
|
|
463
|
+ }
|
|
|
464
|
+ }
|
|
|
465
|
+ if (relayInfo != null) {
|
|
|
466
|
+ Image(
|
|
|
467
|
+ modifier = Modifier.align(Alignment.CenterVertically),
|
|
|
468
|
+ painter = painterResource(mozilla.components.ui.icons.R.drawable.mozac_ic_chevron_right_24),
|
|
|
469
|
+ contentDescription = null,
|
|
|
470
|
+ )
|
|
|
471
|
+ }
|
|
|
472
|
+ }
|
|
|
473
|
+}
|
|
|
474
|
+
|
|
|
475
|
+@Composable
|
|
|
476
|
+private fun PainterLine(
|
|
|
477
|
+ circuitIcon: CircuitIcon,
|
|
|
478
|
+ firstNode: Boolean,
|
|
|
479
|
+ lastNode: Boolean,
|
|
|
480
|
+) {
|
|
|
481
|
+ Column(Modifier.width(16.dp)) {
|
|
|
482
|
+ if (!firstNode) {
|
|
|
483
|
+ VerticalCircuitLine(
|
|
|
484
|
+ modifier = Modifier.height(4.dp).align(Alignment.CenterHorizontally),
|
|
|
485
|
+ verticalExtensionUp = .1.dp,
|
|
|
486
|
+ verticalExtensionDown = .1.dp,
|
|
|
487
|
+ )
|
|
|
488
|
+ }
|
|
|
489
|
+ Image(
|
|
|
490
|
+ painter = circuitIcon.painter,
|
|
|
491
|
+ contentDescription = circuitIcon.description,
|
|
|
492
|
+ modifier = Modifier.align(Alignment.CenterHorizontally),
|
|
|
493
|
+ )
|
|
|
494
|
+ if (!lastNode) {
|
|
|
495
|
+ VerticalCircuitLine(
|
|
|
496
|
+ modifier = Modifier.fillMaxHeight(),
|
|
|
497
|
+ verticalExtensionUp = .4.dp,
|
|
|
498
|
+ verticalExtensionDown = 0.1.dp,
|
|
|
499
|
+ )
|
|
|
500
|
+ }
|
|
|
501
|
+ }
|
|
|
502
|
+}
|
|
|
503
|
+
|
|
|
504
|
+@Preview
|
|
|
505
|
+@Composable
|
|
|
506
|
+fun CircuitDisplayPreview(
|
|
|
507
|
+ @PreviewParameter(CircuitDisplayPreviewParameter::class) circuitsInfo: Pair<Circuits, String>,
|
|
|
508
|
+) {
|
|
|
509
|
+ FirefoxTheme(theme = Theme.Private) {
|
|
|
510
|
+ CircuitDisplay(
|
|
|
511
|
+ modifier = Modifier.background(color = MaterialTheme.colorScheme.surfaceBright),
|
|
|
512
|
+ circuitsInfo = circuitsInfo.first,
|
|
|
513
|
+ websiteUrl = circuitsInfo.second,
|
|
|
514
|
+ onNewCircuitClick = {},
|
|
|
515
|
+ )
|
|
|
516
|
+ }
|
|
|
517
|
+} |
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/trustpanel/ui/CircuitDisplayPreviewParameter.kt
|
|
1
|
+package org.mozilla.fenix.settings.trustpanel.ui
|
|
|
2
|
+
|
|
|
3
|
+import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
|
|
4
|
+import org.json.JSONArray
|
|
|
5
|
+
|
|
|
6
|
+class CircuitDisplayPreviewParameter : PreviewParameterProvider<Pair<Circuits, String>?> {
|
|
|
7
|
+ override val values: Sequence<Pair<Circuits, String>?>
|
|
|
8
|
+ get() =
|
|
|
9
|
+ sequenceOf(
|
|
|
10
|
+ Pair(exampleSinglePathCircuit, "https://www.torproject.org/"),
|
|
|
11
|
+ Pair(exampleMultiPathCircuit, "https://www.torproject.org/"),
|
|
|
12
|
+ Pair(exampleOnionSinglePathCircuit, "http://2gzyxa5ihm7nsggfxnu52rck2vv4rvmdlkiu3zzui5du4xyclen53wid.onion/index.html"),
|
|
|
13
|
+ Pair(exampleOnionMultiPathCircuit, "http://2gzyxa5ihm7nsggfxnu52rck2vv4rvmdlkiu3zzui5du4xyclen53wid.onion/index.html"),
|
|
|
14
|
+ Pair(exampleBridgeSinglePathCircuit, "https://www.torproject.org/"),
|
|
|
15
|
+ Pair(exampleBridgeMultiPathCircuit, "https://www.torproject.org/"),
|
|
|
16
|
+ Pair(exampleSingleBridgeMultiPathCircuit, "https://www.torproject.org/"),
|
|
|
17
|
+ Pair(exampleNoPathCircuit, "https://www.torproject.org/"),
|
|
|
18
|
+ )
|
|
|
19
|
+
|
|
|
20
|
+
|
|
|
21
|
+ val exampleSinglePathCircuit =
|
|
|
22
|
+ Circuits(
|
|
|
23
|
+ JSONArray(
|
|
|
24
|
+ """
|
|
|
25
|
+ [
|
|
|
26
|
+ [
|
|
|
27
|
+ {
|
|
|
28
|
+ "fingerprint": "62F30D00BE3F05376AEF2D9B985975D1223D26CE",
|
|
|
29
|
+ "ipAddrs": [
|
|
|
30
|
+ "64.65.0.34"
|
|
|
31
|
+ ],
|
|
|
32
|
+ "isBridge": false,
|
|
|
33
|
+ "bridgeType": "",
|
|
|
34
|
+ "regionCode": ""
|
|
|
35
|
+ },
|
|
|
36
|
+ {
|
|
|
37
|
+ "fingerprint": "E4E10A813E71AAECC9A860FBD4BD84D2F348281D",
|
|
|
38
|
+ "ipAddrs": [
|
|
|
39
|
+ "45.137.70.43",
|
|
|
40
|
+ "2a0e:97c0:3ea:118::1"
|
|
|
41
|
+ ],
|
|
|
42
|
+ "isBridge": false,
|
|
|
43
|
+ "bridgeType": "",
|
|
|
44
|
+ "regionCode": ""
|
|
|
45
|
+ },
|
|
|
46
|
+ {
|
|
|
47
|
+ "fingerprint": "D00795330D77C75344C54FB8800531FAB3C40FBE",
|
|
|
48
|
+ "ipAddrs": [
|
|
|
49
|
+ "104.244.77.208",
|
|
|
50
|
+ "2605:6400:30:f503::1"
|
|
|
51
|
+ ],
|
|
|
52
|
+ "isBridge": false,
|
|
|
53
|
+ "bridgeType": "",
|
|
|
54
|
+ "regionCode": ""
|
|
|
55
|
+ }
|
|
|
56
|
+ ]
|
|
|
57
|
+ ]
|
|
|
58
|
+ """
|
|
|
59
|
+ .trimIndent(),
|
|
|
60
|
+ ),
|
|
|
61
|
+ )
|
|
|
62
|
+
|
|
|
63
|
+ val exampleMultiPathCircuit =
|
|
|
64
|
+ Circuits(
|
|
|
65
|
+ JSONArray(
|
|
|
66
|
+ """
|
|
|
67
|
+ [
|
|
|
68
|
+ [
|
|
|
69
|
+ {
|
|
|
70
|
+ "fingerprint": "ECB6A3F781A8B9612C4E3EF5F5AFC56E2D5D122D",
|
|
|
71
|
+ "ipAddrs": [
|
|
|
72
|
+ "45.14.135.183"
|
|
|
73
|
+ ],
|
|
|
74
|
+ "isBridge": false,
|
|
|
75
|
+ "bridgeType": "",
|
|
|
76
|
+ "regionCode": ""
|
|
|
77
|
+ },
|
|
|
78
|
+ {
|
|
|
79
|
+ "fingerprint": "D9FC4DD78454FB6735FD080EB91837239432D8F0",
|
|
|
80
|
+ "ipAddrs": [
|
|
|
81
|
+ "141.227.165.150",
|
|
|
82
|
+ "2001:41d0:ab0a:0:f816:3eff:fea2:ff68"
|
|
|
83
|
+ ],
|
|
|
84
|
+ "isBridge": false,
|
|
|
85
|
+ "bridgeType": "",
|
|
|
86
|
+ "regionCode": ""
|
|
|
87
|
+ },
|
|
|
88
|
+ {
|
|
|
89
|
+ "fingerprint": "0D39909B37AAC2BC742305EE72DF1F0FD187D4EE",
|
|
|
90
|
+ "ipAddrs": [
|
|
|
91
|
+ "185.220.101.30",
|
|
|
92
|
+ "2a0b:f4c2::30"
|
|
|
93
|
+ ],
|
|
|
94
|
+ "isBridge": false,
|
|
|
95
|
+ "bridgeType": "",
|
|
|
96
|
+ "regionCode": ""
|
|
|
97
|
+ }
|
|
|
98
|
+ ],
|
|
|
99
|
+ [
|
|
|
100
|
+ {
|
|
|
101
|
+ "fingerprint": "62F30D00BE3F05376AEF2D9B985975D1223D26CE",
|
|
|
102
|
+ "ipAddrs": [
|
|
|
103
|
+ "64.65.0.34"
|
|
|
104
|
+ ],
|
|
|
105
|
+ "isBridge": false,
|
|
|
106
|
+ "bridgeType": "",
|
|
|
107
|
+ "regionCode": ""
|
|
|
108
|
+ },
|
|
|
109
|
+ {
|
|
|
110
|
+ "fingerprint": "79F94E439498B4FDA5EBDCC99749F1DA3F6F86BB",
|
|
|
111
|
+ "ipAddrs": [
|
|
|
112
|
+ "213.239.213.220",
|
|
|
113
|
+ "2a01:4f8:a0:8070::2"
|
|
|
114
|
+ ],
|
|
|
115
|
+ "isBridge": false,
|
|
|
116
|
+ "bridgeType": "",
|
|
|
117
|
+ "regionCode": ""
|
|
|
118
|
+ },
|
|
|
119
|
+ {
|
|
|
120
|
+ "fingerprint": "0D39909B37AAC2BC742305EE72DF1F0FD187D4EE",
|
|
|
121
|
+ "ipAddrs": [
|
|
|
122
|
+ "185.220.101.30",
|
|
|
123
|
+ "2a0b:f4c2::30"
|
|
|
124
|
+ ],
|
|
|
125
|
+ "isBridge": false,
|
|
|
126
|
+ "bridgeType": "",
|
|
|
127
|
+ "regionCode": ""
|
|
|
128
|
+ }
|
|
|
129
|
+ ]
|
|
|
130
|
+ ]
|
|
|
131
|
+ """
|
|
|
132
|
+ .trimIndent(),
|
|
|
133
|
+ ),
|
|
|
134
|
+ )
|
|
|
135
|
+
|
|
|
136
|
+ val exampleOnionSinglePathCircuit =
|
|
|
137
|
+ Circuits(
|
|
|
138
|
+ JSONArray(
|
|
|
139
|
+ """
|
|
|
140
|
+ [
|
|
|
141
|
+ [
|
|
|
142
|
+ {
|
|
|
143
|
+ "fingerprint": "ECB6A3F781A8B9612C4E3EF5F5AFC56E2D5D122D",
|
|
|
144
|
+ "ipAddrs": [
|
|
|
145
|
+ "45.14.135.183"
|
|
|
146
|
+ ],
|
|
|
147
|
+ "isBridge": false,
|
|
|
148
|
+ "bridgeType": "",
|
|
|
149
|
+ "regionCode": ""
|
|
|
150
|
+ },
|
|
|
151
|
+ {
|
|
|
152
|
+ "fingerprint": "EF2C4BA7F7D3499FD042A0DB5E824F21429FF6CF",
|
|
|
153
|
+ "ipAddrs": [
|
|
|
154
|
+ "46.4.96.24",
|
|
|
155
|
+ "2a01:4f8:140:8229::2"
|
|
|
156
|
+ ],
|
|
|
157
|
+ "isBridge": false,
|
|
|
158
|
+ "bridgeType": "",
|
|
|
159
|
+ "regionCode": ""
|
|
|
160
|
+ },
|
|
|
161
|
+ {
|
|
|
162
|
+ "fingerprint": "74536B5436549D77EB9A148E19E4BB6F8285D5E8",
|
|
|
163
|
+ "ipAddrs": [
|
|
|
164
|
+ "193.108.53.121"
|
|
|
165
|
+ ],
|
|
|
166
|
+ "isBridge": false,
|
|
|
167
|
+ "bridgeType": "",
|
|
|
168
|
+ "regionCode": ""
|
|
|
169
|
+ }
|
|
|
170
|
+ ]
|
|
|
171
|
+ ]
|
|
|
172
|
+ """
|
|
|
173
|
+ .trimIndent(),
|
|
|
174
|
+ ),
|
|
|
175
|
+ )
|
|
|
176
|
+
|
|
|
177
|
+ val exampleOnionMultiPathCircuit =
|
|
|
178
|
+ Circuits(
|
|
|
179
|
+ JSONArray(
|
|
|
180
|
+ """
|
|
|
181
|
+ [
|
|
|
182
|
+ [
|
|
|
183
|
+ {
|
|
|
184
|
+ "fingerprint": "1499D3B81B967C47F18AAC9C1C59576E8CF4F01D",
|
|
|
185
|
+ "ipAddrs": [
|
|
|
186
|
+ "87.106.135.148",
|
|
|
187
|
+ "2a01:239:319:100::1"
|
|
|
188
|
+ ],
|
|
|
189
|
+ "isBridge": false,
|
|
|
190
|
+ "bridgeType": "",
|
|
|
191
|
+ "regionCode": ""
|
|
|
192
|
+ },
|
|
|
193
|
+ {
|
|
|
194
|
+ "fingerprint": "CEB8E1650F4DC408F8178EAE4D0D0238BC4CCE43",
|
|
|
195
|
+ "ipAddrs": [
|
|
|
196
|
+ "188.165.0.43"
|
|
|
197
|
+ ],
|
|
|
198
|
+ "isBridge": false,
|
|
|
199
|
+ "bridgeType": "",
|
|
|
200
|
+ "regionCode": ""
|
|
|
201
|
+ },
|
|
|
202
|
+ {
|
|
|
203
|
+ "fingerprint": "76F8A367B368ACE147A81E5F976A29647F1CA6BF",
|
|
|
204
|
+ "ipAddrs": [
|
|
|
205
|
+ "192.42.116.44",
|
|
|
206
|
+ "2001:67c:e60:c0c:192:42:116:44"
|
|
|
207
|
+ ],
|
|
|
208
|
+ "isBridge": false,
|
|
|
209
|
+ "bridgeType": "",
|
|
|
210
|
+ "regionCode": ""
|
|
|
211
|
+ }
|
|
|
212
|
+ ],
|
|
|
213
|
+ [
|
|
|
214
|
+ {
|
|
|
215
|
+ "fingerprint": "C3F7F3E1E32A64B22B2F0734E7C7A312F993D102",
|
|
|
216
|
+ "ipAddrs": [
|
|
|
217
|
+ "65.108.72.156",
|
|
|
218
|
+ "2a01:4f9:6b:48a3::1"
|
|
|
219
|
+ ],
|
|
|
220
|
+ "isBridge": false,
|
|
|
221
|
+ "bridgeType": "",
|
|
|
222
|
+ "regionCode": ""
|
|
|
223
|
+ },
|
|
|
224
|
+ {
|
|
|
225
|
+ "fingerprint": "BCB41A4BAE884CF70CD3117CBC824A8AA6B23019",
|
|
|
226
|
+ "ipAddrs": [
|
|
|
227
|
+ "79.117.124.115"
|
|
|
228
|
+ ],
|
|
|
229
|
+ "isBridge": false,
|
|
|
230
|
+ "bridgeType": "",
|
|
|
231
|
+ "regionCode": ""
|
|
|
232
|
+ },
|
|
|
233
|
+ {
|
|
|
234
|
+ "fingerprint": "76F8A367B368ACE147A81E5F976A29647F1CA6BF",
|
|
|
235
|
+ "ipAddrs": [
|
|
|
236
|
+ "192.42.116.44",
|
|
|
237
|
+ "2001:67c:e60:c0c:192:42:116:44"
|
|
|
238
|
+ ],
|
|
|
239
|
+ "isBridge": false,
|
|
|
240
|
+ "bridgeType": "",
|
|
|
241
|
+ "regionCode": ""
|
|
|
242
|
+ }
|
|
|
243
|
+ ]
|
|
|
244
|
+ ]
|
|
|
245
|
+ """
|
|
|
246
|
+ .trimIndent(),
|
|
|
247
|
+ ),
|
|
|
248
|
+ )
|
|
|
249
|
+
|
|
|
250
|
+ val exampleBridgeSinglePathCircuit =
|
|
|
251
|
+ Circuits(
|
|
|
252
|
+ JSONArray(
|
|
|
253
|
+ // Removed bridge IP address and fingerprint
|
|
|
254
|
+ """
|
|
|
255
|
+ [
|
|
|
256
|
+ [
|
|
|
257
|
+ {
|
|
|
258
|
+ "fingerprint": "0",
|
|
|
259
|
+ "ipAddrs": [
|
|
|
260
|
+ "0.0.0.0"
|
|
|
261
|
+ ],
|
|
|
262
|
+ "isBridge": true,
|
|
|
263
|
+ "bridgeType": "obfs4",
|
|
|
264
|
+ "regionCode": ""
|
|
|
265
|
+ },
|
|
|
266
|
+ {
|
|
|
267
|
+ "fingerprint": "EAF1AAB8EE4B8FD72819188E8C6D36BE8CB62FC3",
|
|
|
268
|
+ "ipAddrs": [
|
|
|
269
|
+ "51.75.140.138"
|
|
|
270
|
+ ],
|
|
|
271
|
+ "isBridge": false,
|
|
|
272
|
+ "bridgeType": "",
|
|
|
273
|
+ "regionCode": ""
|
|
|
274
|
+ },
|
|
|
275
|
+ {
|
|
|
276
|
+ "fingerprint": "2D2A8756BCC7619CF9586902F1610D2D40D6746A",
|
|
|
277
|
+ "ipAddrs": [
|
|
|
278
|
+ "185.220.101.17",
|
|
|
279
|
+ "2a0b:f4c2::17"
|
|
|
280
|
+ ],
|
|
|
281
|
+ "isBridge": false,
|
|
|
282
|
+ "bridgeType": "",
|
|
|
283
|
+ "regionCode": ""
|
|
|
284
|
+ }
|
|
|
285
|
+ ]
|
|
|
286
|
+ ]
|
|
|
287
|
+ """
|
|
|
288
|
+ .trimIndent(),
|
|
|
289
|
+ ),
|
|
|
290
|
+ )
|
|
|
291
|
+
|
|
|
292
|
+ val exampleBridgeMultiPathCircuit =
|
|
|
293
|
+ Circuits(
|
|
|
294
|
+ JSONArray(
|
|
|
295
|
+ // Removed bridge IP addresses and fingerprints
|
|
|
296
|
+ """
|
|
|
297
|
+ [
|
|
|
298
|
+ [
|
|
|
299
|
+ {
|
|
|
300
|
+ "fingerprint": "0",
|
|
|
301
|
+ "ipAddrs": [
|
|
|
302
|
+ "0.0.0.0"
|
|
|
303
|
+ ],
|
|
|
304
|
+ "isBridge": true,
|
|
|
305
|
+ "bridgeType": "obfs4",
|
|
|
306
|
+ "regionCode": ""
|
|
|
307
|
+ },
|
|
|
308
|
+ {
|
|
|
309
|
+ "fingerprint": "37DDF1906EE3DB96130A717EA54667C64DAC78DF",
|
|
|
310
|
+ "ipAddrs": [
|
|
|
311
|
+ "202.61.224.179",
|
|
|
312
|
+ "2a03:4000:56:c1b::1"
|
|
|
313
|
+ ],
|
|
|
314
|
+ "isBridge": false,
|
|
|
315
|
+ "bridgeType": "",
|
|
|
316
|
+ "regionCode": ""
|
|
|
317
|
+ },
|
|
|
318
|
+ {
|
|
|
319
|
+ "fingerprint": "2D1C150271D748B14DC81FD5AA7C4031548CEADB",
|
|
|
320
|
+ "ipAddrs": [
|
|
|
321
|
+ "204.8.96.100",
|
|
|
322
|
+ "2620:7:6003::e664"
|
|
|
323
|
+ ],
|
|
|
324
|
+ "isBridge": false,
|
|
|
325
|
+ "bridgeType": "",
|
|
|
326
|
+ "regionCode": ""
|
|
|
327
|
+ }
|
|
|
328
|
+ ],
|
|
|
329
|
+ [
|
|
|
330
|
+ {
|
|
|
331
|
+ "fingerprint": "0",
|
|
|
332
|
+ "ipAddrs": [
|
|
|
333
|
+ "0.0.0.1"
|
|
|
334
|
+ ],
|
|
|
335
|
+ "isBridge": true,
|
|
|
336
|
+ "bridgeType": "obfs4",
|
|
|
337
|
+ "regionCode": ""
|
|
|
338
|
+ },
|
|
|
339
|
+ {
|
|
|
340
|
+ "fingerprint": "B1F1CDE96E9DC0AB68F833C0370F7F0F43E29F70",
|
|
|
341
|
+ "ipAddrs": [
|
|
|
342
|
+ "185.220.101.135",
|
|
|
343
|
+ "2a0b:f4c2:1::135"
|
|
|
344
|
+ ],
|
|
|
345
|
+ "isBridge": false,
|
|
|
346
|
+ "bridgeType": "",
|
|
|
347
|
+ "regionCode": ""
|
|
|
348
|
+ },
|
|
|
349
|
+ {
|
|
|
350
|
+ "fingerprint": "2D1C150271D748B14DC81FD5AA7C4031548CEADB",
|
|
|
351
|
+ "ipAddrs": [
|
|
|
352
|
+ "204.8.96.100",
|
|
|
353
|
+ "2620:7:6003::e664"
|
|
|
354
|
+ ],
|
|
|
355
|
+ "isBridge": false,
|
|
|
356
|
+ "bridgeType": "",
|
|
|
357
|
+ "regionCode": ""
|
|
|
358
|
+ }
|
|
|
359
|
+ ]
|
|
|
360
|
+ ]
|
|
|
361
|
+ """
|
|
|
362
|
+ .trimIndent(),
|
|
|
363
|
+ ),
|
|
|
364
|
+ )
|
|
|
365
|
+
|
|
|
366
|
+ val exampleSingleBridgeMultiPathCircuit =
|
|
|
367
|
+ Circuits(
|
|
|
368
|
+ JSONArray(
|
|
|
369
|
+ // Removed bridge IP address and fingerprint
|
|
|
370
|
+ """
|
|
|
371
|
+ [
|
|
|
372
|
+ [
|
|
|
373
|
+ {
|
|
|
374
|
+ "fingerprint": "0",
|
|
|
375
|
+ "ipAddrs": [
|
|
|
376
|
+ "0.0.0.0"
|
|
|
377
|
+ ],
|
|
|
378
|
+ "isBridge": true,
|
|
|
379
|
+ "bridgeType": "obfs4",
|
|
|
380
|
+ "regionCode": ""
|
|
|
381
|
+ },
|
|
|
382
|
+ {
|
|
|
383
|
+ "fingerprint": "B017B46A480A155AD211CBB42AF86D98C45D9CD0",
|
|
|
384
|
+ "ipAddrs": [
|
|
|
385
|
+ "188.165.0.43"
|
|
|
386
|
+ ],
|
|
|
387
|
+ "isBridge": false,
|
|
|
388
|
+ "bridgeType": "",
|
|
|
389
|
+ "regionCode": ""
|
|
|
390
|
+ },
|
|
|
391
|
+ {
|
|
|
392
|
+ "fingerprint": "D0FC21D1139403F88F4BED8B7834EF4B2DF12D27",
|
|
|
393
|
+ "ipAddrs": [
|
|
|
394
|
+ "204.8.96.80",
|
|
|
395
|
+ "2620:7:6003::ffff:c759:e650"
|
|
|
396
|
+ ],
|
|
|
397
|
+ "isBridge": false,
|
|
|
398
|
+ "bridgeType": "",
|
|
|
399
|
+ "regionCode": ""
|
|
|
400
|
+ }
|
|
|
401
|
+ ],
|
|
|
402
|
+ [
|
|
|
403
|
+ {
|
|
|
404
|
+ "fingerprint": "0",
|
|
|
405
|
+ "ipAddrs": [
|
|
|
406
|
+ "0.0.0.0"
|
|
|
407
|
+ ],
|
|
|
408
|
+ "isBridge": true,
|
|
|
409
|
+ "bridgeType": "obfs4",
|
|
|
410
|
+ "regionCode": ""
|
|
|
411
|
+ },
|
|
|
412
|
+ {
|
|
|
413
|
+ "fingerprint": "E9463F2B9FD9AEEA170F12C99E8773106D25BE92",
|
|
|
414
|
+ "ipAddrs": [
|
|
|
415
|
+ "88.99.146.237",
|
|
|
416
|
+ "2a01:4f8:10a:2b2c::2"
|
|
|
417
|
+ ],
|
|
|
418
|
+ "isBridge": false,
|
|
|
419
|
+ "bridgeType": "",
|
|
|
420
|
+ "regionCode": ""
|
|
|
421
|
+ },
|
|
|
422
|
+ {
|
|
|
423
|
+ "fingerprint": "D0FC21D1139403F88F4BED8B7834EF4B2DF12D27",
|
|
|
424
|
+ "ipAddrs": [
|
|
|
425
|
+ "204.8.96.80",
|
|
|
426
|
+ "2620:7:6003::ffff:c759:e650"
|
|
|
427
|
+ ],
|
|
|
428
|
+ "isBridge": false,
|
|
|
429
|
+ "bridgeType": "",
|
|
|
430
|
+ "regionCode": ""
|
|
|
431
|
+ }
|
|
|
432
|
+ ]
|
|
|
433
|
+ ]
|
|
|
434
|
+ """
|
|
|
435
|
+ .trimIndent(),
|
|
|
436
|
+ ),
|
|
|
437
|
+ )
|
|
|
438
|
+
|
|
|
439
|
+ val exampleNoPathCircuit =
|
|
|
440
|
+ Circuits(
|
|
|
441
|
+ JSONArray(
|
|
|
442
|
+ "[]",
|
|
|
443
|
+ ),
|
|
|
444
|
+ )
|
|
|
445
|
+} |
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/trustpanel/ui/CircuitDisplayViewModel.kt
|
|
1
|
+package org.mozilla.fenix.settings.trustpanel.ui
|
|
|
2
|
+
|
|
|
3
|
+import android.app.Application
|
|
|
4
|
+import android.util.Log
|
|
|
5
|
+import androidx.lifecycle.AndroidViewModel
|
|
|
6
|
+import kotlinx.coroutines.flow.MutableStateFlow
|
|
|
7
|
+import mozilla.components.browser.engine.gecko.GeckoEngineSession
|
|
|
8
|
+import mozilla.components.browser.state.selector.selectedTab
|
|
|
9
|
+import mozilla.components.support.ktx.android.org.json.tryGetString
|
|
|
10
|
+import org.json.JSONArray
|
|
|
11
|
+import org.json.JSONObject
|
|
|
12
|
+import org.mozilla.fenix.ext.components
|
|
|
13
|
+import org.mozilla.geckoview.GeckoResult
|
|
|
14
|
+import org.mozilla.geckoview.TorAndroidIntegration
|
|
|
15
|
+
|
|
|
16
|
+class CircuitDisplayViewModel(application: Application) :
|
|
|
17
|
+ AndroidViewModel(application), TorAndroidIntegration.TorCircuitChangeListener {
|
|
|
18
|
+ private val components = getApplication<Application>().components
|
|
|
19
|
+ private val selectedTab = components.core.store.state.selectedTab
|
|
|
20
|
+ private val torAndroidIntegration = components.core.geckoRuntime.torIntegrationController
|
|
|
21
|
+
|
|
|
22
|
+ val circuitsStateFlow: MutableStateFlow<Circuits?> by lazy {
|
|
|
23
|
+ MutableStateFlow(null)
|
|
|
24
|
+ }
|
|
|
25
|
+
|
|
|
26
|
+ init {
|
|
|
27
|
+ torAndroidIntegration.registerTorCircuitChangeListener(this)
|
|
|
28
|
+ fetchTorCircuitData()
|
|
|
29
|
+ }
|
|
|
30
|
+
|
|
|
31
|
+ override fun onCleared() {
|
|
|
32
|
+ torAndroidIntegration.unregisterTorCircuitChangeListener(this)
|
|
|
33
|
+ }
|
|
|
34
|
+
|
|
|
35
|
+ fun fetchTorCircuitData() {
|
|
|
36
|
+ selectedTab?.let {
|
|
|
37
|
+ processCircuitData((it.engineState.engineSession as GeckoEngineSession).getTorCircuits())
|
|
|
38
|
+ }
|
|
|
39
|
+ }
|
|
|
40
|
+
|
|
|
41
|
+ fun processCircuitData(torCircuitGeckoResult: GeckoResult<JSONObject?>) {
|
|
|
42
|
+ torCircuitGeckoResult.then { circuitDataJsonObject ->
|
|
|
43
|
+ if (circuitDataJsonObject == null) {
|
|
|
44
|
+ circuitsStateFlow.value = null
|
|
|
45
|
+ Log.d("CircuitDisplayViewModel", "circuit data fetched, was null")
|
|
|
46
|
+ } else {
|
|
|
47
|
+ circuitsStateFlow.value = Circuits(circuitDataJsonObject.getJSONArray("circuits"))
|
|
|
48
|
+ Log.d("CircuitDisplayViewModel", circuitDataJsonObject.getJSONArray("circuits").toString())
|
|
|
49
|
+ }
|
|
|
50
|
+ return@then GeckoResult<Void?>()
|
|
|
51
|
+ }
|
|
|
52
|
+ }
|
|
|
53
|
+
|
|
|
54
|
+ override fun onTorCircuitChange() {
|
|
|
55
|
+ fetchTorCircuitData()
|
|
|
56
|
+ }
|
|
|
57
|
+}
|
|
|
58
|
+
|
|
|
59
|
+data class IpAddresses(val ipv4: String?, val ipv6: String?) {
|
|
|
60
|
+ constructor(
|
|
|
61
|
+ ipAddressesJsonArray: JSONArray,
|
|
|
62
|
+ ) : this(
|
|
|
63
|
+ ipv4 = if (ipAddressesJsonArray.length() > 0) ipAddressesJsonArray[0].toString() else null,
|
|
|
64
|
+ ipv6 = if (ipAddressesJsonArray.length() > 1) ipAddressesJsonArray[1].toString() else null,
|
|
|
65
|
+ )
|
|
|
66
|
+
|
|
|
67
|
+ override fun toString(): String {
|
|
|
68
|
+ return buildList {
|
|
|
69
|
+ if (!ipv4.isNullOrBlank()) add(ipv4)
|
|
|
70
|
+ if (!ipv6.isNullOrBlank()) add(ipv6)
|
|
|
71
|
+ }.joinToString()
|
|
|
72
|
+ }
|
|
|
73
|
+}
|
|
|
74
|
+
|
|
|
75
|
+data class Relay(
|
|
|
76
|
+ val fingerprint: String?,
|
|
|
77
|
+ val ipAddresses: IpAddresses,
|
|
|
78
|
+ val isBridge: Boolean,
|
|
|
79
|
+ val bridgeType: String?,
|
|
|
80
|
+ val regionCode: String?,
|
|
|
81
|
+) {
|
|
|
82
|
+ constructor(
|
|
|
83
|
+ relayJsonObject: JSONObject,
|
|
|
84
|
+ ) : this(
|
|
|
85
|
+ fingerprint = relayJsonObject.tryGetString("fingerprint"),
|
|
|
86
|
+ ipAddresses = IpAddresses(relayJsonObject.getJSONArray("ipAddrs")),
|
|
|
87
|
+ isBridge = relayJsonObject.getBoolean("isBridge"),
|
|
|
88
|
+ bridgeType = relayJsonObject.tryGetString("bridgeType"),
|
|
|
89
|
+ regionCode = relayJsonObject.tryGetString("regionCode"),
|
|
|
90
|
+ )
|
|
|
91
|
+}
|
|
|
92
|
+
|
|
|
93
|
+data class Circuit(val entryRelay: Relay, val middleRelay: Relay, val exitRelay: Relay) {
|
|
|
94
|
+ constructor(
|
|
|
95
|
+ circuitJsonArray: JSONArray,
|
|
|
96
|
+ ) : this(
|
|
|
97
|
+ entryRelay =
|
|
|
98
|
+ Relay(
|
|
|
99
|
+ circuitJsonArray.getJSONObject(0),
|
|
|
100
|
+ ),
|
|
|
101
|
+ middleRelay =
|
|
|
102
|
+ Relay(
|
|
|
103
|
+ circuitJsonArray.getJSONObject(1),
|
|
|
104
|
+ ),
|
|
|
105
|
+ exitRelay =
|
|
|
106
|
+ Relay(
|
|
|
107
|
+ circuitJsonArray.getJSONObject(2),
|
|
|
108
|
+ ),
|
|
|
109
|
+ )
|
|
|
110
|
+}
|
|
|
111
|
+
|
|
|
112
|
+data class Circuits(val first: Circuit?, val second: Circuit?) {
|
|
|
113
|
+ constructor(
|
|
|
114
|
+ circuitsJsonArray: JSONArray,
|
|
|
115
|
+ ) : this(
|
|
|
116
|
+ first = if (circuitsJsonArray.length() > 0) Circuit(circuitsJsonArray.getJSONArray(0)) else null,
|
|
|
117
|
+ second = if (circuitsJsonArray.length() > 1) Circuit(circuitsJsonArray.getJSONArray(1)) else null,
|
|
|
118
|
+ )
|
|
|
119
|
+
|
|
|
120
|
+ fun multipleEntryNodes(): Boolean {
|
|
|
121
|
+ if (this.first?.entryRelay == null || this.second?.entryRelay == null) {
|
|
|
122
|
+ return false
|
|
|
123
|
+ }
|
|
|
124
|
+ return first.entryRelay.ipAddresses != second.entryRelay.ipAddresses
|
|
|
125
|
+ }
|
|
|
126
|
+
|
|
|
127
|
+ fun multipleMiddleNodes(): Boolean {
|
|
|
128
|
+ if (this.first?.middleRelay == null || this.second?.middleRelay == null) {
|
|
|
129
|
+ return false
|
|
|
130
|
+ }
|
|
|
131
|
+ return first.middleRelay.ipAddresses != second.middleRelay.ipAddresses
|
|
|
132
|
+ }
|
|
|
133
|
+
|
|
|
134
|
+ fun getEntryRelayInfo(): Pair<Relay?, Relay?> {
|
|
|
135
|
+ return Pair(first?.entryRelay, second?.entryRelay)
|
|
|
136
|
+ }
|
|
|
137
|
+
|
|
|
138
|
+ fun getMiddleRelayInfo(): Pair<Relay?, Relay?> {
|
|
|
139
|
+ return Pair(first?.middleRelay, second?.middleRelay)
|
|
|
140
|
+ }
|
|
|
141
|
+
|
|
|
142
|
+ fun getExitRelayInfo(): Relay? {
|
|
|
143
|
+ return first?.exitRelay
|
|
|
144
|
+ }
|
|
|
145
|
+} |
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/trustpanel/ui/ProtectionPanel.kt
| ... |
... |
@@ -59,6 +59,10 @@ import org.mozilla.fenix.settings.trustpanel.store.WebsiteInfoState |
|
59
|
59
|
import org.mozilla.fenix.settings.trustpanel.store.WebsitePermission
|
|
60
|
60
|
import org.mozilla.fenix.theme.FirefoxTheme
|
|
61
|
61
|
|
|
|
62
|
+import androidx.compose.foundation.background
|
|
|
63
|
+import mozilla.components.compose.base.theme.Theme
|
|
|
64
|
+import org.json.JSONArray
|
|
|
65
|
+
|
|
62
|
66
|
private const val DROPDOWN_TEXT_WIDTH_FRACTION = 0.5f
|
|
63
|
67
|
|
|
64
|
68
|
@Suppress("LongParameterList")
|
| ... |
... |
@@ -84,6 +88,8 @@ internal fun ProtectionPanel( |
|
84
|
88
|
onViewQWACClick: () -> Unit,
|
|
85
|
89
|
onIPProtectionToggle: () -> Unit,
|
|
86
|
90
|
onIPProtectionNavigate: () -> Unit,
|
|
|
91
|
+ circuitsInfo: Circuits?,
|
|
|
92
|
+ onNewCircuitClick: () -> Unit,
|
|
87
|
93
|
onConnectionSettingsClick: () -> Unit,
|
|
88
|
94
|
) {
|
|
89
|
95
|
val isSiteProtectionEnabled = isTrackingProtectionEnabled && isGlobalTrackingProtectionEnabled
|
| ... |
... |
@@ -118,6 +124,15 @@ internal fun ProtectionPanel( |
|
118
|
124
|
onViewQWACClick = onViewQWACClick,
|
|
119
|
125
|
)
|
|
120
|
126
|
|
|
|
127
|
+ if (!isLocalPdf) {
|
|
|
128
|
+ CircuitDisplay(
|
|
|
129
|
+ modifier = Modifier.background(color = MaterialTheme.colorScheme.surfaceBright),
|
|
|
130
|
+ circuitsInfo,
|
|
|
131
|
+ websiteInfoState.websiteUrl,
|
|
|
132
|
+ onNewCircuitClick,
|
|
|
133
|
+ )
|
|
|
134
|
+ }
|
|
|
135
|
+
|
|
121
|
136
|
MenuGroup {
|
|
122
|
137
|
MenuItem(
|
|
123
|
138
|
label = stringResource(R.string.protection_panel_tor_connection_settings_title),
|
| ... |
... |
@@ -293,7 +308,11 @@ private fun WebsitePermissionsMenuGroup( |
|
293
|
308
|
onToggleablePermissionClick: (WebsitePermission.Toggleable) -> Unit,
|
|
294
|
309
|
) {
|
|
295
|
310
|
Column {
|
|
296
|
|
- Row(modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 8.dp)) {
|
|
|
311
|
+ Row(
|
|
|
312
|
+ modifier = Modifier
|
|
|
313
|
+ .fillMaxWidth()
|
|
|
314
|
+ .padding(horizontal = 16.dp, vertical = 8.dp),
|
|
|
315
|
+ ) {
|
|
297
|
316
|
Text(
|
|
298
|
317
|
text = stringResource(id = R.string.protection_panel_permissions_title),
|
|
299
|
318
|
color = MaterialTheme.colorScheme.onSurface,
|
| ... |
... |
@@ -358,8 +377,9 @@ private fun WebsitePermissionToggle( |
|
358
|
377
|
onToggleablePermissionClick: (WebsitePermission.Toggleable) -> Unit,
|
|
359
|
378
|
) {
|
|
360
|
379
|
Column(
|
|
361
|
|
- modifier =
|
|
362
|
|
- Modifier.clickable { onToggleablePermissionClick(websitePermission) }.semantics { role = Role.Switch }
|
|
|
380
|
+ modifier = Modifier
|
|
|
381
|
+ .clickable { onToggleablePermissionClick(websitePermission) }
|
|
|
382
|
+ .semantics { role = Role.Switch },
|
|
363
|
383
|
) {
|
|
364
|
384
|
Text(
|
|
365
|
385
|
text = toggleLabel,
|
| ... |
... |
@@ -390,7 +410,11 @@ private fun AutoplayDropdownMenu( |
|
390
|
410
|
)
|
|
391
|
411
|
}
|
|
392
|
412
|
|
|
393
|
|
- Column(modifier = Modifier.clickable { expanded = true }.semantics { role = Role.DropdownList }) {
|
|
|
413
|
+ Column(
|
|
|
414
|
+ modifier = Modifier
|
|
|
415
|
+ .clickable { expanded = true }
|
|
|
416
|
+ .semantics { role = Role.DropdownList },
|
|
|
417
|
+ ) {
|
|
394
|
418
|
val placeholderText = dropdownItems.find { it.isChecked }?.text?.value ?: ""
|
|
395
|
419
|
|
|
396
|
420
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
| ... |
... |
@@ -436,7 +460,7 @@ private fun AutoplayDropdownMenu( |
|
436
|
460
|
private fun ProtectionPanelPreview(
|
|
437
|
461
|
@PreviewParameter(ProtectionPanelBannerPreviewProvider::class) state: ProtectionPanelBannerPreviewState
|
|
438
|
462
|
) {
|
|
439
|
|
- FirefoxTheme {
|
|
|
463
|
+ FirefoxTheme(theme = Theme.Private) {
|
|
440
|
464
|
Surface {
|
|
441
|
465
|
ProtectionPanel(
|
|
442
|
466
|
websiteInfoState =
|
| ... |
... |
@@ -451,7 +475,7 @@ private fun ProtectionPanelPreview( |
|
451
|
475
|
isTrackingProtectionEnabled = state.isTrackingProtectionEnabled,
|
|
452
|
476
|
isGlobalTrackingProtectionEnabled = true,
|
|
453
|
477
|
isLocalPdf = false,
|
|
454
|
|
- isPrivate = false,
|
|
|
478
|
+ isPrivate = true,
|
|
455
|
479
|
showIPProtection = true,
|
|
456
|
480
|
numberOfTrackersBlocked = 5,
|
|
457
|
481
|
websitePermissions =
|
| ... |
... |
@@ -472,6 +496,8 @@ private fun ProtectionPanelPreview( |
|
472
|
496
|
onViewQWACClick = {},
|
|
473
|
497
|
onIPProtectionToggle = {},
|
|
474
|
498
|
onIPProtectionNavigate = {},
|
|
|
499
|
+ circuitsInfo = Circuits(JSONArray("[]")),
|
|
|
500
|
+ onNewCircuitClick = {},
|
|
475
|
501
|
onConnectionSettingsClick = {},
|
|
476
|
502
|
)
|
|
477
|
503
|
}
|
mobile/android/fenix/app/src/main/res/drawable/bridge_acorn.xml
|
|
1
|
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
|
2
|
+ android:width="16dp"
|
|
|
3
|
+ android:height="16dp"
|
|
|
4
|
+ android:viewportWidth="16"
|
|
|
5
|
+ android:viewportHeight="16">
|
|
|
6
|
+ <path
|
|
|
7
|
+ android:pathData="M8,4C12.109,4 15.444,7.304 15.497,11.4H15.5V12.5H14V11.5C14,8.186 11.314,5.5 8,5.5C4.686,5.5 2,8.186 2,11.5V12.5H0.5V11.4H0.503C0.556,7.304 3.891,4 8,4Z"
|
|
|
8
|
+ android:fillColor="#FBFBFE" />
|
|
|
9
|
+ <path
|
|
|
10
|
+ android:pathData="M8,6.25C10.866,6.25 13.194,8.547 13.247,11.4H13.25V12.5H11.75V11.5C11.75,9.429 10.071,7.75 8,7.75C5.929,7.75 4.25,9.429 4.25,11.5V12.5H2.75V11.4H2.753C2.806,8.547 5.134,6.25 8,6.25Z"
|
|
|
11
|
+ android:fillColor="#FBFBFE" />
|
|
|
12
|
+ <path
|
|
|
13
|
+ android:pathData="M8,8.5C9.624,8.5 10.944,9.79 10.997,11.4H11V12.5H9.5V11.5C9.5,10.672 8.828,10 8,10C7.172,10 6.5,10.672 6.5,11.5V12.5H5V11.4H5.003C5.056,9.79 6.376,8.5 8,8.5Z"
|
|
|
14
|
+ android:fillColor="#FBFBFE" />
|
|
|
15
|
+</vector> |
mobile/android/fenix/app/src/main/res/drawable/circuit_circle.xml
|
|
1
|
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
|
2
|
+ android:autoMirrored="true"
|
|
|
3
|
+ android:height="14dp"
|
|
|
4
|
+ android:viewportHeight="14"
|
|
|
5
|
+ android:viewportWidth="14"
|
|
|
6
|
+ android:width="14dp">
|
|
|
7
|
+
|
|
|
8
|
+ <path
|
|
|
9
|
+ android:fillColor="#D9BFFF"
|
|
|
10
|
+ android:pathData="M12,7C12,4.239 9.761,2 7,2C4.239,2 2,4.239 2,7C2,9.761 4.239,12 7,12V14C3.134,14 0,10.866 0,7C0,3.134 3.134,0 7,0C10.866,0 14,3.134 14,7C14,10.866 10.866,14 7,14V12C9.761,12 12,9.761 12,7Z" />
|
|
|
11
|
+</vector> |
mobile/android/fenix/app/src/main/res/drawable/dots.xml
|
|
1
|
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
|
2
|
+ android:width="4dp"
|
|
|
3
|
+ android:height="16dp"
|
|
|
4
|
+ android:viewportWidth="4"
|
|
|
5
|
+ android:viewportHeight="16">
|
|
|
6
|
+ <path
|
|
|
7
|
+ android:pathData="M2,2m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0"
|
|
|
8
|
+ android:fillColor="#D9BFFF"/>
|
|
|
9
|
+ <path
|
|
|
10
|
+ android:pathData="M2,8m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0"
|
|
|
11
|
+ android:fillColor="#D9BFFF"/>
|
|
|
12
|
+ <path
|
|
|
13
|
+ android:pathData="M2,14m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0"
|
|
|
14
|
+ android:fillColor="#D9BFFF"/>
|
|
|
15
|
+</vector> |
mobile/android/fenix/app/src/main/res/drawable/hop_diverging.xml
|
|
1
|
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
|
2
|
+ android:width="32dp"
|
|
|
3
|
+ android:height="13dp"
|
|
|
4
|
+ android:viewportWidth="32"
|
|
|
5
|
+ android:viewportHeight="13">
|
|
|
6
|
+ <path
|
|
|
7
|
+ android:pathData="M7,7H25C26.5,7 27,7.5 27,9V13H25V9H7V13H5V0H7V7Z"
|
|
|
8
|
+ android:fillColor="#D9BFFF"/>
|
|
|
9
|
+</vector> |
mobile/android/fenix/app/src/main/res/values/torbrowser_strings.xml
| ... |
... |
@@ -162,6 +162,50 @@ |
|
162
|
162
|
<!-- Connection assist. Here "process" is a noun, referring to the execution of a computer program. "Tor process" specifically refers to the execution of the tor program, which is the program that handles the connection to the "Tor network". -->
|
|
163
|
163
|
<string name="connection_assist_restarting_connection_button">Restarting Tor process…</string>
|
|
164
|
164
|
|
|
|
165
|
+
|
|
|
166
|
+ <!-- Circuit display. "This browser" refers to the browser being used (which is this application; Tor Browser for Android). This will be shown at the start of every circuit -->
|
|
|
167
|
+ <string name="this_browser">This browser</string>
|
|
|
168
|
+ <!-- Circuit display -->
|
|
|
169
|
+ <string name="tor_circuit_display_title">Tor circuit for this site</string>
|
|
|
170
|
+ <!-- Circuit display -->
|
|
|
171
|
+ <string name="tor_circuit_display_description">If the site loads too slowly or does not load at all, try requesting a new circuit</string>
|
|
|
172
|
+ <!-- Circuit display -->
|
|
|
173
|
+ <string name="entry_relay_guard">Entry Relay (guard)</string>
|
|
|
174
|
+ <!-- Circuit display -->
|
|
|
175
|
+ <string name="entry_relay_bridge">Entry Relay (bridge)</string>
|
|
|
176
|
+ <!-- Circuit display -->
|
|
|
177
|
+ <string name="your_entrance_to_the_tor_network">Your entrance to the Tor network</string>
|
|
|
178
|
+ <!-- Circuit display -->
|
|
|
179
|
+ <string name="middle_relay">Middle relay</string>
|
|
|
180
|
+ <!-- Circuit display -->
|
|
|
181
|
+ <string name="adds_an_extra_layer_of_privacy">Adds an extra layer of privacy</string>
|
|
|
182
|
+ <!-- Circuit display -->
|
|
|
183
|
+ <string name="exit_relay">Exit relay</string>
|
|
|
184
|
+ <!-- Circuit display -->
|
|
|
185
|
+ <string name="rendezvous_point">Rendezvous point</string>
|
|
|
186
|
+ <!-- Circuit display -->
|
|
|
187
|
+ <string name="how_you_appear_on_the_internet">How you appear on the internet</string>
|
|
|
188
|
+ <!-- Circuit display -->
|
|
|
189
|
+ <string name="rendezvous_point_description">Where your connection to the onion site happens</string>
|
|
|
190
|
+ <!-- Circuit display. Accessibility description for the bridge icon-->
|
|
|
191
|
+ <string name="bridge_icon_a11y">bridge icon</string>
|
|
|
192
|
+ <!-- Circuit display -->
|
|
|
193
|
+ <string name="protection_panel_new_circuit_for_this_site">New circuit for this site</string>
|
|
|
194
|
+ <!-- Circuit display -->
|
|
|
195
|
+ <string name="circuit_display_details_a11y">Details</string>
|
|
|
196
|
+ <!-- Circuit display -->
|
|
|
197
|
+ <string name="circuit_display_learn_more_a11y">learn more</string>
|
|
|
198
|
+ <!-- Circuit display -->
|
|
|
199
|
+ <string name="some_parts_of_this_site_may_use_a_different_circuit">Some parts of this site may use a different circuit</string>
|
|
|
200
|
+ <!-- Circuit display -->
|
|
|
201
|
+ <string name="onion_site_relays">Onion site relays</string>
|
|
|
202
|
+ <!-- Circuit display -->
|
|
|
203
|
+ <string name="multi_path">multi-path</string>
|
|
|
204
|
+ <!-- Circuit display -->
|
|
|
205
|
+ <string name="single_path">single-path</string>
|
|
|
206
|
+ <!-- Circuit display -->
|
|
|
207
|
+ <string name="no_path">no-path</string>
|
|
|
208
|
+
|
|
165
|
209
|
<!-- ProtectionPanel strings -->
|
|
166
|
210
|
<string name="protection_panel_tor_connection_settings_title">Connection Settings</string>
|
|
167
|
211
|
|
|