-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/#726 profile view #757
base: develop
Are you sure you want to change the base?
Changes from all commits
d128113
f9dea90
d2174d7
25e69c8
6d1f17c
eca79d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// NotificationDIContainer.swift | ||
// Bibbi | ||
// | ||
// Created by λ§κ²½λ―Έ on 31.01.25. | ||
// | ||
|
||
import Core | ||
import Data | ||
import Domain | ||
|
||
final class NotificationDIContainer: BaseContainer { | ||
private func makeNotificationRepository() -> NotificationRepositoryPorotocol { | ||
return NotificationRepository() | ||
} | ||
|
||
private func makeFetchNotificationUseCase() -> FetchNotificationUseCaseProtocol { | ||
FetchNotificationUseCase(notificationRepository: makeNotificationRepository() | ||
) | ||
} | ||
|
||
func registerDependencies() { | ||
container.register(type: FetchNotificationUseCaseProtocol.self) { _ in self.makeFetchNotificationUseCase() | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// NotificationNavigator.swift | ||
// Bibbi | ||
// | ||
// Created by λ§κ²½λ―Έ on 31.01.25. | ||
// | ||
|
||
import UIKit | ||
|
||
import Core | ||
|
||
protocol NotificationNavigatorProtocol: BaseNavigator { | ||
func toPost() | ||
func toMission() | ||
func toPostComment() | ||
} | ||
|
||
final class NotificationNavigator: NotificationNavigatorProtocol { | ||
var navigationController: UINavigationController | ||
|
||
init(navigationController: UINavigationController) { | ||
self.navigationController = navigationController | ||
} | ||
|
||
func toPost() { | ||
|
||
} | ||
|
||
func toMission() { | ||
|
||
} | ||
|
||
func toPostComment() { | ||
|
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// NotificationViewControllerWrapper.swift | ||
// Bibbi | ||
// | ||
// Created by λ§κ²½λ―Έ on 30.01.25. | ||
// | ||
|
||
import Core | ||
import Foundation | ||
import MacrosInterface | ||
|
||
@Wrapper<NotificationReactor, NotificationViewController> | ||
final class NotificationViewControllerWrapper { | ||
|
||
// MARK: - Make | ||
|
||
func makeReactor() -> NotificationReactor { | ||
NotificationReactor() | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
import Foundation | ||
import Core | ||
import UIKit | ||
|
||
// MARK: - λ₯λ§ν¬ νΈλ€λ¬ | ||
final class DeepLinkHandler { | ||
var deepLink: DeepLinkProtocol? | ||
|
||
init(urlString: String) { | ||
guard let url = URL(string: urlString) else { | ||
deepLink = nil | ||
return | ||
} | ||
|
||
let pathComponents = url.pathComponents | ||
.filter { !$0.isEmpty && $0 != "/" } | ||
|
||
let queryParams = URLComponents( | ||
url: url, | ||
resolvingAgainstBaseURL: false | ||
)?.queryItems | ||
|
||
switch pathComponents.first?.lowercased() { | ||
case "main": | ||
deepLink = MainDeepLink( | ||
pathComponents: pathComponents, | ||
queryParams: queryParams | ||
) | ||
case "post": | ||
deepLink = PostDeepLink( | ||
pathComponents: pathComponents, | ||
queryParams: queryParams | ||
) | ||
case "profile": | ||
deepLink = ProfileDeepLink( | ||
pathComponents: pathComponents | ||
) | ||
case "store": | ||
deepLink = StoreDeepLink( | ||
pathComponents: pathComponents | ||
) | ||
default: | ||
deepLink = nil | ||
} | ||
} | ||
|
||
func doDeepLink() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
do { | ||
guard let deepLink else { | ||
throw DeepLinkError.notFound | ||
} | ||
|
||
try deepLink.doDeepLink() | ||
} catch let error as DeepLinkError { | ||
BBToast.text(error.message).show() | ||
} catch { | ||
BBToast.text("μ μ μλ μ€λ₯κ° λ°μνμ΅λλ€.").show() | ||
} | ||
} | ||
} | ||
|
||
enum DeepLinkError: Error { | ||
case invalidLink | ||
case notFound | ||
case errorOccurred | ||
case invalidNavigation | ||
|
||
var message: String { | ||
switch self { | ||
case .invalidLink: | ||
return "μλͺ»λ λ§ν¬μ λλ€." | ||
case .notFound: | ||
return "μμ²ν νμ΄μ§λ₯Ό μ°Ύμ μ μμ΅λλ€." | ||
case .errorOccurred: | ||
return "μμ² μ€ μλ¬κ° λ°μνμ΅λλ€." | ||
case .invalidNavigation: | ||
return "νμ¬ νμ΄μ§λ₯Ό μ°Ύμ μ μμ΅λλ€." | ||
} | ||
} | ||
} | ||
|
||
protocol DeepLinkProtocol { | ||
func doDeepLink() throws | ||
} | ||
|
||
extension DeepLinkProtocol { | ||
func getNavigationController() -> UINavigationController? { | ||
return (UIApplication.shared.connectedScenes | ||
.compactMap { $0 as? UIWindowScene } | ||
.flatMap { $0.windows } | ||
.first { $0.isKeyWindow }? | ||
.rootViewController as? UINavigationController) | ||
} | ||
|
||
func popToViewController<T: UIViewController>(ofType type: T.Type, animated: Bool = true) { | ||
guard let navigationController = getNavigationController() else { | ||
return | ||
} | ||
|
||
for controller in navigationController.viewControllers.reversed() { | ||
if controller is T { | ||
navigationController.popToViewController(controller, animated: animated) | ||
return | ||
} | ||
} | ||
|
||
navigationController.popToRootViewController(animated: animated) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// | ||
// MainDeepLink.swift | ||
// Bibbi | ||
// | ||
// Created by λ§κ²½λ―Έ on 24.02.25. | ||
// | ||
|
||
import Foundation | ||
|
||
import Core | ||
|
||
// MARK: - Main λ₯λ§ν¬ | ||
final class MainDeepLink: DeepLinkProtocol { | ||
enum MainDeepLinkType { | ||
case openMain | ||
case openMission | ||
} | ||
|
||
var type: MainDeepLinkType? | ||
|
||
init( | ||
pathComponents: [String], | ||
queryParams: [URLQueryItem]? | ||
) { | ||
if let isMission = queryParams?.first(where: { | ||
$0.name == "openMission"})?.value { | ||
|
||
if isMission == "true" { | ||
type = .openMission | ||
} else { | ||
type = .openMain | ||
} | ||
} | ||
} | ||
|
||
func doDeepLink() throws { | ||
guard let type else { | ||
throw DeepLinkError.invalidLink | ||
} | ||
|
||
switch type { | ||
case .openMission: openMission() | ||
case .openMain: popToMain() | ||
} | ||
} | ||
} | ||
|
||
extension MainDeepLink { | ||
private func popToMain() { | ||
popToViewController( | ||
ofType: MainViewController.self, | ||
animated: true | ||
) | ||
} | ||
|
||
private func openMission() { | ||
popToMain() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. μκΈ° |
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
podtId μ΄κΈ°κ°μΌλ‘ nullμ μ μλ 건κ°μ?