Skip to content

Commit

Permalink
Merge branch 'main'
Browse files Browse the repository at this point in the history
#Conflicts:
#	Splito/UI/Home/Groups/Group/GroupExpenseListView.swift
  • Loading branch information
cp-amisha-i committed Jan 7, 2025
2 parents 66c919e + 5e1c494 commit 9a867f6
Show file tree
Hide file tree
Showing 16 changed files with 94 additions and 62 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
66 changes: 53 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Splito is currently in active development, with exciting new features planned:
- **Public Contribution Poll:** Allow group members to vote 🗳️ on contributions for events or shared purchases.

<details>
<summary> How to Use Splito </summary>
<summary><b> How to Use Splito </b></summary>

## How to Use Splito

Expand Down Expand Up @@ -105,26 +105,66 @@ Splito is currently in active development, with exciting new features planned:
</tr>
</table>

## Requirements ✅
## Project Setup ⚙️

Make sure you have the latest stable version of Xcode installed. Then, you can clone this repository to Xcode.

To run Splito locally, you'll need:
- iOS (version 16.4 or higher)
- Xcode (version 15.4 or higher)
### Notes 📝
- If you're contributing to the project, make sure to create your own Firebase project and follow the steps above to configure the required files.
- Ensure that you update the `GoogleService-Info.plist` and `Secrets.xcconfig` file with your own Firebase project values to build and run the app successfully.
- Sensitive data such as `REVERSE_CLIENT_ID` and other keys are not included in the repository for security purposes.

<details>
<summary> Firebase Setup </summary>
To clone and run the Splito project locally, please follow these steps:

## Firebase Setup 🚀
### 1. Requirements ✅
- **Xcode:** Version 15.4 or higher.
- **iOS:** Version 16.4 or higher.
- **Firebase:** A Firebase project set up in the [Firebase Console](https://console.firebase.google.com).

To enable Firebase services, you will need to create a new project in the Firebase Console. Use the app bundle ID value specified in the project setting in Xcode. Once the project is created, you will need to add the GoogleService-Info.plist file to the project. For more information, refer to the [Firebase documentation](https://firebase.google.com/docs/ios/setup).
### 2. Creating the Config Settings File 🛠️
- Create a `Secrets.xcconfig` File.
- Add the following configuration values to a new file named `Secrets.xcconfig` in the Splito directory:

Splito uses the following Firebase services, Make sure you enable them in your Firebase project:
```
// APP INFO
app_name = Splito
app_bundle = com.*****.splito // as per your choice.
app_version_name = 1.0.0
app_version_code = 1000000
```

- Authentication (Phone, Google and Apple login)
- Firestore (To store user data)
### 3. Firebase Setup 🚀

</details>
- **Create a Firebase Project:**
- Go to the Firebase Console.
- Create a new project and configure it with the same bundle ID used in the project.

- **Enable Firebase Services:**
- Authentication (Phone, Google, and Apple login).
- Firestore (For storing user data).

- **Download `GoogleService-Info.plist`:**
- After setting up Firebase, download the `GoogleService-Info.plist` file from the Firebase Console.
- Add this file to the project directory under `Splito/Plist/GoogleService-Info.plist`.

### 4. Configuring Reverse Client ID 🔑

- **Set Up Google Login:**
- Obtain the `REVERSE_CLIENT_ID` from your Firebase project's Google Sign-In setup.
- Add this value to the `Secrets.xcconfig` file in the following format:

```
GOOGLE_REVERSE_CLIENT_ID = com.googleusercontent.apps.************-********.....
```

- **Reference in `Info.plist`:**
- The project is configured to use environment variables for sensitive data.
- The `REVERSE_CLIENT_ID` is dynamically added to `Info.plist` during the build process.

### 5. Environment Variable for Deployment 🌐
- The `Secrets.xcconfig` file and `GoogleService-Info.plist` are base64-encoded and stored securely in GitHub secrets for CI/CD purposes.
- During deployment, these files are decoded and added to the project.
- For more detail, you can check this [deployment script](https://github.com/canopas/splito/blob/main/.github/workflows/Deploy.yml).

## Tech stack 📚
Splito utilizes the latest iOS technologies and adheres to industry best practices. Below is the current tech stack used in the development process:
Expand Down
6 changes: 3 additions & 3 deletions Splito.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -336,15 +336,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 @@ -427,7 +427,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 @@ -125,9 +125,6 @@ struct GroupExpenseListView: View {
.padding(.vertical, 5)
Spacer()
}
.onTapGestureForced {
UIApplication.shared.endEditing()
}
}
}

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

Expand Down Expand Up @@ -390,6 +386,5 @@ struct ExpenseNotFoundView: View {
.padding(.horizontal, 16)
.frame(maxWidth: .infinity, alignment: .center)
.frame(minHeight: minHeight, 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 9a867f6

Please sign in to comment.