Skip to content

Commit

Permalink
Merge branch 'refact' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
makinosp committed Nov 15, 2024
2 parents a0ab3b2 + d2b84af commit a162696
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 80 deletions.
86 changes: 45 additions & 41 deletions harmonie/Views/Setting/Profile/ProfileEditView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,60 +86,64 @@ struct ProfileEditView: View {
}
}

@ViewBuilder private var languageSection: some View {
Section("Language") {
ForEach(profileEditVM.editingUserInfo.tags.languageTags) { tag in
Text(tag.description)
.swipeActions {
Button(role: .destructive) {
profileEditVM.removeTag(tag)
} label: {
Text("Delete")
private var languageSection: some View {
Group {
Section("Language") {
ForEach(profileEditVM.editingUserInfo.tags.languageTags) { tag in
Text(tag.description)
.swipeActions {
Button(role: .destructive) {
profileEditVM.removeTag(tag)
} label: {
Text("Delete")
}
}
}
}
}
}
Section {
Button {
isPresentedLanguagePicker = true
} label: {
Label {
Text("Add")
} icon: {
IconSet.plusCircleFilled.icon.symbolRenderingMode(.multicolor)
Section {
Button {
isPresentedLanguagePicker = true
} label: {
Label {
Text("Add")
} icon: {
IconSet.plusCircleFilled.icon.symbolRenderingMode(.multicolor)
}
}
}
.listSectionSpacing(.compact)
}
.listSectionSpacing(.compact)
}

@ViewBuilder private var bioLinksSection: some View {
Section("Social Links") {
ForEach(profileEditVM.editingUserInfo.bioLinks) { url in
Link(destination: url) {
Label(url.description, systemImage: IconSet.link.systemName)
}
.swipeActions {
Button(role: .destructive) {
profileEditVM.removeUrl(url)
} label: {
Text("Delete")
private var bioLinksSection: some View {
Group {
Section("Social Links") {
ForEach(profileEditVM.editingUserInfo.bioLinks) { url in
Link(destination: url) {
Label(url.description, systemImage: IconSet.link.systemName)
}
.swipeActions {
Button(role: .destructive) {
profileEditVM.removeUrl(url)
} label: {
Text("Delete")
}
}
}
}
}
Section {
Button {
isPresentedURLEditor = true
} label: {
Label {
Text("Add")
} icon: {
IconSet.plusCircleFilled.icon.symbolRenderingMode(.multicolor)
Section {
Button {
isPresentedURLEditor = true
} label: {
Label {
Text("Add")
} icon: {
IconSet.plusCircleFilled.icon.symbolRenderingMode(.multicolor)
}
}
}
.listSectionSpacing(.compact)
}
.listSectionSpacing(.compact)
}

@ToolbarContentBuilder private var toolbarContents: some ToolbarContent {
Expand Down
2 changes: 1 addition & 1 deletion harmonie/Views/Setting/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct SettingsView: View {
}
}

var aboutThisApp: some View {
private var aboutThisApp: some View {
List {
LabeledContent {
Text(BundleUtil.appName)
Expand Down
2 changes: 1 addition & 1 deletion harmonie/Views/UserDetail/NoteEditView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct NoteEditView: View {
}
}

func saveAction() async {
private func saveAction() async {
defer { isRequesting = false }
isRequesting = true
do {
Expand Down
20 changes: 0 additions & 20 deletions harmonie/Views/UserDetail/UserDetailView+Actions.swift

This file was deleted.

24 changes: 12 additions & 12 deletions harmonie/Views/UserDetail/UserDetailView+LocationSection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ import SwiftUI
import VRCKit

extension UserDetailView {
var locationSection: some View {
GroupBox("Location") {
HStack {
SquareURLImage(imageUrl: locationImageUrl)
Text(locationDescription)
.font(.headline)
}
.redacted(reason: isRequesting ? .placeholder : [])
}
.groupBoxStyle(.card)
}

private var locationDescription: String {
if let instance = instance {
instance.world.name
Expand All @@ -36,16 +48,4 @@ extension UserDetailView {
Const.offlineImageUrl
}
}

var locationSection: some View {
GroupBox("Location") {
HStack {
SquareURLImage(imageUrl: locationImageUrl)
Text(locationDescription)
.font(.headline)
}
.redacted(reason: isRequesting ? .placeholder : [])
}
.groupBoxStyle(.card)
}
}
4 changes: 2 additions & 2 deletions harmonie/Views/UserDetail/UserDetailView+OverlayViews.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ extension UserDetailView {
}
}

var status: some View {
private var status: some View {
Label {
Text(statusDescription)
} icon: {
Expand All @@ -61,7 +61,7 @@ extension UserDetailView {
.font(.subheadline)
}

var trustRankLabel: some View {
private var trustRankLabel: some View {
Label {
Text(user.trustRank.description)
} icon: {
Expand Down
13 changes: 12 additions & 1 deletion harmonie/Views/UserDetail/UserDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct UserDetailView: View {
}
}

@ToolbarContentBuilder var toolbar: some ToolbarContent {
@ToolbarContentBuilder private var toolbar: some ToolbarContent {
ToolbarItem { UserDetailToolbarMenu(user: user) }
}

Expand All @@ -76,6 +76,17 @@ struct UserDetailView: View {
activitySection
}
}

private func fetchInstance(id: String) async {
do {
defer { isRequesting = false }
isRequesting = true
let service = appVM.services.instanceService
instance = try await service.fetchInstance(location: id)
} catch {
appVM.handleError(error)
}
}
}

#Preview {
Expand Down
2 changes: 1 addition & 1 deletion harmonie/Views/World/WorldPresentationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import VRCKit
@MemberwiseInit
struct WorldPresentationView: View {
@Environment(AppViewModel.self) var appVM
@State var world: World?
@State private var world: World?
@Init(.internal) private let id: String

var body: some View {
Expand Down
2 changes: 1 addition & 1 deletion harmonie/Views/World/WorldView+Toolbar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ extension WorldView {
}
}

func updateFavoriteAction(world: World, group: FavoriteGroup) async {
private func updateFavoriteAction(world: World, group: FavoriteGroup) async {
isRequesting = true
defer { isRequesting = false }
do {
Expand Down

0 comments on commit a162696

Please sign in to comment.