Skip to content

Commit

Permalink
Add member list to group setting
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-amisha-i committed Apr 1, 2024
1 parent 66e3525 commit f5dfbe8
Show file tree
Hide file tree
Showing 25 changed files with 385 additions and 112 deletions.
6 changes: 5 additions & 1 deletion BaseStyle/BaseStyle.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/* Begin PBXBuildFile section */
5DAEE93D2D2208132D031984 /* Pods_BaseStyleTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E4AFAF996FB5C233D40D81D5 /* Pods_BaseStyleTests.framework */; };
A40018A9B957803B8105BEA5 /* Pods_BaseStyle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 174198EE4AF2FC82DADEB060 /* Pods_BaseStyle.framework */; };
D82174BE2BBAD86D00DB42C3 /* ProfileImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D82174BD2BBAD86D00DB42C3 /* ProfileImageView.swift */; };
D8302D9C2B9EE1D2005ACA13 /* PrimaryFloatingButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8302D9B2B9EE1D2005ACA13 /* PrimaryFloatingButton.swift */; };
D887213F2B99992A009DC5BE /* LoaderViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D887213E2B99992A009DC5BE /* LoaderViewModel.swift */; };
D89DBE2D2B88828300E5F1BD /* Countries.json in Resources */ = {isa = PBXBuildFile; fileRef = D89DBE2C2B88828300E5F1BD /* Countries.json */; };
Expand Down Expand Up @@ -69,6 +70,7 @@
2CE85328C46B183FC3F074A3 /* Pods-BaseStyle.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BaseStyle.release.xcconfig"; path = "Target Support Files/Pods-BaseStyle/Pods-BaseStyle.release.xcconfig"; sourceTree = "<group>"; };
5BDB5B9B63CFD771230CD759 /* Pods-BaseStyleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BaseStyleTests.release.xcconfig"; path = "Target Support Files/Pods-BaseStyleTests/Pods-BaseStyleTests.release.xcconfig"; sourceTree = "<group>"; };
CC9EC1F1C0A5A0821118E6CA /* Pods-BaseStyleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BaseStyleTests.debug.xcconfig"; path = "Target Support Files/Pods-BaseStyleTests/Pods-BaseStyleTests.debug.xcconfig"; sourceTree = "<group>"; };
D82174BD2BBAD86D00DB42C3 /* ProfileImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileImageView.swift; sourceTree = "<group>"; };
D8302D9B2B9EE1D2005ACA13 /* PrimaryFloatingButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrimaryFloatingButton.swift; sourceTree = "<group>"; };
D887213E2B99992A009DC5BE /* LoaderViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LoaderViewModel.swift; path = BaseStyle/Views/LoaderViewModel.swift; sourceTree = SOURCE_ROOT; };
D89DBE2C2B88828300E5F1BD /* Countries.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = Countries.json; sourceTree = "<group>"; };
Expand Down Expand Up @@ -298,12 +300,13 @@
D8D42AAA2B872A6D009B345D /* CustomUI */ = {
isa = PBXGroup;
children = (
D8302D9A2B9EE1BF005ACA13 /* Buttons */,
D8D42AAB2B872A7C009B345D /* ToastView.swift */,
D89DBE322B888F2D00E5F1BD /* SearchBar.swift */,
D8D42AAF2B872E44009B345D /* LoaderView.swift */,
D8D14A4F2BA090F000F45FF2 /* ShareSheetView.swift */,
D8302D9A2B9EE1BF005ACA13 /* Buttons */,
D89DBE3B2B88AA1500E5F1BD /* CustomTextField.swift */,
D82174BD2BBAD86D00DB42C3 /* ProfileImageView.swift */,
D8E244C02B986CD800C6C82A /* ImagePickerView.swift */,
);
path = CustomUI;
Expand Down Expand Up @@ -507,6 +510,7 @@
D8D42A812B85D07C009B345D /* SecondaryButton.swift in Sources */,
D8D42AB02B872E44009B345D /* LoaderView.swift in Sources */,
D8D42A9D2B870A5D009B345D /* ToastPrompt.swift in Sources */,
D82174BE2BBAD86D00DB42C3 /* ProfileImageView.swift in Sources */,
D89DBE352B88A05F00E5F1BD /* UIApplication+Extension.swift in Sources */,
D89DBE3C2B88AA1500E5F1BD /* CustomTextField.swift in Sources */,
D8D42A772B85CE2A009B345D /* ButtonStyleTapGestureModifier.swift in Sources */,
Expand Down
79 changes: 79 additions & 0 deletions BaseStyle/BaseStyle/CustomUI/ProfileImageView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
//
// ProfileImageView.swift
// BaseStyle
//
// Created by Amisha Italiya on 01/04/24.
//

import SwiftUI
import Kingfisher

public struct MemberProfileImageView: View {

let imageUrl: String?

public init(imageUrl: String?) {
self.imageUrl = imageUrl
}

public var body: some View {
VStack(spacing: 0) {
if let imageUrl, let url = URL(string: imageUrl) {
KFImage(url)
.placeholder({ _ in
ImageLoaderView()
})
.setProcessor(ResizingImageProcessor(referenceSize: CGSize(width: (50 * UIScreen.main.scale), height: (50 * UIScreen.main.scale)), mode: .aspectFill))
.resizable()
.scaledToFill()
.frame(width: 50, height: 50, alignment: .center)
.clipShape(RoundedRectangle(cornerRadius: 25))
.overlay(
Circle()
.strokeBorder(Color.gray, lineWidth: 1)
)
} else {
Image(.user)
.resizable()
.scaledToFill()
.frame(width: 50, height: 50, alignment: .center)
.clipShape(RoundedRectangle(cornerRadius: 25))
.overlay(
Circle()
.strokeBorder(Color.gray, lineWidth: 1)
)
}
}
}
}

public struct GroupProfileImageView: View {

let imageUrl: String?

public init(imageUrl: String?) {
self.imageUrl = imageUrl
}

public var body: some View {
VStack(spacing: 0) {
if let imageUrl, let url = URL(string: imageUrl) {
KFImage(url)
.placeholder({ _ in
ImageLoaderView()
})
.setProcessor(ResizingImageProcessor(referenceSize: CGSize(width: (50 * UIScreen.main.scale), height: (50 * UIScreen.main.scale)), mode: .aspectFill))
.resizable()
.scaledToFill()
.frame(width: 50, height: 50, alignment: .center)
.clipShape(RoundedRectangle(cornerRadius: 8))
} else {
Image(.group)
.resizable()
.scaledToFill()
.frame(width: 50, height: 50, alignment: .center)
.clipShape(RoundedRectangle(cornerRadius: 8))
}
}
}
}
2 changes: 2 additions & 0 deletions BaseStyle/BaseStyle/Resource/AppColors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public let outlineColor = Color.outline
public let primaryColor = Color.mainPrimary

public let disableText = Color.disableText
public let disableLightText = Color.disableLightText

public let primaryText = Color.primaryText
public let secondaryText = Color.secondaryText

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0xED",
"green" : "0xE8",
"red" : "0xE6"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Group.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "User.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions Data/Data/Router/AppRoute.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public enum AppRoute: Hashable {
case CreateGroupView
case InviteMemberView(groupId: String)
case JoinMemberView
case GroupSettingView(groupId: String)

// MARK: - Expense Button
case AddExpenseView
Expand All @@ -49,6 +50,8 @@ public enum AppRoute: Hashable {
"phoneLoginView"
case .VerifyOTPView:
"verifyOTPView"
case .ProfileView:
"userProfileView"
case .HomeView:
"homeView"

Expand All @@ -68,8 +71,8 @@ public enum AppRoute: Hashable {
"inviteMemberView"
case .JoinMemberView:
"joinMemberView"
case .ProfileView:
"userProfileView"
case .GroupSettingView:
"groupSettingView"

case .AddExpenseView:
"addExpenseView"
Expand Down
8 changes: 4 additions & 4 deletions Splito.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
D8D14A582BA189F800F45FF2 /* JoinMemberViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D14A572BA189F800F45FF2 /* JoinMemberViewModel.swift */; };
D8D14A602BA2DCDB00F45FF2 /* UserProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D14A5F2BA2DCDB00F45FF2 /* UserProfileView.swift */; };
D8D14A622BA2DCE700F45FF2 /* UserProfileViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D14A612BA2DCE700F45FF2 /* UserProfileViewModel.swift */; };
D8D14A652BA2DD7300F45FF2 /* ProfileImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D14A642BA2DD7300F45FF2 /* ProfileImageView.swift */; };
D8D14A652BA2DD7300F45FF2 /* UserProfileImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D14A642BA2DD7300F45FF2 /* UserProfileImageView.swift */; };
D8D14A672BA2E25100F45FF2 /* UserProfileList.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D14A662BA2E25100F45FF2 /* UserProfileList.swift */; };
D8D14A692BA3133500F45FF2 /* OnboardRouteView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D14A682BA3133500F45FF2 /* OnboardRouteView.swift */; };
D8D42A972B86FBF8009B345D /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = D8D42A962B86FBF8009B345D /* GoogleService-Info.plist */; };
Expand Down Expand Up @@ -163,7 +163,7 @@
D8D14A572BA189F800F45FF2 /* JoinMemberViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JoinMemberViewModel.swift; sourceTree = "<group>"; };
D8D14A5F2BA2DCDB00F45FF2 /* UserProfileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserProfileView.swift; sourceTree = "<group>"; };
D8D14A612BA2DCE700F45FF2 /* UserProfileViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserProfileViewModel.swift; sourceTree = "<group>"; };
D8D14A642BA2DD7300F45FF2 /* ProfileImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileImageView.swift; sourceTree = "<group>"; };
D8D14A642BA2DD7300F45FF2 /* UserProfileImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserProfileImageView.swift; sourceTree = "<group>"; };
D8D14A662BA2E25100F45FF2 /* UserProfileList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserProfileList.swift; sourceTree = "<group>"; };
D8D14A682BA3133500F45FF2 /* OnboardRouteView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardRouteView.swift; sourceTree = "<group>"; };
D8D42A962B86FBF8009B345D /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -487,7 +487,7 @@
D8D14A662BA2E25100F45FF2 /* UserProfileList.swift */,
D8D14A5F2BA2DCDB00F45FF2 /* UserProfileView.swift */,
D8D14A612BA2DCE700F45FF2 /* UserProfileViewModel.swift */,
D8D14A642BA2DD7300F45FF2 /* ProfileImageView.swift */,
D8D14A642BA2DD7300F45FF2 /* UserProfileImageView.swift */,
);
path = "User Profile";
sourceTree = "<group>";
Expand Down Expand Up @@ -776,7 +776,7 @@
D8AC26F42B84B12800CEAAD3 /* OnboardViewModel.swift in Sources */,
D89DBE3A2B88A6B400E5F1BD /* VerifyOtpViewModel.swift in Sources */,
D89DBE5F2B8DE98600E5F1BD /* AccountRouteView.swift in Sources */,
D8D14A652BA2DD7300F45FF2 /* ProfileImageView.swift in Sources */,
D8D14A652BA2DD7300F45FF2 /* UserProfileImageView.swift in Sources */,
D8D14A672BA2E25100F45FF2 /* UserProfileList.swift in Sources */,
D85E86E72BB2E189002EDF76 /* ExpenseRouteView.swift in Sources */,
D8302DA02B9F282F005ACA13 /* InviteMemberView.swift in Sources */,
Expand Down
20 changes: 2 additions & 18 deletions Splito/UI/Home/Expense/Detail Selection/ChooseGroupView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,8 @@ private struct GroupCellView: View {
var isSelected: Bool

var body: some View {
HStack(alignment: .center, spacing: 16) {
if let imageUrl = group.imageUrl, let url = URL(string: imageUrl) {
KFImage(url)
.placeholder({ _ in
ImageLoaderView()
})
.setProcessor(ResizingImageProcessor(referenceSize: CGSize(width: (50 * UIScreen.main.scale), height: (50 * UIScreen.main.scale)), mode: .aspectFill))
.resizable()
.scaledToFill()
.frame(width: 50, height: 50, alignment: .center)
.clipShape(RoundedRectangle(cornerRadius: 10))
} else {
Image(.group)
.resizable()
.scaledToFill()
.frame(width: 50, height: 50, alignment: .center)
.clipShape(RoundedRectangle(cornerRadius: 10))
}
HStack(alignment: .center, spacing: 20) {
GroupProfileImageView(imageUrl: group.imageUrl)

Text(group.name)
.font(.subTitle2())
Expand Down
28 changes: 2 additions & 26 deletions Splito/UI/Home/Expense/Detail Selection/ChoosePayerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,32 +82,8 @@ private struct MemberCellView: View {
}

var body: some View {
HStack(alignment: .center, spacing: 16) {
if let imageUrl = member.imageUrl, let url = URL(string: imageUrl) {
KFImage(url)
.placeholder({ _ in
ImageLoaderView()
})
.setProcessor(ResizingImageProcessor(referenceSize: CGSize(width: (50 * UIScreen.main.scale), height: (50 * UIScreen.main.scale)), mode: .aspectFill))
.resizable()
.scaledToFill()
.frame(width: 50, height: 50, alignment: .center)
.clipShape(RoundedRectangle(cornerRadius: 25))
.overlay(
Circle()
.strokeBorder(Color.gray, lineWidth: 1)
)
} else {
Image(.user)
.resizable()
.scaledToFill()
.frame(width: 50, height: 50, alignment: .center)
.clipShape(RoundedRectangle(cornerRadius: 25))
.overlay(
Circle()
.strokeBorder(Color.gray, lineWidth: 1)
)
}
HStack(alignment: .center, spacing: 20) {
MemberProfileImageView(imageUrl: member.imageUrl)

Text((userName ?? "").isEmpty ? "Unknown" : userName!)
.font(.subTitle2())
Expand Down
1 change: 1 addition & 0 deletions Splito/UI/Home/Groups/Add Member/InviteMemberView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ struct InviteMemberView: View {
Spacer()
}
.padding(.horizontal, 20)
.background(backgroundColor)
.navigationBarTitle("Invite Code", displayMode: .inline)
.frame(maxWidth: isIpad ? 600 : nil, alignment: .center)
.toastView(toast: $viewModel.toast)
Expand Down
1 change: 1 addition & 0 deletions Splito/UI/Home/Groups/Add Member/JoinMemberView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ struct JoinMemberView: View {
}
}
.padding(.horizontal, 22)
.background(backgroundColor)
.frame(maxWidth: isIpad ? 600 : nil, alignment: .center)
.navigationBarTitle("Join Group", displayMode: .inline)
.toastView(toast: $viewModel.toast)
Expand Down
35 changes: 0 additions & 35 deletions Splito/UI/Home/Groups/Create Group/CreateGroupView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,41 +118,6 @@ private struct AddGroupNameView: View {
}
}

private struct GroupTypeSelectionView: View {

var body: some View {
VStack(alignment: .leading, spacing: 16) {
Text("Type")
.font(.subTitle4())
.foregroundColor(secondaryText)
.frame(maxWidth: .infinity, alignment: .leading)

ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 10) {
ForEach(CreateGroupViewModel.GroupType.allCases, id: \.self) { type in
Button {

} label: {
Text(type.rawValue)
.font(.subTitle3())
.foregroundColor(secondaryText)
// .foregroundColor(viewModel.selectedGroupType == type ? .white : .primary)
// .background(viewModel.selectedGroupType == type ? Color.blue : Color.clear)
}
.padding(.vertical, 10)
.padding(.horizontal, 20)
.overlay(
RoundedRectangle(cornerRadius: 30)
.stroke(secondaryText.opacity(0.5), lineWidth: 1)
)
}
}
.padding(1)
}
}
}
}

#Preview {
CreateGroupView(viewModel: CreateGroupViewModel(router: .init(root: .CreateGroupView)))
}
5 changes: 3 additions & 2 deletions Splito/UI/Home/Groups/Create Group/CreateGroupViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ class CreateGroupViewModel: BaseViewModel, ObservableObject {
@Published var showImagePickerOptions = false
@Published var profileImage: UIImage?

@Published var selectedGroupType: GroupType?
@Published var group: Groups?
@Published var currentState: ViewState = .initial

let router: Router<AppRoute>
var isOpenForEdit: Bool = false

init(router: Router<AppRoute>) {
init(router: Router<AppRoute>, group: Groups? = nil) {
self.router = router
super.init()
}
Expand Down
Loading

0 comments on commit f5dfbe8

Please sign in to comment.