Skip to content

Commit a208511

Browse files
authored
Merge pull request #179 from makinosp/develop
update: bump up to 0.9.6
2 parents 9b3605c + c4a9524 commit a208511

File tree

12 files changed

+140
-63
lines changed

12 files changed

+140
-63
lines changed

Harmonie.xcodeproj/project.pbxproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@
237237
en,
238238
ja,
239239
"zh-Hans",
240+
Base,
240241
);
241242
mainGroup = 20395D882B945CD700003921;
242243
packageReferences = (
@@ -473,7 +474,7 @@
473474
"$(inherited)",
474475
"@executable_path/Frameworks",
475476
);
476-
MARKETING_VERSION = 0.9.5;
477+
MARKETING_VERSION = 0.9.6;
477478
PRODUCT_BUNDLE_IDENTIFIER = jp.mknn.harmonie;
478479
PRODUCT_NAME = "$(TARGET_NAME)";
479480
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -509,7 +510,7 @@
509510
"$(inherited)",
510511
"@executable_path/Frameworks",
511512
);
512-
MARKETING_VERSION = 0.9.5;
513+
MARKETING_VERSION = 0.9.6;
513514
PRODUCT_BUNDLE_IDENTIFIER = jp.mknn.harmonie;
514515
PRODUCT_NAME = "$(TARGET_NAME)";
515516
SWIFT_EMIT_LOC_STRINGS = YES;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//
2+
// FavoriteType+LocalizedStringKey.swift
3+
// Harmonie
4+
//
5+
// Created by makinosp on 2024/10/30.
6+
//
7+
8+
import VRCKit
9+
import SwiftUICore
10+
11+
extension FavoriteType {
12+
var localizedStringKey: LocalizedStringKey {
13+
switch self {
14+
case .world:
15+
LocalizedStringKey("World")
16+
case .avatar:
17+
LocalizedStringKey("Avatar")
18+
case .friend:
19+
LocalizedStringKey("Friend")
20+
}
21+
}
22+
}

harmonie/Localization/Localizable.xcstrings

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,22 @@
143143
}
144144
}
145145
},
146+
"Avatar" : {
147+
"localizations" : {
148+
"ja" : {
149+
"stringUnit" : {
150+
"state" : "translated",
151+
"value" : "アバター"
152+
}
153+
},
154+
"zh-Hans" : {
155+
"stringUnit" : {
156+
"state" : "translated",
157+
"value" : "模型"
158+
}
159+
}
160+
}
161+
},
146162
"Build" : {
147163
"localizations" : {
148164
"ja" : {
@@ -223,22 +239,6 @@
223239
}
224240
}
225241
},
226-
"Code" : {
227-
"localizations" : {
228-
"ja" : {
229-
"stringUnit" : {
230-
"state" : "translated",
231-
"value" : "コード"
232-
}
233-
},
234-
"zh-Hans" : {
235-
"stringUnit" : {
236-
"state" : "translated",
237-
"value" : "代码"
238-
}
239-
}
240-
}
241-
},
242242
"Confirm" : {
243243
"localizations" : {
244244
"ja" : {
@@ -544,6 +544,22 @@
544544
}
545545
}
546546
},
547+
"Friend" : {
548+
"localizations" : {
549+
"ja" : {
550+
"stringUnit" : {
551+
"state" : "translated",
552+
"value" : "フレンド"
553+
}
554+
},
555+
"zh-Hans" : {
556+
"stringUnit" : {
557+
"state" : "translated",
558+
"value" : "好友"
559+
}
560+
}
561+
}
562+
},
547563
"Friend Locations" : {
548564
"localizations" : {
549565
"ja" : {

harmonie/Models/InstanceLocationModel.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,17 @@ import VRCKit
99

1010
struct InstanceLocation: Hashable {
1111
let location: FriendsLocation
12-
let instance: Instance
12+
let instance: Instance?
1313
}
1414

1515
extension InstanceLocation: Identifiable {
1616
var id: Int { hashValue }
1717
}
18+
19+
extension InstanceLocation {
20+
/// Initialize as private instance
21+
init(friends: [Friend]) {
22+
let location = FriendsLocation(location: .private, friends: friends)
23+
self.init(location: location, instance: nil)
24+
}
25+
}

harmonie/Views/Authentication/OtpView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ struct OtpView: View {
1818
Text("Two-step verification")
1919
.font(.headline)
2020
VStack {
21-
TextField("Code", text: $code)
21+
TextField(text: $code) { Text(verbatim: "000000") }
2222
.multilineTextAlignment(TextAlignment.center)
2323
.keyboardType(.decimalPad)
2424
.textFieldStyle(.roundedBorder)

harmonie/Views/Location/LocationCardView.swift

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,22 @@ struct LocationCardView: View {
1818
let location: FriendsLocation
1919

2020
var body: some View {
21-
Group {
22-
if isFailure {
23-
EmptyView()
24-
} else {
25-
locationCardContent(instance: instance ?? PreviewDataProvider.instance())
26-
}
27-
}
28-
.redacted(reason: isRequesting ? .placeholder : [])
29-
.task {
30-
if case let .id(id) = location.location {
31-
do {
32-
defer { withAnimation { isRequesting = false } }
33-
let service = appVM.services.instanceService
34-
instance = try await service.fetchInstance(location: id)
35-
} catch {
36-
isFailure = true
21+
if isFailure {
22+
EmptyView()
23+
} else {
24+
locationCardContent(instance: instance ?? PreviewDataProvider.instance())
25+
.redacted(reason: isRequesting ? .placeholder : [])
26+
.task {
27+
if case let .id(id) = location.location {
28+
do {
29+
defer { withAnimation { isRequesting = false } }
30+
let service = appVM.services.instanceService
31+
instance = try await service.fetchInstance(location: id)
32+
} catch {
33+
isFailure = true
34+
}
35+
}
3736
}
38-
}
3937
}
4038
}
4139

harmonie/Views/Location/LocationDetailView.swift

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@ import VRCKit
1212

1313
@MemberwiseInit
1414
struct LocationDetailView: View {
15-
@InitWrapper(.internal, type: Binding<SegmentIdSelection?>)
15+
@InitWrapper(.internal, label: "_", type: Binding<SegmentIdSelection?>)
1616
@Binding private var selection: SegmentIdSelection?
17-
@Init(.internal) private let instanceLocation: InstanceLocation
18-
19-
private var location: FriendsLocation { instanceLocation.location }
20-
private var instance: Instance { instanceLocation.instance }
17+
@Init(.internal) private let location: FriendsLocation
18+
@Init(.internal) private let instance: Instance
2119

2220
private typealias InformationItem = (title: String, value: String)
2321
private var information: [InformationItem] {
@@ -62,17 +60,6 @@ struct LocationDetailView: View {
6260
.navigationBarTitleDisplayMode(.inline)
6361
}
6462

65-
private var bottomBar: some View {
66-
VStack(alignment: .leading) {
67-
Text(instance.world.name)
68-
.font(.headline)
69-
}
70-
.frame(maxWidth: .infinity, alignment: .leading)
71-
.padding(.vertical, 8)
72-
.padding(.horizontal, 12)
73-
.foregroundStyle(Color.white)
74-
}
75-
7663
private var friendList: ForEach<[Friend], Friend.ID, some View> {
7764
ForEach(location.friends) { friend in
7865
NavigationLabel {

harmonie/Views/Location/LocationsView.swift

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ struct LocationsView: View {
1313
@Environment(FriendViewModel.self) var friendVM
1414
@State private var columnVisibility: NavigationSplitViewVisibility = .all
1515
@State private var selectedInstance: InstanceLocation?
16+
@State private var isSelectedPrivate = false
1617
@State private var selection: SegmentIdSelection?
1718

1819
var body: some View {
@@ -53,11 +54,11 @@ struct LocationsView: View {
5354

5455
private var content: some View {
5556
Group {
56-
if let selectedInstance = selectedInstance {
57-
LocationDetailView(
58-
selection: $selection,
59-
instanceLocation: selectedInstance
60-
)
57+
if let location = selectedInstance?.location,
58+
let instance = selectedInstance?.instance {
59+
LocationDetailView($selection, location: location, instance: instance)
60+
} else if let instance = selectedInstance, instance.location.location == .private {
61+
PrivateLocationView($selection, friends: instance.location.friends)
6162
}
6263
}
6364
.overlay {
@@ -96,7 +97,7 @@ struct LocationsView: View {
9697
.setColumn()
9798
}
9899

99-
@ViewBuilder private var friendLocations: some View {
100+
private var friendLocations: some View {
100101
Section {
101102
if friendVM.isFetchingAllFriends {
102103
ForEach(0...7, id: \.self) { _ in
@@ -143,6 +144,7 @@ struct LocationsView: View {
143144
}
144145
.padding(.top, 4)
145146
}
147+
.tag(InstanceLocation(friends: friendVM.friendsInPrivate))
146148
}
147149
}
148150
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//
2+
// PrivateLocationView.swift
3+
// Harmonie
4+
//
5+
// Created by makinosp on 2024/10/30.
6+
//
7+
8+
import MemberwiseInit
9+
import SwiftUI
10+
import VRCKit
11+
12+
@MemberwiseInit
13+
struct PrivateLocationView: View {
14+
@InitWrapper(.internal, label: "_", type: Binding<SegmentIdSelection?>)
15+
@Binding private var selection: SegmentIdSelection?
16+
@Init(.internal) private let friends: [Friend]
17+
18+
var body: some View {
19+
List(selection: $selection) {
20+
Section("Friends") {
21+
ForEach(friends) { friend in
22+
NavigationLabel {
23+
Label {
24+
Text(friend.displayName)
25+
} icon: {
26+
UserIcon(user: friend, size: Constants.IconSize.thumbnail)
27+
}
28+
}
29+
.tag(SegmentIdSelection(friendId: friend.id))
30+
}
31+
}
32+
}
33+
.listStyle(.insetGrouped)
34+
.navigationTitle("Private")
35+
.navigationBarTitleDisplayMode(.inline)
36+
}
37+
}

harmonie/Views/Setting/FavoriteGroups/FavoriteGroupsEditView.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ struct FavoriteGroupsEditView: View {
1212
@Environment(AppViewModel.self) var appVM
1313
@Environment(FavoriteViewModel.self) var favoriteVM
1414
@Environment(\.dismiss) private var dismiss
15+
@FocusState var isFocusedTextField
1516
@State private var displayName: String
1617
@State private var visibility: FavoriteGroup.Visibility
1718
@State private var isRequesting = false
@@ -28,10 +29,14 @@ struct FavoriteGroupsEditView: View {
2829
Form {
2930
Section("Display Name") {
3031
TextField("", text: $displayName)
32+
.focused($isFocusedTextField)
3133
}
3234
}
3335
.toolbar { toolbarItems }
3436
}
37+
.task {
38+
isFocusedTextField = true
39+
}
3540
}
3641

3742
@ToolbarContentBuilder var toolbarItems: some ToolbarContent {

0 commit comments

Comments
 (0)