Skip to content

Commit e3fca00

Browse files
authored
Merge pull request #174 from makinosp/develop
Develop
2 parents cd6b883 + 1783f10 commit e3fca00

File tree

16 files changed

+302
-169
lines changed

16 files changed

+302
-169
lines changed

Harmonie.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

harmonie/Components/IconSet.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
//
77

88
enum IconSet {
9+
static var at: some Iconizable {
10+
Icon("at")
11+
}
12+
static var calendar: some Iconizable {
13+
Icon("calendar")
14+
}
915
static var check: some Iconizable {
1016
Icon("checkmark")
1117
}
@@ -81,6 +87,9 @@ enum IconSet {
8187
static var social: some Iconizable {
8288
Icon("person.3.fill")
8389
}
90+
static var stopwatch: some Iconizable {
91+
Icon("stopwatch")
92+
}
8493
static var unfriend: some Iconizable {
8594
Icon("person.fill.xmark")
8695
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//
2+
// PresentationDetent+small.swift
3+
// Harmonie
4+
//
5+
// Created by makinosp on 2024/10/24.
6+
//
7+
8+
import SwiftUI
9+
10+
extension PresentationDetent {
11+
static let small = Self.fraction(1/3)
12+
}

harmonie/Models/SortType.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,14 @@ extension SortType: CustomStringConvertible {
3131
}
3232
}
3333
}
34+
35+
extension SortType {
36+
var icon: Iconizable {
37+
switch self {
38+
case .latest, .oldest: IconSet.stopwatch
39+
case .name: IconSet.at
40+
case .loginLatest, .loginOldest: IconSet.calendar
41+
case .status: IconSet.circleFilled
42+
}
43+
}
44+
}

harmonie/Previews/Friend.swift

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
//
2+
// Friend.swift
3+
// Harmonie
4+
//
5+
// Created by makinosp on 2024/10/21.
6+
//
7+
8+
import Foundation
9+
import VRCKit
10+
11+
extension PreviewDataProvider {
12+
typealias FriendSet = (friend: Friend, userDetail: UserDetail)
13+
14+
var onlineFriends: [Friend] {
15+
friends.filter { $0.status != .offline }
16+
}
17+
18+
var offlineFriends: [Friend] {
19+
friends.filter { $0.status == .offline }
20+
}
21+
22+
static func friend(id: UUID, location: Location, status: UserStatus) -> Friend {
23+
Friend(id: id, location: location, status: status)
24+
}
25+
26+
static var friend: Friend {
27+
Friend(id: UUID(), location: .offline, status: .offline)
28+
}
29+
30+
static func friendSet(
31+
id: UUID,
32+
location: Location,
33+
status: UserStatus
34+
) -> FriendSet {
35+
(
36+
Friend(
37+
id: id,
38+
location: location,
39+
status: status
40+
),
41+
PreviewDataProvider.userDetail(
42+
id: id,
43+
location: location,
44+
state: status == .offline ? .offline : .active,
45+
status: status
46+
)
47+
)
48+
}
49+
}
50+
51+
private extension Friend {
52+
init(
53+
id: UUID,
54+
displayName: String = PreviewString.Name.randomValue,
55+
location: Location,
56+
status: UserStatus
57+
) {
58+
self.init(
59+
bio: "Biography",
60+
bioLinks: SafeDecodingArray(),
61+
avatarImageUrl: PreviewDataProvider.iconImageUrl,
62+
avatarThumbnailUrl: PreviewDataProvider.iconImageUrl,
63+
displayName: displayName,
64+
id: "usr_\(id.uuidString)",
65+
isFriend: true,
66+
lastLogin: Date(),
67+
lastPlatform: "standalonewindows",
68+
platform: .blank,
69+
profilePicOverride: PreviewDataProvider.iconImageUrl,
70+
status: status,
71+
statusDescription: "",
72+
tags: UserTags(),
73+
userIcon: PreviewDataProvider.iconImageUrl,
74+
location: location,
75+
friendKey: ""
76+
)
77+
}
78+
}

harmonie/Previews/Instance.swift

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//
2+
// Instance.swift
3+
// Harmonie
4+
//
5+
// Created by makinosp on 2024/10/21.
6+
//
7+
8+
import Foundation
9+
import VRCKit
10+
11+
extension PreviewDataProvider {
12+
static func instance(worldId: UUID, instanceId: Int) -> Instance {
13+
Instance(worldId: worldId, instanceId: instanceId)
14+
}
15+
16+
static func instance() -> Instance {
17+
Instance(worldId: UUID(), instanceId: 0)
18+
}
19+
}
20+
21+
private extension Instance {
22+
init(worldId: UUID, instanceId: Int) {
23+
self.init(
24+
active: true,
25+
capacity: 32,
26+
full: false,
27+
groupAccessType: nil,
28+
id: "wrld_\(worldId):\(instanceId)",
29+
instanceId: instanceId.description,
30+
location: .id("wrld_\(worldId.uuidString)"),
31+
name: "DummyInstance_\(instanceId)",
32+
ownerId: "usr_\(UUID().uuidString)",
33+
permanent: false,
34+
platforms: Platforms(),
35+
recommendedCapacity: 32,
36+
region: Region.allCases.randomElement() ?? .us,
37+
tags: [],
38+
type: [.public, .friends].randomElement() ?? .public,
39+
userCount: 0,
40+
world: PreviewDataProvider.generateWorld(worldId: worldId)
41+
)
42+
}
43+
}

harmonie/Previews/PreviewContainer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ extension PreviewContainer where Content: View {
4545
}
4646

4747
init(@ViewBuilder content: (_ user: UserDetail) -> Content) {
48-
let userDetail = PreviewDataProvider.generateUserDetail(
48+
let userDetail = PreviewDataProvider.userDetail(
4949
id: UUID(),
5050
location: .private,
5151
state: .active,

0 commit comments

Comments
 (0)