diff --git a/AcaMate.xcodeproj/project.pbxproj b/AcaMate.xcodeproj/project.pbxproj index 1650846..dee89eb 100644 --- a/AcaMate.xcodeproj/project.pbxproj +++ b/AcaMate.xcodeproj/project.pbxproj @@ -317,7 +317,7 @@ INFOPLIST_KEY_UIStatusBarStyle = UIStatusBarStyleLightContent; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; + IPHONEOS_DEPLOYMENT_TARGET = 17.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -328,7 +328,7 @@ SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited) DEV"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited) DEV LOCAL"; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; @@ -359,7 +359,7 @@ INFOPLIST_KEY_UIStatusBarStyle = UIStatusBarStyleLightContent; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; + IPHONEOS_DEPLOYMENT_TARGET = 17.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/AcaMate.xcodeproj/project.xcworkspace/xcuserdata/tanine.xcuserdatad/UserInterfaceState.xcuserstate b/AcaMate.xcodeproj/project.xcworkspace/xcuserdata/tanine.xcuserdatad/UserInterfaceState.xcuserstate index c9c0cf4..5ded53d 100644 Binary files a/AcaMate.xcodeproj/project.xcworkspace/xcuserdata/tanine.xcuserdatad/UserInterfaceState.xcuserstate and b/AcaMate.xcodeproj/project.xcworkspace/xcuserdata/tanine.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/AcaMate/0. Setup/SwiftUI_Prefix.swift b/AcaMate/0. Setup/SwiftUI_Prefix.swift index dcebf6c..d39a653 100644 --- a/AcaMate/0. Setup/SwiftUI_Prefix.swift +++ b/AcaMate/0. Setup/SwiftUI_Prefix.swift @@ -8,14 +8,27 @@ import SwiftUI // MARK: - ACAMATE // APPSTORE_URL : https://apps.apple.com/us/app/%EC%95%84%EC%B9%B4%EB%8D%B0%EB%AF%B8%EB%A9%94%EC%9D%B4%ED%8A%B8/id6739448113 #if LOCAL -public let API_URL: String = "http://localhost:5144" +//public let API_URL: String = "http://0.0.0.0:5144" +public let API_URL: String = "https://localhost:7086" public let WS_URL: String = "ws://localhost:5144" -//public let WS_URL: String = "ws://169.254.53.148:5144" -//#else + +/// 회사 맥에서 사용할 경우의 URL +//public let WS_URL: String = "ws://10.149.217.64:5144" + +/// 집 맥에서 사용할 경우의 URL +//public let WS_URL: String = "ws://192.168.0.71:5144" +//ipconfig getifaddr en0 이거는 와이파이 주소 알아내는거임 + #elseif DEV public let API_URL: String = "https://devacamate.ipstein.myds.me" -//public let WS_URL: String = "ws://devacamate.ipstein.myds.me" -public let WS_URL: String = "ws://192.168.0.71:5144" +/// 서버용 웹소켓 +//public let WS_URL: String = "ws://ipstein.myds.me:7004" + +/// 회사 맥에서 사용할 경우의 URL +public let WS_URL: String = "ws://10.149.217.64:5144" + +/// 집 맥에서 사용할 경우의 URL +//public let WS_URL: String = "ws://192.168.0.71:5144" //ipconfig getifaddr en0 이거는 와이파이 주소 알아내는거임 #else diff --git a/AcaMate/1. View/10. Common/NavigationView.swift b/AcaMate/1. View/10. Common/NavigationView.swift index 6f39ca6..1421d2f 100644 --- a/AcaMate/1. View/10. Common/NavigationView.swift +++ b/AcaMate/1. View/10. Common/NavigationView.swift @@ -22,13 +22,12 @@ struct NavigationView: View { case .NONE: EmptyView() case .Intro: -// IntroView(naviState: $naviState) IntroView() case .Login : -// LoginView(naviState: $naviState) LoginView() + case .SelectAcademy(let bids): + SelectAcademyView(bids: bids) case .Main: -// MainView(naviState: $naviState) MainView() case .ChatRoom(let id): ChattingRoomView(roomID: id) diff --git a/AcaMate/1. View/11. Intro & Login/LoginView.swift b/AcaMate/1. View/11. Intro & Login/LoginView.swift index 98fd415..b546de9 100644 --- a/AcaMate/1. View/11. Intro & Login/LoginView.swift +++ b/AcaMate/1. View/11. Intro & Login/LoginView.swift @@ -43,7 +43,9 @@ struct LoginView: View { Button { // MARK: - TODO, 애플 계정 로그인 구현 - appVM.naviState.set(act: .MOVE, path: .Main) +// appVM.naviState.set(act: .MOVE, path: .Main) + appVM.naviState.set(act: .ADD, path: .SelectAcademy(bids: ["AA0000", "AA0001"])) + } label: { makeButton(image: Image(.Logo.appleIcon), color: Color(.Text.black), "애플 계정으로 시작하기") } @@ -112,6 +114,7 @@ struct LoginView: View { .frame(maxWidth: .infinity,maxHeight: .infinity) .fullDrawView(.Normal.normal) } + func makeButton(image: Image, color: Color? = nil, _ body: String) -> some View { return HStack { image @@ -174,7 +177,8 @@ struct LoginView: View { if let bids = ua.data.toStringDict()["bid"] { printLog(bids) if let bidArray: [String] = jsonToSwift(bids) { - printLog(bidArray[0]) + // 정상 적으로 학원 ID를 불러 온거니까 이제 여기서 할 걸 정해야 함 + appVM.naviState.set(act: .ADD, path: .SelectAcademy(bids: bidArray)) } else { printLog("JSON 변환 실패") } @@ -185,6 +189,3 @@ struct LoginView: View { } } -//#Preview { -// LoginView() -//} diff --git a/AcaMate/1. View/11. Intro & Login/SelectAcademyView.swift b/AcaMate/1. View/11. Intro & Login/SelectAcademyView.swift index 7ed8589..e75efa0 100644 --- a/AcaMate/1. View/11. Intro & Login/SelectAcademyView.swift +++ b/AcaMate/1. View/11. Intro & Login/SelectAcademyView.swift @@ -6,13 +6,56 @@ // import SwiftUI +import Combine + struct SelectAcademyView: View { + @State var cancellables: Set = [] + var bids: [String] + @State private var academyCode: String = "" + var body: some View { - Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + VStack(spacing: 0) { + Spacer() + .frame(height: 100) + Image(.Logo.appIcon) + .resizable() + .frame(width: 200, height: 200) + CustomTextField(placeholder: "학원 코드 입력", text: $academyCode) + .frame(maxWidth: .infinity,maxHeight: 48) + .padding(EdgeInsets(top: 0, leading: 20, bottom: 0, trailing: 20)) + .background { + RoundedRectangle(cornerRadius: 24) + .foregroundStyle(Color(.Normal.light)) + } +// .padding([.leading, .trailing], 24) + .padding(EdgeInsets(top: 12, leading: 24, bottom: 12, trailing: 24)) + + } + .onAppear { + loadAPIData(url: "\(API_URL)", + path: "/api/v1/in/member/academy", + method: .post, + parameters: ["bids": bids], + decodingType: APIResponse<[AcademyName]>.self) + .sink { completion in + + switch completion { + case .failure(let error): + printLog("\(error)") +// appVM.isLoading.toggle() + case .finished: + break +// appVM.isLoading.toggle() + } + } receiveValue: { response in + guard let ua = response as? APIResponse<[AcademyName]> else {return} + printLog(ua) + } + .store(in: &cancellables) + + + } } } -#Preview { - SelectAcademyView() -} diff --git a/AcaMate/1. View/12. Main/BottomView.swift b/AcaMate/1. View/12. Main/BottomView.swift index bc0397d..f5d6721 100644 --- a/AcaMate/1. View/12. Main/BottomView.swift +++ b/AcaMate/1. View/12. Main/BottomView.swift @@ -32,7 +32,7 @@ struct BottomView: View { } } } - .padding(EdgeInsets(top: 12, leading: 24, bottom: 0, trailing: 24)) + .padding(EdgeInsets(top: 12, leading: 24, bottom: 12, trailing: 24)) .background { Rectangle() diff --git a/AcaMate/1. View/12. Main/EmptyBoxView.swift b/AcaMate/1. View/12. Main/EmptyBoxView.swift index b268320..b966fac 100644 --- a/AcaMate/1. View/12. Main/EmptyBoxView.swift +++ b/AcaMate/1. View/12. Main/EmptyBoxView.swift @@ -21,5 +21,6 @@ struct EmptyBoxView: View { .stroke(Color(.Second.normal), lineWidth: 2) .fill(Color(.Second.light)) } + } } diff --git a/AcaMate/2. Model/API Response.swift b/AcaMate/2. Model/API Response.swift index aba043f..42cafe1 100644 --- a/AcaMate/2. Model/API Response.swift +++ b/AcaMate/2. Model/API Response.swift @@ -17,7 +17,7 @@ class Status: Codable { let message: String } -// ---------------- +// /api/v1/in/app/version ---------------- class VersionData: Codable { let os_type, final_ver, dev_ver, force_ver: String @@ -25,11 +25,16 @@ class VersionData: Codable { } -// ---------------- +// /api/v1/in/user/login ---------------- class User_Academy: Codable { let uid: String let bid: [String] } +// /api/v1/in/member/academy ---------------- +class AcademyName: Codable { + let bid: String + let name: String +} diff --git a/AcaMate/2. Model/Navigation.swift b/AcaMate/2. Model/Navigation.swift index afd02ee..0bc2e6c 100644 --- a/AcaMate/2. Model/Navigation.swift +++ b/AcaMate/2. Model/Navigation.swift @@ -42,6 +42,7 @@ enum NaviAction: Hashable { enum PathName: Hashable { case Intro case Login + case SelectAcademy(bids: [String]) case Main case ChatRoom(id: String) case NONE diff --git a/AcaMate/5. Manager/APIManager.swift b/AcaMate/5. Manager/APIManager.swift index 675279d..c1930bb 100644 --- a/AcaMate/5. Manager/APIManager.swift +++ b/AcaMate/5. Manager/APIManager.swift @@ -13,13 +13,15 @@ import Alamofire public func loadAPIData(url: String, path: String, method: HTTPMethod = .get, - parameters: [String: String], + parameters: [String: Any], headers: HTTPHeaders = [:],//["Accept": "application/json"], decodingType: T.Type) -> Future { return Future { promise in + printLog(parameters) AF.request("\(url)\(path)", method: method, parameters: parameters, + encoding: JSONEncoding.default, headers: headers ) .validate(statusCode: 200 ..< 300) diff --git a/AcaMate/6. Modifier/Text.swift b/AcaMate/6. Modifier/Text.swift index 90271b3..3dffc90 100644 --- a/AcaMate/6. Modifier/Text.swift +++ b/AcaMate/6. Modifier/Text.swift @@ -7,8 +7,18 @@ import SwiftUI +protocol MultilineStyle: View { +// func lineLimit(_ limit: Int?) -> Self +// func minimumScaleFactor(_ scale: CGFloat) -> Self +// func multilineTextAlignment(_ alignment: TextAlignment) -> Self +// func truncationMode(_ mode: Text.TruncationMode) -> Self +} -extension Text { +extension Text: MultilineStyle { + +} + +extension MultilineStyle { func multilineStyle(_ alignment: TextAlignment = .leading, limit: Int = 1, scale: CGFloat = 0.5) -> some View { return self .lineLimit(limit) diff --git a/AcaMate/6. Modifier/TextField.swift b/AcaMate/6. Modifier/TextField.swift index ddaa9d5..abc178c 100644 --- a/AcaMate/6. Modifier/TextField.swift +++ b/AcaMate/6. Modifier/TextField.swift @@ -20,7 +20,9 @@ struct CustomTextField: UIViewRepresentable { // [필수] 초기화 시 UIView 생성 func makeUIView(context: Context) -> UITextField { let txf = UITextField() - txf.placeholder = placeholder +// txf.placeholder = placeholder + txf.attributedPlaceholder = NSAttributedString(string: "\(placeholder)", attributes: [NSAttributedString.Key.foregroundColor : UIColor(.Text.border)]) + txf.isSecureTextEntry = isSecure.wrappedValue txf.textColor = textColor diff --git a/AcaMate/6. Modifier/View.swift b/AcaMate/6. Modifier/View.swift index 4f6cd00..6da4b3e 100644 --- a/AcaMate/6. Modifier/View.swift +++ b/AcaMate/6. Modifier/View.swift @@ -14,13 +14,24 @@ struct NetworkModifier: ViewModifier { @EnvironmentObject var appVM: AppViewModel func body(content: Content) -> some View { - content - .onChange(of: networkMonitor.isConnected) { _ , new in - if !new { - appVM.alertData = SetAlertData().setErrorNetwork() - appVM.showAlert.toggle() + if #available(iOS 17.0, *) { + content + .onChange(of: networkMonitor.isConnected) { _ , new in + if !new { + appVM.alertData = SetAlertData().setErrorNetwork() + appVM.showAlert.toggle() + } } - } + } else { + + content + .onChange(of: networkMonitor.isConnected) { new in + if !new { + appVM.alertData = SetAlertData().setErrorNetwork() + appVM.showAlert.toggle() + } + } + } } } @@ -56,16 +67,16 @@ struct LoadingModifier: ViewModifier { .blur(radius: isLoading ? 3:0) if isLoading { Color.Text.detail.opacity(0.6) -// Color.Second.normal.opacity(0.3) + // Color.Second.normal.opacity(0.3) .ignoresSafeArea() ProgressView("Loading...") -// .tint(Color.Text.black) + // .tint(Color.Text.black) .tint(Color.Normal.normal) .scaleEffect(1.5) .foregroundStyle(Color.Normal.normal) - + .font(.nps(font: .bold, size: 16)) - + .padding() } } @@ -124,7 +135,7 @@ extension View { } func endTextEditing() { - UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) + UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) } func loadingView(isLoading: Binding) -> some View { @@ -140,13 +151,8 @@ extension View { .mask(shape.fill(LinearGradient(gradient: Gradient(colors: [.black, .clear]), startPoint: .topLeading, endPoint: .bottomTrailing))) } } - -// func pressAnimation(scale: CGFloat = 0.95, opacity: CGFloat = 0.85, duration: Double = 0.1) -> some View { -// self.modifier(PressEffect(scale: scale, opacity: opacity, duration: duration)) -// } -} -extension View { -// func pressColorAnimation(backgroundColor: Color = Color.black.opacity(0.1), duration: Double = 0.1) -> some View { -// self.modifier(PressBackgroundEffect(backgroundColor: backgroundColor, duration: duration)) -// } + + // func pressAnimation(scale: CGFloat = 0.95, opacity: CGFloat = 0.85, duration: Double = 0.1) -> some View { + // self.modifier(PressEffect(scale: scale, opacity: opacity, duration: duration)) + // } }