addition of microphone

This commit is contained in:
talksik
2021-12-12 02:15:38 -08:00
parent be3e744b49
commit 38e41df164
9 changed files with 91 additions and 32 deletions
+20 -4
View File
@@ -16,13 +16,15 @@
891A15F9276563CA00B26659 /* WelcomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 891A15F8276563CA00B26659 /* WelcomeView.swift */; };
891A15FD276566B800B26659 /* constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 891A15FC276566B800B26659 /* constants.swift */; };
891A15FF27656F9200B26659 /* HeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 891A15FE27656F9200B26659 /* HeaderView.swift */; };
891A160127656FB200B26659 /* Footer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 891A160027656FB200B26659 /* Footer.swift */; };
891A160127656FB200B26659 /* FooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 891A160027656FB200B26659 /* FooterView.swift */; };
891A160327656FC700B26659 /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 891A160227656FC700B26659 /* HomeView.swift */; };
891A1607276572A800B26659 /* Onboarding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 891A1606276572A800B26659 /* Onboarding.swift */; };
891A160B2765732700B26659 /* HomeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 891A160A2765732700B26659 /* HomeViewModel.swift */; };
891A160E27657CEA00B26659 /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = 891A160D27657CEA00B26659 /* User.swift */; };
891A1611276590B000B26659 /* ChatsCarouselView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 891A1610276590B000B26659 /* ChatsCarouselView.swift */; };
891A16132765A44300B26659 /* ChatsCarouselViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 891A16122765A44300B26659 /* ChatsCarouselViewModel.swift */; };
892179E42765FEB8001E6C60 /* FooterControlsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 892179E32765FEB8001E6C60 /* FooterControlsView.swift */; };
892179E62765FECD001E6C60 /* FooterControlsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 892179E52765FECD001E6C60 /* FooterControlsViewModel.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -37,13 +39,15 @@
891A15F8276563CA00B26659 /* WelcomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeView.swift; sourceTree = "<group>"; };
891A15FC276566B800B26659 /* constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = constants.swift; sourceTree = "<group>"; };
891A15FE27656F9200B26659 /* HeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeaderView.swift; sourceTree = "<group>"; };
891A160027656FB200B26659 /* Footer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Footer.swift; sourceTree = "<group>"; };
891A160027656FB200B26659 /* FooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FooterView.swift; sourceTree = "<group>"; };
891A160227656FC700B26659 /* HomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeView.swift; sourceTree = "<group>"; };
891A1606276572A800B26659 /* Onboarding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Onboarding.swift; sourceTree = "<group>"; };
891A160A2765732700B26659 /* HomeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeViewModel.swift; sourceTree = "<group>"; };
891A160D27657CEA00B26659 /* User.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = User.swift; sourceTree = "<group>"; };
891A1610276590B000B26659 /* ChatsCarouselView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatsCarouselView.swift; sourceTree = "<group>"; };
891A16122765A44300B26659 /* ChatsCarouselViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatsCarouselViewModel.swift; sourceTree = "<group>"; };
892179E32765FEB8001E6C60 /* FooterControlsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FooterControlsView.swift; sourceTree = "<group>"; };
892179E52765FECD001E6C60 /* FooterControlsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FooterControlsViewModel.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -108,6 +112,7 @@
891A15F62765639B00B26659 /* Views */ = {
isa = PBXGroup;
children = (
892179E22765FE93001E6C60 /* FooterControlsView */,
891A16052765726800B26659 /* Templates */,
891A16042765725D00B26659 /* WelcomeView */,
891A1608276572BB00B26659 /* HomeView */,
@@ -126,7 +131,7 @@
891A16052765726800B26659 /* Templates */ = {
isa = PBXGroup;
children = (
891A160027656FB200B26659 /* Footer.swift */,
891A160027656FB200B26659 /* FooterView.swift */,
891A15FE27656F9200B26659 /* HeaderView.swift */,
891A1606276572A800B26659 /* Onboarding.swift */,
);
@@ -169,6 +174,15 @@
path = ChatsCarouselView;
sourceTree = "<group>";
};
892179E22765FE93001E6C60 /* FooterControlsView */ = {
isa = PBXGroup;
children = (
892179E32765FEB8001E6C60 /* FooterControlsView.swift */,
892179E52765FECD001E6C60 /* FooterControlsViewModel.swift */,
);
path = FooterControlsView;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -244,13 +258,15 @@
891A15E327653A7000B26659 /* ContentView.swift in Sources */,
891A160327656FC700B26659 /* HomeView.swift in Sources */,
891A160B2765732700B26659 /* HomeViewModel.swift in Sources */,
892179E62765FECD001E6C60 /* FooterControlsViewModel.swift in Sources */,
891A15F5276557AB00B26659 /* colors.swift in Sources */,
891A15F9276563CA00B26659 /* WelcomeView.swift in Sources */,
891A1611276590B000B26659 /* ChatsCarouselView.swift in Sources */,
891A16132765A44300B26659 /* ChatsCarouselViewModel.swift in Sources */,
891A15E127653A7000B26659 /* nirvana_iosApp.swift in Sources */,
891A160127656FB200B26659 /* Footer.swift in Sources */,
891A160127656FB200B26659 /* FooterView.swift in Sources */,
891A15FF27656F9200B26659 /* HeaderView.swift in Sources */,
892179E42765FEB8001E6C60 /* FooterControlsView.swift in Sources */,
891A15FD276566B800B26659 /* constants.swift in Sources */,
891A160E27657CEA00B26659 /* User.swift in Sources */,
);
+1 -1
View File
@@ -36,7 +36,7 @@ extension UIColor {
}
}
final class NirvanaColors {
final class NirvanaColor {
static let teal:Color = Color(red: 0.0, green: 0.314, blue: 0.314)
static let bgLightGrey:Color = Color(red: 0.898, green: 0.898, blue: 0.898)
static let white: Color = Color.white
@@ -0,0 +1,38 @@
//
// FooterControlsView.swift
// nirvana-ios
//
// Created by Arjun Patel on 12/12/21.
//
import SwiftUI
struct FooterControlsView: View {
@StateObject var viewModel:FooterControlsViewModel = FooterControlsViewModel()
var body: some View {
HStack(alignment: .center) {
Spacer()
Button {
print("Button was pressed!")
} label: {
var icon:String = viewModel.isRecording ? "waveform" : "mic.fill"
Image(systemName: icon)
.foregroundColor(.white)
.padding()
.background(NirvanaColor.teal)
.clipShape(Circle())
}
}
.frame(maxWidth: .infinity)
.padding(.horizontal, 30)
}
}
struct FooterControlsView_Previews: PreviewProvider {
static var previews: some View {
FooterControlsView()
}
}
@@ -0,0 +1,14 @@
//
// FooterControlsViewModel.swift
// nirvana-ios
//
// Created by Arjun Patel on 12/12/21.
//
import Foundation
final class FooterControlsViewModel: ObservableObject {
@Published var isRecording: Bool = false
}
@@ -12,14 +12,7 @@ struct ChatsCarouselView: View {
// current snapped/selected user
@State var selectedUserId: String = ""
@State var selectedUser: User?
private func getScale(proxy: GeometryProxy) -> CGFloat {
let scale:CGFloat = 2
return scale
}
func getSelectedUser(userId: String) -> User {
return self.viewModel.carouselUsers.filter{user in
return user.id == userId
@@ -33,7 +26,6 @@ struct ChatsCarouselView: View {
ForEach(viewModel.carouselUsers) { carouselUser in
GeometryReader {proxy in
let minX = proxy.frame(in: .local).minX
let scale = getScale(proxy: proxy)
Image(carouselUser.profilePictureUrl)
.renderingMode(.original)
@@ -45,12 +37,12 @@ struct ChatsCarouselView: View {
.blur(radius: abs(minX) / 40)
.scaleEffect()
.padding(40)
.frame(maxWidth: UIScreen.main.bounds.width)
}
.tag(carouselUser.id)
}
}
.frame(maxWidth: UIScreen.main.bounds.width * 0.8)
.tabViewStyle(.page(indexDisplayMode: .never))
.onAppear {
self.selectedUserId = self.viewModel.carouselUsers.first?.id ?? ""
@@ -75,7 +67,7 @@ struct ChatsCarouselView: View {
.id(user.id)
.overlay(
RoundedRectangle(cornerRadius: 100)
.strokeBorder(NirvanaColors.teal, lineWidth: 2)
.strokeBorder(NirvanaColor.teal, lineWidth: 2)
.opacity(isSelected ? 1 : 0)
)
.onTapGesture {
@@ -83,11 +75,11 @@ struct ChatsCarouselView: View {
self.selectedUserId = user.id
}
}
.frame(maxHeight: 75)
.frame(maxHeight: 60)
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.padding(.vertical, 40)
.padding(.top, 40)
.padding(.horizontal, 40)
}
+3 -4
View File
@@ -14,14 +14,13 @@ struct HomeView: View {
ChatsCarouselView()
Text("This is the region for the bottom actions")
.padding(.vertical, 10)
FooterControlsView()
Spacer()
}
.frame(maxWidth:.infinity, maxHeight: .infinity)
.accentColor(NirvanaColors.teal)
.background(NirvanaColors.bgLightGrey)
.accentColor(NirvanaColor.teal)
.background(NirvanaColor.bgLightGrey)
}
}
+3 -3
View File
@@ -20,7 +20,7 @@ struct HeaderView: View {
Image(systemName: "list.bullet.circle")
.font(Font.system(.largeTitle))
.padding()
.foregroundColor(NirvanaColors.teal)
.foregroundColor(NirvanaColor.teal)
}
@@ -33,7 +33,7 @@ struct HeaderView: View {
Text("nirvana")
.font(Font.custom("Satisfy-Regular", size: 35))
.foregroundColor(NirvanaColors.teal)
.foregroundColor(NirvanaColor.teal)
.multilineTextAlignment(.center)
}
@@ -43,7 +43,7 @@ struct HeaderView: View {
Image(systemName: "person.crop.circle.badge.plus")
.font(Font.system(.largeTitle))
.padding()
.foregroundColor(NirvanaColors.teal)
.foregroundColor(NirvanaColor.teal)
}
}
@@ -28,7 +28,7 @@ struct WelcomeView: View {
.font(.title)
+ Text("minimalist ")
.font(.title)
.foregroundColor(NirvanaColors.teal)
.foregroundColor(NirvanaColor.teal)
+ Text("social media.")
.font(.title)
@@ -50,12 +50,12 @@ struct WelcomeView: View {
label: {
Text("Start Your Detox")
.bold()
.foregroundColor(NirvanaColors.white)
.foregroundColor(NirvanaColor.white)
}
)
.frame(maxWidth: .infinity)
.padding(.vertical, 25)
.background(NirvanaColors.teal)
.background(NirvanaColor.teal)
.clipShape(Capsule())
// .shadow(color: NirvanaColors.teal, radius: 3, x: 1, y: 2)
// .cornerRadius(8)
@@ -69,7 +69,7 @@ struct WelcomeView: View {
.bold()
}
)
.background(NirvanaColors.bgLightGrey)
.background(NirvanaColor.bgLightGrey)
//learn more button to usenirvana.com
}
@@ -83,9 +83,9 @@ struct WelcomeView: View {
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.accentColor(NirvanaColors.teal)
.background(NirvanaColors.bgLightGrey)
// .background(RadialGradient(gradient: Gradient(colors: [NirvanaColors.teal.opacity(0.1), NirvanaColors.bgLightGrey, NirvanaColors.bgLightGrey]), center: .center, startRadius: 0, endRadius: 200)
.accentColor(NirvanaColor.teal)
.background(NirvanaColor.bgLightGrey)
// .background(RadialGradient(gradient: Gradient(colors: [NirvanaColor.teal.opacity(0.1), NirvanaColor.bgLightGrey, NirvanaColor.bgLightGrey]), center: .center, startRadius: 0, endRadius: 200)
// )
}