ui/common/src/iosMain/kotlin/IosBrowserLauncher.kt
changeset 51 d69bdf1ad491
parent 36 a8cfcfe9a6ed
child 80 2474591aa280
equal deleted inserted replaced
50:baa92ecc2001 51:d69bdf1ad491
    19  * You should have received a copy of the GNU General Public License
    19  * You should have received a copy of the GNU General Public License
    20  * along with AboutOss.  If not, see <http://www.gnu.org/licenses/>.
    20  * along with AboutOss.  If not, see <http://www.gnu.org/licenses/>.
    21  */
    21  */
    22 package com.geekorum.aboutoss.ui.common
    22 package com.geekorum.aboutoss.ui.common
    23 
    23 
       
    24 import androidx.compose.runtime.Composable
       
    25 import androidx.compose.runtime.remember
    24 import platform.Foundation.NSURL.Companion.URLWithString
    26 import platform.Foundation.NSURL.Companion.URLWithString
    25 import platform.UIKit.UIApplication
    27 import platform.UIKit.UIApplication
    26 
    28 
    27 
    29 
    28 class IosBrowserLauncher : BrowserLauncher {
    30 class IosBrowserLauncher : BrowserLauncher {
    29     override fun warmUp() {}
       
    30 
    31 
    31     override fun launchUrl(link: String) {
    32     override fun launchUrl(link: String) {
    32         UIApplication.sharedApplication.openURL(
    33         UIApplication.sharedApplication.openURL(
    33             URLWithString(link)!!,
    34             URLWithString(link)!!,
    34             options = emptyMap<Any?, Any>(),
    35             options = emptyMap<Any?, Any>(),
    35             completionHandler = {}
    36             completionHandler = {}
    36         )
    37         )
    37     }
    38     }
    38 
    39 
    39     override fun mayLaunchUrl(vararg uris: String) {}
    40     override fun mayLaunchUrl(vararg uris: String) {}
       
    41 }
    40 
    42 
    41     override fun shutdown() {}
    43 @Composable
       
    44 actual fun rememberBrowserLauncher(): BrowserLauncher {
       
    45     return remember { IosBrowserLauncher() }
    42 }
    46 }