-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
12 changed files
with
164 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,7 +86,8 @@ query AiringQuery( | |
id, | ||
site, | ||
thumbnail | ||
} | ||
}, | ||
siteUrl | ||
} | ||
} | ||
} | ||
|
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 |
---|---|---|
|
@@ -74,6 +74,7 @@ query MediumQuery($id: Int, $statusVersion: Int, $html: Boolean) { | |
id, | ||
site, | ||
thumbnail | ||
} | ||
}, | ||
siteUrl | ||
} | ||
} |
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 |
---|---|---|
|
@@ -86,7 +86,8 @@ query SeasonQuery( | |
id, | ||
site, | ||
thumbnail | ||
} | ||
}, | ||
siteUrl | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -89,7 +89,8 @@ query TrendingQuery( | |
id, | ||
site, | ||
thumbnail | ||
} | ||
}, | ||
siteUrl | ||
} | ||
} | ||
} |
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
35 changes: 35 additions & 0 deletions
35
composeApp/src/androidMain/kotlin/dev/datlag/aniflow/ui/custom/share.android.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,35 @@ | ||
package dev.datlag.aniflow.ui.custom | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.core.content.ContextCompat | ||
|
||
@Composable | ||
actual fun shareHandler(): ShareHandler { | ||
val context = LocalContext.current | ||
return remember(context) { | ||
ShareHandler(context) | ||
} | ||
} | ||
|
||
actual class ShareHandler( | ||
private val context: Context | ||
) { | ||
actual fun share(url: String?) { | ||
if (!url.isNullOrBlank()) { | ||
val intent = Intent(Intent.ACTION_SEND) | ||
intent.type = "text/plain" | ||
intent.putExtra(Intent.EXTRA_TEXT, url) | ||
|
||
ContextCompat.startActivity( | ||
context, | ||
Intent.createChooser(intent, null), | ||
null | ||
) | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/custom/share.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,10 @@ | ||
package dev.datlag.aniflow.ui.custom | ||
|
||
import androidx.compose.runtime.Composable | ||
|
||
@Composable | ||
expect fun shareHandler(): ShareHandler | ||
|
||
expect class ShareHandler { | ||
fun share(url: String?) | ||
} |
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
25 changes: 25 additions & 0 deletions
25
composeApp/src/iosMain/kotlin/dev/datlag/aniflow/ui/custom/share.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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package dev.datlag.aniflow.ui.custom | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.platform.LocalUriHandler | ||
import androidx.compose.ui.platform.UriHandler | ||
|
||
@Composable | ||
actual fun shareHandler(): ShareHandler { | ||
val uriHandler = LocalUriHandler.current | ||
return remember(uriHandler) { | ||
ShareHandler(uriHandler) | ||
} | ||
} | ||
|
||
actual class ShareHandler( | ||
private val uriHandler: UriHandler | ||
) { | ||
actual fun share(url: String?) { | ||
if (!url.isNullOrBlank()) { | ||
uriHandler.openUri(url) | ||
} | ||
} | ||
} |