Skip to content

Commit

Permalink
Fix notification for rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
livid committed Jul 4, 2023
1 parent acdce6f commit 9f66357
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Planet/versioning.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CURRENT_PROJECT_VERSION = 1477
CURRENT_PROJECT_VERSION = 1478
18 changes: 15 additions & 3 deletions PlanetLite/AppSidebarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import SwiftUI
struct AppSidebarView: View {
@StateObject private var ipfsState: IPFSState
@StateObject private var planetStore: PlanetStore

init() {
_ipfsState = StateObject(wrappedValue: IPFSState.shared)
_planetStore = StateObject(wrappedValue: PlanetStore.shared)
Expand All @@ -30,7 +30,7 @@ struct AppSidebarView: View {
}
}
.listStyle(.sidebar)

HStack(spacing: 6) {
Circle()
.frame(width: 11, height: 11, alignment: .center)
Expand All @@ -39,7 +39,7 @@ struct AppSidebarView: View {
.font(.body)

Spacer()

Button {
planetStore.isCreatingPlanet = true
} label: {
Expand Down Expand Up @@ -89,6 +89,18 @@ struct AppSidebarView: View {
PlanetQuickShareView()
.frame(width: .sheetWidth, height: .sheetHeight + 28)
}
.onReceive(NotificationCenter.default.publisher(for: .publishMyPlanet)) {
aNotification in
if let userObject = aNotification.object, let planet = userObject as? MyPlanetModel {
Task(priority: .background) {
do {
try await planet.publish()
} catch {
debugPrint("Failed to publish: \(planet.name) id=\(planet.id)")
}
}
}
}
.frame(minWidth: PlanetUI.WINDOW_SIDEBAR_WIDTH_MIN, idealWidth: PlanetUI.WINDOW_SIDEBAR_WIDTH_MIN, maxWidth: PlanetUI.WINDOW_SIDEBAR_WIDTH_MAX, minHeight: PlanetUI.WINDOW_CONTENT_HEIGHT_MIN, idealHeight: PlanetUI.WINDOW_CONTENT_HEIGHT_MIN, maxHeight: .infinity)
}
}
Expand Down

0 comments on commit 9f66357

Please sign in to comment.