Skip to content

Commit

Permalink
Remove unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-nirali-s committed Dec 6, 2024
1 parent 5b76781 commit fcb02e4
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 172 deletions.
4 changes: 0 additions & 4 deletions BaseStyle/BaseStyle.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
D82C65552C46886E009947DC /* Roboto-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = D82C65502C46886E009947DC /* Roboto-Bold.ttf */; };
D82C65562C46886E009947DC /* Roboto-Medium.ttf in Resources */ = {isa = PBXBuildFile; fileRef = D82C65512C46886E009947DC /* Roboto-Medium.ttf */; };
D8302D9C2B9EE1D2005ACA13 /* PrimaryFloatingButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8302D9B2B9EE1D2005ACA13 /* PrimaryFloatingButton.swift */; };
D86632962C2410BB009D3EF5 /* OtpTextInputView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D86632952C2410BB009D3EF5 /* OtpTextInputView.swift */; };
D887213F2B99992A009DC5BE /* LoaderViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D887213E2B99992A009DC5BE /* LoaderViewModel.swift */; };
D89C933F2BC3C0F800FACD16 /* ForwardIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = D89C933E2BC3C0F800FACD16 /* ForwardIcon.swift */; };
D89C93462BC42DE500FACD16 /* MailComposeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D89C93452BC42DE500FACD16 /* MailComposeView.swift */; };
Expand Down Expand Up @@ -90,7 +89,6 @@
D82C65502C46886E009947DC /* Roboto-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Roboto-Bold.ttf"; sourceTree = "<group>"; };
D82C65512C46886E009947DC /* Roboto-Medium.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Roboto-Medium.ttf"; sourceTree = "<group>"; };
D8302D9B2B9EE1D2005ACA13 /* PrimaryFloatingButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrimaryFloatingButton.swift; sourceTree = "<group>"; };
D86632952C2410BB009D3EF5 /* OtpTextInputView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OtpTextInputView.swift; sourceTree = "<group>"; };
D887213E2B99992A009DC5BE /* LoaderViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LoaderViewModel.swift; path = BaseStyle/Views/LoaderViewModel.swift; sourceTree = SOURCE_ROOT; };
D89C933E2BC3C0F800FACD16 /* ForwardIcon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForwardIcon.swift; sourceTree = "<group>"; };
D89C93452BC42DE500FACD16 /* MailComposeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MailComposeView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -309,7 +307,6 @@
D8D42AAF2B872E44009B345D /* LoaderView.swift */,
D8D14A4F2BA090F000F45FF2 /* ShareSheetView.swift */,
D89C93452BC42DE500FACD16 /* MailComposeView.swift */,
D86632952C2410BB009D3EF5 /* OtpTextInputView.swift */,
D82174BD2BBAD86D00DB42C3 /* ProfileImageView.swift */,
D8E244C02B986CD800C6C82A /* ImagePickerView.swift */,
);
Expand Down Expand Up @@ -526,7 +523,6 @@
21D26E232CA199630090488B /* CapsuleButton.swift in Sources */,
D89C93462BC42DE500FACD16 /* MailComposeView.swift in Sources */,
213A1F2A2C52335D00BF9800 /* CheckmarkButton.swift in Sources */,
D86632962C2410BB009D3EF5 /* OtpTextInputView.swift in Sources */,
D8E244C12B986CD800C6C82A /* ImagePickerView.swift in Sources */,
D8D42A862B85D08F009B345D /* Font+Extension.swift in Sources */,
D8EB0ED82CAD8C9F00AC6A44 /* ErrorView.swift in Sources */,
Expand Down
61 changes: 0 additions & 61 deletions BaseStyle/BaseStyle/CustomUI/OtpTextInputView.swift

This file was deleted.

4 changes: 0 additions & 4 deletions BaseStyle/BaseStyle/Extension/String+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ extension String {
return emailPred.evaluate(with: self)
}

public func getNumbersOnly() -> String {
self.filter("0123456789".contains)
}

public func randomString(length: Int) -> String {
let letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
return String((0..<length).compactMap { _ in letters.randomElement() })
Expand Down
4 changes: 0 additions & 4 deletions Data/Data.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
D89C934C2BC68D9000FACD16 /* Date+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D89C934B2BC68D9000FACD16 /* Date+Extension.swift */; };
D89C934E2BC694C200FACD16 /* Double+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D89C934D2BC694C200FACD16 /* Double+Extension.swift */; };
D89DBE1D2B872F0B00E5F1BD /* NonceGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = D89DBE1C2B872F0B00E5F1BD /* NonceGenerator.swift */; };
D89DBE282B88802800E5F1BD /* Country.swift in Sources */ = {isa = PBXBuildFile; fileRef = D89DBE272B88802800E5F1BD /* Country.swift */; };
D89DBE2B2B88817E00E5F1BD /* JSONUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = D89DBE2A2B88817E00E5F1BD /* JSONUtils.swift */; };
D89DBE402B8C9E7400E5F1BD /* RouterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D89DBE3F2B8C9E7400E5F1BD /* RouterView.swift */; };
D89DBE462B8CBE0F00E5F1BD /* UserRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = D89DBE452B8CBE0F00E5F1BD /* UserRepository.swift */; };
Expand Down Expand Up @@ -88,7 +87,6 @@
D89C934B2BC68D9000FACD16 /* Date+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+Extension.swift"; sourceTree = "<group>"; };
D89C934D2BC694C200FACD16 /* Double+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Double+Extension.swift"; sourceTree = "<group>"; };
D89DBE1C2B872F0B00E5F1BD /* NonceGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NonceGenerator.swift; sourceTree = "<group>"; };
D89DBE272B88802800E5F1BD /* Country.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Country.swift; sourceTree = "<group>"; };
D89DBE2A2B88817E00E5F1BD /* JSONUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONUtils.swift; sourceTree = "<group>"; };
D89DBE3F2B8C9E7400E5F1BD /* RouterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouterView.swift; sourceTree = "<group>"; };
D89DBE452B8CBE0F00E5F1BD /* UserRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserRepository.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -177,7 +175,6 @@
D89DBE262B88801F00E5F1BD /* Model */ = {
isa = PBXGroup;
children = (
D89DBE272B88802800E5F1BD /* Country.swift */,
D89DBE472B8CBE4C00E5F1BD /* AppUser.swift */,
D83B15042B9996C0004A5F4F /* Groups.swift */,
D85E86DD2BAB0292002EDF76 /* Expense.swift */,
Expand Down Expand Up @@ -526,7 +523,6 @@
D8A7CA802BA867F80014EC67 /* String+Extension.swift in Sources */,
213D0CCA2C89DBC800D65C73 /* Notification+Extension.swift in Sources */,
D895F2282CA297B900C2E4EB /* NetworkManager.swift in Sources */,
D89DBE282B88802800E5F1BD /* Country.swift in Sources */,
D8910E382BB6D1D300877CE0 /* ExpenseStore.swift in Sources */,
D8CF5A212C1986250014E3AD /* Transaction.swift in Sources */,
D83D72EC2C8B23FB007BAAA9 /* DocumentReference+Extension.swift in Sources */,
Expand Down
34 changes: 0 additions & 34 deletions Data/Data/Model/Country.swift

This file was deleted.

4 changes: 2 additions & 2 deletions Data/Data/Repository/UserRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ public class UserRepository: ObservableObject {

public func storeUser(user: AppUser) async throws -> AppUser {
if let storedUser = try await store.fetchUserBy(id: user.id) {
LogD("User already exists in Firestore: \(storedUser)")
LogD("UserRepository: \(#function) User already exists in Firestore: \(storedUser)")
return storedUser
} else {
LogD("User does not exist. Adding new user: \(user)")
LogD("UserRepository: \(#function) User does not exist. Adding new user: \(user)")
try await store.addUser(user: user)
return user
}
Expand Down
44 changes: 0 additions & 44 deletions Splito/Localization/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,6 @@
"Enter a reason for this payment" : {
"extractionState" : "manual"
},
"Enter a valid phone number." : {
"extractionState" : "manual"
},
"Enter code" : {
"extractionState" : "manual"
},
Expand Down Expand Up @@ -370,9 +367,6 @@
"Enter your phone number" : {
"extractionState" : "manual"
},
"Entered number is too long, Please check the phone number." : {
"extractionState" : "manual"
},
"equally" : {
"extractionState" : "manual"
},
Expand Down Expand Up @@ -400,9 +394,6 @@
"get back" : {
"extractionState" : "manual"
},
"Get OTP" : {
"extractionState" : "manual"
},
"Get Started" : {
"extractionState" : "manual"
},
Expand Down Expand Up @@ -454,9 +445,6 @@
"Invalid Email" : {
"extractionState" : "manual"
},
"Invalid OTP" : {
"extractionState" : "manual"
},
"It seems that everything has settled down in all groups." : {

},
Expand Down Expand Up @@ -634,9 +622,6 @@
"Please select group to get payer list." : {
"extractionState" : "manual"
},
"Please, enter a valid OTP code." : {
"extractionState" : "manual"
},
"Privacy Policy" : {
"extractionState" : "manual"
},
Expand Down Expand Up @@ -673,17 +658,6 @@
"requires recent authentication" : {
"extractionState" : "manual"
},
"Resend code " : {
"extractionState" : "stale",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Resend code "
}
}
}
},
"Restore expense" : {
"extractionState" : "manual"
},
Expand All @@ -705,9 +679,6 @@
"Retry" : {
"extractionState" : "manual"
},
"Search" : {
"extractionState" : "manual"
},
"Search expenses" : {
"extractionState" : "manual"
},
Expand Down Expand Up @@ -933,24 +904,9 @@
"Use settle up to divide costs with your friends or colleagues. It's easy and ensures everyone pays or receives their fair share.\\n\\nLet's get started splitting bills easily with friends." : {
"extractionState" : "manual"
},
"Verification code" : {
"extractionState" : "manual"
},
"Verify" : {
"extractionState" : "manual"
},
"Warning" : {
"extractionState" : "manual"
},
"We’ll verify your phone number with a verification code." : {
"extractionState" : "manual"
},
"We’ve sent a verification code to your phone %@." : {
"extractionState" : "manual"
},
"What’s your phone number?" : {
"extractionState" : "manual"
},
"Whoops!" : {
"extractionState" : "manual"
},
Expand Down
17 changes: 0 additions & 17 deletions Splito/UI/Home/Account/User Profile/UserProfileViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
// Created by Amisha Italiya on 14/03/24.
//

import SwiftUI
import Data
import Combine
import BaseStyle
import AVFoundation
import FirebaseAuth
Expand Down Expand Up @@ -327,19 +325,4 @@ extension UserProfileViewModel {

TopViewController.shared.topViewController()?.present(alert, animated: true)
}

private func handleFirebaseAuthErrors(_ error: Error) {
if (error as NSError).code == FirebaseAuth.AuthErrorCode.webContextCancelled.rawValue {
showAlertFor(message: "Something went wrong! Please try after some time.")
} else if (error as NSError).code == FirebaseAuth.AuthErrorCode.tooManyRequests.rawValue {
showAlertFor(message: "Too many attempts, please try after some time.")
} else if (error as NSError).code == FirebaseAuth.AuthErrorCode.missingPhoneNumber.rawValue {
showAlertFor(message: "Enter a valid phone number.")
} else if (error as NSError).code == FirebaseAuth.AuthErrorCode.invalidPhoneNumber.rawValue {
showAlertFor(message: "Enter a valid phone number.")
} else {
LogE("UserProfileViewModel: \(#function) Phone login fail with error: \(error).")
showAlertFor(title: "Authentication failed", message: "Apologies, we were not able to complete the authentication process. Please try again later.")
}
}
}
43 changes: 41 additions & 2 deletions Splito/UI/Home/Groups/Add Member/JoinMemberView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ struct JoinMemberView: View {
.foregroundStyle(primaryText)
.multilineTextAlignment(.center)

OtpTextInputView(text: $viewModel.code, placeholder: "AF0R00", isFocused: $isFocused,
keyboardType: .alphabet) {
JoinMemberTextInputView(text: $viewModel.code, placeholder: "AF0R00", isFocused: $isFocused) {
viewModel.handleJoinMemberAction { isSucceed in
if isSucceed { dismiss() }
}
Expand Down Expand Up @@ -72,3 +71,43 @@ struct JoinMemberView: View {
}
}
}

public struct JoinMemberTextInputView: View {

private let CODE_TOTAL_CHARACTERS = 6

@Binding var text: String

let placeholder: String
let isFocused: FocusState<Bool>.Binding

var onCodeChange: (() -> Void)

public var body: some View {
TextField(placeholder.localized, text: $text)
.kerning(16)
.focused(isFocused)
.tint(primaryColor)
.font(.Header2())
.keyboardType(.alphabet)
.foregroundStyle(primaryText)
.multilineTextAlignment(.center)
.textContentType(.oneTimeCode)
.autocorrectionDisabled()
.onChange(of: text) { newValue in
if newValue.count == CODE_TOTAL_CHARACTERS {
onCodeChange()
UIApplication.shared.endEditing()
}
}
.textInputAutocapitalization(.never)
.onAppear {
if text.isEmpty {
isFocused.wrappedValue = true
} else {
isFocused.wrappedValue = false
UIApplication.shared.endEditing()
}
}
}
}

0 comments on commit fcb02e4

Please sign in to comment.