Skip to content

Commit

Permalink
feat: 위젯 전달 정보에 AgencyName 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
FirstDo committed Nov 3, 2024
1 parent 633c493 commit 6c06e08
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
7 changes: 3 additions & 4 deletions Projects/App/WidgetExtension/Sources/Model/AgencyEntry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,15 @@ struct AgencyProvider: TimelineProvider {

func getTimeline(in context: Context, completion: @escaping (Timeline<AgencyEntry>) -> ()) {
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ struct LedgerListResponseDTO: Responsable {
let ledgerDetailTotalCount :Int
let totalBalance: Int
let ledgerInfoViewDetails: [LedgerResponseDTO]
let agencyName: String

var toEntity: LedgerList {
return LedgerList(
Expand Down

0 comments on commit 6c06e08

Please sign in to comment.