Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native Notifications [WIP] #462

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Native Notifications [WIP] #462

wants to merge 3 commits into from

Conversation

VeselovAlex
Copy link
Contributor

No description provided.

import kotlin.native.concurrent.freeze

internal actual suspend fun sendNotification(notification: Notification) {
val nc = UNUserNotificationCenter.currentNotificationCenter().freeze()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to freeze here, this is Objective-C object.

@@ -11,7 +11,7 @@ import kotlin.math.sin
import kotlin.math.PI
import kotlin.math.pow

class Clocks(private val layer: SkiaLayer): SkikoView {
open class Clocks(private val layer: SkiaLayer): SkikoView {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporarily opened to add custom key binding for macOS

super.onKeyboardEvent(event)
if (event.kind == SkikoKeyboardEventKind.DOWN) when (event.key) {
SkikoKey.KEY_N -> runBlocking {
Notification(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, why runBlocking? Cannot we just run it as suspend on SkikoDispatchers.Main dispatcher?

import platform.Foundation.NSMakeRect
import platform.Foundation.NSSelectorFromString
import platform.darwin.NSObject
import org.jetbrains.skiko.notifications.Notification
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if notifications deserve their own package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants