Initial commit
This commit is contained in:
1 parent
d8329bf6ed
commit
d22da0f21a
10 files changed
+150
-117
No files matched your search
+62
@@ -0,0 +1,62 @@
|
|||||||
|
# Xcode
|
||||||
|
#
|
||||||
|
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
|
||||||
|
|
||||||
|
## User settings
|
||||||
|
xcuserdata/
|
||||||
|
|
||||||
|
## Obj-C/Swift specific
|
||||||
|
*.hmap
|
||||||
|
|
||||||
|
## App packaging
|
||||||
|
*.ipa
|
||||||
|
*.dSYM.zip
|
||||||
|
*.dSYM
|
||||||
|
|
||||||
|
## Playgrounds
|
||||||
|
timeline.xctimeline
|
||||||
|
playground.xcworkspace
|
||||||
|
|
||||||
|
# Swift Package Manager
|
||||||
|
#
|
||||||
|
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
|
||||||
|
# Packages/
|
||||||
|
# Package.pins
|
||||||
|
# Package.resolved
|
||||||
|
# *.xcodeproj
|
||||||
|
#
|
||||||
|
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
|
||||||
|
# hence it is not needed unless you have added a package configuration file to your project
|
||||||
|
# .swiftpm
|
||||||
|
|
||||||
|
.build/
|
||||||
|
|
||||||
|
# CocoaPods
|
||||||
|
#
|
||||||
|
# We recommend against adding the Pods directory to your .gitignore. However
|
||||||
|
# you should judge for yourself, the pros and cons are mentioned at:
|
||||||
|
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
||||||
|
#
|
||||||
|
# Pods/
|
||||||
|
#
|
||||||
|
# Add this line if you want to avoid checking in source code from the Xcode workspace
|
||||||
|
# *.xcworkspace
|
||||||
|
|
||||||
|
# Carthage
|
||||||
|
#
|
||||||
|
# Add this line if you want to avoid checking in source code from Carthage dependencies.
|
||||||
|
# Carthage/Checkouts
|
||||||
|
|
||||||
|
Carthage/Build/
|
||||||
|
|
||||||
|
# fastlane
|
||||||
|
#
|
||||||
|
# It is recommended to not store the screenshots in the git repo.
|
||||||
|
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
|
||||||
|
# For more information about the recommended setup visit:
|
||||||
|
# https://docs.fastlane.tools/best-practices/source-control/#source-control
|
||||||
|
|
||||||
|
fastlane/report.xml
|
||||||
|
fastlane/Preview.html
|
||||||
|
fastlane/screenshots/**/*.png
|
||||||
|
fastlane/test_output
|
||||||
@@ -35,16 +35,6 @@
|
|||||||
path = BerryLeaderboards;
|
path = BerryLeaderboards;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
1F7A1CE12DF7A0CD00464EB4 /* BerryLeaderboardsTests */ = {
|
|
||||||
isa = PBXFileSystemSynchronizedRootGroup;
|
|
||||||
path = BerryLeaderboardsTests;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
1F7A1CEB2DF7A0CD00464EB4 /* BerryLeaderboardsUITests */ = {
|
|
||||||
isa = PBXFileSystemSynchronizedRootGroup;
|
|
||||||
path = BerryLeaderboardsUITests;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
/* End PBXFileSystemSynchronizedRootGroup section */
|
/* End PBXFileSystemSynchronizedRootGroup section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@@ -76,8 +66,6 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
1F7A1CD22DF7A0C500464EB4 /* BerryLeaderboards */,
|
1F7A1CD22DF7A0C500464EB4 /* BerryLeaderboards */,
|
||||||
1F7A1CE12DF7A0CD00464EB4 /* BerryLeaderboardsTests */,
|
|
||||||
1F7A1CEB2DF7A0CD00464EB4 /* BerryLeaderboardsUITests */,
|
|
||||||
1F7A1CD12DF7A0C500464EB4 /* Products */,
|
1F7A1CD12DF7A0C500464EB4 /* Products */,
|
||||||
);
|
);
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -130,9 +118,6 @@
|
|||||||
dependencies = (
|
dependencies = (
|
||||||
1F7A1CE02DF7A0CD00464EB4 /* PBXTargetDependency */,
|
1F7A1CE02DF7A0CD00464EB4 /* PBXTargetDependency */,
|
||||||
);
|
);
|
||||||
fileSystemSynchronizedGroups = (
|
|
||||||
1F7A1CE12DF7A0CD00464EB4 /* BerryLeaderboardsTests */,
|
|
||||||
);
|
|
||||||
name = BerryLeaderboardsTests;
|
name = BerryLeaderboardsTests;
|
||||||
packageProductDependencies = (
|
packageProductDependencies = (
|
||||||
);
|
);
|
||||||
@@ -153,9 +138,6 @@
|
|||||||
dependencies = (
|
dependencies = (
|
||||||
1F7A1CEA2DF7A0CD00464EB4 /* PBXTargetDependency */,
|
1F7A1CEA2DF7A0CD00464EB4 /* PBXTargetDependency */,
|
||||||
);
|
);
|
||||||
fileSystemSynchronizedGroups = (
|
|
||||||
1F7A1CEB2DF7A0CD00464EB4 /* BerryLeaderboardsUITests */,
|
|
||||||
);
|
|
||||||
name = BerryLeaderboardsUITests;
|
name = BerryLeaderboardsUITests;
|
||||||
packageProductDependencies = (
|
packageProductDependencies = (
|
||||||
);
|
);
|
||||||
@@ -195,6 +177,8 @@
|
|||||||
);
|
);
|
||||||
mainGroup = 1F7A1CC72DF7A0C500464EB4;
|
mainGroup = 1F7A1CC72DF7A0C500464EB4;
|
||||||
minimizedProjectReferenceProxies = 1;
|
minimizedProjectReferenceProxies = 1;
|
||||||
|
packageReferences = (
|
||||||
|
);
|
||||||
preferredProjectObjectVersion = 77;
|
preferredProjectObjectVersion = 77;
|
||||||
productRefGroup = 1F7A1CD12DF7A0C500464EB4 /* Products */;
|
productRefGroup = 1F7A1CD12DF7A0C500464EB4 /* Products */;
|
||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
@@ -395,6 +379,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
CODE_SIGN_ENTITLEMENTS = BerryLeaderboards/BerryLeaderboards.entitlements;
|
CODE_SIGN_ENTITLEMENTS = BerryLeaderboards/BerryLeaderboards.entitlements;
|
||||||
|
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
@@ -422,6 +407,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
CODE_SIGN_ENTITLEMENTS = BerryLeaderboards/BerryLeaderboards.entitlements;
|
CODE_SIGN_ENTITLEMENTS = BerryLeaderboards/BerryLeaderboards.entitlements;
|
||||||
|
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
|||||||
@@ -6,5 +6,7 @@
|
|||||||
<true/>
|
<true/>
|
||||||
<key>com.apple.security.files.user-selected.read-only</key>
|
<key>com.apple.security.files.user-selected.read-only</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>com.apple.security.network.client</key>
|
||||||
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
@@ -8,17 +8,42 @@
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct ContentView: View {
|
struct ContentView: View {
|
||||||
|
@State private var players: [Player] = []
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack {
|
ZStack {
|
||||||
Image(systemName: "globe")
|
VisualEffectBlur()
|
||||||
.imageScale(.large)
|
.ignoresSafeArea()
|
||||||
.foregroundStyle(.tint)
|
List(players) { player in
|
||||||
Text("Hello, world!")
|
HStack {
|
||||||
|
Text(player.username)
|
||||||
|
Spacer()
|
||||||
|
Text("\(player.score)")
|
||||||
|
.bold()
|
||||||
|
}
|
||||||
|
.padding(.vertical, 4)
|
||||||
|
.listRowBackground(Color.clear)
|
||||||
|
}
|
||||||
|
.background(Color.clear)
|
||||||
|
.scrollContentBackground(.hidden)
|
||||||
|
.task {
|
||||||
|
await loadPlayers()
|
||||||
}
|
}
|
||||||
.padding()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#Preview {
|
func loadPlayers() async {
|
||||||
ContentView()
|
do {
|
||||||
|
players = try await loadLeaderboard()
|
||||||
|
} catch {
|
||||||
|
print("Failed to load leaderboard:", error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func loadLeaderboard() async throws -> [Player] {
|
||||||
|
let url = URL(string: "https://berrydash.lncvrt.xyz/database/getTopPlayersAPI.php")!
|
||||||
|
let (data, _) = try await URLSession.shared.data(from: url)
|
||||||
|
guard let raw = String(data: data, encoding: .utf8) else { return [] }
|
||||||
|
return parseLeaderboard(raw)
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
//
|
||||||
|
// Player.swift
|
||||||
|
// BerryLeaderboards
|
||||||
|
//
|
||||||
|
// Created by Lncvrt on 6/9/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
struct Player: Identifiable {
|
||||||
|
let id = UUID()
|
||||||
|
let username: String
|
||||||
|
let score: Int
|
||||||
|
}
|
||||||
|
|
||||||
|
func parseLeaderboard(_ raw: String) -> [Player] {
|
||||||
|
raw.split(separator: ";").compactMap { entry in
|
||||||
|
let parts = entry.split(separator: ":")
|
||||||
|
guard parts.count == 2,
|
||||||
|
let nameData = Data(base64Encoded: String(parts[0])),
|
||||||
|
let username = String(data: nameData, encoding: .utf8),
|
||||||
|
let score = Int(parts[1]) else { return nil }
|
||||||
|
return Player(username: username, score: score)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
//
|
||||||
|
// VisualEffectBlur.swift
|
||||||
|
// BerryLeaderboards
|
||||||
|
//
|
||||||
|
// Created by Lncvrt on 6/9/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct VisualEffectBlur: NSViewRepresentable {
|
||||||
|
func makeNSView(context: Context) -> NSVisualEffectView {
|
||||||
|
let view = NSVisualEffectView()
|
||||||
|
view.blendingMode = .behindWindow
|
||||||
|
view.material = .underWindowBackground
|
||||||
|
view.state = .active
|
||||||
|
return view
|
||||||
|
}
|
||||||
|
func updateNSView(_ nsView: NSVisualEffectView, context: Context) {}
|
||||||
|
}
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
//
|
|
||||||
// BerryLeaderboardsTests.swift
|
|
||||||
// BerryLeaderboardsTests
|
|
||||||
//
|
|
||||||
// Created by Lncvrt on 6/9/25.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Testing
|
|
||||||
@testable import BerryLeaderboards
|
|
||||||
|
|
||||||
struct BerryLeaderboardsTests {
|
|
||||||
|
|
||||||
@Test func example() async throws {
|
|
||||||
// Write your test here and use APIs like `#expect(...)` to check expected conditions.
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
//
|
|
||||||
// BerryLeaderboardsUITests.swift
|
|
||||||
// BerryLeaderboardsUITests
|
|
||||||
//
|
|
||||||
// Created by Lncvrt on 6/9/25.
|
|
||||||
//
|
|
||||||
|
|
||||||
import XCTest
|
|
||||||
|
|
||||||
final class BerryLeaderboardsUITests: XCTestCase {
|
|
||||||
|
|
||||||
override func setUpWithError() throws {
|
|
||||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
|
||||||
|
|
||||||
// In UI tests it is usually best to stop immediately when a failure occurs.
|
|
||||||
continueAfterFailure = false
|
|
||||||
|
|
||||||
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tearDownWithError() throws {
|
|
||||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
|
||||||
}
|
|
||||||
|
|
||||||
@MainActor
|
|
||||||
func testExample() throws {
|
|
||||||
// UI tests must launch the application that they test.
|
|
||||||
let app = XCUIApplication()
|
|
||||||
app.launch()
|
|
||||||
|
|
||||||
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
|
||||||
}
|
|
||||||
|
|
||||||
@MainActor
|
|
||||||
func testLaunchPerformance() throws {
|
|
||||||
// This measures how long it takes to launch your application.
|
|
||||||
measure(metrics: [XCTApplicationLaunchMetric()]) {
|
|
||||||
XCUIApplication().launch()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
//
|
|
||||||
// BerryLeaderboardsUITestsLaunchTests.swift
|
|
||||||
// BerryLeaderboardsUITests
|
|
||||||
//
|
|
||||||
// Created by Lncvrt on 6/9/25.
|
|
||||||
//
|
|
||||||
|
|
||||||
import XCTest
|
|
||||||
|
|
||||||
final class BerryLeaderboardsUITestsLaunchTests: XCTestCase {
|
|
||||||
|
|
||||||
override class var runsForEachTargetApplicationUIConfiguration: Bool {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
override func setUpWithError() throws {
|
|
||||||
continueAfterFailure = false
|
|
||||||
}
|
|
||||||
|
|
||||||
@MainActor
|
|
||||||
func testLaunch() throws {
|
|
||||||
let app = XCUIApplication()
|
|
||||||
app.launch()
|
|
||||||
|
|
||||||
// Insert steps here to perform after app launch but before taking a screenshot,
|
|
||||||
// such as logging into a test account or navigating somewhere in the app
|
|
||||||
|
|
||||||
let attachment = XCTAttachment(screenshot: app.screenshot())
|
|
||||||
attachment.name = "Launch Screen"
|
|
||||||
attachment.lifetime = .keepAlways
|
|
||||||
add(attachment)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user