Compare commits
33 Commits
2024.2-122
...
develop
Author | SHA1 | Date |
---|---|---|
Shadowfacts | e3c480131a | |
Shadowfacts | 575166f5b4 | |
Shadowfacts | c60aa3e3f3 | |
Shadowfacts | 75f0d12c82 | |
Shadowfacts | 5cf2bc4fbf | |
Shadowfacts | 908b499f8f | |
Shadowfacts | 67c7905acf | |
Shadowfacts | eacafe87b3 | |
Shadowfacts | 2a53b24487 | |
Shadowfacts | 9df3c33c6c | |
Shadowfacts | d4e82d6e7a | |
Shadowfacts | 06ba758309 | |
Shadowfacts | 2c56902389 | |
Shadowfacts | cb3fd43dbd | |
Shadowfacts | 3d15759fb9 | |
Shadowfacts | 5620b6ab78 | |
Shadowfacts | 09999175f7 | |
Shadowfacts | f2a9f890ff | |
Shadowfacts | 093994b474 | |
Shadowfacts | 3d0de5af04 | |
Shadowfacts | 966a906436 | |
Shadowfacts | 844d4056e3 | |
Shadowfacts | 00ef131bb6 | |
Shadowfacts | d6be6f14dc | |
Shadowfacts | 2ccf028bc2 | |
Shadowfacts | 3eeffada1f | |
Shadowfacts | 0499255be7 | |
Shadowfacts | f909c1da10 | |
Shadowfacts | 81543965ae | |
Shadowfacts | 96d42756d5 | |
Shadowfacts | f6e57d664f | |
Shadowfacts | c33be1cbf3 | |
Shadowfacts | 6d99156bd9 |
|
@ -1,3 +1,20 @@
|
|||
## 2024.2
|
||||
This release introduces push notifications as well as an enhanced multi-column interface on iPadOS!
|
||||
|
||||
Features/Improvements:
|
||||
- Push notifications
|
||||
- Add post preview to Appearance preferences
|
||||
- Show instance announcements in Notifications tab
|
||||
- Add subscription option to Tip Jar
|
||||
- iPadOS: Multi-column navigation
|
||||
- Pleroma/Akkoma: Emoji reaction notifications
|
||||
|
||||
Bugfixes:
|
||||
- Fix fetching server info on some instances
|
||||
- Fix attachment captions not displaying while loading in gallery
|
||||
- macOS: Remove in-app Safari preferences
|
||||
- Pleroma: Handle posts with missing creation date
|
||||
|
||||
## 2024.1
|
||||
This update includes a significant improvements for the attachment gallery and displaying rich text posts. See below for a full list of improvements and fixes.
|
||||
|
||||
|
|
17
CHANGELOG.md
17
CHANGELOG.md
|
@ -1,5 +1,22 @@
|
|||
# Changelog
|
||||
|
||||
## 2024.3 (126)
|
||||
Bugfixes:
|
||||
- Fix an issue displaying post HTML in certain edge cases
|
||||
- Fix crash when video attachment playback ends
|
||||
- Fix excessive CPU usage when scrubbing video attachment
|
||||
- Fix video attachment thubmnails being flipped on Compose screen
|
||||
- Pleroma: Fix editing attachment descriptions not working
|
||||
|
||||
## 2024.2 (124)
|
||||
Features/Improvements:
|
||||
- Add subscription option to Tip Jar
|
||||
|
||||
Bugfixes:
|
||||
- Fix attachment captions not displaying while loading in gallery
|
||||
- Fix tapping follow request push notification not working
|
||||
- Pleroma: Handle posts with missing creation dates
|
||||
|
||||
## 2024.2 (122)
|
||||
Features/Improvements:
|
||||
- Show instance announcements in Notifications
|
||||
|
|
|
@ -40,6 +40,7 @@ class AttachmentThumbnailController: ViewController {
|
|||
case .video, .gifv:
|
||||
let asset = AVURLAsset(url: url)
|
||||
let imageGenerator = AVAssetImageGenerator(asset: asset)
|
||||
imageGenerator.appliesPreferredTrackTransform = true
|
||||
#if os(visionOS)
|
||||
#warning("Use async AVAssetImageGenerator.image(at:)")
|
||||
#else
|
||||
|
@ -91,6 +92,7 @@ class AttachmentThumbnailController: ViewController {
|
|||
if type.conforms(to: .movie) {
|
||||
let asset = AVURLAsset(url: url)
|
||||
let imageGenerator = AVAssetImageGenerator(asset: asset)
|
||||
imageGenerator.appliesPreferredTrackTransform = true
|
||||
#if os(visionOS)
|
||||
#warning("Use async AVAssetImageGenerator.image(at:)")
|
||||
#else
|
||||
|
|
|
@ -52,15 +52,22 @@ class GalleryDismissAnimationController: NSObject, UIViewControllerAnimatedTrans
|
|||
appliedSourceToDestTransform = false
|
||||
}
|
||||
|
||||
// Moving `to.view` to the container is necessary when the presenting VC (i.e., `to`)
|
||||
// is in the window's root presentation.
|
||||
// But it breaks when the gallery is presented from a sheet-presented VC--in which case
|
||||
// `to.view` is already in the view hierarchy at this point; and adding it to the
|
||||
// container causees it to be removed when the transition completes.
|
||||
if to.view.superview == nil {
|
||||
to.view.frame = container.bounds
|
||||
container.addSubview(to.view)
|
||||
}
|
||||
|
||||
from.view.frame = container.bounds
|
||||
container.addSubview(from.view)
|
||||
|
||||
let content = itemViewController.takeContent()
|
||||
content.view.translatesAutoresizingMaskIntoConstraints = true
|
||||
content.view.layer.masksToBounds = true
|
||||
|
||||
container.addSubview(to.view)
|
||||
container.addSubview(from.view)
|
||||
container.addSubview(content.view)
|
||||
|
||||
content.view.frame = destFrameInContainer
|
||||
|
|
|
@ -157,7 +157,7 @@ public final class InstanceFeatures: ObservableObject {
|
|||
}
|
||||
|
||||
public var needsEditAttachmentsInSeparateRequest: Bool {
|
||||
instanceType.isPleroma(.akkoma(nil))
|
||||
instanceType.isPleroma
|
||||
}
|
||||
|
||||
public var composeDirectStatuses: Bool {
|
||||
|
|
|
@ -42,7 +42,8 @@ public struct Client: Sendable {
|
|||
} else if let date = iso8601.date(from: str) {
|
||||
return date
|
||||
} else {
|
||||
throw DecodingError.typeMismatch(Date.self, .init(codingPath: container.codingPath, debugDescription: "unexpected date format"))
|
||||
// throw DecodingError.typeMismatch(Date.self, .init(codingPath: container.codingPath, debugDescription: "unexpected date format: \(str)"))
|
||||
return Date(timeIntervalSinceReferenceDate: 0)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -104,6 +104,7 @@ class PushManagerImpl: _PushManager {
|
|||
self.subscriptions = await AsyncSequenceAdaptor(wrapping: subscriptions).map {
|
||||
let newEndpoint = await self.endpointURL(deviceToken: token, accountID: $0.accountID)
|
||||
guard newEndpoint != $0.endpoint else {
|
||||
PushManager.logger.debug("Skipping update of push subscription with endpoint \($0.endpoint, privacy: .public)")
|
||||
return $0
|
||||
}
|
||||
var copy = $0
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
D60E2F2E244248BF005F8713 /* MastodonCachePersistentStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = D60E2F2D244248BF005F8713 /* MastodonCachePersistentStore.swift */; };
|
||||
D6114E0D27F7FEB30080E273 /* TrendingStatusesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6114E0C27F7FEB30080E273 /* TrendingStatusesViewController.swift */; };
|
||||
D6114E1127F899B30080E273 /* TrendingLinksViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6114E1027F899B30080E273 /* TrendingLinksViewController.swift */; };
|
||||
D6187BED2BFA840B00B3A281 /* FollowRequestNotificationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6187BEC2BFA840B00B3A281 /* FollowRequestNotificationViewController.swift */; };
|
||||
D61A45E628DC0F2F002BE511 /* ConfirmLoadMoreCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D61A45E528DC0F2F002BE511 /* ConfirmLoadMoreCollectionViewCell.swift */; };
|
||||
D61A45E828DF477D002BE511 /* LoadingCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D61A45E728DF477D002BE511 /* LoadingCollectionViewCell.swift */; };
|
||||
D61A45EA28DF51EE002BE511 /* TimelineLikeCollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D61A45E928DF51EE002BE511 /* TimelineLikeCollectionViewController.swift */; };
|
||||
|
@ -74,6 +75,7 @@
|
|||
D620483423D3801D008A63EF /* LinkTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D620483323D3801D008A63EF /* LinkTextView.swift */; };
|
||||
D620483623D38075008A63EF /* ContentTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D620483523D38075008A63EF /* ContentTextView.swift */; };
|
||||
D620483823D38190008A63EF /* StatusContentTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D620483723D38190008A63EF /* StatusContentTextView.swift */; };
|
||||
D6210D762C0B924F009BB569 /* RemoveProfileSuggestionService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6210D752C0B924F009BB569 /* RemoveProfileSuggestionService.swift */; };
|
||||
D621733328F1D5ED004C7DB1 /* ReblogService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D621733228F1D5ED004C7DB1 /* ReblogService.swift */; };
|
||||
D62275A824F1CA2800B82A16 /* ComposeReplyContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D62275A724F1CA2800B82A16 /* ComposeReplyContentView.swift */; };
|
||||
D623A53D2635F5590095BD04 /* StatusPollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D623A53C2635F5590095BD04 /* StatusPollView.swift */; };
|
||||
|
@ -95,7 +97,7 @@
|
|||
D630C3CA2BC59FF500208903 /* MastodonController+Push.swift in Sources */ = {isa = PBXBuildFile; fileRef = D630C3C92BC59FF500208903 /* MastodonController+Push.swift */; };
|
||||
D630C3CC2BC5FD4600208903 /* GetAuthorizationTokenService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D630C3CB2BC5FD4600208903 /* GetAuthorizationTokenService.swift */; };
|
||||
D630C3D42BC61B6100208903 /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D630C3D32BC61B6100208903 /* NotificationService.swift */; };
|
||||
D630C3D82BC61B6100208903 /* NotificationExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = D630C3D12BC61B6000208903 /* NotificationExtension.appex */; platformFilters = (ios, maccatalyst, ); settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
D630C3D82BC61B6100208903 /* NotificationExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = D630C3D12BC61B6000208903 /* NotificationExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
D630C3DF2BC61C4900208903 /* PushNotifications in Frameworks */ = {isa = PBXBuildFile; productRef = D630C3DE2BC61C4900208903 /* PushNotifications */; };
|
||||
D630C3E12BC61C6700208903 /* UserAccounts in Frameworks */ = {isa = PBXBuildFile; productRef = D630C3E02BC61C6700208903 /* UserAccounts */; };
|
||||
D630C3E52BC6313400208903 /* Pachyderm in Frameworks */ = {isa = PBXBuildFile; productRef = D630C3E42BC6313400208903 /* Pachyderm */; };
|
||||
|
@ -467,6 +469,7 @@
|
|||
D60E2F2D244248BF005F8713 /* MastodonCachePersistentStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonCachePersistentStore.swift; sourceTree = "<group>"; };
|
||||
D6114E0C27F7FEB30080E273 /* TrendingStatusesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrendingStatusesViewController.swift; sourceTree = "<group>"; };
|
||||
D6114E1027F899B30080E273 /* TrendingLinksViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrendingLinksViewController.swift; sourceTree = "<group>"; };
|
||||
D6187BEC2BFA840B00B3A281 /* FollowRequestNotificationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowRequestNotificationViewController.swift; sourceTree = "<group>"; };
|
||||
D61A45E528DC0F2F002BE511 /* ConfirmLoadMoreCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfirmLoadMoreCollectionViewCell.swift; sourceTree = "<group>"; };
|
||||
D61A45E728DF477D002BE511 /* LoadingCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadingCollectionViewCell.swift; sourceTree = "<group>"; };
|
||||
D61A45E928DF51EE002BE511 /* TimelineLikeCollectionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineLikeCollectionViewController.swift; sourceTree = "<group>"; };
|
||||
|
@ -504,6 +507,7 @@
|
|||
D620483323D3801D008A63EF /* LinkTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkTextView.swift; sourceTree = "<group>"; };
|
||||
D620483523D38075008A63EF /* ContentTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentTextView.swift; sourceTree = "<group>"; };
|
||||
D620483723D38190008A63EF /* StatusContentTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusContentTextView.swift; sourceTree = "<group>"; };
|
||||
D6210D752C0B924F009BB569 /* RemoveProfileSuggestionService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoveProfileSuggestionService.swift; sourceTree = "<group>"; };
|
||||
D621733228F1D5ED004C7DB1 /* ReblogService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReblogService.swift; sourceTree = "<group>"; };
|
||||
D62275A724F1CA2800B82A16 /* ComposeReplyContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeReplyContentView.swift; sourceTree = "<group>"; };
|
||||
D623A53C2635F5590095BD04 /* StatusPollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusPollView.swift; sourceTree = "<group>"; };
|
||||
|
@ -1164,6 +1168,7 @@
|
|||
D646DCD92A081A2C0059ECEB /* PollFinishedNotificationCollectionViewCell.swift */,
|
||||
D646DCDB2A081CF10059ECEB /* StatusUpdatedNotificationCollectionViewCell.swift */,
|
||||
D68245112BCA1F4000AFB38B /* NotificationLoadingViewController.swift */,
|
||||
D6187BEC2BFA840B00B3A281 /* FollowRequestNotificationViewController.swift */,
|
||||
);
|
||||
path = Notifications;
|
||||
sourceTree = "<group>";
|
||||
|
@ -1754,6 +1759,7 @@
|
|||
D6DD8FFC298495A8002AD3FD /* LogoutService.swift */,
|
||||
D6D79F252A0C8D2700AB2315 /* FetchStatusSourceService.swift */,
|
||||
D630C3CB2BC5FD4600208903 /* GetAuthorizationTokenService.swift */,
|
||||
D6210D752C0B924F009BB569 /* RemoveProfileSuggestionService.swift */,
|
||||
);
|
||||
path = API;
|
||||
sourceTree = "<group>";
|
||||
|
@ -2234,6 +2240,7 @@
|
|||
D65A261D2BC39399005EB5D8 /* PushInstanceSettingsView.swift in Sources */,
|
||||
D65C6BF525478A9C00A6E89C /* BackgroundableViewController.swift in Sources */,
|
||||
D61DC84D28F500D200B82C6E /* ProfileViewController.swift in Sources */,
|
||||
D6187BED2BFA840B00B3A281 /* FollowRequestNotificationViewController.swift in Sources */,
|
||||
D600891F29848DE2005B4D00 /* AddInstancePinnedTimelineView.swift in Sources */,
|
||||
D693A72F25CF91C6003A14E2 /* FeaturedProfileCollectionViewCell.swift in Sources */,
|
||||
D627943223A5466600D38C68 /* SelectableTableViewCell.swift in Sources */,
|
||||
|
@ -2358,6 +2365,7 @@
|
|||
D698F46D2BD0B8310054DB14 /* AnnouncementsCollection.swift in Sources */,
|
||||
D61F75AF293AF50C00C0B37F /* EditedFilter.swift in Sources */,
|
||||
D691771929A7B8820054D7EF /* ProfileHeaderMovedOverlayView.swift in Sources */,
|
||||
D6210D762C0B924F009BB569 /* RemoveProfileSuggestionService.swift in Sources */,
|
||||
D61F75B9293C15A000C0B37F /* ZeroHeightCollectionViewCell.swift in Sources */,
|
||||
D68232F72464F4FD00325FB8 /* ComposeDrawingViewController.swift in Sources */,
|
||||
04586B4122B2FFB10021BD04 /* PreferencesView.swift in Sources */,
|
||||
|
@ -3237,7 +3245,7 @@
|
|||
repositoryURL = "https://git.shadowfacts.net/shadowfacts/HTMLStreamer.git";
|
||||
requirement = {
|
||||
kind = exactVersion;
|
||||
version = 0.2.3;
|
||||
version = 0.2.4;
|
||||
};
|
||||
};
|
||||
D63CC700290EC0B8000E19DE /* XCRemoteSwiftPackageReference "sentry-cocoa" */ = {
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
//
|
||||
// RemoveProfileSuggestionService.swift
|
||||
// Tusker
|
||||
//
|
||||
// Created by Shadowfacts on 6/1/24.
|
||||
// Copyright © 2024 Shadowfacts. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Pachyderm
|
||||
|
||||
@MainActor
|
||||
class RemoveProfileSuggestionService {
|
||||
private let accountID: String
|
||||
private let mastodonController: MastodonController
|
||||
private let presenter: any TuskerNavigationDelegate
|
||||
private let completionHandler: @MainActor () -> Void
|
||||
|
||||
init(accountID: String, mastodonController: MastodonController, presenter: any TuskerNavigationDelegate, completionHandler: @MainActor @escaping () -> Void) {
|
||||
self.accountID = accountID
|
||||
self.mastodonController = mastodonController
|
||||
self.presenter = presenter
|
||||
self.completionHandler = completionHandler
|
||||
}
|
||||
|
||||
func run() async {
|
||||
let req = Suggestion.remove(accountID: accountID)
|
||||
do {
|
||||
_ = try await mastodonController.run(req)
|
||||
completionHandler()
|
||||
} catch {
|
||||
let config = ToastConfiguration(from: error, with: "Error Removing Suggestion", in: presenter) { toast in
|
||||
toast.dismissToast(animated: true)
|
||||
await self.run()
|
||||
}
|
||||
self.presenter.showToast(configuration: config, animated: true)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -185,7 +185,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||
let mastodonController = MastodonController.getForAccount(account)
|
||||
do {
|
||||
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
|
||||
} catch {
|
||||
PushManager.logger.error("Error updating push subscription: \(String(describing: error))")
|
||||
|
|
|
@ -96,7 +96,7 @@ final class ImageCache: @unchecked Sendable {
|
|||
}
|
||||
|
||||
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
|
||||
}
|
||||
guard let image = UIImage(data: data) else {
|
||||
|
|
|
@ -225,7 +225,6 @@ class MainSceneDelegate: UIResponder, UIWindowSceneDelegate, TuskerSceneDelegate
|
|||
window!.windowScene!.title = account.instanceURL.host!
|
||||
}
|
||||
|
||||
let newRoot = createAppUI()
|
||||
if let container = window?.rootViewController as? AccountSwitchingContainerViewController {
|
||||
let direction: AccountSwitchingContainerViewController.AnimationDirection
|
||||
if animated,
|
||||
|
@ -235,9 +234,9 @@ class MainSceneDelegate: UIResponder, UIWindowSceneDelegate, TuskerSceneDelegate
|
|||
} else {
|
||||
direction = .none
|
||||
}
|
||||
container.setRoot(newRoot, for: account, animating: direction)
|
||||
container.setRoot(createAppUI, for: account, animating: direction)
|
||||
} else {
|
||||
window!.rootViewController = AccountSwitchingContainerViewController(root: newRoot, for: account)
|
||||
window!.rootViewController = AccountSwitchingContainerViewController(root: createAppUI(), for: account)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -248,6 +247,9 @@ class MainSceneDelegate: UIResponder, UIWindowSceneDelegate, TuskerSceneDelegate
|
|||
LogoutService(accountInfo: account).run()
|
||||
if UserAccountsManager.shared.onboardingComplete {
|
||||
activateAccount(UserAccountsManager.shared.accounts.first!, animated: false)
|
||||
if let container = window?.rootViewController as? AccountSwitchingContainerViewController {
|
||||
container.removeAccount(account)
|
||||
}
|
||||
} else {
|
||||
window!.rootViewController = createOnboardingUI()
|
||||
}
|
||||
|
|
|
@ -222,7 +222,7 @@ class ConversationViewController: UIViewController {
|
|||
}
|
||||
}
|
||||
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") {
|
||||
effectiveURL = location
|
||||
} else {
|
||||
|
|
|
@ -184,7 +184,19 @@ extension SuggestedProfilesViewController: UICollectionViewDelegate {
|
|||
return UIContextMenuConfiguration {
|
||||
ProfileViewController(accountID: id, mastodonController: self.mastodonController)
|
||||
} actionProvider: { _ in
|
||||
UIMenu(children: self.actionsForProfile(accountID: id, source: .view(cell)))
|
||||
let dismiss = UIAction(title: "Remove Suggestion", image: UIImage(systemName: "trash"), attributes: .destructive) { [unowned self] _ in
|
||||
let service = RemoveProfileSuggestionService(accountID: id, mastodonController: self.mastodonController, presenter: self) { [weak self] in
|
||||
guard let self else { return }
|
||||
var snapshot = self.dataSource.snapshot()
|
||||
// the source here doesn't matter, since it's ignored by the equatable and hashable impls
|
||||
snapshot.deleteItems([.account(id, .global)])
|
||||
self.dataSource.apply(snapshot, animatingDifferences: true)
|
||||
}
|
||||
Task {
|
||||
await service.run()
|
||||
}
|
||||
}
|
||||
return UIMenu(children: [UIMenu(options: .displayInline, children: [dismiss])] + self.actionsForProfile(accountID: id, source: .view(cell)))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -368,20 +368,14 @@ class TrendsViewController: UIViewController, CollectionViewController {
|
|||
|
||||
@MainActor
|
||||
private func removeProfileSuggestion(accountID: String) async {
|
||||
let req = Suggestion.remove(accountID: accountID)
|
||||
do {
|
||||
_ = try await mastodonController.run(req)
|
||||
var snapshot = dataSource.snapshot()
|
||||
let service = RemoveProfileSuggestionService(accountID: accountID, mastodonController: mastodonController, presenter: self) { [weak self] in
|
||||
guard let self else { return }
|
||||
var snapshot = self.dataSource.snapshot()
|
||||
// the source here doesn't matter, since it's ignored by the equatable and hashable impls
|
||||
snapshot.deleteItems([.account(accountID, .global)])
|
||||
await apply(snapshot: snapshot)
|
||||
} catch {
|
||||
let config = ToastConfiguration(from: error, with: "Error Removing Suggestion", in: self) { [unowned self] toast in
|
||||
toast.dismissToast(animated: true)
|
||||
_ = await self.removeProfileSuggestion(accountID: accountID)
|
||||
}
|
||||
self.showToast(configuration: config, animated: true)
|
||||
self.dataSource.apply(snapshot, animatingDifferences: true)
|
||||
}
|
||||
await service.run()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class ImageGalleryDataSource: GalleryDataSource {
|
|||
gifController: gifController
|
||||
)
|
||||
} else {
|
||||
return LoadingGalleryContentViewController {
|
||||
return LoadingGalleryContentViewController(caption: nil) {
|
||||
let (data, image) = await self.cache.get(self.url, loadOriginal: true)
|
||||
if let image {
|
||||
let gifController: GIFController? =
|
||||
|
|
|
@ -10,6 +10,7 @@ import UIKit
|
|||
import GalleryVC
|
||||
|
||||
class LoadingGalleryContentViewController: UIViewController, GalleryContentViewController {
|
||||
private let fallbackCaption: String?
|
||||
private let provider: () async -> (any GalleryContentViewController)?
|
||||
private var wrapped: (any GalleryContentViewController)!
|
||||
|
||||
|
@ -24,14 +25,15 @@ class LoadingGalleryContentViewController: UIViewController, GalleryContentViewC
|
|||
}
|
||||
|
||||
var caption: String? {
|
||||
wrapped?.caption
|
||||
wrapped?.caption ?? fallbackCaption
|
||||
}
|
||||
|
||||
var canAnimateFromSourceView: Bool {
|
||||
wrapped?.canAnimateFromSourceView ?? true
|
||||
}
|
||||
|
||||
init(provider: @escaping () async -> (any GalleryContentViewController)?) {
|
||||
init(caption: String?, provider: @escaping () async -> (any GalleryContentViewController)?) {
|
||||
self.fallbackCaption = caption
|
||||
self.provider = provider
|
||||
|
||||
super.init(nibName: nil, bundle: nil)
|
||||
|
|
|
@ -57,7 +57,8 @@ class StatusAttachmentsGalleryDataSource: GalleryDataSource {
|
|||
gifController: gifController
|
||||
)
|
||||
} else {
|
||||
return LoadingGalleryContentViewController {
|
||||
return LoadingGalleryContentViewController(caption: attachment.description) {
|
||||
try! await Task.sleep(nanoseconds: NSEC_PER_SEC)
|
||||
let (data, image) = await ImageCache.attachments.get(attachment.url, loadOriginal: true)
|
||||
if let image {
|
||||
let gifController: GIFController? =
|
||||
|
@ -95,9 +96,9 @@ class StatusAttachmentsGalleryDataSource: GalleryDataSource {
|
|||
// TODO: use separate content VC with audio visualization?
|
||||
return VideoGalleryContentViewController(url: attachment.url, caption: attachment.description)
|
||||
case .unknown:
|
||||
return LoadingGalleryContentViewController {
|
||||
return LoadingGalleryContentViewController(caption: nil) {
|
||||
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)
|
||||
try data.write(to: url)
|
||||
return FallbackGalleryNavigationController(url: url)
|
||||
|
|
|
@ -120,6 +120,15 @@ class VideoControlsViewController: UIViewController {
|
|||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
deinit {
|
||||
if let timestampObserverToken {
|
||||
player.removeTimeObserver(timestampObserverToken)
|
||||
}
|
||||
if let scrubberObserverToken {
|
||||
player.removeTimeObserver(scrubberObserverToken)
|
||||
}
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
|
@ -256,10 +265,8 @@ private class VideoScrubbingControl: UIControl {
|
|||
|
||||
private func updateFillLayerMask() {
|
||||
// I don't know where this animation is coming from
|
||||
CATransaction.begin()
|
||||
CATransaction.setDisableActions(true)
|
||||
fillMaskLayer.frame = CGRect(x: 0, y: 0, width: fractionComplete * bounds.width, height: 8)
|
||||
CATransaction.commit()
|
||||
fillMaskLayer.removeAllAnimations()
|
||||
}
|
||||
|
||||
override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
|
||||
|
|
|
@ -23,7 +23,7 @@ class AccountSwitchingContainerViewController: UIViewController {
|
|||
private(set) var currentAccountID: String
|
||||
private(set) var root: AccountSwitchableViewController
|
||||
|
||||
private var userActivities: [String: NSUserActivity] = [:]
|
||||
private var viewControllers: [String: (AccountSwitchableViewController?, NSUserActivity)] = [:]
|
||||
|
||||
init(root: AccountSwitchableViewController, for account: UserAccountInfo) {
|
||||
self.currentAccountID = account.id
|
||||
|
@ -42,26 +42,46 @@ class AccountSwitchingContainerViewController: UIViewController {
|
|||
embedChild(root)
|
||||
}
|
||||
|
||||
func setRoot(_ newRoot: AccountSwitchableViewController, for account: UserAccountInfo, animating direction: AnimationDirection) {
|
||||
override func didReceiveMemoryWarning() {
|
||||
super.didReceiveMemoryWarning()
|
||||
viewControllers = viewControllers.mapValues { (_, activity) in
|
||||
(nil, activity)
|
||||
}
|
||||
}
|
||||
|
||||
func removeAccount(_ account: UserAccountInfo) {
|
||||
viewControllers.removeValue(forKey: account.id)
|
||||
}
|
||||
|
||||
func setRoot(_ newRootProvider: () -> AccountSwitchableViewController, for account: UserAccountInfo, animating direction: AnimationDirection) {
|
||||
let oldRoot = self.root
|
||||
if direction == .none {
|
||||
oldRoot.removeViewAndController()
|
||||
}
|
||||
if let activity = oldRoot.stateRestorationActivity() {
|
||||
stateRestorationLogger.debug("AccountSwitchingContainer: saving \(activity.activityType, privacy: .public) for \(self.currentAccountID, privacy: .public)")
|
||||
userActivities[currentAccountID] = activity
|
||||
viewControllers[currentAccountID] = (oldRoot, activity)
|
||||
}
|
||||
|
||||
self.currentAccountID = account.id
|
||||
self.root = newRoot
|
||||
embedChild(newRoot)
|
||||
|
||||
if let activity = userActivities.removeValue(forKey: account.id) {
|
||||
let newRoot: AccountSwitchableViewController
|
||||
if let (existingRoot, activity) = viewControllers.removeValue(forKey: account.id) {
|
||||
if let existingRoot {
|
||||
newRoot = existingRoot
|
||||
stateRestorationLogger.debug("AccountSwitchingContainer: reusing existing VC for \(account.id, privacy: .public)")
|
||||
} else {
|
||||
newRoot = newRootProvider()
|
||||
stateRestorationLogger.debug("AccountSwitchingContainer: restoring \(activity.activityType, privacy: .public) for \(account.id, privacy: .public)")
|
||||
let context = StateRestorationUserActivityHandlingContext(root: newRoot)
|
||||
_ = activity.handleResume(manager: UserActivityManager(scene: view.window!.windowScene!, context: context))
|
||||
context.finalize(activity: activity)
|
||||
}
|
||||
} else {
|
||||
newRoot = newRootProvider()
|
||||
}
|
||||
|
||||
self.currentAccountID = account.id
|
||||
self.root = newRoot
|
||||
embedChild(newRoot)
|
||||
|
||||
if direction != .none {
|
||||
if UIAccessibility.prefersCrossFadeTransitions {
|
||||
|
@ -92,6 +112,7 @@ class AccountSwitchingContainerViewController: UIViewController {
|
|||
#endif
|
||||
|
||||
// only one edge is affected in each direction, i have no idea why
|
||||
let origAdditionalSafeAreaInsets = oldRoot.additionalSafeAreaInsets
|
||||
if direction == .upwards {
|
||||
oldRoot.additionalSafeAreaInsets.bottom = view.safeAreaInsets.bottom
|
||||
} else {
|
||||
|
@ -102,6 +123,8 @@ class AccountSwitchingContainerViewController: UIViewController {
|
|||
oldRoot.view.transform = CGAffineTransform(translationX: 0, y: -newInitialOffset).scaledBy(x: scale, y: scale)
|
||||
newRoot.view.transform = .identity
|
||||
} completion: { (_) in
|
||||
oldRoot.view.transform = .identity
|
||||
oldRoot.additionalSafeAreaInsets = origAdditionalSafeAreaInsets
|
||||
oldRoot.removeViewAndController()
|
||||
newRoot.view.layer.masksToBounds = false
|
||||
}
|
||||
|
|
|
@ -180,26 +180,41 @@ class MainSplitViewController: UISplitViewController {
|
|||
}
|
||||
|
||||
@objc func handleSidebarCommandTimelines() {
|
||||
if let previous = sidebar.selectedItem {
|
||||
navigationStacks[previous] = secondaryNavController.viewControllers
|
||||
}
|
||||
sidebar.select(item: .tab(.timelines), animated: false)
|
||||
select(item: .tab(.timelines))
|
||||
}
|
||||
|
||||
@objc func handleSidebarCommandNotifications() {
|
||||
if let previous = sidebar.selectedItem {
|
||||
navigationStacks[previous] = secondaryNavController.viewControllers
|
||||
}
|
||||
sidebar.select(item: .tab(.notifications), animated: false)
|
||||
select(item: .tab(.notifications))
|
||||
}
|
||||
|
||||
@objc func handleSidebarCommandExplore() {
|
||||
if let previous = sidebar.selectedItem {
|
||||
navigationStacks[previous] = secondaryNavController.viewControllers
|
||||
}
|
||||
sidebar.select(item: .tab(.explore), animated: false)
|
||||
select(item: .tab(.explore))
|
||||
}
|
||||
|
||||
@objc func handleSidebarCommandBookmarks() {
|
||||
if let previous = sidebar.selectedItem {
|
||||
navigationStacks[previous] = secondaryNavController.viewControllers
|
||||
}
|
||||
sidebar.select(item: .bookmarks, animated: false)
|
||||
select(item: .bookmarks)
|
||||
}
|
||||
|
||||
@objc func handleSidebarCommandMyProfile() {
|
||||
if let previous = sidebar.selectedItem {
|
||||
navigationStacks[previous] = secondaryNavController.viewControllers
|
||||
}
|
||||
sidebar.select(item: .tab(.myProfile), animated: false)
|
||||
select(item: .tab(.myProfile))
|
||||
}
|
||||
|
|
|
@ -0,0 +1,144 @@
|
|||
//
|
||||
// FollowRequestNotificationViewController.swift
|
||||
// Tusker
|
||||
//
|
||||
// Created by Shadowfacts on 5/19/24.
|
||||
// Copyright © 2024 Shadowfacts. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Pachyderm
|
||||
|
||||
class FollowRequestNotificationViewController: UIViewController, CollectionViewController {
|
||||
|
||||
private let mastodonController: MastodonController
|
||||
private let notification: Pachyderm.Notification
|
||||
|
||||
var collectionView: UICollectionView! {
|
||||
view as? UICollectionView
|
||||
}
|
||||
private var dataSource: UICollectionViewDiffableDataSource<Section, Item>!
|
||||
|
||||
init(notification: Pachyderm.Notification, mastodonController: MastodonController) {
|
||||
precondition(notification.kind == .followRequest)
|
||||
self.mastodonController = mastodonController
|
||||
self.notification = notification
|
||||
|
||||
super.init(nibName: nil, bundle: nil)
|
||||
|
||||
title = "Follow Request"
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
override func loadView() {
|
||||
let layout = UICollectionViewCompositionalLayout { sectionIndex, environment in
|
||||
var config = UICollectionLayoutListConfiguration(appearance: .grouped)
|
||||
config.backgroundColor = .appGroupedBackground
|
||||
let section = NSCollectionLayoutSection.list(using: config, layoutEnvironment: environment)
|
||||
section.readableContentInset(in: environment)
|
||||
return section
|
||||
}
|
||||
view = UICollectionView(frame: .zero, collectionViewLayout: layout)
|
||||
collectionView.delegate = self
|
||||
collectionView.dragDelegate = self
|
||||
collectionView.allowsFocus = true
|
||||
dataSource = createDataSource()
|
||||
}
|
||||
|
||||
private func createDataSource() -> UICollectionViewDiffableDataSource<Section, Item> {
|
||||
let followRequestCell = UICollectionView.CellRegistration<FollowRequestNotificationCollectionViewCell, Void> { [unowned self] cell, indexPath, itemIdentifier in
|
||||
cell.delegate = self
|
||||
cell.updateUI(notification: self.notification)
|
||||
}
|
||||
return UICollectionViewDiffableDataSource(collectionView: collectionView) { collectionView, indexPath, itemIdentifier in
|
||||
return collectionView.dequeueConfiguredReusableCell(using: followRequestCell, for: indexPath, item: ())
|
||||
}
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
var snapshot = NSDiffableDataSourceSnapshot<Section, Item>()
|
||||
snapshot.appendSections([.notifications])
|
||||
snapshot.appendItems([.notification])
|
||||
dataSource.apply(snapshot, animatingDifferences: false)
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
clearSelectionOnAppear(animated: animated)
|
||||
}
|
||||
}
|
||||
|
||||
extension FollowRequestNotificationViewController {
|
||||
enum Section {
|
||||
case notifications
|
||||
}
|
||||
enum Item {
|
||||
case notification
|
||||
}
|
||||
}
|
||||
|
||||
extension FollowRequestNotificationViewController: UICollectionViewDelegate {
|
||||
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||
selected(account: notification.account.id)
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? {
|
||||
guard let cell = collectionView.cellForItem(at: indexPath) else {
|
||||
return nil
|
||||
}
|
||||
let accountID = notification.account.id
|
||||
return UIContextMenuConfiguration {
|
||||
ProfileViewController(accountID: accountID, mastodonController: self.mastodonController)
|
||||
} actionProvider: { _ in
|
||||
let cell = cell as! FollowRequestNotificationCollectionViewCell
|
||||
let acceptRejectChildren = [
|
||||
UIAction(title: "Accept", image: UIImage(systemName: "checkmark.circle"), handler: { _ in cell.acceptButtonPressed() }),
|
||||
UIAction(title: "Reject", image: UIImage(systemName: "xmark.circle"), handler: { _ in cell.rejectButtonPressed() }),
|
||||
]
|
||||
let acceptRejectMenu: UIMenu
|
||||
if #available(iOS 16.0, *) {
|
||||
acceptRejectMenu = UIMenu(options: .displayInline, preferredElementSize: .medium, children: acceptRejectChildren)
|
||||
} else {
|
||||
acceptRejectMenu = UIMenu(options: .displayInline, children: acceptRejectChildren)
|
||||
}
|
||||
return UIMenu(children: [
|
||||
acceptRejectMenu,
|
||||
UIMenu(options: .displayInline, children: self.actionsForProfile(accountID: accountID, source: .view(cell))),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, willPerformPreviewActionForMenuWith configuration: UIContextMenuConfiguration, animator: any UIContextMenuInteractionCommitAnimating) {
|
||||
MenuPreviewHelper.willPerformPreviewAction(animator: animator, presenter: self)
|
||||
}
|
||||
}
|
||||
|
||||
extension FollowRequestNotificationViewController: UICollectionViewDragDelegate {
|
||||
func collectionView(_ collectionView: UICollectionView, itemsForBeginning session: any UIDragSession, at indexPath: IndexPath) -> [UIDragItem] {
|
||||
let provider = NSItemProvider(object: notification.account.url as NSURL)
|
||||
let activity = UserActivityManager.showProfileActivity(id: notification.account.id, accountID: mastodonController.accountInfo!.id)
|
||||
activity.displaysAuxiliaryScene = true
|
||||
provider.registerObject(activity, visibility: .all)
|
||||
return [UIDragItem(itemProvider: provider)]
|
||||
}
|
||||
}
|
||||
|
||||
extension FollowRequestNotificationViewController: TuskerNavigationDelegate {
|
||||
var apiController: MastodonController! { mastodonController }
|
||||
}
|
||||
|
||||
extension FollowRequestNotificationViewController: MenuActionProvider {
|
||||
}
|
||||
|
||||
extension FollowRequestNotificationViewController: StatusBarTappableViewController {
|
||||
func handleStatusBarTapped(xPosition: CGFloat) -> StatusBarTapActionResult {
|
||||
collectionView.scrollToTop()
|
||||
return .stop
|
||||
}
|
||||
}
|
|
@ -89,8 +89,7 @@ class NotificationLoadingViewController: UIViewController {
|
|||
case .follow:
|
||||
vc = ProfileViewController(accountID: notification.account.id, mastodonController: mastodonController)
|
||||
case .followRequest:
|
||||
// todo
|
||||
return
|
||||
vc = FollowRequestNotificationViewController(notification: notification, mastodonController: mastodonController)
|
||||
case .unknown:
|
||||
showLoadingError(Error.unknownType)
|
||||
return
|
||||
|
|
|
@ -17,6 +17,15 @@ struct NotificationsPrefsView: View {
|
|||
|
||||
var body: some View {
|
||||
List {
|
||||
NavigationLink {
|
||||
TipJarView()
|
||||
} label: {
|
||||
Text("Push notifications are available for free to all users, but providing them has an ongoing cost. If you like the app, please consider \(Text("supporting Tusker").foregroundColor(.accentColor)).")
|
||||
.font(.callout)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
.listRowBackground(Color.accentColor.opacity(0.1))
|
||||
|
||||
Section {
|
||||
ForEach(userAccounts.accounts) { account in
|
||||
PushInstanceSettingsView(account: account)
|
||||
|
|
|
@ -90,7 +90,7 @@ struct PushInstanceSettingsView: View {
|
|||
let mastodonController = await MastodonController.getForAccount(account)
|
||||
do {
|
||||
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
|
||||
return true
|
||||
} catch {
|
||||
|
@ -112,7 +112,7 @@ struct PushInstanceSettingsView: View {
|
|||
let mastodonController = await MastodonController.getForAccount(account)
|
||||
do {
|
||||
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)
|
||||
subscription?.alerts = alerts
|
||||
subscription?.policy = policy
|
||||
|
|
|
@ -11,18 +11,24 @@ import StoreKit
|
|||
import Combine
|
||||
|
||||
struct TipJarView: View {
|
||||
private static let productIDs = [
|
||||
private static let tipProductIDs = [
|
||||
"tusker.tip.small",
|
||||
"tusker.tip.medium",
|
||||
"tusker.tip.large",
|
||||
]
|
||||
private static let supporterProductIDs = [
|
||||
"tusker.supporter.regular",
|
||||
]
|
||||
|
||||
@State private var isLoaded = false
|
||||
@State private var products: [(Product, Bool)] = []
|
||||
@State private var tipProducts: [(Product, Bool)] = []
|
||||
@State private var supporterProducts: [(Product, Bool)] = []
|
||||
@State private var error: Error?
|
||||
@State private var showConfetti = false
|
||||
@State private var updatesObserver: Task<Void, Never>?
|
||||
@State private var buttonWidth: CGFloat?
|
||||
@State private var tipButtonWidth: CGFloat?
|
||||
@State private var supporterButtonWidth: CGFloat?
|
||||
@State private var supporterStartDate: Date?
|
||||
@StateObject private var observer = UbiquitousKeyValueStoreObserver()
|
||||
|
||||
var body: some View {
|
||||
|
@ -47,9 +53,20 @@ struct TipJarView: View {
|
|||
updatesObserver = Task.detached { @MainActor in
|
||||
await observeTransactionUpdates()
|
||||
}
|
||||
for await verificationResult in Transaction.currentEntitlements {
|
||||
if case .verified(let transaction) = verificationResult,
|
||||
Self.supporterProductIDs.contains(transaction.productID),
|
||||
await transaction.subscriptionStatus?.state == .subscribed {
|
||||
supporterStartDate = transaction.originalPurchaseDate
|
||||
break
|
||||
}
|
||||
}
|
||||
do {
|
||||
products = try await Product.products(for: Self.productIDs).map { ($0, false) }
|
||||
products.sort(by: { $0.0.price < $1.0.price })
|
||||
let allProducts = try await Product.products(for: Self.tipProductIDs + Self.supporterProductIDs).map { ($0, false) }
|
||||
tipProducts = allProducts.filter { Self.tipProductIDs.contains($0.0.id) }
|
||||
tipProducts.sort(by: { $0.0.price < $1.0.price })
|
||||
supporterProducts = allProducts.filter { Self.supporterProductIDs.contains($0.0.id) }
|
||||
supporterProducts.sort(by: { $0.0.price < $1.0.price })
|
||||
isLoaded = true
|
||||
} catch {
|
||||
self.error = .fetchingProducts(error)
|
||||
|
@ -67,25 +84,17 @@ struct TipJarView: View {
|
|||
private var productsView: some View {
|
||||
if isLoaded {
|
||||
VStack {
|
||||
Text("If you're enjoying using Tusker and want to show your gratitude or help support its development, it is greatly appreciated!")
|
||||
if !supporterProducts.isEmpty {
|
||||
supporterSubscriptions
|
||||
}
|
||||
|
||||
tipPurchases
|
||||
|
||||
if let tipStatus {
|
||||
tipStatus
|
||||
.multilineTextAlignment(.center)
|
||||
.padding(.horizontal)
|
||||
|
||||
VStack(alignment: .myAlignment) {
|
||||
ForEach($products, id: \.0.id) { $productAndPurchasing in
|
||||
TipRow(product: productAndPurchasing.0, buttonWidth: buttonWidth, isPurchasing: $productAndPurchasing.1, showConfetti: $showConfetti)
|
||||
}
|
||||
}
|
||||
.onPreferenceChange(ButtonWidthKey.self) { newValue in
|
||||
if let buttonWidth {
|
||||
self.buttonWidth = max(buttonWidth, newValue)
|
||||
} else {
|
||||
self.buttonWidth = newValue
|
||||
}
|
||||
}
|
||||
|
||||
if let total = getTotalTips(), total > 0 {
|
||||
Text("You've tipped a total of \(Text(total, format: products[0].0.priceFormatStyle)) 😍")
|
||||
.padding(.top, 16)
|
||||
Text("Thank you!")
|
||||
}
|
||||
}
|
||||
|
@ -95,20 +104,93 @@ struct TipJarView: View {
|
|||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var supporterSubscriptions: some View {
|
||||
Text("If you want to contribute Tusker's continued development, you can become a supporter. Supporting Tusker is an auto-renewable monthly subscription.")
|
||||
.multilineTextAlignment(.center)
|
||||
.padding(.horizontal)
|
||||
|
||||
VStack(alignment: .myAlignment) {
|
||||
ForEach($supporterProducts, id: \.0.id) { $productAndPurchasing in
|
||||
TipRow(product: productAndPurchasing.0, buttonWidth: supporterButtonWidth, isPurchasing: $productAndPurchasing.1, showConfetti: $showConfetti)
|
||||
}
|
||||
}
|
||||
.onPreferenceChange(ButtonWidthKey.self) { newValue in
|
||||
if let supporterButtonWidth {
|
||||
self.supporterButtonWidth = max(supporterButtonWidth, newValue)
|
||||
} else {
|
||||
self.supporterButtonWidth = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var tipPurchases: some View {
|
||||
Text("Or, you can choose to make a one-time tip to show your gratitutde or help support the app's development. It is greatly appreciated!")
|
||||
.multilineTextAlignment(.center)
|
||||
.padding(.horizontal)
|
||||
.padding(.top, 16)
|
||||
|
||||
VStack(alignment: .myAlignment) {
|
||||
ForEach($tipProducts, id: \.0.id) { $productAndPurchasing in
|
||||
TipRow(product: productAndPurchasing.0, buttonWidth: tipButtonWidth, isPurchasing: $productAndPurchasing.1, showConfetti: $showConfetti)
|
||||
}
|
||||
}
|
||||
.onPreferenceChange(ButtonWidthKey.self) { newValue in
|
||||
if let tipButtonWidth {
|
||||
self.tipButtonWidth = max(tipButtonWidth, newValue)
|
||||
} else {
|
||||
self.tipButtonWidth = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var tipStatus: Text? {
|
||||
var text: Text?
|
||||
if let supporterStartDate {
|
||||
var months = Calendar.current.dateComponents([.month], from: supporterStartDate, to: Date()).month!
|
||||
// the user has already paid for n months before the nth month has finished, so reflect that
|
||||
months += 1
|
||||
text = Text("You've been a supporter for ^[\(months) months](inflect: true)")
|
||||
}
|
||||
if let total = getTotalTips(),
|
||||
total > 0 {
|
||||
if let t = text {
|
||||
text = Text("\(t) and tipped \(total.formatted(tipProducts[0].0.priceFormatStyle))")
|
||||
} else {
|
||||
text = Text("You've tipped \(total.formatted(tipProducts[0].0.priceFormatStyle))")
|
||||
}
|
||||
}
|
||||
if let text {
|
||||
return Text("\(text) 😍")
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
private func observeTransactionUpdates() async {
|
||||
for await verificationResult in StoreKit.Transaction.updates {
|
||||
guard let index = products.firstIndex(where: { $0.0.id == verificationResult.unsafePayloadValue.productID }) else {
|
||||
continue
|
||||
}
|
||||
if let index = tipProducts.firstIndex(where: { $0.0.id == verificationResult.unsafePayloadValue.productID }) {
|
||||
switch verificationResult {
|
||||
case .verified(let transaction):
|
||||
await transaction.finish()
|
||||
self.products[index].1 = false
|
||||
self.tipProducts[index].1 = false
|
||||
self.showConfetti = true
|
||||
case .unverified(_, let error):
|
||||
self.error = .verifyingTransaction(error)
|
||||
}
|
||||
} else if let index = supporterProducts.firstIndex(where: { $0.0.id == verificationResult.unsafePayloadValue.productID }) {
|
||||
switch verificationResult {
|
||||
case .verified(let transaction):
|
||||
await transaction.finish()
|
||||
self.supporterProducts[index].1 = false
|
||||
self.showConfetti = true
|
||||
self.supporterStartDate = transaction.originalPurchaseDate
|
||||
case .unverified(_, let error):
|
||||
self.error = .verifyingTransaction(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,6 +231,20 @@ private struct TipRow: View {
|
|||
Text(product.displayName)
|
||||
.alignmentGuide(.myAlignment, computeValue: { context in context[.trailing] })
|
||||
|
||||
if let subscription = product.subscription {
|
||||
SubscriptionButton(product: product, subscriptionInfo: subscription, isPurchasing: $isPurchasing, buttonWidth: buttonWidth, purchase: purchase)
|
||||
} else {
|
||||
tipButton
|
||||
}
|
||||
}
|
||||
.alertWithData("Error", data: $error) { _ in
|
||||
Button("OK") {}
|
||||
} message: { error in
|
||||
Text(error.localizedDescription)
|
||||
}
|
||||
}
|
||||
|
||||
private var tipButton: some View {
|
||||
Button {
|
||||
Task {
|
||||
await self.purchase()
|
||||
|
@ -169,12 +265,6 @@ private struct TipRow: View {
|
|||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
}
|
||||
.alertWithData("Error", data: $error) { _ in
|
||||
Button("OK") {}
|
||||
} message: { error in
|
||||
Text(error.localizedDescription)
|
||||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
private func purchase() async {
|
||||
|
@ -221,6 +311,71 @@ private struct TipRow: View {
|
|||
}
|
||||
}
|
||||
|
||||
private struct SubscriptionButton: View {
|
||||
let product: Product
|
||||
let subscriptionInfo: Product.SubscriptionInfo
|
||||
@Binding var isPurchasing: Bool
|
||||
let buttonWidth: CGFloat?
|
||||
let purchase: () async -> Void
|
||||
@State private var hasPurchased = false
|
||||
@State private var showManageSheet = false
|
||||
|
||||
var body: some View {
|
||||
Button {
|
||||
if #available(iOS 17.0, *), hasPurchased {
|
||||
showManageSheet = true
|
||||
} else {
|
||||
Task {
|
||||
await purchase()
|
||||
await updateHasPurchased()
|
||||
}
|
||||
}
|
||||
} label: {
|
||||
if #available(iOS 17.0, *), hasPurchased {
|
||||
Text("Manage")
|
||||
} else if isPurchasing {
|
||||
ProgressView()
|
||||
.progressViewStyle(.circular)
|
||||
.frame(width: buttonWidth, alignment: .center)
|
||||
} else {
|
||||
let per: String = if subscriptionInfo.subscriptionPeriod.value == 1, subscriptionInfo.subscriptionPeriod.unit == .month {
|
||||
"mo"
|
||||
} else {
|
||||
subscriptionInfo.subscriptionPeriod.formatted(product.subscriptionPeriodFormatStyle)
|
||||
}
|
||||
Text("\(product.displayPrice)/\(per)")
|
||||
.background(GeometryReader { proxy in
|
||||
Color.clear
|
||||
.preference(key: ButtonWidthKey.self, value: proxy.size.width)
|
||||
})
|
||||
.frame(width: buttonWidth)
|
||||
}
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
.task {
|
||||
await updateHasPurchased()
|
||||
}
|
||||
.onChange(of: showManageSheet) {
|
||||
if !$0 {
|
||||
Task {
|
||||
await updateHasPurchased()
|
||||
}
|
||||
}
|
||||
}
|
||||
.manageSubscriptionsSheetIfAvailable(isPresented: $showManageSheet, subscriptionGroupID: subscriptionInfo.subscriptionGroupID)
|
||||
}
|
||||
|
||||
private func updateHasPurchased() async {
|
||||
switch await Transaction.currentEntitlement(for: product.id) {
|
||||
case .verified(let transaction):
|
||||
let state = await transaction.subscriptionStatus?.state
|
||||
hasPurchased = state == .subscribed
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension HorizontalAlignment {
|
||||
private enum MyTrailing: AlignmentID {
|
||||
static func defaultValue(in context: ViewDimensions) -> CGFloat {
|
||||
|
@ -263,3 +418,15 @@ private class UbiquitousKeyValueStoreObserver: ObservableObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private extension View {
|
||||
@available(iOS, obsoleted: 17.0)
|
||||
@ViewBuilder
|
||||
func manageSubscriptionsSheetIfAvailable(isPresented: Binding<Bool>, subscriptionGroupID: String) -> some View {
|
||||
if #available(iOS 17.0, *) {
|
||||
self.manageSubscriptionsSheet(isPresented: isPresented, subscriptionGroupID: subscriptionGroupID)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -273,12 +273,17 @@ private class ColumnView: UIView {
|
|||
}
|
||||
|
||||
private func installCloseBarButton(navigationItem: UINavigationItem) {
|
||||
func makeItem() -> UIBarButtonItem {
|
||||
let item = UIBarButtonItem(image: UIImage(systemName: "xmark"), style: .done, target: self, action: #selector(closeNavigationColumn))
|
||||
item.accessibilityLabel = "Close Column"
|
||||
if navigationItem.leftBarButtonItems != nil {
|
||||
navigationItem.leftBarButtonItems!.insert(item, at: 0)
|
||||
return item
|
||||
}
|
||||
if let leftItems = navigationItem.leftBarButtonItems {
|
||||
if !leftItems.contains(where: { $0.action == #selector(closeNavigationColumn) }) {
|
||||
navigationItem.leftBarButtonItems!.insert(makeItem(), at: 0)
|
||||
}
|
||||
} else {
|
||||
navigationItem.leftBarButtonItems = [item]
|
||||
navigationItem.leftBarButtonItems = [makeItem()]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,8 +50,11 @@ extension UIViewController {
|
|||
}
|
||||
|
||||
func removeViewAndController() {
|
||||
beginAppearanceTransition(false, animated: false)
|
||||
view.removeFromSuperview()
|
||||
willMove(toParent: nil)
|
||||
removeFromParent()
|
||||
endAppearanceTransition()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,7 +71,7 @@ extension UIView {
|
|||
|
||||
if layout {
|
||||
subview.frame = bounds
|
||||
|
||||
subview.translatesAutoresizingMaskIntoConstraints = false
|
||||
NSLayoutConstraint.activate([
|
||||
subview.leadingAnchor.constraint(equalTo: leadingAnchor),
|
||||
subview.trailingAnchor.constraint(equalTo: trailingAnchor),
|
||||
|
|
|
@ -53,13 +53,94 @@
|
|||
"settings" : {
|
||||
"_applicationInternalID" : "1498334597",
|
||||
"_developerTeamID" : "V4WK9KR9U2",
|
||||
"_lastSynchronizedDate" : 696310076.23998904
|
||||
"_failTransactionsEnabled" : false,
|
||||
"_lastSynchronizedDate" : 737914663.21114194,
|
||||
"_storeKitErrors" : [
|
||||
{
|
||||
"current" : null,
|
||||
"enabled" : false,
|
||||
"name" : "Load Products"
|
||||
},
|
||||
{
|
||||
"current" : null,
|
||||
"enabled" : false,
|
||||
"name" : "Purchase"
|
||||
},
|
||||
{
|
||||
"current" : null,
|
||||
"enabled" : false,
|
||||
"name" : "Verification"
|
||||
},
|
||||
{
|
||||
"current" : null,
|
||||
"enabled" : false,
|
||||
"name" : "App Store Sync"
|
||||
},
|
||||
{
|
||||
"current" : null,
|
||||
"enabled" : false,
|
||||
"name" : "Subscription Status"
|
||||
},
|
||||
{
|
||||
"current" : null,
|
||||
"enabled" : false,
|
||||
"name" : "App Transaction"
|
||||
},
|
||||
{
|
||||
"current" : null,
|
||||
"enabled" : false,
|
||||
"name" : "Manage Subscriptions Sheet"
|
||||
},
|
||||
{
|
||||
"current" : null,
|
||||
"enabled" : false,
|
||||
"name" : "Refund Request Sheet"
|
||||
},
|
||||
{
|
||||
"current" : null,
|
||||
"enabled" : false,
|
||||
"name" : "Offer Code Redeem Sheet"
|
||||
}
|
||||
]
|
||||
},
|
||||
"subscriptionGroups" : [
|
||||
{
|
||||
"id" : "21490109",
|
||||
"localizations" : [
|
||||
|
||||
],
|
||||
"name" : "Tip Jar",
|
||||
"subscriptions" : [
|
||||
{
|
||||
"adHocOffers" : [
|
||||
|
||||
],
|
||||
"codeOffers" : [
|
||||
|
||||
],
|
||||
"displayPrice" : "1.99",
|
||||
"familyShareable" : false,
|
||||
"groupNumber" : 1,
|
||||
"internalID" : "6502909920",
|
||||
"introductoryOffer" : null,
|
||||
"localizations" : [
|
||||
{
|
||||
"description" : "Support the continued development of Tusker!",
|
||||
"displayName" : "Tusker Supporter",
|
||||
"locale" : "en_US"
|
||||
}
|
||||
],
|
||||
"productID" : "tusker.supporter.regular",
|
||||
"recurringSubscriptionPeriod" : "P1M",
|
||||
"referenceName" : "tusker.supporter.regular",
|
||||
"subscriptionGroupID" : "21490109",
|
||||
"type" : "RecurringSubscription"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"version" : {
|
||||
"major" : 2,
|
||||
"major" : 3,
|
||||
"minor" : 0
|
||||
}
|
||||
}
|
||||
|
|
|
@ -511,7 +511,7 @@ extension AttachmentView: UIContextMenuInteractionDelegate {
|
|||
} else if self.attachment.kind == .gifv || self.attachment.kind == .video {
|
||||
itemSource = VideoActivityItemSource(asset: AVAsset(url: self.attachment.url), url: self.attachment.url)
|
||||
itemData = Task {
|
||||
try? await URLSession.shared.data(from: self.attachment.url).0
|
||||
try? await URLSession.appDefault.data(from: self.attachment.url).0
|
||||
}
|
||||
} else {
|
||||
return nil
|
||||
|
|
|
@ -33,6 +33,11 @@ class CachedImageView: UIImageView {
|
|||
commonInit()
|
||||
}
|
||||
|
||||
deinit {
|
||||
fetchTask?.cancel()
|
||||
blurHashTask?.cancel()
|
||||
}
|
||||
|
||||
private func commonInit() {
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(preferencesChanged), name: .preferencesChanged, object: nil)
|
||||
}
|
||||
|
|
|
@ -25,9 +25,9 @@ class ProfileHeaderView: UIView {
|
|||
weak var delegate: ProfileHeaderViewDelegate?
|
||||
var mastodonController: MastodonController! { delegate?.apiController }
|
||||
|
||||
@IBOutlet weak var headerImageView: UIImageView!
|
||||
@IBOutlet weak var headerImageView: CachedImageView!
|
||||
@IBOutlet weak var avatarContainerView: UIView!
|
||||
@IBOutlet weak var avatarImageView: UIImageView!
|
||||
@IBOutlet weak var avatarImageView: CachedImageView!
|
||||
@IBOutlet weak var moreButton: ProfileHeaderButton!
|
||||
@IBOutlet weak var followButton: ProfileHeaderButton!
|
||||
@IBOutlet weak var displayNameLabel: AccountDisplayNameLabel!
|
||||
|
@ -44,8 +44,6 @@ class ProfileHeaderView: UIView {
|
|||
|
||||
var accountID: String!
|
||||
|
||||
private var imagesTask: Task<Void, Never>?
|
||||
|
||||
private var isGrayscale = false
|
||||
private var followButtonMode = FollowButtonMode.follow {
|
||||
didSet {
|
||||
|
@ -56,10 +54,6 @@ class ProfileHeaderView: UIView {
|
|||
}
|
||||
}
|
||||
|
||||
deinit {
|
||||
imagesTask?.cancel()
|
||||
}
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
|
@ -69,11 +63,13 @@ class ProfileHeaderView: UIView {
|
|||
avatarContainerView.layer.cornerCurve = .continuous
|
||||
// Set zPositions so the gallery presentation/dismissal animation looks correct.
|
||||
avatarContainerView.layer.zPosition = 2
|
||||
avatarImageView.cache = .avatars
|
||||
avatarImageView.layer.masksToBounds = true
|
||||
avatarImageView.layer.cornerCurve = .continuous
|
||||
avatarImageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(avatarPressed)))
|
||||
avatarImageView.isUserInteractionEnabled = true
|
||||
|
||||
headerImageView.cache = .headers
|
||||
headerImageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(headerPressed)))
|
||||
headerImageView.isUserInteractionEnabled = true
|
||||
headerImageView.layer.zPosition = 1
|
||||
|
@ -138,11 +134,11 @@ class ProfileHeaderView: UIView {
|
|||
usernameLabel.text = "@\(account.acct)"
|
||||
lockImageView.isHidden = !account.locked
|
||||
|
||||
imagesTask?.cancel()
|
||||
let avatar = account.avatar
|
||||
let header = account.header
|
||||
imagesTask = Task {
|
||||
await updateImages(avatar: avatar, header: header)
|
||||
if let avatar = account.avatar {
|
||||
avatarImageView.update(for: avatar)
|
||||
}
|
||||
if let header = account.header {
|
||||
headerImageView.update(for: header)
|
||||
}
|
||||
|
||||
moreButton.menu = UIMenu(title: "", image: nil, identifier: nil, options: [], children: delegate?.actionsForProfile(accountID: accountID, source: .view(moreButton), fetchRelationship: false) ?? [])
|
||||
|
@ -294,44 +290,6 @@ class ProfileHeaderView: UIView {
|
|||
avatarContainerView.layer.cornerRadius = Preferences.shared.avatarStyle.cornerRadius(for: avatarContainerView)
|
||||
avatarImageView.layer.cornerRadius = Preferences.shared.avatarStyle.cornerRadius(for: avatarImageView)
|
||||
displayNameLabel.updateForAccountDisplayName(account: account)
|
||||
|
||||
if isGrayscale != Preferences.shared.grayscaleImages {
|
||||
isGrayscale = Preferences.shared.grayscaleImages
|
||||
imagesTask?.cancel()
|
||||
let avatar = account.avatar
|
||||
let header = account.header
|
||||
imagesTask = Task {
|
||||
await updateImages(avatar: avatar, header: header)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private nonisolated func updateImages(avatar: URL?, header: URL?) async {
|
||||
await withTaskGroup(of: Void.self) { group in
|
||||
group.addTask {
|
||||
guard let avatar,
|
||||
let image = await ImageCache.avatars.get(avatar, loadOriginal: true).1,
|
||||
let transformedImage = await ImageGrayscalifier.convertIfNecessary(url: avatar, image: image),
|
||||
!Task.isCancelled else {
|
||||
return
|
||||
}
|
||||
await MainActor.run {
|
||||
self.avatarImageView.image = transformedImage
|
||||
}
|
||||
}
|
||||
group.addTask {
|
||||
guard let header,
|
||||
let image = await ImageCache.avatars.get(header, loadOriginal: true).1,
|
||||
let transformedImage = await ImageGrayscalifier.convertIfNecessary(url: header, image: image),
|
||||
!Task.isCancelled else {
|
||||
return
|
||||
}
|
||||
await MainActor.run {
|
||||
self.headerImageView.image = transformedImage
|
||||
}
|
||||
}
|
||||
await group.waitForAll()
|
||||
}
|
||||
}
|
||||
|
||||
private func formatBigNumber(_ value: Int) -> (String, String) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
|
@ -14,7 +14,7 @@
|
|||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="iN0-l3-epB" customClass="ProfileHeaderView" customModule="Tusker" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="dgG-dR-lSv">
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="dgG-dR-lSv" customClass="CachedImageView" customModule="Tusker" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="48" width="414" height="150"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="150" id="aCE-CA-XWm"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wT9-2J-uSY">
|
||||
<rect key="frame" x="16" y="138" width="120" height="120"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="TkY-oK-if4">
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="TkY-oK-if4" customClass="CachedImageView" customModule="Tusker" customModuleProvider="target">
|
||||
<rect key="frame" x="2" y="2" width="116" height="116"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="116" id="eDg-Vc-o8R"/>
|
||||
|
|
|
@ -640,7 +640,7 @@ extension ConversationMainStatusCollectionViewCell: UIPointerInteractionDelegate
|
|||
return defaultRegion
|
||||
} else if let button = interaction.view as? UIButton,
|
||||
actionButtons.contains(button) {
|
||||
var rect = button.convert(button.imageView!.bounds, to: button.imageView!)
|
||||
var rect = button.convert(button.imageView!.bounds, from: button.imageView!)
|
||||
rect = rect.insetBy(dx: -24, dy: -24)
|
||||
return UIPointerRegion(rect: rect)
|
||||
}
|
||||
|
@ -654,8 +654,8 @@ extension ConversationMainStatusCollectionViewCell: UIPointerInteractionDelegate
|
|||
} else if let button = interaction.view as? UIButton,
|
||||
actionButtons.contains(button) {
|
||||
let preview = UITargetedPreview(view: button.imageView!)
|
||||
var rect = button.convert(button.imageView!.bounds, to: button.imageView!)
|
||||
rect = rect.insetBy(dx: -24, dy: -24)
|
||||
var rect = button.convert(button.imageView!.bounds, from: button.imageView!)
|
||||
rect = rect.insetBy(dx: -8, dy: -8)
|
||||
return UIPointerStyle(effect: .highlight(preview), shape: .roundedRect(rect))
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
// Configuration settings file format documentation can be found at:
|
||||
// https://help.apple.com/xcode/#/dev745c5c974
|
||||
|
||||
MARKETING_VERSION = 2024.2
|
||||
CURRENT_PROJECT_VERSION = 122
|
||||
MARKETING_VERSION = 2024.3
|
||||
CURRENT_PROJECT_VERSION = 126
|
||||
CURRENT_PROJECT_VERSION = $(inherited)$(CURRENT_PROJECT_VERSION_BUILD_SUFFIX_$(CONFIGURATION))
|
||||
|
||||
CURRENT_PROJECT_VERSION_BUILD_SUFFIX_Debug=-dev
|
||||
|
|
Loading…
Reference in New Issue