From 6c06e08fb0b07cce10fe6019e752367f31e55a1c Mon Sep 17 00:00:00 2001 From: doyeonKim Date: Sun, 3 Nov 2024 16:15:21 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=9C=84=EC=A0=AF=20=EC=A0=84=EB=8B=AC?= =?UTF-8?q?=20=EC=A0=95=EB=B3=B4=EC=97=90=20AgencyName=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../App/WidgetExtension/Sources/Model/AgencyEntry.swift | 7 +++---- .../APIs/LedgerAPI/Repository/LedgerRepository.swift | 6 +++--- .../APIs/LedgerAPI/ResponseDTO/LedgerListResponseDTO.swift | 1 + 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Projects/App/WidgetExtension/Sources/Model/AgencyEntry.swift b/Projects/App/WidgetExtension/Sources/Model/AgencyEntry.swift index a971d344..66ce0fe6 100644 --- a/Projects/App/WidgetExtension/Sources/Model/AgencyEntry.swift +++ b/Projects/App/WidgetExtension/Sources/Model/AgencyEntry.swift @@ -26,16 +26,15 @@ struct AgencyProvider: TimelineProvider { func getTimeline(in context: Context, completion: @escaping (Timeline) -> ()) { let entry: AgencyEntry - if let dic = UserDefaults(suiteName: "group.moneymong")?.dictionary(forKey: "test"), + if let dic = UserDefaults(suiteName: "group.moneymong")?.dictionary(forKey: "agencyInfo"), let name = dic["name"] as? String, - let amount = dic["total"] as? Int { - + let amount = dic["total"] as? Int + { entry = AgencyEntry( date: .now, name: name, amount: amount ) - } else { entry = AgencyEntry( date: .now, diff --git a/Projects/Core/Core/Sources/Network/APIs/LedgerAPI/Repository/LedgerRepository.swift b/Projects/Core/Core/Sources/Network/APIs/LedgerAPI/Repository/LedgerRepository.swift index f2c42ed4..5641b05a 100644 --- a/Projects/Core/Core/Sources/Network/APIs/LedgerAPI/Repository/LedgerRepository.swift +++ b/Projects/Core/Core/Sources/Network/APIs/LedgerAPI/Repository/LedgerRepository.swift @@ -132,12 +132,12 @@ public final class LedgerRepository: LedgerRepositoryInterface { let result = try await networkManager.request(target: targetType, of: LedgerListResponseDTO.self) - let dic:[String: Any] = [ - "name" : "머니몽 소속", + let dict: [String: Any] = [ + "name" : result.agencyName, "total" : result.totalBalance ] - UserDefaults(suiteName: "group.moneymong")?.set(dic, forKey: "test") + UserDefaults(suiteName: "group.moneymong")?.set(dict, forKey: "agencyInfo") WidgetCenter.shared.reloadAllTimelines() return result.toEntity } diff --git a/Projects/Core/Core/Sources/Network/APIs/LedgerAPI/ResponseDTO/LedgerListResponseDTO.swift b/Projects/Core/Core/Sources/Network/APIs/LedgerAPI/ResponseDTO/LedgerListResponseDTO.swift index 18db719b..64d090c2 100644 --- a/Projects/Core/Core/Sources/Network/APIs/LedgerAPI/ResponseDTO/LedgerListResponseDTO.swift +++ b/Projects/Core/Core/Sources/Network/APIs/LedgerAPI/ResponseDTO/LedgerListResponseDTO.swift @@ -5,6 +5,7 @@ struct LedgerListResponseDTO: Responsable { let ledgerDetailTotalCount :Int let totalBalance: Int let ledgerInfoViewDetails: [LedgerResponseDTO] + let agencyName: String var toEntity: LedgerList { return LedgerList(