Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Oct 13, 2024
1 parent 65f01a2 commit b49c394
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion ApplicationLibrary/Views/Abstract/ShareButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public struct ShareButtonCompat<Label>: View where Label: View {
#if os(iOS)
private nonisolated func shareItem0() async {
do {
let shareItem = try itemURL()
let shareItem = try await itemURL()
await MainActor.run {
shareItem1(shareItem)
}
Expand Down
2 changes: 1 addition & 1 deletion ApplicationLibrary/Views/Groups/GroupItemView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public struct GroupItemView: View {
do {
try await LibboxNewStandaloneCommandClient()!.selectOutbound(group.tag, outboundTag: item.tag)
var newGroup = await group
newGroup.selected = item.tag
newGroup.selected = await item.tag
await MainActor.run { [newGroup] in
_group.wrappedValue = newGroup
}
Expand Down
2 changes: 1 addition & 1 deletion ApplicationLibrary/Views/Profile/EditProfileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public struct EditProfileView: View {
do {
_ = try await ProfileManager.update(profile)
#if os(iOS) || os(tvOS)
try await UIProfileUpdateTask.configure()
try UIProfileUpdateTask.configure()
#else
try await ProfileUpdateTask.configure()
#endif
Expand Down
2 changes: 1 addition & 1 deletion ApplicationLibrary/Views/Profile/NewProfileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public struct NewProfileView: View {
))
if profileType == .remote {
#if os(iOS) || os(tvOS)
try await UIProfileUpdateTask.configure()
try UIProfileUpdateTask.configure()
#else
try await ProfileUpdateTask.configure()
#endif
Expand Down
17 changes: 11 additions & 6 deletions ApplicationLibrary/Views/Setting/CoreView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Libbox
import Library
import SwiftUI

@MainActor
public struct CoreView: View {
@State private var isLoading = true

Expand Down Expand Up @@ -51,13 +52,17 @@ public struct CoreView: View {

private nonisolated func loadSettings() async {
if ApplicationLibrary.inPreview {
version = "<redacted>"
dataSize = LibboxFormatBytes(1000 * 1000 * 10)
isLoading = false
await MainActor.run {
version = "<redacted>"
dataSize = LibboxFormatBytes(1000 * 1000 * 10)
isLoading = false
}
} else {
version = LibboxVersion()
dataSize = "Loading..."
isLoading = false
await MainActor.run {
version = LibboxVersion()
dataSize = "Loading..."
isLoading = false
}
await loadSettingsBackground()
}
}
Expand Down
10 changes: 7 additions & 3 deletions Library/Network/CommandClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,12 @@ public class CommandClient: ObservableObject {
}

private func initializeConnectionFilterState() async {
connectionStateFilter = await .init(rawValue: SharedPreferences.connectionStateFilter.get()) ?? .all
connectionSort = await .init(rawValue: SharedPreferences.connectionSort.get()) ?? .byDate
let newFilter: ConnectionStateFilter = await .init(rawValue: SharedPreferences.connectionStateFilter.get()) ?? .active
let newSort: ConnectionSort = await .init(rawValue: SharedPreferences.connectionSort.get()) ?? .byDate
await MainActor.run {
connectionStateFilter = newFilter
connectionSort = newSort
}
}

private nonisolated func connect0() async {
Expand All @@ -111,7 +115,7 @@ public class CommandClient: ObservableObject {
case .log:
clientOptions.statusInterval = Int64(500 * NSEC_PER_MSEC)
default:
clientOptions.statusInterval = Int64(2 * NSEC_PER_SEC)
clientOptions.statusInterval = Int64(NSEC_PER_SEC)
}
let client = LibboxNewCommandClient(clientHandler(self), clientOptions)!
do {
Expand Down

0 comments on commit b49c394

Please sign in to comment.