Skip to content

Commit 1783f10

Browse files
authored
Merge pull request #173 from makinosp/feature/improvement-preview-data
feat: improvement preview data
2 parents fe8f315 + 7510894 commit 1783f10

File tree

3 files changed

+36
-30
lines changed

3 files changed

+36
-30
lines changed

harmonie/Previews/PreviewDataProvider.swift

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ final class PreviewDataProvider: Sendable {
1515
let userDetails: [UserDetail]
1616
let instances: [Instance]
1717

18-
static let iconImageUrl = URL(string: "https://www.mediafire.com/convkey/f444/fmivuoxwvdvnucx9g.jpg")
18+
static let iconImageUrl = URL(string: "https://www.mediafire.com/convkey/e2dd/ksfjh96ukjtwhuczg.jpg")
1919

2020
private init() {
2121
let instance = Self.instance(worldId: UUID(), instanceId: 0)
@@ -52,7 +52,7 @@ final class PreviewDataProvider: Sendable {
5252
avatarImageUrl: PreviewDataProvider.iconImageUrl,
5353
avatarThumbnailUrl: PreviewDataProvider.iconImageUrl,
5454
dateJoined: Date(),
55-
displayName: "usr_\(previewUserId.uuidString.prefix(8))",
55+
displayName: "Demo User",
5656
friendKey: "",
5757
friends: friends.map(\.id),
5858
homeLocation: "",
@@ -73,17 +73,23 @@ final class PreviewDataProvider: Sendable {
7373
userIcon: PreviewDataProvider.iconImageUrl,
7474
userLanguage: nil,
7575
userLanguageCode: nil,
76-
presence: Presence(
77-
groups: [],
78-
id: UUID().uuidString,
79-
instance: "",
80-
instanceType: "",
81-
platform: .android,
82-
status: .active,
83-
travelingToInstance: "",
84-
travelingToWorld: "",
85-
world: ""
86-
)
76+
presence: Presence()
77+
)
78+
}
79+
}
80+
81+
private extension Presence {
82+
init() {
83+
self.init(
84+
groups: [],
85+
id: UUID().uuidString,
86+
instance: "",
87+
instanceType: "",
88+
platform: .android,
89+
status: .active,
90+
travelingToInstance: "",
91+
travelingToWorld: "",
92+
world: ""
8793
)
8894
}
8995
}

harmonie/Previews/PreviewString.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ enum PreviewString {
1010
case emma
1111
case josh
1212
case clarke
13+
case nathalie
1314
}
1415
}
1516

harmonie/Previews/Services/FavoritePreviewService.swift

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,27 @@
66
//
77

88
import Foundation
9+
import MemberwiseInit
910
import VRCKit
1011

12+
@MemberwiseInit
1113
final actor FavoritePreviewService: APIService, FavoriteServiceProtocol {
1214
let client: APIClient
1315

14-
init(client: APIClient) {
15-
self.client = client
16-
}
17-
1816
func listFavoriteGroups() async throws -> [FavoriteGroup] {
19-
[
20-
FavoriteGroup(
21-
id: "fvgrp_\(UUID().uuidString)",
22-
displayName: "DemoGroup",
23-
name: "group_1",
24-
ownerId: PreviewDataProvider.shared.previewUser.id,
25-
tags: [],
26-
type: .friend,
27-
visibility: .private
28-
)
29-
]
17+
FavoriteType.allCases.flatMap { type in
18+
(1...3).map { index in
19+
FavoriteGroup(
20+
id: "fvgrp_\(UUID().uuidString)",
21+
displayName: "\(type.rawValue.capitalized) Group \(index)",
22+
name: "group_\(index)",
23+
ownerId: PreviewDataProvider.shared.previewUser.id,
24+
tags: [],
25+
type: type,
26+
visibility: .private
27+
)
28+
}
29+
}
3030
}
3131

3232
func listFavorites(type: FavoriteType) async throws -> [Favorite] {
@@ -35,8 +35,7 @@ final actor FavoritePreviewService: APIService, FavoriteServiceProtocol {
3535
PreviewDataProvider.shared.onlineFriends.prefix(5).map { friend in
3636
Favorite(id: UUID().uuidString, favoriteId: friend.id, tags: ["group_1"], type: .friend)
3737
}
38-
default:
39-
[]
38+
default: []
4039
}
4140
}
4241

0 commit comments

Comments
 (0)