Skip to content
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

Wait 500ms before sending request token #317

Merged
merged 2 commits into from
Oct 12, 2024
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
5 changes: 3 additions & 2 deletions SNUTT-2022/SNUTT/Repositories/NetworkUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ extension DataTask {
if let data = await response.data,
let errDto = try? JSONDecoder().decode(ErrorDto.self, from: data)
{
try Task.checkCancellation()
let errCode = ErrorCode(rawValue: errDto.errcode)
var requestInfo = await collectRequestInfo()
requestInfo["ErrorMessage"] = errCode?.errorMessage
Expand All @@ -129,13 +130,13 @@ extension DataTask {
throw STError(errCode ?? .SERVER_FAULT)
}
}

if let dto = try? await value {
return dto
}

try Task.checkCancellation()
let requestInfo = await collectRequestInfo()
Crashlytics.crashlytics().record(error: NSError(domain: "UNKNOWN_ERROR", code: -1, userInfo: requestInfo))
try Task.checkCancellation()
throw STError(.SERVER_FAULT)
}

Expand Down
1 change: 1 addition & 0 deletions SNUTT-2022/SNUTT/ViewModels/FriendsViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class FriendsViewModel: BaseViewModel, ObservableObject {
Task { @MainActor [weak self] in
guard let self else { return }
appState.friend.pendingFriendRequestToken = nil
try await Task.sleep(nanoseconds: 500_000_000)
await eventEmitter.emitEvent(.addFriendKakao, payload: ["requestToken": token])
}
}
Expand Down
Loading