mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-18 03:17:03 +05:30
common: make UrlLauncher use expect/actual
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
3021f96465
commit
f5c3a950bf
5 changed files with 15 additions and 11 deletions
|
@ -3,10 +3,9 @@ package dev.msfjarvis.lobsters.ui.urllauncher
|
|||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import androidx.browser.customtabs.CustomTabsIntent
|
||||
import dev.msfjarvis.lobsters.ui.urllauncher.UrlLauncher
|
||||
|
||||
class AndroidUrlLauncherImpl(private val context: Context) : UrlLauncher {
|
||||
override fun launch(url: String) {
|
||||
actual class UrlLauncher(private val context: Context) {
|
||||
actual fun launch(url: String) {
|
||||
val customTabsIntent = CustomTabsIntent.Builder()
|
||||
.setShareState(CustomTabsIntent.SHARE_STATE_ON)
|
||||
.setShowTitle(true)
|
|
@ -1,5 +1,5 @@
|
|||
package dev.msfjarvis.lobsters.ui.urllauncher
|
||||
|
||||
fun interface UrlLauncher {
|
||||
expect class UrlLauncher {
|
||||
fun launch(url: String)
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@ package dev.msfjarvis.lobsters.ui.urllauncher
|
|||
import java.awt.Desktop
|
||||
import java.net.URI
|
||||
|
||||
class JVMUrlLauncherImpl() : UrlLauncher {
|
||||
override fun launch(url: String) {
|
||||
actual class UrlLauncher {
|
||||
actual fun launch(url: String) {
|
||||
val desktop = Desktop.getDesktop()
|
||||
|
||||
if (Desktop.isDesktopSupported() && desktop.isSupported(Desktop.Action.BROWSE)) {
|
Loading…
Add table
Add a link
Reference in a new issue