-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
80b3a75
commit 7570781
Showing
11 changed files
with
60 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
core/common/src/commonMain/kotlin/org/michaelbel/movies/common/browser/Browser.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package org.michaelbel.movies.common.browser | ||
|
||
import androidx.compose.runtime.Composable | ||
|
||
@Composable | ||
expect fun navigateToUrl(url: String): () -> Unit |
10 changes: 7 additions & 3 deletions
10
core/common/src/iosMain/kotlin/org/michaelbel/movies/common/browser/Browser.ios.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
package org.michaelbel.movies.common.browser | ||
|
||
import androidx.compose.runtime.Composable | ||
import platform.Foundation.NSURL | ||
import platform.UIKit.UIApplication | ||
|
||
fun openUrl(url: String) { | ||
@Composable | ||
actual fun navigateToUrl(url: String): () -> Unit { | ||
val nsUrl = NSURL.URLWithString(url) | ||
if (nsUrl != null) { | ||
UIApplication.sharedApplication().openURL(nsUrl) | ||
return { | ||
if (nsUrl != null) { | ||
UIApplication.sharedApplication().openURL(nsUrl) | ||
} | ||
} | ||
} |
5 changes: 4 additions & 1 deletion
5
core/common/src/jsMain/kotlin/org/michaelbel/movies/common/browser/Browser.js.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
package org.michaelbel.movies.common.browser | ||
|
||
fun openUrl(url: String) { | ||
import androidx.compose.runtime.Composable | ||
|
||
@Composable | ||
actual fun navigateToUrl(url: String): () -> Unit { | ||
return {} | ||
} |
10 changes: 7 additions & 3 deletions
10
core/common/src/jvmMain/kotlin/org/michaelbel/movies/common/browser/Browser.desktop.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
package org.michaelbel.movies.common.browser | ||
|
||
import androidx.compose.runtime.Composable | ||
import java.awt.Desktop | ||
import java.net.URI | ||
|
||
fun openUrl(url: String) { | ||
@Composable | ||
actual fun navigateToUrl(url: String): () -> Unit { | ||
val desktop = if (Desktop.isDesktopSupported()) Desktop.getDesktop() else null | ||
if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) { | ||
desktop.browse(URI.create(url)) | ||
return { | ||
if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) { | ||
desktop.browse(URI.create(url)) | ||
} | ||
} | ||
} |
5 changes: 4 additions & 1 deletion
5
core/common/src/wasmJsMain/kotlin/org/michaelbel/movies/common/browser/Browser.wasm.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
package org.michaelbel.movies.common.browser | ||
|
||
fun openUrl(url: String) { | ||
import androidx.compose.runtime.Composable | ||
|
||
@Composable | ||
actual fun navigateToUrl(url: String): () -> Unit { | ||
return {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters