Skip to content

Commit a1365ed

Browse files
More migrations to Bedrock
1 parent 0129fc4 commit a1365ed

File tree

9 files changed

+28
-80
lines changed

9 files changed

+28
-80
lines changed

Alidade.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MCMaps/Red Window/Extensions/Tab+RedWindowRoute.swift

Lines changed: 0 additions & 17 deletions
This file was deleted.

MCMaps/Red Window/Routing/RedWindowRoute.swift

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
// Created by Marquis Kurt on 16-06-2025.
66
//
77

8+
import BedrockUI
89
import MCMap
910
import SwiftUI
1011

1112
/// An enumeration representing all the available tab routes in the app.
1213
///
1314
/// This routing system works in conjunction with the new designs via Red Window to provide programmatic navigation.
1415
/// Tabs and navigation links should supply this value to enable routing accordingly.
15-
enum RedWindowRoute: Identifiable, Hashable {
16+
enum RedWindowRoute: Identifiable {
1617
/// A unique identifier for the current route.
1718
var id: Self { self }
1819

@@ -52,9 +53,9 @@ extension RedWindowRoute: CaseIterable {
5253
}
5354
}
5455

55-
extension RedWindowRoute {
56+
extension RedWindowRoute: TabRoute {
5657
/// The localized name for the route.
57-
var name: LocalizedStringKey {
58+
var nameKey: LocalizedStringResource {
5859
switch self {
5960
case .map: "Map"
6061
case .worldEdit: "World"
@@ -78,4 +79,12 @@ extension RedWindowRoute {
7879
case .pin: "mappin"
7980
}
8081
}
82+
83+
var name: String {
84+
String(localized: nameKey)
85+
}
86+
87+
var icon: TabRouteIcon {
88+
.system(symbol)
89+
}
8190
}

MCMaps/Red Window/Views/RedWindowContentView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ struct RedWindowContentView: View {
108108
}
109109

110110
TabSection("Library") {
111-
Tab(route: .allPins) {
111+
Tab(route: RedWindowRoute.allPins) {
112112
RedWindowPinLibraryView(file: $file, path: $libraryNavigationPath)
113113
}
114114
.customizationID("app.tab.library.all_pins")

MCMaps/Shared/DocumentLaunchExperience.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ struct DocumentLaunchScene: Scene {
1414

1515
var body: some Scene {
1616
#if os(macOS)
17-
DocumentLaunchView(MCMapsApp.appName, creating: CartographyMapFile(withManifest: .sampleFile)) {
17+
DocumentLaunchView(MCMapsApp.information.name, creating: CartographyMapFile(withManifest: .sampleFile)) {
1818
EmptyView()
1919
} background: {
2020
Image(.packMcmeta)

MCMaps/Shared/Entrypoint.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ struct MCMapsApp: App {
3030
@State private var redWindowEnvironment = RedWindowEnvironment()
3131

3232
init() {
33-
UserDefaults.standard.set(Self.version, forKey: "CFBundleShortVersionString")
34-
UserDefaults.standard.set(Self.buildNumber, forKey: "CFBundleVersion")
33+
UserDefaults.standard.set(Self.information.version, forKey: "CFBundleShortVersionString")
34+
UserDefaults.standard.set(Self.information.buildNumber, forKey: "CFBundleVersion")
3535
UserDefaults.standard.synchronize()
3636
do {
3737
try Tips.configure()
@@ -82,13 +82,13 @@ struct MCMapsApp: App {
8282
.labelsVisibility(.visible)
8383
}
8484
CommandGroup(replacing: .help) {
85-
Link("\(Self.appName) Help", destination: URL(appLink: .help)!)
85+
Link("\(Self.information.name) Help", destination: URL(appLink: .help)!)
8686
Divider()
8787
if let docs = URL(appLink: .docs) {
88-
Link("View \(Self.appName) Documentation", destination: docs)
88+
Link("View \(Self.information.name) Documentation", destination: docs)
8989
}
9090
if let feedback = URL(appLink: .issues) {
91-
Link("Send \(Self.appName) Feedback", destination: feedback)
91+
Link("Send \(Self.information.name) Feedback", destination: feedback)
9292
}
9393
}
9494
CommandGroup(after: .pasteboard) {
@@ -122,12 +122,12 @@ struct MCMapsApp: App {
122122
#if os(macOS)
123123
.commands {
124124
CommandGroup(replacing: .appInfo) {
125-
Button("About \(Self.appName)") {
125+
Button("About \(Self.information.name)") {
126126
openWindow(id: .about)
127127
}
128128
}
129129
CommandGroup(after: .windowArrangement) {
130-
Button("Welcome to \(Self.appName)") {
130+
Button("Welcome to \(Self.information.name)") {
131131
openWindow(id: .launch)
132132
}
133133
.keyboardShortcut("0", modifiers: [.shift, .command])
@@ -159,7 +159,7 @@ struct MCMapsApp: App {
159159
DocumentLaunchScene(proxyMap: $proxyMap)
160160

161161
#if os(macOS)
162-
Window("About \(Self.appName)", id: "about") {
162+
Window("About \(Self.information.name)", id: "about") {
163163
AboutWindowView()
164164
.containerBackground(.thickMaterial, for: .window)
165165
}

MCMaps/Shared/Extensions/MCMapsApp+AppProperties.swift

Lines changed: 0 additions & 30 deletions
This file was deleted.

MCMaps/Shared/Views/AboutWindowView.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Created by Marquis Kurt on 15-03-2025.
66
//
77

8+
import BedrockUI
89
import SwiftUI
910

1011
/// A view for displaying information about the current app.
@@ -18,7 +19,7 @@ struct AboutWindowView: View {
1819
static let paneWidth: Double = 300.0
1920
}
2021
private var version: String {
21-
return String(localized: "v\(MCMapsApp.version) (Build \(MCMapsApp.buildNumber))")
22+
return String(localized: "v\(MCMapsApp.information.version) (Build \(MCMapsApp.information.buildNumber))")
2223
}
2324

2425
@State private var creditsPane: AttributedString?
@@ -31,13 +32,13 @@ struct AboutWindowView: View {
3132
.resizable()
3233
.scaledToFit()
3334
.frame(width: Constants.appIconSize, height: Constants.appIconSize)
34-
Text(MCMapsApp.appName)
35+
Text(MCMapsApp.information.name)
3536
.font(.title)
3637
.bold()
3738
Text(version)
3839
.font(.headline)
3940
.foregroundStyle(.secondary)
40-
Text(MCMapsApp.copyrightString)
41+
Text(MCMapsApp.information.copyrightString)
4142
.foregroundStyle(.tertiary)
4243
.padding(.top, 4)
4344
}

MCMapsTests/Extensions/CGPointTests.swift

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,7 @@ import Testing
1010

1111
@testable import Alidade
1212

13-
struct PointSet {
14-
let source: CGPoint
15-
let destination: CGPoint
16-
}
17-
1813
struct CGPointTests {
19-
@Test(arguments: [
20-
(PointSet(source: .init(x: 1, y: 1), destination: .init(x: 4, y: 5)), 7.0),
21-
(PointSet(source: .init(x: 1, y: 2), destination: .init(x: 3, y: 3)), 3.0),
22-
(PointSet(source: .init(x: 4, y: 2), destination: .init(x: 4, y: 2)), 0.0),
23-
])
24-
func manhattanDistance(points: PointSet, distance: Double) async throws {
25-
let diff = points.source.manhattanDistance(to: points.destination)
26-
#expect(diff == distance)
27-
}
28-
2914
@Test func accessibilityReadout() async throws {
3015
let point = CGPoint(x: 1847, y: 1847)
3116
#expect(point.accessibilityReadout == "1,847, 1,847")

0 commit comments

Comments
 (0)