Skip to content

Commit

Permalink
Add improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-amisha-i authored Jan 2, 2025
1 parent 37582c6 commit a4fd1fc
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 49 deletions.
2 changes: 1 addition & 1 deletion BaseStyle/BaseStyle/Views/NavigationTitleTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public struct NavigationTitleTextView: View {
}

public var body: some View {
Text(text)
Text(text.localized)
.font(font)
.foregroundStyle(foregroundColor)
}
Expand Down
6 changes: 3 additions & 3 deletions Splito.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -329,15 +329,15 @@
path = ActivityLog;
sourceTree = "<group>";
};
2156A8AE2C24064400CFAB64 /* Transactions */ = {
2156A8AE2C24064400CFAB64 /* Settlements */ = {
isa = PBXGroup;
children = (
2156A8AF2C24069800CFAB64 /* GroupTransactionsRouteView.swift */,
21B1C0992C1C59F10098B4FD /* GroupTransactionListView.swift */,
21B1C09B2C1C5A040098B4FD /* GroupTransactionListViewModel.swift */,
2177692E2C206678009B3B37 /* Transaction Detail */,
);
path = Transactions;
path = Settlements;
sourceTree = "<group>";
};
2177692E2C206678009B3B37 /* Transaction Detail */ = {
Expand Down Expand Up @@ -410,7 +410,7 @@
isa = PBXGroup;
children = (
D83344562C0DD03B00CD9F05 /* Settle up */,
2156A8AE2C24064400CFAB64 /* Transactions */,
2156A8AE2C24064400CFAB64 /* Settlements */,
D83344552C0DD02F00CD9F05 /* Balances */,
D833445F2C0EF1D300CD9F05 /* Totals */,
);
Expand Down
14 changes: 7 additions & 7 deletions Splito/Localization/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -546,15 +546,15 @@
},
"No members in your selected group." : {

},
"No payments yet!" : {

},
"No results found for \"%@\"!" : {

},
"No results were found that match your search criteria." : {

},
"No settlements yet!" : {

},
"No unsettled bills yet!" : {

Expand Down Expand Up @@ -604,9 +604,6 @@
"Payment made successfully." : {
"extractionState" : "manual"
},
"Payments" : {
"extractionState" : "manual"
},
"Payments made" : {
"extractionState" : "manual"
},
Expand Down Expand Up @@ -720,6 +717,9 @@
},
"settled up" : {

},
"Settlements" : {
"extractionState" : "manual"
},
"Share App" : {
"extractionState" : "manual"
Expand Down Expand Up @@ -1038,4 +1038,4 @@
}
},
"version" : "1.0"
}
}
2 changes: 2 additions & 0 deletions Splito/Plist/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
</array>
<key>CFBundleVersion</key>
<string>$(app_version_code)</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
Expand Down
10 changes: 6 additions & 4 deletions Splito/UI/Home/Expense/AddExpenseViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,14 @@ extension AddExpenseViewModel {
let payerIds = Array(self.selectedPayers.keys.prefix(2))
let user1 = await self.fetchUserData(for: payerIds[0])
let user2 = await self.fetchUserData(for: payerIds[1])
if let user1, let user2 {
if let user1, let user2, let currentUser = preference.user {
let user1Name = user1.id == currentUser.id ? "You" : user1.nameWithLastInitial
let user2Name = user2.id == currentUser.id ? "You" : user2.nameWithLastInitial
if self.selectedPayers.count == 2 {
self.payerName = "\(user1.nameWithLastInitial) and \(user2.nameWithLastInitial)"
self.payerName = "\(user1Name) and \(user2Name)"
} else {
let remainingCount = self.selectedPayers.count - 2
self.payerName = "\(user1.nameWithLastInitial), \(user2.nameWithLastInitial) and +\(remainingCount)"
let remainingPayersCount = self.selectedPayers.count - 2
self.payerName = "\(user1Name), \(user2Name) and +\(remainingPayersCount)"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ struct ChoosePayerView: View {
)
.onTapGestureForced {
viewModel.handlePayerSelection(userId: user.id)
dismiss()
}
}

Expand All @@ -58,13 +59,6 @@ struct ChoosePayerView: View {
}
.scrollIndicators(.hidden)
.scrollBounceBehavior(.basedOnSize)

PrimaryButton(text: "Save", isEnabled: !viewModel.selectedPayers.isEmpty, onClick: {
viewModel.handleSaveBtnTap()
dismiss()
})
.padding([.bottom, .horizontal], 16)
.padding(.top, 8)
}
}
.background(surfaceColor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class ChoosePayerViewModel: BaseViewModel, ObservableObject {
// MARK: - User Actions
func handlePayerSelection(userId: String) {
selectedPayers = [userId: amount]
onPayerSelection(selectedPayers)
}

func handleMultiplePayerTap() {
Expand All @@ -66,15 +67,10 @@ class ChoosePayerViewModel: BaseViewModel, ObservableObject {
message: "Please enter a cost for your expense first!"))
return
}

router?.push(.ChooseMultiplePayerView(groupId: groupId, selectedPayers: selectedPayers,
amount: amount, onPayerSelection: onPayerSelection))
}

func handleSaveBtnTap() {
onPayerSelection(selectedPayers)
}

// MARK: - Error Handling
private func handleServiceError() {
if !networkMonitor.isConnected {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ struct DatePickerView: View {

@Binding var date: Date

private let maximumDate = Calendar.current.date(byAdding: .year, value: 0, to: Date()) ?? Date()
private let maximumDate = Calendar.current.date(byAdding: .year, value: 1, to: Date()) ?? Date()

@State private var tempDate: Date
@State private var showDatePicker = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct GroupTransactionListView: View {
.toolbarRole(.editor)
.toolbar {
ToolbarItem(placement: .topBarLeading) {
NavigationTitleTextView(text: "Payments")
NavigationTitleTextView(text: "Settlements")
}
}
}
Expand Down Expand Up @@ -251,7 +251,7 @@ private struct EmptyTransactionView: View {
.frame(width: geometry.size.width * 0.5, height: geometry.size.width * 0.4)
.padding(.bottom, 40)

Text("No payments yet!")
Text("No settlements yet!")
.font(.Header1())
.foregroundStyle(primaryText)
.multilineTextAlignment(.center)
Expand Down
5 changes: 0 additions & 5 deletions Splito/UI/Home/Groups/Group/GroupExpenseListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@ struct GroupExpenseListView: View {
.padding(.vertical, 5)
Spacer()
}
.onTapGestureForced {
UIApplication.shared.endEditing()
}
}
}

Expand Down Expand Up @@ -288,7 +285,6 @@ private struct GroupExpenseHeaderView: View {
.clipShape(RoundedRectangle(cornerRadius: 12))
.padding(.horizontal, 16)
.padding(.top, 8)
.onTapGestureForced { UIApplication.shared.endEditing() }
}
}

Expand Down Expand Up @@ -388,6 +384,5 @@ private struct ExpenseNotFoundView: View {
.padding(.horizontal, 16)
.frame(maxWidth: .infinity, alignment: .center)
.frame(minHeight: geometry.size.height - 280, maxHeight: .infinity, alignment: .center)
.onTapGestureForced { UIApplication.shared.endEditing() }
}
}
31 changes: 17 additions & 14 deletions Splito/UI/Home/Groups/Group/GroupHomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,13 @@ struct GroupHomeView: View {
}
}
}
.onTapGestureForced {
UIApplication.shared.endEditing()
}
.frame(maxWidth: isIpad ? 600 : nil, alignment: .center)
.frame(maxWidth: .infinity, alignment: .center)
.background(surfaceColor)
.toastView(toast: $viewModel.toast)
.alertView.alert(isPresented: $viewModel.showAlert, alertStruct: viewModel.alert)
.onDisappear {
if viewModel.showSearchBar {
Expand All @@ -68,7 +72,18 @@ struct GroupHomeView: View {
.ignoresSafeArea(.keyboard)
}
}
.toastView(toast: $viewModel.toast)
.toolbarRole(.editor)
.toolbar {
ToolbarItem(placement: .topBarLeading) {
NavigationTitleTextView(text: viewModel.group?.name ?? "")
}
ToolbarItem(placement: .topBarTrailing) {
ToolbarButtonView(systemImageName: "magnifyingglass", onClick: viewModel.handleSearchOptionTap)
}
ToolbarItem(placement: .topBarTrailing) {
ToolbarButtonView(systemImageName: "gearshape", onClick: viewModel.handleSettingsOptionTap)
}
}
.fullScreenCover(isPresented: $viewModel.showAddExpenseSheet) {
ExpenseRouteView(selectedGroupId: viewModel.groupId)
}
Expand Down Expand Up @@ -107,18 +122,6 @@ struct GroupHomeView: View {
.presentationDetents([.height(sheetHeight)])
.presentationCornerRadius(24)
}
.toolbarRole(.editor)
.toolbar {
ToolbarItem(placement: .topBarLeading) {
NavigationTitleTextView(text: viewModel.group?.name ?? "")
}
ToolbarItem(placement: .topBarTrailing) {
ToolbarButtonView(systemImageName: "magnifyingglass", onClick: viewModel.handleSearchOptionTap)
}
ToolbarItem(placement: .topBarTrailing) {
ToolbarButtonView(systemImageName: "gearshape", onClick: viewModel.handleSettingsOptionTap)
}
}
}
}

Expand All @@ -136,7 +139,7 @@ struct GroupOptionsListView: View {
HStack(spacing: 8) {
GroupOptionsButtonView(text: "Settle up", isForSettleUp: isSettleUpEnable, onTap: onSettleUpTap)

GroupOptionsButtonView(text: "Payments", onTap: onTransactionsTap)
GroupOptionsButtonView(text: "Settlements", onTap: onTransactionsTap)

GroupOptionsButtonView(text: "Balances", onTap: onBalanceTap)

Expand Down

0 comments on commit a4fd1fc

Please sign in to comment.