forked from AcaMate/AcaMate_iOS
[✨] 아카데미 인증 및 리스트 확인 뷰 작성 중
This commit is contained in:
parent
9ae1fe4265
commit
ca49db680c
|
@ -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",
|
||||
|
|
Binary file not shown.
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
//}
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -21,5 +21,6 @@ struct EmptyBoxView: View {
|
|||
.stroke(Color(.Second.normal), lineWidth: 2)
|
||||
.fill(Color(.Second.light))
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -14,6 +14,7 @@ struct NetworkModifier: ViewModifier {
|
|||
@EnvironmentObject var appVM: AppViewModel
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
if #available(iOS 17.0, *) {
|
||||
content
|
||||
.onChange(of: networkMonitor.isConnected) { _ , new in
|
||||
if !new {
|
||||
|
@ -21,6 +22,16 @@ struct NetworkModifier: ViewModifier {
|
|||
appVM.showAlert.toggle()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
content
|
||||
.onChange(of: networkMonitor.isConnected) { new in
|
||||
if !new {
|
||||
appVM.alertData = SetAlertData().setErrorNetwork()
|
||||
appVM.showAlert.toggle()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,10 +67,10 @@ 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)
|
||||
|
@ -141,12 +152,7 @@ extension View {
|
|||
}
|
||||
}
|
||||
|
||||
// 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))
|
||||
// }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user