Skip to content

Commit

Permalink
Merge pull request #86 from makinosp/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
makinosp authored Aug 24, 2024
2 parents c18f8d9 + cc11b57 commit 8043380
Show file tree
Hide file tree
Showing 10 changed files with 167 additions and 147 deletions.
8 changes: 6 additions & 2 deletions Harmonie.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
20634BC32C760A2D00D57D57 /* ProfileEditView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20634BC22C760A2D00D57D57 /* ProfileEditView.swift */; };
2065F8702C788A59007F132B /* ProfileEditViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2065F86F2C788A59007F132B /* ProfileEditViewModel.swift */; };
206AC9012BFA07AA00E0D5AE /* AsyncSwiftUI in Frameworks */ = {isa = PBXBuildFile; productRef = 206AC9002BFA07AA00E0D5AE /* AsyncSwiftUI */; };
207836FD2C79AB1B00659C91 /* SettingsView+AboutSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 207836FC2C79AB1B00659C91 /* SettingsView+AboutSection.swift */; };
207FC6352C4256E60018E605 /* View+SizeModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 207FC6322C4256E60018E605 /* View+SizeModifier.swift */; };
207FC6362C4256E60018E605 /* View+ErrorAlertModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 207FC6332C4256E60018E605 /* View+ErrorAlertModifier.swift */; };
207FC6372C4256E60018E605 /* View+SectionModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 207FC6342C4256E60018E605 /* View+SectionModifier.swift */; };
Expand Down Expand Up @@ -114,6 +115,7 @@
206088E82C48079900626DDC /* LocationDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationDetailView.swift; sourceTree = "<group>"; };
20634BC22C760A2D00D57D57 /* ProfileEditView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ProfileEditView.swift; path = harmonie/Views/Setting/Profile/ProfileEditView.swift; sourceTree = SOURCE_ROOT; };
2065F86F2C788A59007F132B /* ProfileEditViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ProfileEditViewModel.swift; path = Harmonie/ViewModels/ProfileEditViewModel.swift; sourceTree = SOURCE_ROOT; };
207836FC2C79AB1B00659C91 /* SettingsView+AboutSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "SettingsView+AboutSection.swift"; path = "Harmonie/Views/Setting/SettingsView+AboutSection.swift"; sourceTree = SOURCE_ROOT; };
207FC6322C4256E60018E605 /* View+SizeModifier.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "View+SizeModifier.swift"; sourceTree = "<group>"; };
207FC6332C4256E60018E605 /* View+ErrorAlertModifier.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "View+ErrorAlertModifier.swift"; sourceTree = "<group>"; };
207FC6342C4256E60018E605 /* View+SectionModifier.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "View+SectionModifier.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -316,6 +318,7 @@
children = (
207836FB2C798A8C00659C91 /* Profile */,
205B3BF12C00D51A0097D62A /* SettingsView.swift */,
207836FC2C79AB1B00659C91 /* SettingsView+AboutSection.swift */,
);
path = Setting;
sourceTree = "<group>";
Expand Down Expand Up @@ -533,6 +536,7 @@
20460CAE2C561ED200B276E3 /* UserDetailPresentationView.swift in Sources */,
209A788A2C2FC0FA00BEFAE6 /* FavoriteViewModel.swift in Sources */,
205AA45E2C72E61B008CCC8A /* UserDetailView+Toolbar.swift in Sources */,
207836FD2C79AB1B00659C91 /* SettingsView+AboutSection.swift in Sources */,
20D50FA72C77F94F00F89B4F /* LanguagePickerView.swift in Sources */,
207FC6372C4256E60018E605 /* View+SectionModifier.swift in Sources */,
2099A4582C78326600104842 /* URL+Identifiable.swift in Sources */,
Expand Down Expand Up @@ -743,7 +747,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.3.0;
MARKETING_VERSION = 0.4.0;
PRODUCT_BUNDLE_IDENTIFIER = net.nemushee.harmonie;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down Expand Up @@ -777,7 +781,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.3.0;
MARKETING_VERSION = 0.4.0;
PRODUCT_BUNDLE_IDENTIFIER = net.nemushee.harmonie;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down
22 changes: 15 additions & 7 deletions harmonie/Views/Favorite/FavoritesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,22 @@ struct FavoritesView: View {
Button {
selected = Selected(id: friend.id)
} label: {
HStack {
CircleURLImage(
imageUrl: friend.thumbnailUrl,
size: Constants.IconSize.thumbnail
)
Text(friend.displayName)
Spacer()
LabeledContent {
Constants.Icon.forward
} label: {
Label {
Text(friend.displayName)
} icon: {
ZStack {
Circle()
.foregroundStyle(friend.status.color)
.frame(size: Constants.IconSize.thumbnailOutside)
CircleURLImage(
imageUrl: friend.thumbnailUrl,
size: Constants.IconSize.thumbnail
)
}
}
}
.frame(maxWidth: .infinity, alignment: .leading)
.contentShape(Rectangle())
Expand Down
27 changes: 15 additions & 12 deletions harmonie/Views/Friend/FriendsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,22 @@ struct FriendsView: View {
Button {
selected = Selected(id: friend.id)
} label: {
HStack {
ZStack {
Circle()
.foregroundStyle(friend.status.color)
.frame(size: Constants.IconSize.thumbnailOutside)
CircleURLImage(
imageUrl: friend.thumbnailUrl,
size: Constants.IconSize.thumbnail
)
}
Text(friend.displayName)
Spacer()
LabeledContent {
Constants.Icon.forward
} label: {
Label {
Text(friend.displayName)
} icon: {
ZStack {
Circle()
.foregroundStyle(friend.status.color)
.frame(size: Constants.IconSize.thumbnailOutside)
CircleURLImage(
imageUrl: friend.thumbnailUrl,
size: Constants.IconSize.thumbnail
)
}
}
}
.frame(maxWidth: .infinity, alignment: .leading)
.contentShape(Rectangle())
Expand Down
57 changes: 29 additions & 28 deletions harmonie/Views/Location/LocationCardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,40 +51,41 @@ struct LocationCardView: View {

func locationCardContent(instance: Instance) -> some View {
HStack(alignment: .top) {
VStack(alignment: .leading) {
Text(instance.world.name)
.font(.body)
HStack {
Text(instance.typeDescription)
.font(.footnote)
.foregroundStyle(Color.gray)
Spacer()
Text(personAmount(instance))
.font(.footnote)
.foregroundStyle(Color.gray)
}
ScrollView(.horizontal) {
HStack(spacing: -8) {
ForEach(location.friends) { friend in
ZStack {
Circle()
.foregroundStyle(friend.status.color)
.frame(size: Constants.IconSize.thumbnailOutside)
CircleURLImage(
imageUrl: friend.thumbnailUrl,
size: Constants.IconSize.thumbnail
)
locationThumbnail(instance.world.imageUrl)
Spacer()
HStack {
VStack(alignment: .leading) {
Text(instance.world.name)
.font(.body)
HStack {
Text(instance.typeDescription)
.font(.footnote)
.foregroundStyle(Color.gray)
Text(personAmount(instance))
.font(.footnote)
.foregroundStyle(Color.gray)
}
ScrollView(.horizontal) {
HStack(spacing: -8) {
ForEach(location.friends) { friend in
ZStack {
Circle()
.foregroundStyle(friend.status.color)
.frame(size: Constants.IconSize.thumbnailOutside)
CircleURLImage(
imageUrl: friend.thumbnailUrl,
size: Constants.IconSize.thumbnail
)
}
}
}
}
}
.frame(maxWidth: .infinity, alignment: .leading)
Constants.Icon.forward
}
.padding()
.frame(maxWidth: .infinity, alignment: .leading)
Spacer()
locationThumbnail(instance.world.imageUrl)
.padding()
}
.padding()
}

func personAmount(_ instance: Instance) -> String {
Expand Down
5 changes: 3 additions & 2 deletions harmonie/Views/Location/LocationDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ struct LocationDetailView: View {
var friendList: some View {
ForEach(location.friends) { friend in
NavigationLink(value: Selected(id: friend.id)) {
HStack {
Label {
Text(friend.displayName)
} icon: {
ZStack {
Circle()
.foregroundStyle(friend.status.color)
Expand All @@ -60,7 +62,6 @@ struct LocationDetailView: View {
size: Constants.IconSize.thumbnail
)
}
Text(friend.displayName)
}
.frame(maxWidth: .infinity, alignment: .leading)
.contentShape(Rectangle())
Expand Down
73 changes: 73 additions & 0 deletions harmonie/Views/Setting/SettingsView+AboutSection.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
//
// SettingsView+AboutSection.swift
// Harmonie
//
// Created by makinosp on 2024/08/24.
//

import SwiftUI

extension SettingsView {
var appName: String {
Bundle.main.object(forInfoDictionaryKey: "CFBundleDisplayName") as? String ?? ""
}

var appVersion: String {
Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? ""
}

var aboutSection: some View {
Section("About") {
LabeledContent {
Constants.Icon.forward
} label: {
Button {
destination = .about
} label: {
Label {
Text("About This App")
} icon: {
Image(systemName: "info.circle")
}
}
}
Link(destination: URL(string: "https://github.com/makinosp/harmonie")!) {
Label {
Text("Source Code")
} icon: {
Image(systemName: "curlybraces")
}
}
LabeledContent {
Constants.Icon.forward
} label: {
Button {
destination = .license
} label: {
Label {
Text("Third Party Licence")
} icon: {
Image(systemName: "lightbulb")
}
}
}
}
}

var aboutThisApp: some View {
List {
LabeledContent {
Text(appName)
} label: {
Text("App Name")
}
LabeledContent {
Text(appVersion)
} label: {
Text("App Version")
}
}
.navigationTitle("About")
.navigationBarTitleDisplayMode(.inline)
}
}
47 changes: 8 additions & 39 deletions harmonie/Views/Setting/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,16 @@ struct SettingsView: View {
@State var isPresentedForm = false

enum Destination: Hashable {
case userDetail, license
case userDetail, about, license
}

var body: some View {
NavigationSplitView(columnVisibility: .constant(.all)) {
VStack {
settingsContent
HStack {
Text(appName)
Text(appVersion)
settingsContent
.navigationDestination(item: $destination) { destination in
presentDestination(destination)
}
.font(.footnote)
}
.navigationDestination(item: $destination) { destination in
presentDestination(destination)
}
.navigationTitle("Settings")
.navigationTitle("Settings")
}
.navigationSplitViewStyle(.balanced)
.onAppear {
Expand All @@ -53,6 +46,8 @@ struct SettingsView: View {
if let user = appVM.user {
UserDetailPresentationView(id: user.id)
}
case .about:
aboutThisApp
case .license:
LicenseListView()
}
Expand All @@ -63,25 +58,7 @@ struct SettingsView: View {
if let user = appVM.user {
profileSection(user: user)
}
Section(header: Text("Open Source License Notice")) {
Link(destination: URL(string: "https://github.com/makinosp/harmonie")!) {
Label {
Text("Source Code")
} icon: {
Image(systemName: "curlybraces.square.fill")
}
}
Button {
destination = .license
} label: {
Label {
Text("Third Party Licence")
} icon: {
Image(systemName: "info.circle.fill")
}
}
}
.textCase(nil)
aboutSection
Section {
AsyncButton {
await appVM.logout()
Expand All @@ -97,12 +74,4 @@ struct SettingsView: View {
}
}
}

var appName: String {
Bundle.main.object(forInfoDictionaryKey: "CFBundleDisplayName") as? String ?? ""
}

var appVersion: String {
Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? ""
}
}
14 changes: 0 additions & 14 deletions harmonie/Views/UserDetail/UserDetailView+Actions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,6 @@ extension UserDetailView {
}
}

func saveUserInfo() async {
let service = appVM.isDemoMode
? UserPreviewService(client: appVM.client)
: UserService(client: appVM.client)
do {
try await service.updateUser(
id: user.id,
editedInfo: editingUserInfo
)
} catch {
appVM.handleError(error)
}
}

func saveNote() async {
let service = appVM.isDemoMode
? UserNotePreviewService(client: appVM.client)
Expand Down
2 changes: 1 addition & 1 deletion harmonie/Views/UserDetail/UserDetailView+Toolbar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ extension UserDetailView {
}
}

func favoriteMenuItem(group: FavoriteGroup) -> some View {
private func favoriteMenuItem(group: FavoriteGroup) -> some View {
AsyncButton {
await updateFavorite(friendId: user.id, group: group)
} label: {
Expand Down
Loading

0 comments on commit 8043380

Please sign in to comment.