Skip to content

Commit dd6a13f

Browse files
committed
Uncommited changes
1 parent 84c6487 commit dd6a13f

38 files changed

+2003
-126
lines changed

RubyEvents.xcodeproj/project.pbxproj

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
973DD3652D95F8BE008E0AED /* CachedAsyncImage in Frameworks */ = {isa = PBXBuildFile; productRef = 973DD3642D95F8BE008E0AED /* CachedAsyncImage */; };
1011
97613B4C2D0635C600220031 /* HotwireNative in Frameworks */ = {isa = PBXBuildFile; productRef = 97613B4B2D0635C600220031 /* HotwireNative */; };
1112
97613B572D06512900220031 /* YouTubePlayerKit in Frameworks */ = {isa = PBXBuildFile; productRef = 97613B562D06512900220031 /* YouTubePlayerKit */; };
1213
/* End PBXBuildFile section */
@@ -42,6 +43,7 @@
4243
buildActionMask = 2147483647;
4344
files = (
4445
97613B572D06512900220031 /* YouTubePlayerKit in Frameworks */,
46+
973DD3652D95F8BE008E0AED /* CachedAsyncImage in Frameworks */,
4547
97613B4C2D0635C600220031 /* HotwireNative in Frameworks */,
4648
);
4749
runOnlyForDeploymentPostprocessing = 0;
@@ -87,6 +89,7 @@
8789
packageProductDependencies = (
8890
97613B4B2D0635C600220031 /* HotwireNative */,
8991
97613B562D06512900220031 /* YouTubePlayerKit */,
92+
973DD3642D95F8BE008E0AED /* CachedAsyncImage */,
9093
);
9194
productName = RubyEvents;
9295
productReference = 97613B162D0634F500220031 /* RubyEvents.app */;
@@ -119,6 +122,7 @@
119122
packageReferences = (
120123
97613B4A2D0635C600220031 /* XCRemoteSwiftPackageReference "hotwire-native-ios" */,
121124
97613B552D06512900220031 /* XCRemoteSwiftPackageReference "YouTubePlayerKit" */,
125+
973DD3632D95F8BE008E0AED /* XCRemoteSwiftPackageReference "CachedAsyncImage" */,
122126
);
123127
preferredProjectObjectVersion = 77;
124128
productRefGroup = 97613B172D0634F500220031 /* Products */;
@@ -356,6 +360,14 @@
356360
/* End XCConfigurationList section */
357361

358362
/* Begin XCRemoteSwiftPackageReference section */
363+
973DD3632D95F8BE008E0AED /* XCRemoteSwiftPackageReference "CachedAsyncImage" */ = {
364+
isa = XCRemoteSwiftPackageReference;
365+
repositoryURL = "https://github.com/bullinnyc/CachedAsyncImage";
366+
requirement = {
367+
kind = upToNextMajorVersion;
368+
minimumVersion = 2.6.0;
369+
};
370+
};
359371
97613B4A2D0635C600220031 /* XCRemoteSwiftPackageReference "hotwire-native-ios" */ = {
360372
isa = XCRemoteSwiftPackageReference;
361373
repositoryURL = "https://github.com/hotwired/hotwire-native-ios";
@@ -375,6 +387,11 @@
375387
/* End XCRemoteSwiftPackageReference section */
376388

377389
/* Begin XCSwiftPackageProductDependency section */
390+
973DD3642D95F8BE008E0AED /* CachedAsyncImage */ = {
391+
isa = XCSwiftPackageProductDependency;
392+
package = 973DD3632D95F8BE008E0AED /* XCRemoteSwiftPackageReference "CachedAsyncImage" */;
393+
productName = CachedAsyncImage;
394+
};
378395
97613B4B2D0635C600220031 /* HotwireNative */ = {
379396
isa = XCSwiftPackageProductDependency;
380397
package = 97613B4A2D0635C600220031 /* XCRemoteSwiftPackageReference "hotwire-native-ios" */;

RubyEvents.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

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

RubyEvents/App.swift

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
//
2+
// App.swift
3+
// RubyEvents
4+
//
5+
// Created by Marco Roth on 17.01.2025.
6+
//
7+
8+
import HotwireNative
9+
import SwiftUI
10+
import UIKit
11+
12+
class App {
13+
static var instance = App()
14+
15+
var isTabbed: Bool = true
16+
17+
var sceneDelegate: SceneDelegate?
18+
19+
lazy var navigator = Navigator(delegate: self)
20+
lazy var tabBarController = TabBarController(app: self)
21+
22+
private var currentUnreadMessagesCount: String?
23+
24+
var navigators: [Navigator] {
25+
if isTabbed {
26+
return tabBarController.navigators
27+
}
28+
return [navigator]
29+
}
30+
31+
var viewControllers: [UIViewController] {
32+
navigators.map(\.rootViewController)
33+
}
34+
35+
var window: UIWindow? {
36+
sceneDelegate?.window
37+
}
38+
39+
var isDebug: Bool {
40+
#if DEBUG
41+
return true
42+
#else
43+
return false
44+
#endif
45+
}
46+
47+
var isTestFlight: Bool {
48+
Bundle.main.appStoreReceiptURL?.lastPathComponent == "sandboxReceipt"
49+
}
50+
51+
var environment: Environment {
52+
if isDebug {
53+
return .development
54+
}
55+
56+
if isTestFlight {
57+
return .staging
58+
}
59+
60+
return .production
61+
}
62+
63+
func start(sceneDelegate: SceneDelegate) {
64+
self.sceneDelegate = sceneDelegate
65+
self.tabBarController.setupTabs()
66+
67+
switchToTabController()
68+
}
69+
70+
func switchToNavigationController() {
71+
sceneDelegate?.window?.rootViewController = navigator.rootViewController
72+
self.isTabbed = false
73+
}
74+
75+
func switchToTabController() {
76+
sceneDelegate?.window?.rootViewController = tabBarController
77+
self.isTabbed = true
78+
}
79+
80+
func navigatorFor(title: String) -> Navigator? {
81+
tabBarController.navigatorFor(title: title)
82+
}
83+
}
84+
85+
extension App: NavigatorDelegate {
86+
func handle(proposal: VisitProposal) -> ProposalResult {
87+
88+
print("viewController \(proposal.viewController)")
89+
90+
switch proposal.viewController {
91+
case "home":
92+
let viewController = UIHostingController(
93+
rootView: HomeView(
94+
navigator: App.instance.navigatorFor(title: "Home")
95+
)
96+
)
97+
98+
return .acceptCustom(viewController)
99+
default:
100+
return .accept
101+
}
102+
}
103+
}

RubyEvents/AppDelegate.swift

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,34 @@
1+
//
2+
// AppDelegate.swift
3+
// RubyEvents
4+
//
5+
// Created by Marco Roth on 06.01.2025.
6+
//
7+
8+
import HotwireNative
19
import UIKit
210

311
@main
412
class AppDelegate: UIResponder, UIApplicationDelegate {
5-
613
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
7-
// Override point for customization after application launch.
14+
15+
let versionNumber = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String
16+
let uniqueDeviceId = UIDevice.current.identifierForVendor?.uuidString ?? ""
17+
18+
Hotwire.config.applicationUserAgentPrefix = "Hotwire Native iOS; app_version: \(versionNumber); unique_device_id: \(uniqueDeviceId);"
19+
20+
Hotwire.registerBridgeComponents([
21+
ButtonComponent.self
22+
])
23+
24+
Hotwire.config.showDoneButtonOnModals = true
25+
Hotwire.config.debugLoggingEnabled = true
26+
27+
Hotwire.loadPathConfiguration(from: [
28+
.server(Router.instance.path_configuration_url()),
29+
.file(Bundle.main.url(forResource: "path-configuration", withExtension: "json")!)
30+
])
31+
832
return true
933
}
1034

RubyEvents/HotwireNavigator.swift

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

RubyEvents/Router.swift

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

RubyEvents/SceneDelegate.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
44
var window: UIWindow?
55

66
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
7-
guard let _ = (scene as? UIWindowScene) else { return }
8-
9-
HotwireNavigator.instance.didStart(url: connectionOptions.urlContexts.first?.url, window: window)
7+
App.instance.start(sceneDelegate: self)
108
}
119
}

RubyEvents/ViewController.swift

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

0 commit comments

Comments
 (0)