mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 17:27:45 +00:00
Refactor
This commit is contained in:
parent
d044a4090d
commit
85c7a23235
@ -1,6 +1,8 @@
|
||||
package org.thoughtcrime.securesms
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
|
||||
@ -147,6 +149,14 @@ fun Context.showOpenUrlDialog(build: SessionDialogBuilder.() -> Unit): AlertDial
|
||||
build()
|
||||
}.show()
|
||||
|
||||
fun Context.showOpenUrlDialog(url: String): AlertDialog =
|
||||
showOpenUrlDialog {
|
||||
okButton { openUrl(url) }
|
||||
cancelButton()
|
||||
}
|
||||
|
||||
fun Context.openUrl(url: String) = Intent(Intent.ACTION_VIEW, Uri.parse(url)).let(::startActivity)
|
||||
|
||||
fun Fragment.showSessionDialog(build: SessionDialogBuilder.() -> Unit): AlertDialog =
|
||||
SessionDialogBuilder(requireContext()).apply { build() }.show()
|
||||
fun Fragment.createSessionDialog(build: SessionDialogBuilder.() -> Unit): AlertDialog =
|
||||
|
@ -81,12 +81,7 @@ class NewMessageFragment : Fragment() {
|
||||
viewModel,
|
||||
onClose = { delegate.onDialogClosePressed() },
|
||||
onBack = { delegate.onDialogBackPressed() },
|
||||
onHelp = {
|
||||
requireContext().showOpenUrlDialog {
|
||||
okButton { Intent(Intent.ACTION_VIEW, Uri.parse("https://sessionapp.zendesk.com/hc/en-us/articles/4439132747033-How-do-Session-ID-usernames-work")).let(::startActivity) }
|
||||
cancelButton()
|
||||
}
|
||||
}
|
||||
onHelp = { requireContext().showOpenUrlDialog("https://sessionapp.zendesk.com/hc/en-us/articles/4439132747033-How-do-Session-ID-usernames-work") }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user