Support audio attachement + better push keys flow
This commit is contained in:
parent
5920e40528
commit
a9db49e5df
|
@ -74,6 +74,8 @@ public class PushNotificationsService: ObservableObject {
|
|||
|
||||
public func updateSubscriptions(accounts: [PushAccounts]) async {
|
||||
subscriptions = []
|
||||
let key = notificationsPrivateKeyAsKey.publicKey.x963Representation
|
||||
let authKey = notificationsAuthKeyAsKey
|
||||
guard let pushToken = pushToken, isUserPushEnabled else { return }
|
||||
for account in accounts {
|
||||
let client = Client(server: account.server, oauthToken: account.token)
|
||||
|
@ -87,8 +89,8 @@ public class PushNotificationsService: ObservableObject {
|
|||
#endif
|
||||
let sub: PushSubscription =
|
||||
try await client.post(endpoint: Push.createSub(endpoint: listenerURL,
|
||||
p256dh: notificationsPrivateKeyAsKey.publicKey.x963Representation,
|
||||
auth: notificationsAuthKeyAsKey,
|
||||
p256dh: key,
|
||||
auth: authKey,
|
||||
mentions: isMentionNotificationEnabled,
|
||||
status: isNewPostsNotificationEnabled,
|
||||
reblog: isReblogNotificationEnabled,
|
||||
|
|
|
@ -11,7 +11,7 @@ public struct MediaAttachement: Codable, Identifiable, Hashable {
|
|||
}
|
||||
|
||||
public enum SupportedType: String {
|
||||
case image, gifv, video
|
||||
case image, gifv, video, audio
|
||||
}
|
||||
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
|
|
|
@ -163,7 +163,7 @@ public struct StatusMediaPreviewView: View {
|
|||
.shimmering()
|
||||
})
|
||||
}
|
||||
case .gifv, .video:
|
||||
case .gifv, .video, .audio:
|
||||
if let url = attachement.url {
|
||||
VideoPlayerView(viewModel: .init(url: url))
|
||||
.frame(height: imageMaxHeight)
|
||||
|
@ -209,7 +209,7 @@ public struct StatusMediaPreviewView: View {
|
|||
.cornerRadius(4)
|
||||
}
|
||||
}
|
||||
case .gifv, .video:
|
||||
case .gifv, .video, .audio:
|
||||
if let url = attachement.url {
|
||||
VideoPlayerView(viewModel: .init(url: url))
|
||||
.frame(width: isNotifications ? imageMaxHeight : proxy.frame(in: .local).width)
|
||||
|
|
Loading…
Reference in New Issue