Merge branch 'public-beta' into develop

This commit is contained in:
Shadowfacts 2024-05-27 22:29:23 -07:00
commit 5620b6ab78
8 changed files with 10 additions and 8 deletions

View File

@ -157,7 +157,7 @@ public final class InstanceFeatures: ObservableObject {
} }
public var needsEditAttachmentsInSeparateRequest: Bool { public var needsEditAttachmentsInSeparateRequest: Bool {
instanceType.isPleroma(.akkoma(nil)) instanceType.isPleroma
} }
public var composeDirectStatuses: Bool { public var composeDirectStatuses: Bool {

View File

@ -104,6 +104,7 @@ class PushManagerImpl: _PushManager {
self.subscriptions = await AsyncSequenceAdaptor(wrapping: subscriptions).map { self.subscriptions = await AsyncSequenceAdaptor(wrapping: subscriptions).map {
let newEndpoint = await self.endpointURL(deviceToken: token, accountID: $0.accountID) let newEndpoint = await self.endpointURL(deviceToken: token, accountID: $0.accountID)
guard newEndpoint != $0.endpoint else { guard newEndpoint != $0.endpoint else {
PushManager.logger.debug("Skipping update of push subscription with endpoint \($0.endpoint, privacy: .public)")
return $0 return $0
} }
var copy = $0 var copy = $0

View File

@ -185,7 +185,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let mastodonController = MastodonController.getForAccount(account) let mastodonController = MastodonController.getForAccount(account)
do { do {
let result = try await mastodonController.updatePushSubscription(subscription: $0) let result = try await mastodonController.updatePushSubscription(subscription: $0)
PushManager.logger.debug("Updated push subscription \(result.id) on \(mastodonController.instanceURL)") PushManager.logger.info("Updated push subscription \(result.id, privacy: .public) on \(mastodonController.instanceURL) with endpoint \($0.endpoint, privacy: .public)")
PushManager.logger.debug("New push subscription: \(String(describing: result))")
return true return true
} catch { } catch {
PushManager.logger.error("Error updating push subscription: \(String(describing: error))") PushManager.logger.error("Error updating push subscription: \(String(describing: error))")

View File

@ -96,7 +96,7 @@ final class ImageCache: @unchecked Sendable {
} }
private func fetch(url: URL) async -> FetchResult { private func fetch(url: URL) async -> FetchResult {
guard let (data, _) = try? await URLSession.shared.data(from: url) else { guard let (data, _) = try? await URLSession.appDefault.data(from: url) else {
return .none return .none
} }
guard let image = UIImage(data: data) else { guard let image = UIImage(data: data) else {

View File

@ -222,7 +222,7 @@ class ConversationViewController: UIViewController {
} }
} }
if isLikelyMastodonRemoteStatus(url: url), if isLikelyMastodonRemoteStatus(url: url),
let (_, response) = try? await URLSession.shared.data(from: url, delegate: RedirectBlocker()), let (_, response) = try? await URLSession.appDefault.data(from: url, delegate: RedirectBlocker()),
let location = (response as? HTTPURLResponse)?.value(forHTTPHeaderField: "location") { let location = (response as? HTTPURLResponse)?.value(forHTTPHeaderField: "location") {
effectiveURL = location effectiveURL = location
} else { } else {

View File

@ -98,7 +98,7 @@ class StatusAttachmentsGalleryDataSource: GalleryDataSource {
case .unknown: case .unknown:
return LoadingGalleryContentViewController(caption: nil) { return LoadingGalleryContentViewController(caption: nil) {
do { do {
let (data, _) = try await URLSession.shared.data(from: attachment.url) let (data, _) = try await URLSession.appDefault.data(from: attachment.url)
let url = FileManager.default.temporaryDirectory.appendingPathComponent(attachment.url.lastPathComponent) let url = FileManager.default.temporaryDirectory.appendingPathComponent(attachment.url.lastPathComponent)
try data.write(to: url) try data.write(to: url)
return FallbackGalleryNavigationController(url: url) return FallbackGalleryNavigationController(url: url)

View File

@ -90,7 +90,7 @@ struct PushInstanceSettingsView: View {
let mastodonController = await MastodonController.getForAccount(account) let mastodonController = await MastodonController.getForAccount(account)
do { do {
let result = try await mastodonController.createPushSubscription(subscription: subscription) let result = try await mastodonController.createPushSubscription(subscription: subscription)
PushManager.logger.debug("Push subscription \(result.id) created on \(account.instanceURL)") PushManager.logger.debug("Push subscription \(result.id, privacy: .public) created on \(account.instanceURL) with endpoint \(result.endpoint, privacy: .public)")
self.subscription = subscription self.subscription = subscription
return true return true
} catch { } catch {
@ -112,7 +112,7 @@ struct PushInstanceSettingsView: View {
let mastodonController = await MastodonController.getForAccount(account) let mastodonController = await MastodonController.getForAccount(account)
do { do {
let result = try await mastodonController.updatePushSubscription(alerts: alerts, policy: policy) let result = try await mastodonController.updatePushSubscription(alerts: alerts, policy: policy)
PushManager.logger.debug("Push subscription \(result.id) updated on \(account.instanceURL)") PushManager.logger.debug("Push subscription \(result.id, privacy: .public) updated on \(account.instanceURL)")
await PushManager.shared.updateSubscription(account: account, alerts: alerts, policy: policy) await PushManager.shared.updateSubscription(account: account, alerts: alerts, policy: policy)
subscription?.alerts = alerts subscription?.alerts = alerts
subscription?.policy = policy subscription?.policy = policy

View File

@ -511,7 +511,7 @@ extension AttachmentView: UIContextMenuInteractionDelegate {
} else if self.attachment.kind == .gifv || self.attachment.kind == .video { } else if self.attachment.kind == .gifv || self.attachment.kind == .video {
itemSource = VideoActivityItemSource(asset: AVAsset(url: self.attachment.url), url: self.attachment.url) itemSource = VideoActivityItemSource(asset: AVAsset(url: self.attachment.url), url: self.attachment.url)
itemData = Task { itemData = Task {
try? await URLSession.shared.data(from: self.attachment.url).0 try? await URLSession.appDefault.data(from: self.attachment.url).0
} }
} else { } else {
return nil return nil