Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Wable-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
DE54B0422D833B0B009A7C34 /* WableSheetViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE54B0412D833B0B009A7C34 /* WableSheetViewController.swift */; };
DE59BB9A2D8A9D3A0040ADCB /* NotificationEmpty.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE59BB992D8A9D3A0040ADCB /* NotificationEmpty.swift */; };
DE59BBA92D8A9EFD0040ADCB /* UIViewController+.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE59BBA82D8A9EFD0040ADCB /* UIViewController+.swift */; };
DE6459CF2D97AA9D005569B8 /* AppDelegate+InjectDependency.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6459CE2D97AA9D005569B8 /* AppDelegate+InjectDependency.swift */; };
DE67A9EB2D7211070021BDE1 /* Like.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE67A9EA2D7211070021BDE1 /* Like.swift */; };
DE67A9EF2D7213D90021BDE1 /* Opacity.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE67A9EE2D7213D90021BDE1 /* Opacity.swift */; };
DE6C3E3E2D91A8E00046DB30 /* NewsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6C3E3D2D91A8E00046DB30 /* NewsViewModel.swift */; };
Expand Down Expand Up @@ -457,6 +458,7 @@
DE54B0412D833B0B009A7C34 /* WableSheetViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WableSheetViewController.swift; sourceTree = "<group>"; };
DE59BB992D8A9D3A0040ADCB /* NotificationEmpty.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationEmpty.swift; sourceTree = "<group>"; };
DE59BBA82D8A9EFD0040ADCB /* UIViewController+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+.swift"; sourceTree = "<group>"; };
DE6459CE2D97AA9D005569B8 /* AppDelegate+InjectDependency.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AppDelegate+InjectDependency.swift"; sourceTree = "<group>"; };
DE67A9EA2D7211070021BDE1 /* Like.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Like.swift; sourceTree = "<group>"; };
DE67A9EE2D7213D90021BDE1 /* Opacity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Opacity.swift; sourceTree = "<group>"; };
DE6C3E3D2D91A8E00046DB30 /* NewsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsViewModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1069,6 +1071,7 @@
isa = PBXGroup;
children = (
DD8CEF472D6A007900DBE580 /* AppDelegate.swift */,
DE6459CE2D97AA9D005569B8 /* AppDelegate+InjectDependency.swift */,
DD8CEF482D6A007900DBE580 /* SceneDelegate.swift */,
);
path = App;
Expand Down Expand Up @@ -1810,6 +1813,7 @@
DD29683E2D6DAD2F00143851 /* UpdateToken.swift in Sources */,
DE20BAD72D903985000126A4 /* AnnouncementDetailView.swift in Sources */,
DE70048D2D8EA85400B7AB71 /* NewsViewController.swift in Sources */,
DE6459CF2D97AA9D005569B8 /* AppDelegate+InjectDependency.swift in Sources */,
DE8E863B2D918735000A4292 /* RankViewItem.swift in Sources */,
DD29683F2D6DAD2F00143851 /* FetchInfoNotifications.swift in Sources */,
DD2968402D6DAD2F00143851 /* FetchNewsNoticeNumber.swift in Sources */,
Expand Down
18 changes: 18 additions & 0 deletions Wable-iOS/App/AppDelegate+InjectDependency.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// AppDelegate+InjectDependency.swift
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오... 보통 네이밍을 이런식으로 많이 짓나요? 처음 보는 네이밍이어서 여쭤봅니다요

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어떻게 해야할 지 저도 몰라서 우선 저렇게 지어보었습니다. ㅎㅎ

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

앗 ㅎㅎ 확인했습니닷

// Wable-iOS
//
// Created by 김진웅 on 3/29/25.
//

import Foundation

extension AppDelegate {
var diContainer: AppDIContainer { AppDIContainer.shared }

func injectDependency() {

// TODO: 객체를 주입

}
Comment on lines +13 to +17
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Implement the TODO for dependency injection

The method is currently empty with only a TODO comment. According to the PR description, this method should register all necessary dependencies at startup to avoid application crashes from unregistered dependencies.

func injectDependency() {
    
-   // TODO: 객체를 주입
+   // Register your dependencies here
+   // Example:
+   // diContainer.register(for: SomeService.self) { _ in
+   //     SomeServiceImplementation()
+   // }
    
}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
func injectDependency() {
// TODO: 객체를 주입
}
func injectDependency() {
// Register your dependencies here
// Example:
// diContainer.register(for: SomeService.self) { _ in
// SomeServiceImplementation()
// }
}
🧰 Tools
🪛 SwiftLint (0.57.0)

[Warning] 15-15: TODOs should be resolved (객체를 주입)

(todo)

}
10 changes: 3 additions & 7 deletions Wable-iOS/App/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
injectDependency()

KakaoSDK.initSDK(appKey: Bundle.kakaoAppKey)

return true
Expand All @@ -27,14 +29,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
configurationForConnecting connectingSceneSession: UISceneSession,
options: UIScene.ConnectionOptions
) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {}
}
7 changes: 1 addition & 6 deletions Wable-iOS/Core/DI/DIContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,7 @@ extension AppDIContainer: DependencyContainer {
}

func register<T>(for type: T.Type, _ resolver: @escaping (any DependencyResolvable) -> T) {
dependencies[key(type)] = { [weak self] in
guard let self else {
fatalError("self is optional")
}
return resolver(self)
}
dependencies[key(type)] = resolver
}

func unregister<T>(for type: T.Type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ final class OverviewPageViewController: UIViewController {

// MARK: - Property

private var currentIndex = 0
private var currentIndex = 0 {
didSet {
guard oldValue != currentIndex else { return }
trackPageChangeEvent(for: currentIndex)
}
}
private var viewControllers = [UIViewController]()

private let pageViewController = UIPageViewController(
Expand Down Expand Up @@ -189,14 +194,27 @@ private extension OverviewPageViewController {
}
}



// MARK: - Helper Method

private extension OverviewPageViewController {
func index(for viewController: UIViewController) -> Int? {
return viewControllers.firstIndex(of: viewController)
}

func trackPageChangeEvent(for index: Int) {
switch index {
case 0:
AmplitudeManager.shared.trackEvent(tag: "click_gameschedule")
case 1:
AmplitudeManager.shared.trackEvent(tag: "click_ranking")
case 2:
AmplitudeManager.shared.trackEvent(tag: "click_news")
case 3:
AmplitudeManager.shared.trackEvent(tag: "click_announcement")
default:
break
}
}
Comment on lines +204 to +217
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

}

// MARK: - Computed Property
Expand Down