Skip to content

Commit 2f79675

Browse files
committed
Merge branch 'feature/rebuild-favorite' into develop
2 parents d22bdb7 + b55a752 commit 2f79675

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

Sources/VRCKit/APIServices/FavoriteService.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ import Foundation
1111
// MARK: Favorite API
1212
//
1313

14-
public typealias FavoriteDetail = (favoriteGroupId: String, favorites: [Favorite])
15-
@available(macOS 12.0, *)
16-
@available(iOS 15.0, *)
17-
public typealias FavoriteFriendDetail = (favoriteGroupId: String, friends: [UserDetail])
18-
1914
@available(macOS 12.0, *)
2015
@available(iOS 15.0, *)
2116
public struct FavoriteService {
@@ -60,7 +55,7 @@ public struct FavoriteService {
6055
for favoriteGroup in favoriteGroups.filter({ $0.type == .friend }) {
6156
taskGroup.addTask {
6257
try await FavoriteDetail(
63-
favoriteGroupId: favoriteGroup.id,
58+
id: favoriteGroup.id,
6459
favorites: FavoriteService.listFavorites(
6560
client,
6661
type: .friend,

Sources/VRCKit/Models/FavoriteModel.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ public struct Favorite: Codable, Identifiable {
1818
public let type: FavoriteType
1919
}
2020

21+
public struct FavoriteDetail: Identifiable {
22+
public let id: String
23+
public let favorites: [Favorite]
24+
25+
public func allFavoritesAre(_ type: FavoriteType) -> Bool {
26+
favorites.allSatisfy { $0.type == type }
27+
}
28+
}
29+
2130
public struct FavoriteGroup: Codable, Identifiable {
2231
public let id: String
2332
public let displayName: String

0 commit comments

Comments
 (0)