-
Notifications
You must be signed in to change notification settings - Fork 2
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
자동로그인 오류 수정 및 토큰 재발급 로직 구현 #314
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f723dc2
[#313] Legacy API 호출 코드 삭제
thinkySide 412945f
[#313] UIComponent 네이밍 컨벤션 업데이트
thinkySide b53f1f7
[#313] AppDelegate 파일 정리
thinkySide aceee6d
[#313] WriteAnswerView View 오류 수정
thinkySide 7f16ff4
[#313] HapticEvent 수정
thinkySide c0d87b4
[#313] API 호출 캡슐화를 위한 request 함수 구현
thinkySide 539d26a
[#313] API 호출 Request 함수로 리팩토링
thinkySide 418f7a6
[#313] 토큰 재발급 실패 예외 처리
thinkySide c410935
Update Qapple/Qapple/SourceCode/Feature/1.MainFlow/MainFlowView.swift
thinkySide 2bd6a05
[#313] Warning Error 해결
thinkySide File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
Qapple/Qapple/SourceCode/App/UNUserNotificationCenterDelegate.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
// | ||
// UNUserNotificationCenterDelegate.swift | ||
// Qapple | ||
// | ||
// Created by 김민준 on 2/21/25. | ||
// | ||
|
||
import UIKit | ||
|
||
// MARK: - UNUserNotificationCenterDelegate | ||
|
||
extension AppDelegate: UNUserNotificationCenterDelegate { | ||
|
||
/// 푸시 메세지가 앱이 켜져있을 때 나올 때 | ||
func userNotificationCenter( | ||
_ center: UNUserNotificationCenter, | ||
willPresent notification: UNNotification, | ||
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) | ||
-> Void | ||
) { | ||
let userInfo = notification.request.content.userInfo | ||
pushNotificationTapped(userInfo: userInfo) | ||
|
||
// Do Something With MSG Data... | ||
if let messageID = userInfo[Constant.gcmMessageIDKey] { | ||
print("Message ID: \(messageID)") | ||
} | ||
|
||
print(userInfo) | ||
|
||
completionHandler([[.banner, .badge, .sound]]) | ||
} | ||
|
||
/// 푸시메세지를 받았을 때 | ||
func userNotificationCenter( | ||
_ center: UNUserNotificationCenter, | ||
didReceive response: UNNotificationResponse, | ||
withCompletionHandler completionHandler: @escaping () -> Void | ||
) { | ||
let userInfo = response.notification.request.content.userInfo | ||
pushNotificationTapped(userInfo: userInfo) | ||
|
||
// Do Something With MSG Data... | ||
if let messageID = userInfo[Constant.gcmMessageIDKey] { | ||
print("Message ID: \(messageID)") | ||
} | ||
|
||
print(userInfo) | ||
|
||
completionHandler() | ||
} | ||
|
||
private func pushNotificationTapped(userInfo: [AnyHashable: Any]) { | ||
if let questionId = userInfo["questionId"], | ||
let idString = questionId as? String, | ||
let _ = Int(idString) { | ||
// TODO: API 업데이트 후 추후 적용 | ||
// evaluateQuestionPushNotification(id) | ||
} | ||
|
||
if let boardId = userInfo["boardId"], | ||
let idString = boardId as? String, | ||
let id = Int(idString) { | ||
Task { | ||
do { | ||
let response = try await bulletinBoardRepository.fetchSingleBoard(id) | ||
mainFlowStore.send(.pushToComment(response)) | ||
} catch { | ||
print("Failed to fetch single board") | ||
} | ||
} | ||
} | ||
} | ||
|
||
private func evaluateQuestionPushNotification(_ id: Int) { | ||
var hasNext = true | ||
var threshold: String? | ||
while hasNext { | ||
Task { | ||
let response = try await questionRepository.fetchQuestionList(threshold) | ||
response.0.forEach { | ||
if $0.id == id { | ||
if $0.isAnswered { | ||
mainFlowStore.send(.pushToAnswerList($0)) | ||
} else { | ||
mainFlowStore.send(.pushToWriteAnswer($0)) | ||
} | ||
return | ||
} | ||
} | ||
threshold = response.2.threshold | ||
hasNext = response.2.hasNext | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
AppDelegate 파일을 정리했습니다. 같은 목적의 코드는 함수로 묶어 분리했습니다.