Skip to content

Commit

Permalink
Fix settingview when there is no subdetail for member
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-nirali-s committed Dec 16, 2024
1 parent 2bcd63c commit 8edb673
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Data/Data/Model/AppUser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public struct AppUser: Identifiable, Codable, Hashable {
public var phoneNumber: String?
public var imageUrl: String?
public var deviceFcmToken: String?
public let loginType: LoginType
public var loginType: LoginType
public var totalOweAmount: Double
public var isActive: Bool

Expand Down
3 changes: 2 additions & 1 deletion Data/Data/Repository/UserRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ public class UserRepository: ObservableObject {
public func storeUser(user: AppUser) async throws -> AppUser {
if var fetchedUser = try await store.fetchUserBy(id: user.id) {
LogD("UserRepository: \(#function) User already exists in Firestore.")
if !fetchedUser.isActive {
if !fetchedUser.isActive || user.loginType != fetchedUser.loginType {
fetchedUser.isActive = true
fetchedUser.loginType = user.loginType
return try await updateUser(user: fetchedUser)
}
return fetchedUser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ private struct GroupMemberCellView: View {
}

private var subInfo: String {
if let emailId = member.emailId {
if let emailId = member.emailId, !emailId.isEmpty {
return emailId
} else if let phoneNumber = member.phoneNumber {
} else if let phoneNumber = member.phoneNumber, !phoneNumber.isEmpty {
return phoneNumber
} else {
return "No email address"
Expand Down

0 comments on commit 8edb673

Please sign in to comment.