Skip to content

Commit 7193bc4

Browse files
committed
Updated intro text for encrypt and verify
- In the verify step, changed the link from the ProofMode github to proofmode.org - In the encrypt step, changed "Tor" to "Orbot", and updated the link to orbot.app Added onDismiss action to dialogs When a dialog is dismissed by tapping outside of it, an optional action can now be triggered. This is used in the "Project created" dialog to ensure navigation still occurs. Removed Snackbar for media deletion The Snackbar confirming media deletion has been removed as per ticket #673. Media items are now deleted immediately.
1 parent 8304b1c commit 7193bc4

File tree

5 files changed

+48
-34
lines changed

5 files changed

+48
-34
lines changed

app/src/main/java/net/opendasharchive/openarchive/features/core/dialog/BaseDialog.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ fun DialogHost(dialogStateManager: DialogStateManager) {
241241
BaseDialog(
242242
onDismiss = {
243243
dialogStateManager.dismissDialog()
244+
config.onDismissAction?.invoke()
244245
},
245246
icon = config.icon,
246247
iconColor = config.iconColor,

app/src/main/java/net/opendasharchive/openarchive/features/core/dialog/DialogConfigBuilder.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ class DialogBuilder {
111111
.build(defaultText = defaultDestructiveText())
112112
}
113113

114+
fun onDismissAction(block: () -> Unit) {
115+
_onDismissAction = block
116+
}
117+
114118
// Default texts based on type.
115119
private fun defaultPositiveTextFor(type: DialogType): UiText = when (type) {
116120
DialogType.Success -> UiText.StringResource(R.string.lbl_ok)
@@ -211,6 +215,7 @@ class DialogBuilder {
211215
positiveButton = _positiveButton, //?: ButtonData(defaultPositiveTextFor(type)),
212216
neutralButton = _neutralButton,
213217
destructiveButton = _destructiveButton,
218+
onDismissAction = _onDismissAction,
214219
showCheckbox = showCheckbox,
215220
checkboxText = checkboxText,
216221
onCheckboxChanged = onCheckboxChanged,
@@ -267,6 +272,7 @@ fun DialogStateManager.showSuccessDialog(
267272
@StringRes positiveButtonText: Int? = null,
268273
icon: UiImage? = null,
269274
onDone: () -> Unit = {},
275+
onDismissed: () -> Unit = {}
270276
) {
271277
val resourceProvider = this.requireResourceProvider()
272278

@@ -280,6 +286,9 @@ fun DialogStateManager.showSuccessDialog(
280286
text = UiText.StringResource(positiveButtonText ?: R.string.lbl_got_it)
281287
action = onDone
282288
}
289+
onDismissAction {
290+
onDismissed()
291+
}
283292
}
284293
}
285294

app/src/main/java/net/opendasharchive/openarchive/features/folders/BrowseFoldersFragment.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ class BrowseFoldersFragment : BaseFragment(), MenuProvider {
9292
positiveButtonText = R.string.label_got_it,
9393
onDone = {
9494
navigateBackWithResult(projectId)
95+
},
96+
onDismissed = {
97+
// If the dialog is dismissed, we still want to navigate back
98+
navigateBackWithResult(projectId)
9599
}
96100
)
97101
}

app/src/main/java/net/opendasharchive/openarchive/features/main/adapters/MainMediaAdapter.kt

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -231,38 +231,38 @@ class MainMediaAdapter(
231231
if (pos < 0 || pos >= media.size) return
232232

233233
val item = media[pos]
234-
var undone = false
235-
236-
val snackbar =
237-
Snackbar.make(recyclerView, R.string.confirm_remove_media, Snackbar.LENGTH_LONG)
238-
snackbar.setAction(R.string.undo) { _ ->
239-
undone = true
240-
media.add(pos, item)
241-
242-
notifyItemInserted(pos)
243-
}
244-
245-
snackbar.addCallback(object : Snackbar.Callback() {
246-
override fun onDismissed(transientBottomBar: Snackbar?, event: Int) {
247-
if (!undone) {
248-
val collection = item.collection
249-
250-
// Delete collection along with the item, if the collection
251-
// would become empty.
252-
if ((collection?.size ?: 0) < 2) {
253-
collection?.delete()
254-
} else {
255-
item.delete()
256-
}
257-
258-
BroadcastManager.postDelete(recyclerView.context, item.id)
259-
}
260-
261-
super.onDismissed(transientBottomBar, event)
262-
}
263-
})
264-
265-
snackbar.show()
234+
// var undone = false
235+
236+
// val snackbar =
237+
// Snackbar.make(recyclerView, R.string.confirm_remove_media, Snackbar.LENGTH_INDEFINITE)
238+
// snackbar.setAction(R.string.undo) { _ ->
239+
// undone = true
240+
// media.add(pos, item)
241+
//
242+
// notifyItemInserted(pos)
243+
// }
244+
//
245+
// snackbar.addCallback(object : Snackbar.Callback() {
246+
// override fun onDismissed(transientBottomBar: Snackbar?, event: Int) {
247+
// if (!undone) {
248+
// val collection = item.collection
249+
//
250+
// // Delete collection along with the item, if the collection
251+
// // would become empty.
252+
// if ((collection?.size ?: 0) < 2) {
253+
// collection?.delete()
254+
// } else {
255+
// item.delete()
256+
// }
257+
//
258+
// BroadcastManager.postDelete(recyclerView.context, item.id)
259+
// }
260+
//
261+
// super.onDismissed(transientBottomBar, event)
262+
// }
263+
// })
264+
265+
//snackbar.show()
266266

267267
removeItem(item.id)
268268

app/src/main/res/values/strings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,12 @@
313313
<string name="intro_text_verify"><![CDATA[Authenticate and verify your media with sha256 hashes and <a href=\"%1$s\"><u>ProofMode</u></a>.]]></string>
314314
<string name="intro_link_verify" translatable="false">https://proofmode.org</string>
315315
<string name="intro_text_encrypt_old">Automatically upload over TLS (Transport Layer Security) and use Orbot to protect your media in transit over the Tor network.</string>
316-
<string name="intro_text_encrypt" translatable="false"><![CDATA[<b><i>Save</i></b> always uploads over TLS (Transport Layer Security) to protect your media in transit.<br>To further enhance security, enable <a href=\"%1$s\"><u>Tor</u></a> to prevent interception of your media from your phone to the server.]]></string>
316+
<string name="intro_text_encrypt" translatable="false"><![CDATA[<b><i>Save</i></b> always uploads over TLS (Transport Layer Security) to protect your media in transit.<br>To further enhance security, enable <a href=\"%1$s\"><u>Orbot</u></a> to prevent interception of your media from your phone to the server.]]></string>
317317
<!-- <string name="intro_text_encrypt">-->
318318
<!-- &lt;b&gt;&lt;i&gt;Save&lt;/i&gt;&lt;/b&gt; always uploads over TLS (Transport Layer Security) to protect your media in transit.&lt;br&gt;-->
319319
<!-- To further enhance security, enable &lt;a href="%1$s" style="text-decoration: underline;"&gt;Tor&lt;/a&gt; to prevent interception of your media from your phone to the server.-->
320320
<!-- </string>-->
321-
<string name="intro_link_encrypt" translatable="false">https://www.torproject.org</string>
321+
<string name="intro_link_encrypt" translatable="false">https://orbot.app/</string>
322322

323323
<string name="next">Next</string>
324324
<string name="done">Done</string>

0 commit comments

Comments
 (0)