Merge pull request 'main' (#9) from seonkyu.kim/AcaMate_iOS:main into main
Reviewed-on: https://git.ipstein.myds.me/AcaMate/AcaMate_iOS/pulls/9
|
@ -294,6 +294,7 @@
|
|||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
|
||||
CODE_SIGN_ENTITLEMENTS = AcaMate/AcaMate.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1.0.0.0;
|
||||
|
@ -302,13 +303,16 @@
|
|||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = AcaMate/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = "아카데미메이트";
|
||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.education";
|
||||
INFOPLIST_KEY_NSUserTrackingUsageDescription = "최적화된 개인 간 연결과 맞춤 헤택을 위해 사용합니다.";
|
||||
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
|
||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
|
||||
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen.st;
|
||||
INFOPLIST_KEY_UIStatusBarStyle = UIStatusBarStyleLightContent;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
|
@ -332,6 +336,7 @@
|
|||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
|
||||
CODE_SIGN_ENTITLEMENTS = AcaMate/AcaMate.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1.0.0.0;
|
||||
|
@ -340,13 +345,16 @@
|
|||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = AcaMate/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = "아카데미메이트";
|
||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.education";
|
||||
INFOPLIST_KEY_NSUserTrackingUsageDescription = "최적화된 개인 간 연결과 맞춤 헤택을 위해 사용합니다.";
|
||||
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
|
||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
|
||||
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen.st;
|
||||
INFOPLIST_KEY_UIStatusBarStyle = UIStatusBarStyleLightContent;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
|
|
|
@ -18,12 +18,12 @@ struct IntroView: View {
|
|||
VStack(spacing: 0) {
|
||||
Spacer()
|
||||
.frame(height: 100)
|
||||
Image(.Icon.appIcon)
|
||||
Image(.Logo.appIcon)
|
||||
.resizable()
|
||||
.frame(width: 200, height: 200)
|
||||
Spacer()
|
||||
HStack(spacing: 4) {
|
||||
Image(.Icon.teamIcon)
|
||||
Image(.Logo.teamIcon)
|
||||
.resizable()
|
||||
.frame(width: 24, height: 24)
|
||||
Text("STEIN")
|
||||
|
|
|
@ -21,12 +21,16 @@ struct LoginView: View {
|
|||
@State var isSecure: Bool = true
|
||||
@State var isSave: Bool = false
|
||||
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 0) {
|
||||
Image(.Icon.appIcon)
|
||||
Spacer().frame(height: 100)
|
||||
Image(.Logo.appIcon)
|
||||
.resizable()
|
||||
.frame(width: 200, height: 200)
|
||||
.padding(.top, 80)
|
||||
// .padding(.top, 80)
|
||||
.padding(.bottom, 84)
|
||||
|
||||
/// 앱 아이콘 이미지
|
||||
VStack(spacing: 16) {
|
||||
Button {
|
||||
|
@ -34,16 +38,20 @@ struct LoginView: View {
|
|||
appVM.isLoading.toggle()
|
||||
loginAction(type: .Kakao)
|
||||
} label: {
|
||||
makeButton(image: Image(.Icon.kakaoIcon),color: Color(.Other.yellow), "카카오 계정으로 시작하기")
|
||||
makeButton(image: Image(.Logo.kakaoIcon),color: Color(.Other.yellow), "카카오 계정으로 시작하기")
|
||||
}
|
||||
|
||||
Button {
|
||||
// MARK: - TODO, 애플 계정 로그인 구현
|
||||
naviState.set(act: .MOVE, path: .Main)
|
||||
} label: {
|
||||
makeButton(image: Image(.Icon.appleIcon), color: Color(.Text.black), "애플 계정으로 시작하기")
|
||||
makeButton(image: Image(.Logo.appleIcon), color: Color(.Text.black), "애플 계정으로 시작하기")
|
||||
}
|
||||
}
|
||||
.padding([.leading,.trailing], 28)
|
||||
|
||||
Spacer(minLength: 1)
|
||||
|
||||
|
||||
/*
|
||||
VStack(spacing: 16) {
|
||||
|
@ -96,7 +104,6 @@ struct LoginView: View {
|
|||
/// APPLE 로그인 버튼
|
||||
}
|
||||
*/
|
||||
.padding([.leading,.trailing], 28)
|
||||
|
||||
}
|
||||
.onAppear {
|
||||
|
|
|
@ -10,47 +10,48 @@ import SwiftUI
|
|||
|
||||
|
||||
struct CircleBtnView: View {
|
||||
let title: String?
|
||||
let image: Image
|
||||
@Binding var isSelected: Bool
|
||||
let isReverse: Bool
|
||||
|
||||
let action: VOID_TO_VOID?
|
||||
|
||||
var backColor: Color {isReverse ? Color(.Second.light) : Color(.Normal.normal)}
|
||||
var tintColor: Color {isSelected ? Color(.Second.normal) : Color(.Disable.normal)}
|
||||
@ObservedObject var vm: ButtonViewModel
|
||||
let id: UUID
|
||||
|
||||
var body: some View {
|
||||
if let state = vm.btnStates[id] {
|
||||
Button{
|
||||
guard let action = action else {return}
|
||||
guard let action = state.action else {return}
|
||||
action()
|
||||
} label: {
|
||||
VStack(alignment: .center, spacing: 0) {
|
||||
self.image
|
||||
if let image = state.image {
|
||||
image
|
||||
.resizable()
|
||||
.renderingMode(.template)
|
||||
.foregroundStyle(self.tintColor)
|
||||
.frame(width: 24, height: 24)
|
||||
if let title = self.title {
|
||||
.foregroundStyle(state.foreColor)
|
||||
.frame(width: state.width/2, height: state.height/2)
|
||||
}
|
||||
//
|
||||
if let title = state.title, let font = state.font {
|
||||
Text("\(title)")
|
||||
.font(.nps(font: .bold, size: 6))
|
||||
.tint(self.tintColor)
|
||||
.font(font)
|
||||
.lineLimit(1)
|
||||
.minimumScaleFactor(0.5)
|
||||
.truncationMode(.tail)
|
||||
.foregroundStyle(state.textColor)
|
||||
// .padding()
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
.background {
|
||||
if isReverse {
|
||||
if state.isReverse {
|
||||
Circle()
|
||||
.accentColor(self.backColor)
|
||||
.frame(width: 48, height: 48)
|
||||
.accentColor(state.backColor)
|
||||
.frame(width: state.width, height: state.height)
|
||||
.innerShadow(shape: Circle(), color: Color(.Text.black).opacity(0.75), blur: 8, x: 0, y: 4)
|
||||
} else {
|
||||
Circle()
|
||||
.accentColor(self.backColor)
|
||||
.frame(width: 48, height: 48)
|
||||
.accentColor(state.backColor)
|
||||
.frame(width: state.width, height: state.height)
|
||||
.shadow(color: Color(.Text.black).opacity(0.75), radius: 8, x: 4, y: 8)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,40 +6,45 @@
|
|||
//
|
||||
|
||||
import SwiftUI
|
||||
//import combine
|
||||
|
||||
|
||||
struct SimpleBtnView: View {
|
||||
let title: String?
|
||||
let image: Image?
|
||||
let font: Font?
|
||||
let width: CGFloat
|
||||
let height: CGFloat
|
||||
|
||||
let action: VOID_TO_VOID?
|
||||
|
||||
@ObservedObject var vm: ButtonViewModel
|
||||
let id: UUID
|
||||
|
||||
var body: some View {
|
||||
Button{
|
||||
guard let action = action else { return }
|
||||
action()
|
||||
} label: {
|
||||
if let title = title, let font = font {
|
||||
if let state = vm.btnStates[id] {
|
||||
if let title = state.title, let font = state.font {
|
||||
Text("\(title)")
|
||||
.font(font)
|
||||
.tint(Color(.Second.dark))
|
||||
.frame(width: width, height: height)
|
||||
.lineLimit(1)
|
||||
.minimumScaleFactor(0.5)
|
||||
.truncationMode(.tail)
|
||||
.foregroundStyle(state.textColor)
|
||||
.frame(width: state.width, height: state.height)
|
||||
.onTapGesture {
|
||||
if state.isUsable {
|
||||
guard let action = state.action else { return }
|
||||
action()
|
||||
}
|
||||
else if let image = image {
|
||||
}
|
||||
}
|
||||
else {
|
||||
Button{
|
||||
guard let action = state.action else { return }
|
||||
action()
|
||||
} label: {
|
||||
if let image = state.image {
|
||||
image
|
||||
.resizable()
|
||||
.frame(width: width, height: height)
|
||||
.frame(width: state.width, height: state.height)
|
||||
}
|
||||
}
|
||||
.disabled(!state.isUsable)
|
||||
}
|
||||
} else {
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
SimpleBtnView(title: "체크 합니다", image: Image(.BottomBar.home),
|
||||
font: .nps(font: .bold, size: 12),
|
||||
width: 40, height: 40,
|
||||
action: nil)
|
||||
}
|
||||
|
|
106
AcaMate/1. View/12. Main/122. DashBoard/TopProfileView.swift
Normal file
|
@ -0,0 +1,106 @@
|
|||
//
|
||||
// TopProfileView.swift
|
||||
// AcaMate
|
||||
//
|
||||
// Created by TAnine on 2/5/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct TopProfileView: View {
|
||||
var userType: UserType = .ETC
|
||||
var childrenList: [String] = ["name1", "name2", "name3"]
|
||||
var academyName: String = "Academy' NAME"
|
||||
var myName: String = "Name"
|
||||
|
||||
@State var childNum: Int = 0
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 0){
|
||||
VStack(alignment: .center, spacing: 0) {
|
||||
HStack(spacing: 0) {
|
||||
// SimpleBtnView(image: Image(.Icon.market), title: nil, font: nil,
|
||||
// width: 40, height: 40)
|
||||
// .doAction {
|
||||
// printLog("TEST")
|
||||
// }
|
||||
Spacer(minLength: 1)
|
||||
// SimpleBtnView(image: Image(.Icon.notificationSET), title: nil, font: nil,
|
||||
// width: 40, height: 40)
|
||||
// .doAction {
|
||||
// printLog("TEST")
|
||||
// }
|
||||
} /// 최상단 버튼 Stack
|
||||
ZStack{
|
||||
Circle()
|
||||
.stroke(Color(.Second.normal) ,lineWidth: 4)
|
||||
.frame(width: 200, height: 200)
|
||||
switch self.userType {
|
||||
case .Student:
|
||||
// MARK: TO-DO
|
||||
// 학생일때 표시하는거 어떻게 할 건지 좀 더 고민을 해보자
|
||||
Image(.Icon.face)
|
||||
.resizable()
|
||||
.frame(width: 150, height: 150)
|
||||
case .Parent:
|
||||
Text("학부모")
|
||||
.font(.nps(font: .bold, size: 48))
|
||||
.foregroundStyle(Color(.Second.normal))
|
||||
case .Teacher:
|
||||
Text("선생님")
|
||||
.font(.nps(font: .bold, size: 48))
|
||||
.foregroundStyle(Color(.Second.normal))
|
||||
case .Admin:
|
||||
Text("관리자")
|
||||
.font(.nps(font: .bold, size: 48))
|
||||
.foregroundStyle(Color(.Second.normal))
|
||||
case .Employee:
|
||||
Text("직원")
|
||||
.font(.nps(font: .bold, size: 48))
|
||||
.foregroundStyle(Color(.Second.normal))
|
||||
case .ETC:
|
||||
Text("방문객")
|
||||
.font(.nps(font: .bold, size: 48))
|
||||
.foregroundStyle(Color(.Second.normal))
|
||||
}
|
||||
} /// 중앙 원형 Stack
|
||||
.padding([.top, .bottom], 40)
|
||||
VStack(alignment: .center, spacing: 8) {
|
||||
Text("\(self.academyName)")
|
||||
.frame(alignment: .center)
|
||||
.multilineTextAlignment(.center)
|
||||
.font(.nps(font: .bold, size: 36))
|
||||
Text("\(self.myName)")
|
||||
.multilineTextAlignment(.center)
|
||||
.frame(alignment: .center)
|
||||
.font(.nps(size: 18))
|
||||
.foregroundStyle(Color(.Text.detail))
|
||||
}
|
||||
} /// 위쪽 VStack
|
||||
.padding(EdgeInsets(top: 24, leading: 24, bottom: 12, trailing: 24))
|
||||
|
||||
HStack(spacing: 0) {
|
||||
// ForEach(Array(childrenList.enumerated()),id: \.offset){ index, name in
|
||||
// CircleBtnView(title: "\(name)", image: Image(.Icon.face),
|
||||
// // MARK: TO-DO
|
||||
// /// 이 바인딩 이거 잘 작동 되는지 후에 확인 할것
|
||||
// isSelected: Binding(
|
||||
// get: { self.childNum == index },
|
||||
// set: { _ in self.childNum = index }
|
||||
// ), isReverse: false) {
|
||||
// self.childNum = index
|
||||
// }
|
||||
// if index != childrenList.count-1 {
|
||||
// Spacer()
|
||||
// }
|
||||
// }
|
||||
} /// 아래쪽 HStack
|
||||
.padding([.leading, .trailing], 24)
|
||||
}
|
||||
.fullDrawView(.Other.cell)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
TopProfileView()
|
||||
}
|
|
@ -8,72 +8,63 @@
|
|||
import SwiftUI
|
||||
|
||||
struct BottomView: View {
|
||||
@State private var isHomeSelected: Bool = true
|
||||
@State private var isManagementSelected: Bool = false
|
||||
@State private var isChattingSelected: Bool = false
|
||||
@State private var isCalendarSelected: Bool = false
|
||||
@State private var isEtcSelected: Bool = false
|
||||
@StateObject var btnVM = ButtonViewModel()
|
||||
@State var pageType: PageType = .Home
|
||||
|
||||
@State private var homeID = UUID()
|
||||
@State private var managementID = UUID()
|
||||
@State private var chattingID = UUID()
|
||||
@State private var calendarID = UUID()
|
||||
@State private var etcID = UUID()
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 0){
|
||||
Spacer(minLength: 1)
|
||||
CircleBtnView(title: "홈", image: Image(.BottomBar.home),
|
||||
isSelected: $isHomeSelected, isReverse: false,
|
||||
action: {
|
||||
btnAllFalse()
|
||||
isHomeSelected.toggle()
|
||||
})
|
||||
Spacer(minLength: 1)
|
||||
let idList: [UUID] = [homeID,managementID,chattingID,calendarID,etcID]
|
||||
|
||||
CircleBtnView(title: "학습 관리", image: Image(.BottomBar.management),
|
||||
isSelected: $isManagementSelected, isReverse: false,
|
||||
action: {
|
||||
btnAllFalse()
|
||||
isManagementSelected.toggle()
|
||||
})
|
||||
Spacer(minLength: 1)
|
||||
CircleBtnView(title: "채팅", image: Image(.BottomBar.chatting),
|
||||
isSelected: $isChattingSelected, isReverse: false,
|
||||
action: {
|
||||
btnAllFalse()
|
||||
isChattingSelected.toggle()
|
||||
})
|
||||
Spacer(minLength: 1)
|
||||
CircleBtnView(title: "일정", image: Image(.BottomBar.calendar),
|
||||
isSelected: $isCalendarSelected, isReverse: false,
|
||||
action: {
|
||||
btnAllFalse()
|
||||
isCalendarSelected.toggle()
|
||||
})
|
||||
Spacer(minLength: 1)
|
||||
CircleBtnView(title: "더보기", image: Image(.BottomBar.etc),
|
||||
isSelected: $isEtcSelected, isReverse: false,
|
||||
action: {
|
||||
btnAllFalse()
|
||||
isEtcSelected.toggle()
|
||||
})
|
||||
HStack(alignment: .center, spacing: 0){
|
||||
ForEach(Array(idList.enumerated()), id: \.offset) { index, id in
|
||||
CircleBtnView(vm: btnVM, id: id)
|
||||
if index != idList.count-1 {
|
||||
Spacer(minLength: 1)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// MARK: TO-DO
|
||||
// 이거 패딩 제대로 안먹는거 이유 찾기
|
||||
.padding([.top],12)
|
||||
.padding([.horizontal],24)
|
||||
// .padding(EdgeInsets(top: 12, leading: 24, bottom: 0, trailing: 24))
|
||||
|
||||
.background {
|
||||
Rectangle()
|
||||
.foregroundStyle(Color(.Normal.dark))
|
||||
.ignoresSafeArea(edges: .bottom)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.onAppear {
|
||||
let idList: [UUID] = [homeID,managementID,chattingID,calendarID,etcID]
|
||||
let btnText: [String] = ["홈", "학습 관리", "채팅", "일정", "더보기"]
|
||||
let btnImage: [Image] = [Image(.Icon.home),Image(.Icon.management),Image(.Icon.chatting),Image(.Icon.calendar),Image(.Icon.etc)]
|
||||
|
||||
idList.enumerated().forEach { (index, id) in
|
||||
btnVM.btnStates[id] = ButtonState()
|
||||
btnVM.setSize(for: id, newWidth: 48, newHeight: 48)
|
||||
btnVM.setText(for: id, newText: btnText[index],
|
||||
newFont: .nps(font: .bold, size: 6))
|
||||
btnVM.setImage(for: id, newImage: btnImage[index])
|
||||
|
||||
btnVM.setAction(for: id) {
|
||||
btnVM.setIsSelected(for: id, newValue: true)
|
||||
idList.forEach {
|
||||
if $0 != id {
|
||||
btnVM.setIsSelected(for: $0, newValue: false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
btnVM.setIsSelected(for: idList[pageType.rawValue], newValue: true)
|
||||
}
|
||||
|
||||
private func btnAllFalse() {
|
||||
isHomeSelected = false
|
||||
isManagementSelected = false
|
||||
isChattingSelected = false
|
||||
isCalendarSelected = false
|
||||
isEtcSelected = false
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
BottomView()
|
||||
}
|
||||
|
|
|
@ -8,24 +8,36 @@
|
|||
import SwiftUI
|
||||
|
||||
struct TopView: View {
|
||||
@StateObject var btnVM = ButtonViewModel()
|
||||
|
||||
@State var titleName: String = ""
|
||||
@State var changeLogo: Bool = false
|
||||
@State var tailLogo: Bool = false
|
||||
|
||||
@State private var leftBtnID = UUID()
|
||||
@State private var rightBtnID = UUID()
|
||||
|
||||
var myType: UserType = .Teacher
|
||||
|
||||
var body: some View {
|
||||
HStack(alignment: .center, spacing: 0) {
|
||||
SimpleBtnView(title: nil, image: Image(.TopBar.face), font: nil, width: 40, height: 40, action: {
|
||||
|
||||
})
|
||||
SimpleBtnView(vm: btnVM, id: leftBtnID)
|
||||
.background {
|
||||
if let state = btnVM.btnStates[leftBtnID], state.image == nil {
|
||||
Circle()
|
||||
.strokeBorder(Color(.Second.normal) ,lineWidth: 4)
|
||||
.frame(width: 40, height: 40)
|
||||
}
|
||||
}
|
||||
.padding(EdgeInsets(top: 12, leading: 24, bottom: 12, trailing: 12))
|
||||
|
||||
|
||||
Text("\(titleName)")
|
||||
.tint(Color(.Text.disabled))
|
||||
.foregroundStyle(Color(.Text.detail))
|
||||
.font(.nps(font: .bold, size: 20))
|
||||
Spacer()
|
||||
|
||||
SimpleBtnView(title: nil, image: Image(.TopBar.face), font: nil, width: 40, height: 40, action: {
|
||||
|
||||
})
|
||||
.hidden()
|
||||
SimpleBtnView(vm: btnVM, id: rightBtnID)
|
||||
.padding(EdgeInsets(top: 12, leading: 12, bottom: 12, trailing: 24))
|
||||
|
||||
}
|
||||
.background {
|
||||
|
@ -34,10 +46,49 @@ struct TopView: View {
|
|||
.ignoresSafeArea(edges: .top)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.onAppear {
|
||||
btnVM.btnStates[leftBtnID] = ButtonState()
|
||||
btnVM.btnStates[rightBtnID] = ButtonState()
|
||||
|
||||
btnVM.setSize(for: leftBtnID, newWidth: 40, newHeight: 40)
|
||||
btnVM.setSize(for: rightBtnID, newWidth: 40, newHeight: 40)
|
||||
|
||||
if self.myType == .Student {
|
||||
btnVM.setImage(for: leftBtnID, newImage: Image(.Icon.face))
|
||||
} else {
|
||||
btnVM.setText(for: leftBtnID,
|
||||
newText: "\(myType.rawValue)",
|
||||
newFont: .nps(font: .bold, size: 24))
|
||||
}
|
||||
btnVM.setImage(for: rightBtnID, newImage: Image(.Icon.notificationSET))
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
TopView(titleName: "Name")
|
||||
}
|
||||
//struct TypeIcon: View {
|
||||
// var myType: UserType
|
||||
//
|
||||
// var body: some View {
|
||||
|
||||
// if self.myType == .Student {
|
||||
|
||||
// SimpleBtnView(image: Image(.Icon.face), title: nil, font: nil, width: 40, height: 40)
|
||||
// } else {
|
||||
// SimpleBtnView(image: nil, title: "\(self.myType.rawValue)", font: .nps(font: .bold, size: 24), width: 40, height: 40)
|
||||
// .doAction {
|
||||
// printLog("CHECK!!!")
|
||||
// }
|
||||
// .setTextColor(.red)
|
||||
// .setIsUsable(false)
|
||||
|
||||
|
||||
|
||||
// }
|
||||
|
||||
// }
|
||||
//}
|
||||
|
||||
//#Preview {
|
||||
// TopView(titleName: "Name")
|
||||
//}
|
||||
|
|
31
AcaMate/2. Model/Button State.swift
Normal file
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// ButtonState.swift
|
||||
// AcaMate
|
||||
//
|
||||
// Created by TAnine on 2/6/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ButtonState {
|
||||
var image: Image? = nil
|
||||
|
||||
var title: String? = nil
|
||||
var font: Font? = nil
|
||||
|
||||
var width: CGFloat = 0
|
||||
var height: CGFloat = 0
|
||||
|
||||
var action: VOID_TO_VOID? = nil
|
||||
|
||||
var textColor: Color = .Text.detail
|
||||
var isUsable: Bool = true
|
||||
|
||||
// -- CircleBtn 전용 -- //
|
||||
|
||||
var isSelected: Bool = false
|
||||
var isReverse: Bool = false
|
||||
|
||||
var backColor: Color = .Normal.normal
|
||||
var foreColor: Color = .Disable.normal
|
||||
}
|
16
AcaMate/2. Model/Page Type.swift
Normal file
|
@ -0,0 +1,16 @@
|
|||
//
|
||||
// Page Type.swift
|
||||
// AcaMate
|
||||
//
|
||||
// Created by TAnine on 2/6/25.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
enum PageType: Int{
|
||||
case Home = 0
|
||||
case Management
|
||||
case Chatting
|
||||
case Calendar
|
||||
case Etc
|
||||
}
|
17
AcaMate/2. Model/User Type.swift
Normal file
|
@ -0,0 +1,17 @@
|
|||
//
|
||||
// UserType.swift
|
||||
// AcaMate
|
||||
//
|
||||
// Created by TAnine on 2/5/25.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
enum UserType: String {
|
||||
case Student = "S"
|
||||
case Parent = "P"
|
||||
case Teacher = "T"
|
||||
case Admin = "A"
|
||||
case Employee = "E"
|
||||
case ETC = "V"
|
||||
}
|
|
@ -12,6 +12,7 @@ class AppViewModel: ObservableObject {
|
|||
@Published var isLoading: Bool = false
|
||||
|
||||
@Published var showAlert: Bool = false
|
||||
|
||||
var alertData: AlertData = .init(body: "")
|
||||
|
||||
let alertAction = CurrentValueSubject<String?, Never>(nil)
|
||||
|
|
98
AcaMate/3. ViewModel/ButtonViewModel.swift
Normal file
|
@ -0,0 +1,98 @@
|
|||
//
|
||||
// ButtonViewModel.swift
|
||||
// AcaMate
|
||||
//
|
||||
// Created by TAnine on 2/6/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Combine
|
||||
|
||||
class ButtonViewModel: ObservableObject {
|
||||
@Published var btnStates: [UUID: ButtonState] = [:]
|
||||
|
||||
func setImage(for id: UUID, newImage: Image){
|
||||
var state = btnStates[id] ?? ButtonState()
|
||||
state.image = newImage
|
||||
btnStates[id] = state
|
||||
objectWillChange.send()
|
||||
}
|
||||
|
||||
func setText(for id: UUID, newText: String?, newFont: Font?) {
|
||||
var state = btnStates[id] ?? ButtonState()
|
||||
|
||||
state.title = newText
|
||||
state.font = newFont
|
||||
|
||||
btnStates[id] = state
|
||||
objectWillChange.send()
|
||||
}
|
||||
|
||||
func setSize(for id: UUID, newWidth: CGFloat?, newHeight: CGFloat?){
|
||||
var state = btnStates[id] ?? ButtonState()
|
||||
|
||||
state.width = newWidth ?? 0
|
||||
state.height = newHeight ?? 0
|
||||
|
||||
btnStates[id] = state
|
||||
objectWillChange.send()
|
||||
}
|
||||
|
||||
func setAction(for id: UUID, newAction: @escaping VOID_TO_VOID) {
|
||||
var state = btnStates[id] ?? ButtonState()
|
||||
state.action = newAction
|
||||
btnStates[id] = state
|
||||
objectWillChange.send()
|
||||
}
|
||||
|
||||
func setTextColor(for id: UUID, newColor: Color) {
|
||||
var state = btnStates[id] ?? ButtonState()
|
||||
|
||||
state.textColor = newColor
|
||||
|
||||
btnStates[id] = state
|
||||
objectWillChange.send()
|
||||
}
|
||||
|
||||
func setIsUsable(for id: UUID, newValue: Bool) {
|
||||
var state = btnStates[id] ?? ButtonState()
|
||||
state.isUsable = newValue
|
||||
btnStates[id] = state
|
||||
objectWillChange.send()
|
||||
}
|
||||
|
||||
// -- CircleBtn 전용 -- //
|
||||
|
||||
func setIsSelected(for id: UUID, newValue: Bool){
|
||||
var state = btnStates[id] ?? ButtonState()
|
||||
state.isSelected = newValue
|
||||
state.foreColor = newValue ? Color(.Second.normal) : Color(.Disable.normal)
|
||||
btnStates[id] = state
|
||||
objectWillChange.send()
|
||||
}
|
||||
|
||||
func setIsReverse(for id: UUID, newValue: Bool){
|
||||
var state = btnStates[id] ?? ButtonState()
|
||||
state.isReverse = newValue
|
||||
state.backColor = newValue ? Color(.Second.light) : Color(.Normal.normal)
|
||||
btnStates[id] = state
|
||||
objectWillChange.send()
|
||||
}
|
||||
|
||||
// func setBackColor(for id: UUID, newColor: Color) {
|
||||
// var state = btnStates[id] ?? ButtonState()
|
||||
//
|
||||
// state.backColor = newColor
|
||||
//
|
||||
// btnStates[id] = state
|
||||
// objectWillChange.send()
|
||||
// }
|
||||
// func setForeColor(for id: UUID, newColor: Color) {
|
||||
// var state = btnStates[id] ?? ButtonState()
|
||||
//
|
||||
// state.foreColor = newColor
|
||||
//
|
||||
// btnStates[id] = state
|
||||
// objectWillChange.send()
|
||||
// }
|
||||
}
|
|
@ -104,4 +104,16 @@ extension View {
|
|||
.mask(shape.fill(LinearGradient(gradient: Gradient(colors: [.black, .clear]), startPoint: .topLeading, endPoint: .bottomTrailing)))
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
func switchButtonStyle(_ animate: Bool) -> some View {
|
||||
if animate {
|
||||
self.buttonStyle(DefaultButtonStyle())
|
||||
} else {
|
||||
self.buttonStyle(PlainButtonStyle())
|
||||
// .allowsHitTesting(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//extension BUtton
|
||||
|
|
Before Width: | Height: | Size: 587 B After Width: | Height: | Size: 587 B |
Before Width: | Height: | Size: 636 B After Width: | Height: | Size: 636 B |
Before Width: | Height: | Size: 543 B After Width: | Height: | Size: 543 B |
Before Width: | Height: | Size: 684 B After Width: | Height: | Size: 684 B |
Before Width: | Height: | Size: 635 B After Width: | Height: | Size: 635 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 604 B After Width: | Height: | Size: 604 B |
Before Width: | Height: | Size: 577 B After Width: | Height: | Size: 577 B |
Before Width: | Height: | Size: 535 B After Width: | Height: | Size: 535 B |
12
AcaMate/6. Resources/Assets.xcassets/Image Folder/Icon/Notification OFF.imageset/Contents.json
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "Notification OFF.png",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 1.1 KiB |
12
AcaMate/6. Resources/Assets.xcassets/Image Folder/Icon/Notification ON.imageset/Contents.json
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "Notification ON.png",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
AcaMate/6. Resources/Assets.xcassets/Image Folder/Icon/Notification ON.imageset/Notification ON.png
vendored
Normal file
After Width: | Height: | Size: 1.4 KiB |
12
AcaMate/6. Resources/Assets.xcassets/Image Folder/Icon/Notification SET.imageset/Contents.json
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "Notification SET.png",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 945 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 261 B After Width: | Height: | Size: 261 B |
Before Width: | Height: | Size: 844 B After Width: | Height: | Size: 844 B |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"provides-namespace" : true
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 587 B After Width: | Height: | Size: 587 B |
Before Width: | Height: | Size: 684 B After Width: | Height: | Size: 684 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 535 B After Width: | Height: | Size: 535 B |
BIN
AcaMate/6. Resources/Images/Icon/Notification OFF.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
AcaMate/6. Resources/Images/Icon/Notification ON.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
AcaMate/6. Resources/Images/Icon/Notification SET.png
Normal file
After Width: | Height: | Size: 945 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 261 B After Width: | Height: | Size: 261 B |
Before Width: | Height: | Size: 844 B After Width: | Height: | Size: 844 B |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 811 KiB After Width: | Height: | Size: 811 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB |
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Z5j-31-33C">
|
||||
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
|
||||
|
@ -39,7 +39,7 @@
|
|||
<stackView opaque="NO" contentMode="scaleToFill" alignment="center" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="3Cc-mO-qI9">
|
||||
<rect key="frame" x="159" y="711.66666666666663" width="75.333333333333314" height="24"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Icon/Team_Icon" translatesAutoresizingMaskIntoConstraints="NO" id="HZ9-M4-4km">
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Logo/Team_Icon" translatesAutoresizingMaskIntoConstraints="NO" id="HZ9-M4-4km">
|
||||
<rect key="frame" x="0.0" y="0.0" width="24" height="24"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="24" id="jTz-mU-7gD"/>
|
||||
|
@ -54,7 +54,7 @@
|
|||
</label>
|
||||
</subviews>
|
||||
</stackView>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Icon/App_Icon" translatesAutoresizingMaskIntoConstraints="NO" id="yVp-20-rR1">
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Logo/App_Icon" translatesAutoresizingMaskIntoConstraints="NO" id="yVp-20-rR1">
|
||||
<rect key="frame" x="96.666666666666686" y="159" width="200" height="200"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="200" id="USS-fT-KDG"/>
|
||||
|
@ -83,8 +83,8 @@
|
|||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="Icon/App_Icon" width="1024" height="1024"/>
|
||||
<image name="Icon/Team_Icon" width="144" height="144"/>
|
||||
<image name="Logo/App_Icon" width="1024" height="1024"/>
|
||||
<image name="Logo/Team_Icon" width="144" height="144"/>
|
||||
<namedColor name="Normal/Normal">
|
||||
<color red="0.92199999094009399" green="0.875" blue="0.82400000095367432" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</namedColor>
|
||||
|
|