Skip to content

Commit

Permalink
#10 Remove loading of preconfigured LADV profile
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-lipp committed May 9, 2024
1 parent 390c6c3 commit 587aac4
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 178 deletions.
40 changes: 0 additions & 40 deletions Athlety.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
/* Begin PBXBuildFile section */
E300059C2ADB21EC0072F10F /* ProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E300059B2ADB21EC0072F10F /* ProfileView.swift */; };
E300059E2ADB235D0072F10F /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = E300059D2ADB235D0072F10F /* Localizable.xcstrings */; };
E30005A32ADB25900072F10F /* Profile.swift in Sources */ = {isa = PBXBuildFile; fileRef = E30005A22ADB25900072F10F /* Profile.swift */; };
E30005A62ADB26BA0072F10F /* ProfileClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = E30005A52ADB26BA0072F10F /* ProfileClient.swift */; };
E30005A82ADB271B0072F10F /* LadvProfileClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = E30005A72ADB271B0072F10F /* LadvProfileClient.swift */; };
E30005AB2ADB295D0072F10F /* ProfileViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E30005AA2ADB295D0072F10F /* ProfileViewModel.swift */; };
E30F66072A3354C90066AC01 /* Attachement.swift in Sources */ = {isa = PBXBuildFile; fileRef = E30F66062A3354C90066AC01 /* Attachement.swift */; };
E330221A2A33E10200A998B2 /* EventsListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E33022192A33E10200A998B2 /* EventsListView.swift */; };
E330221D2A33E59700A998B2 /* AttachementView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E330221C2A33E59700A998B2 /* AttachementView.swift */; };
Expand Down Expand Up @@ -54,10 +50,6 @@
/* Begin PBXFileReference section */
E300059B2ADB21EC0072F10F /* ProfileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileView.swift; sourceTree = "<group>"; };
E300059D2ADB235D0072F10F /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = "<group>"; };
E30005A22ADB25900072F10F /* Profile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Profile.swift; sourceTree = "<group>"; };
E30005A52ADB26BA0072F10F /* ProfileClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileClient.swift; sourceTree = "<group>"; };
E30005A72ADB271B0072F10F /* LadvProfileClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LadvProfileClient.swift; sourceTree = "<group>"; };
E30005AA2ADB295D0072F10F /* ProfileViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileViewModel.swift; sourceTree = "<group>"; };
E30F66062A3354C90066AC01 /* Attachement.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Attachement.swift; sourceTree = "<group>"; };
E33022192A33E10200A998B2 /* EventsListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventsListView.swift; sourceTree = "<group>"; };
E330221C2A33E59700A998B2 /* AttachementView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttachementView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -112,22 +104,11 @@
E300059A2ADB21DE0072F10F /* Profile */ = {
isa = PBXGroup;
children = (
E30005A42ADB25B80072F10F /* Clients */,
E300059F2ADB25680072F10F /* Models */,
E30005A02ADB256E0072F10F /* Views */,
E30005A92ADB294E0072F10F /* View Models */,
);
path = Profile;
sourceTree = "<group>";
};
E300059F2ADB25680072F10F /* Models */ = {
isa = PBXGroup;
children = (
E30005A22ADB25900072F10F /* Profile.swift */,
);
path = Models;
sourceTree = "<group>";
};
E30005A02ADB256E0072F10F /* Views */ = {
isa = PBXGroup;
children = (
Expand All @@ -136,23 +117,6 @@
path = Views;
sourceTree = "<group>";
};
E30005A42ADB25B80072F10F /* Clients */ = {
isa = PBXGroup;
children = (
E30005A52ADB26BA0072F10F /* ProfileClient.swift */,
E30005A72ADB271B0072F10F /* LadvProfileClient.swift */,
);
path = Clients;
sourceTree = "<group>";
};
E30005A92ADB294E0072F10F /* View Models */ = {
isa = PBXGroup;
children = (
E30005AA2ADB295D0072F10F /* ProfileViewModel.swift */,
);
path = "View Models";
sourceTree = "<group>";
};
E30F66042A33549D0066AC01 /* Attachements */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -457,9 +421,7 @@
E3FA60BA2BC5D9700058E89C /* EventRegistrationView.swift in Sources */,
E3F0FC8A2A215D6B00CC7274 /* EventDetailsView.swift in Sources */,
E3FA60B62BC5CBC80058E89C /* EventHeaderView.swift in Sources */,
E30005A62ADB26BA0072F10F /* ProfileClient.swift in Sources */,
E30F66072A3354C90066AC01 /* Attachement.swift in Sources */,
E30005AB2ADB295D0072F10F /* ProfileViewModel.swift in Sources */,
E35B03B72A1FD5CE00D25FF4 /* EventsFilterToolbar.swift in Sources */,
E39859B02A1E94C8007027BA /* EventsFilterViewModel.swift in Sources */,
E3496E382A13ECA300104A0B /* EventsViewModel.swift in Sources */,
Expand All @@ -475,7 +437,6 @@
E361DE502AE1EE3A003BB538 /* EventLocationView.swift in Sources */,
E37EC9D42ADF1F6C00F6F4C6 /* EventMapView.swift in Sources */,
E3496E482A142BBC00104A0B /* LadvEventsClient.swift in Sources */,
E30005A32ADB25900072F10F /* Profile.swift in Sources */,
E300059C2ADB21EC0072F10F /* ProfileView.swift in Sources */,
E3F84E832BBF0994009EC9D6 /* CalendarEventEditView.swift in Sources */,
E376DB142A29137C00C53058 /* EventDetailsViewModel.swift in Sources */,
Expand All @@ -484,7 +445,6 @@
E3496E592A17E33500104A0B /* Association.swift in Sources */,
E369D23E2A11DBB500FF2051 /* App.swift in Sources */,
E3496E3D2A13F07200104A0B /* EventsClient.swift in Sources */,
E30005A82ADB271B0072F10F /* LadvProfileClient.swift in Sources */,
E3496E462A1423A400104A0B /* Config.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
3 changes: 0 additions & 3 deletions Athlety/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ struct AthletyApp: App {
@ObservedObject private var eventsFilterStore = EventsFilterStore()
@ObservedObject private var eventsFilterViewModel = EventsFilterViewModel()

@ObservedObject private var profileViewModel = ProfileViewModel()

var body: some Scene {
WindowGroup {
TabView {
Expand All @@ -28,7 +26,6 @@ struct AthletyApp: App {
.environmentObject(eventsFilterViewModel)
.tabItem { Label("Events", systemImage: "trophy") }
ProfileView()
.environmentObject(profileViewModel)
.tabItem { Label("Profile", systemImage: "person")}
}
}
Expand Down
2 changes: 0 additions & 2 deletions Athlety/Config.sample.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
<dict>
<key>LADV</key>
<dict>
<key>ProfileID</key>
<string></string>
<key>APIKey</key>
<string></string>
<key>BaseURL</key>
Expand Down
21 changes: 8 additions & 13 deletions Athlety/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,17 @@ class Config {

let ladvApiKey: String
let ladvBaseUrl: String
let ladvProfileId: Int

private init(ladvApiKey: String, ladvBaseUrl: String, ladvProfileId: Int) {
private init(ladvApiKey: String, ladvBaseUrl: String) {
self.ladvApiKey = ladvApiKey
self.ladvBaseUrl = ladvBaseUrl
self.ladvProfileId = ladvProfileId
}

private static let explanation = "Please refer to the README for more information on how to correctly set up the Config.plist file."

static var shared: Config = {
guard let configPath = Bundle.main.path(forResource: "Config", ofType: "plist") else {
fatalError("A Config.plist file is required within the Athlety directory." +
"Please refer to the README for more information on how to correctly set up the Config.plist file.")
fatalError("A Config.plist file is required within the Athlety directory." + explanation)
}

do {
Expand All @@ -31,19 +30,15 @@ class Config {
guard let config = try PropertyListSerialization.propertyList(from: configData, format: nil) as? [String: Any],
let ladvConfig = config["LADV"] as? [String: Any],
let ladvApiKey = ladvConfig["APIKey"] as? String, !ladvApiKey.isEmpty,
let ladvBaseUrl = ladvConfig["BaseURL"] as? String, !ladvBaseUrl.isEmpty,
let ladvProfileIdString = ladvConfig["ProfileID"] as? String, !ladvProfileIdString.isEmpty,
let ladvProfileId = Int(ladvProfileIdString)
let ladvBaseUrl = ladvConfig["BaseURL"] as? String, !ladvBaseUrl.isEmpty
else {
fatalError("Could not find required keys and values in Config.plist file. " +
"Please refer to the README for more information on how to correctly set up the Config.plist file.")
fatalError("Could not find required keys and values in Config.plist file. " + explanation)
}

return Config(ladvApiKey: ladvApiKey, ladvBaseUrl: ladvBaseUrl, ladvProfileId: ladvProfileId)
return Config(ladvApiKey: ladvApiKey, ladvBaseUrl: ladvBaseUrl)

} catch {
fatalError("Invalid Config.plist file found in Athlety directory." +
"Please refer to the README for more information on how to correctly set up the Config.plist file.")
fatalError("Invalid Config.plist file found in Athlety directory." + explanation)
}
}()
}
26 changes: 10 additions & 16 deletions Athlety/Localizable.xcstrings
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
{
"sourceLanguage" : "en",
"strings" : {
"%@ %@" : {
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "%1$@ %2$@"
}
},
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "%1$@ %2$@"
}
}
}
},
"%@ at %@" : {
"localizations" : {
"de" : {
Expand Down Expand Up @@ -146,6 +130,16 @@
}
}
}
},
"Your Profile" : {
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Dein Profil"
}
}
}
}
},
"version" : "1.0"
Expand Down
49 changes: 0 additions & 49 deletions Athlety/Profile/Clients/LadvProfileClient.swift

This file was deleted.

14 changes: 0 additions & 14 deletions Athlety/Profile/Clients/ProfileClient.swift

This file was deleted.

15 changes: 0 additions & 15 deletions Athlety/Profile/Models/Profile.swift

This file was deleted.

20 changes: 0 additions & 20 deletions Athlety/Profile/View Models/ProfileViewModel.swift

This file was deleted.

9 changes: 5 additions & 4 deletions Athlety/Profile/Views/ProfileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import SwiftUI

struct ProfileView: View {

@EnvironmentObject var viewModel: ProfileViewModel

var body: some View {
Text("\(viewModel.profile?.firstName ?? "") \(viewModel.profile?.lastName ?? "")")
.task { await viewModel.loadProfile(with: Config.shared.ladvProfileId) }
NavigationStack {
Text(verbatim: "")
.navigationTitle("Your Profile")
.navigationBarTitleDisplayMode(.large)
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Athlety

## Introduction
Athlety is an iOS application for track & field athletes and coaches.
Athlety is an iOS application for track & field athletes and coaches in Germany.

## Getting Started
The project setup assumes that there exists a _Config.plist_ file within the _Athlety_ directory,
which includes the base URL and an API key for the public LADV API.
A _Config.sample.plist_ file serves as a reference for this and can be copied or renamed accordingly.
Make sure that you don't forget to enter your own LADV API key and profile ID in the final _Config.plist_ file.
Make sure that you don't forget to enter your own LADV API key in the final _Config.plist_ file.

0 comments on commit 587aac4

Please sign in to comment.