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

Add ability to start live activities #196

Merged
Prev Previous commit
Next Next commit
Remove additional conformances
  • Loading branch information
nakajima committed Apr 4, 2024
commit 5af6d92d57faddf3e9412303a8df81e383a87299
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ import struct Foundation.UUID
/// A live activity notification.
///
/// It is **important** that you do not encode anything with the key `aps`.
public struct APNSLiveActivityNotification<ContentState: Encodable & Hashable & Sendable>:
public struct APNSLiveActivityNotification<ContentState: Encodable>:
APNSMessage
{
enum CodingKeys: CodingKey {
@@ -49,7 +49,7 @@ public struct APNSLiveActivityNotification<ContentState: Encodable & Hashable &
}

/// Event type e.g. update
public var event: any APNSLiveActivityNotificationEvent {
public var event: APNSLiveActivityNotificationEvent {
get {
switch self.aps.event {
case "end":
Original file line number Diff line number Diff line change
@@ -12,9 +12,7 @@
//
//===----------------------------------------------------------------------===//

struct APNSLiveActivityNotificationAPSStorage<ContentState: Encodable & Hashable & Sendable>:
Encodable, Sendable, Hashable
{
struct APNSLiveActivityNotificationAPSStorage<ContentState: Encodable>: Encodable {
enum CodingKeys: String, CodingKey {
case timestamp = "timestamp"
case event = "event"
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//

public protocol APNSLiveActivityNotificationEvent: Hashable, Encodable {
public protocol APNSLiveActivityNotificationEvent: Encodable {
var rawValue: String { get }
}

@@ -24,15 +24,15 @@ public struct APNSLiveActivityNotificationEventEnd: APNSLiveActivityNotification
public let rawValue = "end"
}

public protocol APNSLiveActivityNotificationEventStartStateProtocol: Encodable & Hashable & Sendable
public protocol APNSLiveActivityNotificationEventStartStateProtocol: Encodable
{
associatedtype State: Encodable & Hashable & Sendable
associatedtype State: Encodable
}

public struct APNSLiveActivityNotificationEventStart<State: Encodable & Hashable & Sendable>:
public struct APNSLiveActivityNotificationEventStart<State: Encodable>:
APNSLiveActivityNotificationEvent, APNSLiveActivityNotificationEventStartStateProtocol
{
public struct Attributes: Encodable, Hashable, Sendable {
public struct Attributes: Encodable {
public let type: String
public let state: State