diff --git a/dime/Views/BudgetView.swift b/dime/Views/BudgetView.swift index 358b3e6..d79a43f 100644 --- a/dime/Views/BudgetView.swift +++ b/dime/Views/BudgetView.swift @@ -1688,6 +1688,8 @@ struct FilteredCategoryDayBudgetView: View { @EnvironmentObject var dataController: DataController @AppStorage("showCents", store: UserDefaults(suiteName: "group.com.rafaelsoh.dime")) var showCents: Bool = true @AppStorage("swapTimeLabel", store: UserDefaults(suiteName: "group.com.rafaelsoh.dime")) var swapTimeLabel: Bool = false + @AppStorage("showExpenseOrIncomeSign", store: UserDefaults(suiteName: "group.com.rafaelsoh.dime")) + var showExpenseOrIncomeSign: Bool = true var body: some View { VStack(spacing: 0) { @@ -1695,7 +1697,7 @@ struct FilteredCategoryDayBudgetView: View { NoResultsView(fullscreen: false) } else { ForEach(transactions, id: \.id) { transaction in - SingleTransactionView(transaction: transaction, showCents: showCents, currencySymbol: currencySymbol, currency: currency, swapTimeLabel: swapTimeLabel, future: false) + SingleTransactionView(transaction: transaction, showCents: showCents, currencySymbol: currencySymbol, currency: currency, swapTimeLabel: swapTimeLabel, future: false, showExpenseOrIncomeSign: showExpenseOrIncomeSign) } } } diff --git a/dime/Views/InsightsView.swift b/dime/Views/InsightsView.swift index b20aa03..333484c 100644 --- a/dime/Views/InsightsView.swift +++ b/dime/Views/InsightsView.swift @@ -460,6 +460,10 @@ struct FilteredDateInsightsView: View { @AppStorage("swapTimeLabel", store: UserDefaults(suiteName: "group.com.rafaelsoh.dime")) var swapTimeLabel: Bool = false @AppStorage("showCents", store: UserDefaults(suiteName: "group.com.rafaelsoh.dime")) var showCents: Bool = true + + @AppStorage("showExpenseOrIncomeSign", store: UserDefaults(suiteName: "group.com.rafaelsoh.dime")) + var showExpenseOrIncomeSign: Bool = true + var body: some View { VStack(spacing: 0) { @@ -467,7 +471,7 @@ struct FilteredDateInsightsView: View { NoResultsView(fullscreen: false) } ForEach(transactions) { transaction in - SingleTransactionView(transaction: transaction, showCents: showCents, currencySymbol: currencySymbol, currency: currency, swapTimeLabel: swapTimeLabel, future: false) + SingleTransactionView(transaction: transaction, showCents: showCents, currencySymbol: currencySymbol, currency: currency, swapTimeLabel: swapTimeLabel, future: false, showExpenseOrIncomeSign: showExpenseOrIncomeSign) } } .frame(maxHeight: .infinity) diff --git a/dime/Views/LogView.swift b/dime/Views/LogView.swift index 20c55de..92c8b50 100644 --- a/dime/Views/LogView.swift +++ b/dime/Views/LogView.swift @@ -961,6 +961,9 @@ struct ListView: View { var currencySymbol: String { return Locale.current.localizedCurrencySymbol(forCurrencyCode: currency)! } + + @AppStorage("showExpenseOrIncomeSign", store: UserDefaults(suiteName: "group.com.rafaelsoh.dime")) + var showExpenseOrIncomeSign: Bool = true @AppStorage("swapTimeLabel", store: UserDefaults(suiteName: "group.com.rafaelsoh.dime")) var swapTimeLabel: Bool = false @@ -995,7 +998,7 @@ struct ListView: View { .padding(.top, 10) ForEach(filtered.transactions, id: \.id) { transaction in - SingleTransactionView(transaction: transaction, showCents: showCents, currencySymbol: currencySymbol, currency: currency, swapTimeLabel: swapTimeLabel, future: false) + SingleTransactionView(transaction: transaction, showCents: showCents, currencySymbol: currencySymbol, currency: currency, swapTimeLabel: swapTimeLabel, future: false, showExpenseOrIncomeSign: showExpenseOrIncomeSign) } } .contentShape(RoundedRectangle(cornerRadius: 10)) @@ -1097,6 +1100,9 @@ struct FutureListView: View { var currencySymbol: String { return Locale.current.localizedCurrencySymbol(forCurrencyCode: currency)! } + + @AppStorage("showExpenseOrIncomeSign", store: UserDefaults(suiteName: "group.com.rafaelsoh.dime")) + var showExpenseOrIncomeSign: Bool = true @AppStorage("swapTimeLabel", store: UserDefaults(suiteName: "group.com.rafaelsoh.dime")) var swapTimeLabel: Bool = false @@ -1150,7 +1156,7 @@ struct FutureListView: View { .padding(.horizontal, 10) ForEach(transactions) { transaction in - SingleTransactionView(transaction: transaction, showCents: showCents, currencySymbol: currencySymbol, currency: currency, swapTimeLabel: swapTimeLabel, future: true) + SingleTransactionView(transaction: transaction, showCents: showCents, currencySymbol: currencySymbol, currency: currency, swapTimeLabel: swapTimeLabel, future: true, showExpenseOrIncomeSign: showExpenseOrIncomeSign) } } .padding(.bottom, 18) @@ -1181,6 +1187,7 @@ struct SingleTransactionView: View { let currency: String let swapTimeLabel: Bool let future: Bool + let showExpenseOrIncomeSign: Bool @State var refreshID = UUID() @@ -1278,7 +1285,7 @@ struct SingleTransactionView: View { .frame(maxWidth: .infinity, alignment: .leading) if transaction.income { - Text("+\(transactionAmountString)") + Text(showExpenseOrIncomeSign ? "+\(transactionAmountString)" : transactionAmountString) .font(.system(.title3, design: .rounded).weight(.medium)) .dynamicTypeSize(...DynamicTypeSize.xxxLarge) .foregroundColor(future ? Color.SubtitleText : Color.IncomeGreen) @@ -1287,7 +1294,7 @@ struct SingleTransactionView: View { .layoutPriority(1) } else { - Text("-\(transactionAmountString)") + Text(showExpenseOrIncomeSign ? "-\(transactionAmountString)" : transactionAmountString) .font(.system(.title3, design: .rounded).weight(.medium)) .dynamicTypeSize(...DynamicTypeSize.xxxLarge) .foregroundColor(future ? Color.SubtitleText : Color.PrimaryText) @@ -1706,6 +1713,9 @@ struct FilteredDateView: View { @AppStorage("swapTimeLabel", store: UserDefaults(suiteName: "group.com.rafaelsoh.dime")) var swapTimeLabel: Bool = false @AppStorage("showCents", store: UserDefaults(suiteName: "group.com.rafaelsoh.dime")) var showCents: Bool = true + + @AppStorage("showExpenseOrIncomeSign", store: UserDefaults(suiteName: "group.com.rafaelsoh.dime")) + var showExpenseOrIncomeSign: Bool = true var body: some View { VStack(spacing: 0) { @@ -1713,7 +1723,7 @@ struct FilteredDateView: View { NoResultsView(fullscreen: true) } ForEach(transactions) { transaction in - SingleTransactionView(transaction: transaction, showCents: showCents, currencySymbol: currencySymbol, currency: currency, swapTimeLabel: swapTimeLabel, future: false) + SingleTransactionView(transaction: transaction, showCents: showCents, currencySymbol: currencySymbol, currency: currency, swapTimeLabel: swapTimeLabel, future: false, showExpenseOrIncomeSign: showExpenseOrIncomeSign) } } .frame(maxHeight: .infinity) diff --git a/dime/Views/Settings/SettingsView.swift b/dime/Views/Settings/SettingsView.swift index d00e68b..4f00d34 100644 --- a/dime/Views/Settings/SettingsView.swift +++ b/dime/Views/Settings/SettingsView.swift @@ -108,6 +108,9 @@ struct SettingsView: View { @AppStorage("incomeTracking", store: UserDefaults(suiteName: "group.com.rafaelsoh.dime")) var incomeTracking: Bool = true + + @AppStorage("showExpenseOrIncomeSign", store: UserDefaults(suiteName: "group.com.rafaelsoh.dime")) + var showExpenseOrIncomeSign: Bool = true @AppStorage( "showUpcomingTransactions", store: UserDefaults(suiteName: "group.com.rafaelsoh.dime")) @@ -247,6 +250,12 @@ struct SettingsView: View { NavigationLink(destination: SettingsWeekStartView()) { SettingsRowView(systemImage: "calendar", title: "Time Frames", colour: 109) } + + ToggleRow( + icon: "plus.forwardslash.minus", color: "123", text: "Display Expense/income sign", bool: showExpenseOrIncomeSign, + onTap: { + showExpenseOrIncomeSign.toggle() + }) } .padding(10) .background(Color.SettingsBackground, in: RoundedRectangle(cornerRadius: 9))