Skip to content

Commit 11e6c9a

Browse files
committed
Cleanup
1 parent cbe1992 commit 11e6c9a

File tree

18 files changed

+149
-193
lines changed

18 files changed

+149
-193
lines changed

RubyEvents.xcodeproj/project.pbxproj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
164164
CODE_SIGN_STYLE = Automatic;
165165
CURRENT_PROJECT_VERSION = 1;
166-
DEVELOPMENT_TEAM = NAQKG42NC3;
166+
DEVELOPMENT_TEAM = 5UY2R75SM3;
167167
GENERATE_INFOPLIST_FILE = YES;
168168
INFOPLIST_FILE = RubyEvents/Info.plist;
169169
INFOPLIST_KEY_CFBundleDisplayName = RubyEvents;
@@ -173,11 +173,12 @@
173173
INFOPLIST_KEY_UIMainStoryboardFile = Main;
174174
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
175175
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
176+
IPHONEOS_DEPLOYMENT_TARGET = 17.6;
176177
LD_RUNPATH_SEARCH_PATHS = (
177178
"$(inherited)",
178179
"@executable_path/Frameworks",
179180
);
180-
MARKETING_VERSION = 1.0;
181+
MARKETING_VERSION = 0.1;
181182
PRODUCT_BUNDLE_IDENTIFIER = org.rubyevents.RubyEvents;
182183
PRODUCT_NAME = "$(TARGET_NAME)";
183184
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -194,7 +195,7 @@
194195
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
195196
CODE_SIGN_STYLE = Automatic;
196197
CURRENT_PROJECT_VERSION = 1;
197-
DEVELOPMENT_TEAM = NAQKG42NC3;
198+
DEVELOPMENT_TEAM = 5UY2R75SM3;
198199
GENERATE_INFOPLIST_FILE = YES;
199200
INFOPLIST_FILE = RubyEvents/Info.plist;
200201
INFOPLIST_KEY_CFBundleDisplayName = RubyEvents;
@@ -204,11 +205,12 @@
204205
INFOPLIST_KEY_UIMainStoryboardFile = Main;
205206
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
206207
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
208+
IPHONEOS_DEPLOYMENT_TARGET = 17.6;
207209
LD_RUNPATH_SEARCH_PATHS = (
208210
"$(inherited)",
209211
"@executable_path/Frameworks",
210212
);
211-
MARKETING_VERSION = 1.0;
213+
MARKETING_VERSION = 0.1;
212214
PRODUCT_BUNDLE_IDENTIFIER = org.rubyevents.RubyEvents;
213215
PRODUCT_NAME = "$(TARGET_NAME)";
214216
SWIFT_EMIT_LOC_STRINGS = YES;

RubyEvents/App.swift

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,81 +11,89 @@ import UIKit
1111

1212
class App {
1313
static var instance = App()
14-
14+
1515
var isTabbed: Bool = true
16-
16+
1717
var sceneDelegate: SceneDelegate?
18-
18+
1919
lazy var navigator = Navigator(delegate: self)
2020
lazy var tabBarController = TabBarController(app: self)
21-
21+
2222
private var currentUnreadMessagesCount: String?
23-
23+
2424
var navigators: [Navigator] {
2525
if isTabbed {
2626
return tabBarController.navigators
2727
}
2828
return [navigator]
2929
}
30-
30+
3131
var viewControllers: [UIViewController] {
3232
navigators.map(\.rootViewController)
3333
}
34-
34+
3535
var window: UIWindow? {
3636
sceneDelegate?.window
3737
}
38-
38+
3939
var isDebug: Bool {
40-
#if DEBUG
41-
return true
42-
#else
43-
return false
44-
#endif
40+
#if DEBUG
41+
return true
42+
#else
43+
return false
44+
#endif
4545
}
46-
46+
4747
var isTestFlight: Bool {
4848
Bundle.main.appStoreReceiptURL?.lastPathComponent == "sandboxReceipt"
4949
}
50-
50+
5151
var environment: Environment {
5252
if isDebug {
5353
return .development
5454
}
55-
55+
5656
if isTestFlight {
5757
return .staging
5858
}
59-
59+
6060
return .production
6161
}
62-
62+
6363
func start(sceneDelegate: SceneDelegate) {
6464
self.sceneDelegate = sceneDelegate
6565
self.tabBarController.setupTabs()
6666

6767
switchToTabController()
6868
}
69-
69+
7070
func switchToNavigationController() {
7171
sceneDelegate?.window?.rootViewController = navigator.rootViewController
7272
self.isTabbed = false
7373
}
74-
74+
7575
func switchToTabController() {
7676
sceneDelegate?.window?.rootViewController = tabBarController
7777
self.isTabbed = true
7878
}
79-
79+
8080
func navigatorFor(title: String) -> Navigator? {
8181
tabBarController.navigatorFor(title: title)
8282
}
8383
}
8484

85+
extension UIHostingController {
86+
func hideNavigationBar(animated: Bool = true) {
87+
navigationController?.setNavigationBarHidden(true, animated: animated)
88+
}
89+
90+
func showNavigationBar(animated: Bool = true) {
91+
navigationController?.setNavigationBarHidden(false, animated: animated)
92+
}
93+
}
94+
8595
extension App: NavigatorDelegate {
8696
func handle(proposal: VisitProposal) -> ProposalResult {
87-
88-
print("viewController \(proposal.viewController)")
8997

9098
switch proposal.viewController {
9199
case "home":
@@ -94,7 +102,8 @@ extension App: NavigatorDelegate {
94102
navigator: App.instance.navigatorFor(title: "Home")
95103
)
96104
)
97-
105+
viewController.hideNavigationBar()
106+
98107
return .acceptCustom(viewController)
99108
default:
100109
return .accept

RubyEvents/AppDelegate.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,35 @@ import UIKit
1111
@main
1212
class AppDelegate: UIResponder, UIApplicationDelegate {
1313
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
14-
14+
1515
let versionNumber = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String
1616
let uniqueDeviceId = UIDevice.current.identifierForVendor?.uuidString ?? ""
17-
17+
1818
Hotwire.config.applicationUserAgentPrefix = "Hotwire Native iOS; app_version: \(versionNumber); unique_device_id: \(uniqueDeviceId);"
19-
19+
2020
Hotwire.registerBridgeComponents([
2121
ButtonComponent.self
2222
])
23-
23+
2424
Hotwire.config.showDoneButtonOnModals = true
2525
Hotwire.config.debugLoggingEnabled = true
26-
26+
2727
Hotwire.loadPathConfiguration(from: [
2828
.server(Router.instance.path_configuration_url()),
2929
.file(Bundle.main.url(forResource: "path-configuration", withExtension: "json")!)
3030
])
31-
31+
3232
return true
3333
}
34-
34+
3535
// MARK: UISceneSession Lifecycle
36-
36+
3737
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
3838
// Called when a new scene session is being created.
3939
// Use this method to select a configuration to create the new scene with.
4040
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
4141
}
42-
42+
4343
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
4444
// Called when the user discards a scene session.
4545
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.

RubyEvents/Assets.xcassets/AccentColor.colorset/Contents.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"color-space" : "srgb",
66
"components" : {
77
"alpha" : "1.000",
8-
"blue" : "0.236",
9-
"green" : "0.081",
10-
"red" : "0.865"
8+
"blue" : "0.037",
9+
"green" : "0.023",
10+
"red" : "0.008"
1111
}
1212
},
1313
"idiom" : "universal"
99.9 KB
Loading
-3.35 KB
Loading
26.3 KB
Loading
188 KB
Loading

RubyEvents/SceneDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import UIKit
22

33
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
44
var window: UIWindow?
5-
5+
66
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
77
App.instance.start(sceneDelegate: self)
88
}

RubyEvents/api/APIService.swift

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,58 +16,55 @@ enum NetworkError: Error {
1616

1717
class APIService {
1818
static let shared = APIService()
19-
19+
2020
private init() {}
21-
21+
2222
func fetchData<T: Decodable>(from endpoint: String, completion: @escaping (Result<T, NetworkError>) -> Void) {
2323
guard let url = URL(string: endpoint) else {
2424
completion(.failure(.invalidURL))
2525
return
2626
}
27-
27+
2828
let task = URLSession.shared.dataTask(with: url) { data, response, error in
2929
if let error = error {
3030
completion(.failure(.requestFailed(error)))
3131
return
3232
}
33-
33+
3434
guard let httpResponse = response as? HTTPURLResponse,
35-
(200...299).contains(httpResponse.statusCode) else {
35+
(200...299).contains(httpResponse.statusCode) else {
3636
completion(.failure(.invalidResponse))
3737
return
3838
}
39-
39+
4040
guard let data = data else {
4141
completion(.failure(.invalidData))
4242
return
4343
}
44-
44+
4545
do {
46-
let json = try JSONSerialization.jsonObject(with: data) as? [String: Any]
47-
print("JSON structure: \(json ?? [:])")
48-
4946
let decodedData = try JSONDecoder().decode(T.self, from: data)
5047
completion(.success(decodedData))
5148
} catch {
5249
completion(.failure(.invalidData))
5350
}
5451
}
55-
52+
5653
task.resume()
5754
}
58-
55+
5956
func fetchData<T: Decodable>(from endpoint: String) async throws -> T {
6057
guard let url = URL(string: endpoint) else {
6158
throw NetworkError.invalidURL
6259
}
63-
60+
6461
let (data, response) = try await URLSession.shared.data(from: url)
65-
62+
6663
guard let httpResponse = response as? HTTPURLResponse,
67-
(200...299).contains(httpResponse.statusCode) else {
64+
(200...299).contains(httpResponse.statusCode) else {
6865
throw NetworkError.invalidResponse
6966
}
70-
67+
7168
do {
7269
return try JSONDecoder().decode(T.self, from: data)
7370
} catch {

0 commit comments

Comments
 (0)