[] 아카데미 인증 및 리스트 확인 뷰 작성 중

This commit is contained in:
Seonkyu_Kim 2025-02-18 17:33:05 +09:00
parent 9ae1fe4265
commit ca49db680c
14 changed files with 129 additions and 46 deletions

View File

@ -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",

View File

@ -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

View File

@ -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)

View File

@ -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()
//}

View File

@ -6,13 +6,56 @@
//
import SwiftUI
import Combine
struct SelectAcademyView: View {
@State var cancellables: Set<AnyCancellable> = []
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()
}

View File

@ -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()

View File

@ -21,5 +21,6 @@ struct EmptyBoxView: View {
.stroke(Color(.Second.normal), lineWidth: 2)
.fill(Color(.Second.light))
}
}
}

View File

@ -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
}

View File

@ -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

View File

@ -13,13 +13,15 @@ import Alamofire
public func loadAPIData<T: Decodable>(url: String, path: String,
method: HTTPMethod = .get,
parameters: [String: String],
parameters: [String: Any],
headers: HTTPHeaders = [:],//["Accept": "application/json"],
decodingType: T.Type) -> Future<Any, Error> {
return Future { promise in
printLog(parameters)
AF.request("\(url)\(path)",
method: method,
parameters: parameters,
encoding: JSONEncoding.default,
headers: headers
)
.validate(statusCode: 200 ..< 300)

View File

@ -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)

View File

@ -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

View File

@ -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<Bool>) -> 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))
// }
}