1
0
mirror of https://github.com/mastodon/mastodon-ios.git synced 2024-12-26 16:55:09 +01:00

Show followed hashtags by default (IOS-37)

This commit is contained in:
Nathan Mattes 2023-03-27 22:57:11 +02:00
parent 24b1602972
commit 48a14bc63c

View File

@ -2,6 +2,7 @@
import Foundation
import Intents
import MastodonSDK
class HashtagIntentHandler: INExtension, HashtagIntentHandling {
func provideHashtagOptionsCollection(for intent: HashtagIntent, searchTerm: String?) async throws -> INObjectCollection<NSString> {
@ -21,11 +22,21 @@ class HashtagIntentHandler: INExtension, HashtagIntentHandling {
.apiService
.search(query: .init(q: searchTerm, type: .hashtags), authenticationBox: authenticationBox)
.value
.hashtags.compactMap { $0.name as NSString }
.hashtags
.compactMap { $0.name as NSString }
results = searchResults
} else {
//TODO: Show hashtags I follow
let followedTags = try await WidgetExtension.appContext.apiService.getFollowedTags(
domain: authenticationBox.domain,
query: Mastodon.API.Account.FollowedTagsQuery(limit: nil),
authenticationBox: authenticationBox)
.value
.compactMap { $0.name as NSString }
results = followedTags
}
return INObjectCollection(items: results)