Improve openUrlInExternalApp API and move url to UnifiedPushConfig
This commit is contained in:
parent
a89dde2bb4
commit
565e5ce87d
3 changed files with 5 additions and 4 deletions
|
|
@ -156,10 +156,9 @@ fun Context.startSharePlainTextIntent(
|
|||
fun Context.openUrlInExternalApp(
|
||||
url: String,
|
||||
errorMessage: String = getString(R.string.error_no_compatible_app_found),
|
||||
inNewTask: Boolean = false,
|
||||
) {
|
||||
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
|
||||
if (inNewTask) {
|
||||
if (this !is Activity) {
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
}
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ object UnifiedPushConfig {
|
|||
*/
|
||||
const val DEFAULT_PUSH_GATEWAY_HTTP_URL: String = "https://matrix.gateway.unifiedpush.org/_matrix/push/v1/notify"
|
||||
|
||||
const val UNIFIED_PUSH_DISTRIBUTORS_URL = "https://unifiedpush.org/users/distributors/"
|
||||
|
||||
const val INDEX = 1
|
||||
const val NAME = "UnifiedPush"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import com.squareup.anvil.annotations.ContributesBinding
|
|||
import io.element.android.libraries.androidutils.system.openUrlInExternalApp
|
||||
import io.element.android.libraries.di.AppScope
|
||||
import io.element.android.libraries.di.ApplicationContext
|
||||
import io.element.android.libraries.pushproviders.unifiedpush.UnifiedPushConfig
|
||||
import javax.inject.Inject
|
||||
|
||||
interface OpenDistributorWebPageAction {
|
||||
|
|
@ -34,8 +35,7 @@ class DefaultOpenDistributorWebPageAction @Inject constructor(
|
|||
override fun execute() {
|
||||
// Open the distributor download page
|
||||
context.openUrlInExternalApp(
|
||||
url = "https://unifiedpush.org/users/distributors/",
|
||||
inNewTask = true
|
||||
url = UnifiedPushConfig.UNIFIED_PUSH_DISTRIBUTORS_URL,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue