feat(character): 본인인증 하지 않은 유저가 캐릭터 상세보기로 들어갈 때 본인인증 팝업 띄움
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 124 KiB  | 
@@ -1,7 +1,7 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "images" : [
 | 
					  "images" : [
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      "filename" : "launcher.png",
 | 
					      "filename" : "1024x1024.jpg",
 | 
				
			||||||
      "idiom" : "universal",
 | 
					      "idiom" : "universal",
 | 
				
			||||||
      "platform" : "ios",
 | 
					      "platform" : "ios",
 | 
				
			||||||
      "size" : "1024x1024"
 | 
					      "size" : "1024x1024"
 | 
				
			||||||
 
 | 
				
			|||||||
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 101 KiB  | 
@@ -39,7 +39,6 @@ final class CharacterViewModel: ObservableObject {
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            } receiveValue: { response in
 | 
					            } receiveValue: { response in
 | 
				
			||||||
                let responseData = response.data
 | 
					                let responseData = response.data
 | 
				
			||||||
                self.isLoading = false
 | 
					 | 
				
			||||||
                
 | 
					                
 | 
				
			||||||
                do {
 | 
					                do {
 | 
				
			||||||
                    let jsonDecoder = JSONDecoder()
 | 
					                    let jsonDecoder = JSONDecoder()
 | 
				
			||||||
@@ -60,7 +59,9 @@ final class CharacterViewModel: ObservableObject {
 | 
				
			|||||||
                        
 | 
					                        
 | 
				
			||||||
                        self.isShowPopup = true
 | 
					                        self.isShowPopup = true
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					                    self.isLoading = false
 | 
				
			||||||
                } catch {
 | 
					                } catch {
 | 
				
			||||||
 | 
					                    self.isLoading = false
 | 
				
			||||||
                    self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
 | 
					                    self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
 | 
				
			||||||
                    self.isShowPopup = true
 | 
					                    self.isShowPopup = true
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,6 +28,7 @@ struct ChatTabView: View {
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
    @State private var selectedTab: InnerTab = .character
 | 
					    @State private var selectedTab: InnerTab = .character
 | 
				
			||||||
    @State private var isShowAuthView: Bool = false
 | 
					    @State private var isShowAuthView: Bool = false
 | 
				
			||||||
 | 
					    @State private var isShowAuthConfirmView: Bool = false
 | 
				
			||||||
    @State private var pendingCharacterId: Int? = nil
 | 
					    @State private var pendingCharacterId: Int? = nil
 | 
				
			||||||
    @State private var payload = Payload()
 | 
					    @State private var payload = Payload()
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
@@ -41,97 +42,118 @@ struct ChatTabView: View {
 | 
				
			|||||||
        if auth == false {
 | 
					        if auth == false {
 | 
				
			||||||
            // 본인인증 전체화면 표시 후 완료 시 바로 이동
 | 
					            // 본인인증 전체화면 표시 후 완료 시 바로 이동
 | 
				
			||||||
            pendingCharacterId = characterId
 | 
					            pendingCharacterId = characterId
 | 
				
			||||||
            isShowAuthView = true
 | 
					            isShowAuthConfirmView = true
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        AppState.shared.setAppStep(step: .characterDetail(characterId: characterId))
 | 
					        AppState.shared.setAppStep(step: .characterDetail(characterId: characterId))
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    var body: some View {
 | 
					    var body: some View {
 | 
				
			||||||
        VStack(alignment: .leading, spacing: 0) {
 | 
					        ZStack {
 | 
				
			||||||
            // 앱 바
 | 
					            VStack(alignment: .leading, spacing: 0) {
 | 
				
			||||||
            HStack(spacing: 24) {
 | 
					                // 앱 바
 | 
				
			||||||
                Image("img_text_logo")
 | 
					                HStack(spacing: 24) {
 | 
				
			||||||
                
 | 
					                    Image("img_text_logo")
 | 
				
			||||||
                Spacer()
 | 
					 | 
				
			||||||
                
 | 
					 | 
				
			||||||
                if !token.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
 | 
					 | 
				
			||||||
                    Image("ic_search_white")
 | 
					 | 
				
			||||||
                        .onTapGesture {
 | 
					 | 
				
			||||||
                            AppState
 | 
					 | 
				
			||||||
                                .shared
 | 
					 | 
				
			||||||
                                .setAppStep(step: .search)
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    
 | 
					                    
 | 
				
			||||||
                    Image("ic_can")
 | 
					                    Spacer()
 | 
				
			||||||
                        .onTapGesture {
 | 
					                    
 | 
				
			||||||
                            AppState
 | 
					                    if !token.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
 | 
				
			||||||
                                .shared
 | 
					                        Image("ic_search_white")
 | 
				
			||||||
                                .setAppStep(step: .canCharge(refresh: {}))
 | 
					                            .onTapGesture {
 | 
				
			||||||
                        }
 | 
					                                AppState
 | 
				
			||||||
                }
 | 
					                                    .shared
 | 
				
			||||||
            }
 | 
					                                    .setAppStep(step: .search)
 | 
				
			||||||
            .padding(.horizontal, 24)
 | 
					                            }
 | 
				
			||||||
            .padding(.vertical, 20)
 | 
					                        
 | 
				
			||||||
            
 | 
					                        Image("ic_can")
 | 
				
			||||||
            // 내부 탭 (캐릭터 / 톡)
 | 
					                            .onTapGesture {
 | 
				
			||||||
            HStack(spacing: 0) {
 | 
					                                AppState
 | 
				
			||||||
                ChatInnerTab(
 | 
					                                    .shared
 | 
				
			||||||
                    title: InnerTab.character.title,
 | 
					                                    .setAppStep(step: .canCharge(refresh: {}))
 | 
				
			||||||
                    isSelected: selectedTab == .character,
 | 
					                            }
 | 
				
			||||||
                    onTap: { if selectedTab != .character { selectedTab = .character } }
 | 
					 | 
				
			||||||
                )
 | 
					 | 
				
			||||||
                
 | 
					 | 
				
			||||||
                ChatInnerTab(
 | 
					 | 
				
			||||||
                    title: InnerTab.talk.title,
 | 
					 | 
				
			||||||
                    isSelected: selectedTab == .talk,
 | 
					 | 
				
			||||||
                    onTap: { if selectedTab != .talk { selectedTab = .talk } }
 | 
					 | 
				
			||||||
                )
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            .padding(.bottom, 12)
 | 
					 | 
				
			||||||
            
 | 
					 | 
				
			||||||
            Group {
 | 
					 | 
				
			||||||
                switch selectedTab {
 | 
					 | 
				
			||||||
                case .character:
 | 
					 | 
				
			||||||
                    CharacterView(onSelectCharacter: handleCharacterSelection)
 | 
					 | 
				
			||||||
                case .talk:
 | 
					 | 
				
			||||||
                    TalkView()
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        .onAppear {
 | 
					 | 
				
			||||||
            payload.applicationId = BOOTPAY_APP_ID
 | 
					 | 
				
			||||||
            payload.price = 0
 | 
					 | 
				
			||||||
            payload.pg = "다날"
 | 
					 | 
				
			||||||
            payload.method = "본인인증"
 | 
					 | 
				
			||||||
            payload.orderName = "본인인증"
 | 
					 | 
				
			||||||
            payload.authenticationId = "\(UserDefaults.string(forKey: .nickname))__\(String(NSTimeIntervalSince1970))"
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        .fullScreenCover(isPresented: $isShowAuthView) {
 | 
					 | 
				
			||||||
            BootpayUI(payload: payload, requestType: BootpayRequest.TYPE_AUTHENTICATION)
 | 
					 | 
				
			||||||
                .onConfirm { _ in
 | 
					 | 
				
			||||||
                    true
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                .onCancel { _ in
 | 
					 | 
				
			||||||
                    isShowAuthView = false
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                .onError { _ in
 | 
					 | 
				
			||||||
                    AppState.shared.errorMessage = "본인인증 중 오류가 발생했습니다."
 | 
					 | 
				
			||||||
                    AppState.shared.isShowErrorPopup = true
 | 
					 | 
				
			||||||
                    isShowAuthView = false
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                .onDone { _ in
 | 
					 | 
				
			||||||
                    auth = true
 | 
					 | 
				
			||||||
                    isShowAuthView = false
 | 
					 | 
				
			||||||
                    if let chId = pendingCharacterId {
 | 
					 | 
				
			||||||
                        pendingCharacterId = nil
 | 
					 | 
				
			||||||
                        AppState.shared.setAppStep(step: .characterDetail(characterId: chId))
 | 
					 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                .onClose {
 | 
					                .padding(.horizontal, 24)
 | 
				
			||||||
                    isShowAuthView = false
 | 
					                .padding(.vertical, 20)
 | 
				
			||||||
 | 
					                
 | 
				
			||||||
 | 
					                // 내부 탭 (캐릭터 / 톡)
 | 
				
			||||||
 | 
					                HStack(spacing: 0) {
 | 
				
			||||||
 | 
					                    ChatInnerTab(
 | 
				
			||||||
 | 
					                        title: InnerTab.character.title,
 | 
				
			||||||
 | 
					                        isSelected: selectedTab == .character,
 | 
				
			||||||
 | 
					                        onTap: { if selectedTab != .character { selectedTab = .character } }
 | 
				
			||||||
 | 
					                    )
 | 
				
			||||||
 | 
					                    
 | 
				
			||||||
 | 
					                    ChatInnerTab(
 | 
				
			||||||
 | 
					                        title: InnerTab.talk.title,
 | 
				
			||||||
 | 
					                        isSelected: selectedTab == .talk,
 | 
				
			||||||
 | 
					                        onTap: { if selectedTab != .talk { selectedTab = .talk } }
 | 
				
			||||||
 | 
					                    )
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                .padding(.bottom, 12)
 | 
				
			||||||
 | 
					                
 | 
				
			||||||
 | 
					                Group {
 | 
				
			||||||
 | 
					                    switch selectedTab {
 | 
				
			||||||
 | 
					                    case .character:
 | 
				
			||||||
 | 
					                        CharacterView(onSelectCharacter: handleCharacterSelection)
 | 
				
			||||||
 | 
					                    case .talk:
 | 
				
			||||||
 | 
					                        TalkView()
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            .onAppear {
 | 
				
			||||||
 | 
					                payload.applicationId = BOOTPAY_APP_ID
 | 
				
			||||||
 | 
					                payload.price = 0
 | 
				
			||||||
 | 
					                payload.pg = "다날"
 | 
				
			||||||
 | 
					                payload.method = "본인인증"
 | 
				
			||||||
 | 
					                payload.orderName = "본인인증"
 | 
				
			||||||
 | 
					                payload.authenticationId = "\(UserDefaults.string(forKey: .nickname))__\(String(NSTimeIntervalSince1970))"
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            .fullScreenCover(isPresented: $isShowAuthView) {
 | 
				
			||||||
 | 
					                BootpayUI(payload: payload, requestType: BootpayRequest.TYPE_AUTHENTICATION)
 | 
				
			||||||
 | 
					                    .onConfirm { _ in
 | 
				
			||||||
 | 
					                        true
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    .onCancel { _ in
 | 
				
			||||||
 | 
					                        isShowAuthView = false
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    .onError { _ in
 | 
				
			||||||
 | 
					                        AppState.shared.errorMessage = "본인인증 중 오류가 발생했습니다."
 | 
				
			||||||
 | 
					                        AppState.shared.isShowErrorPopup = true
 | 
				
			||||||
 | 
					                        isShowAuthView = false
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    .onDone { _ in
 | 
				
			||||||
 | 
					                        auth = true
 | 
				
			||||||
 | 
					                        isShowAuthView = false
 | 
				
			||||||
 | 
					                        if let chId = pendingCharacterId {
 | 
				
			||||||
 | 
					                            pendingCharacterId = nil
 | 
				
			||||||
 | 
					                            AppState.shared.setAppStep(step: .characterDetail(characterId: chId))
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    .onClose {
 | 
				
			||||||
 | 
					                        isShowAuthView = false
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					            if isShowAuthConfirmView {
 | 
				
			||||||
 | 
					                SodaDialog(
 | 
				
			||||||
 | 
					                    title: "본인인증",
 | 
				
			||||||
 | 
					                    desc: "보이스온의 오픈월드 캐릭터톡은\n청소년 보호를 위해 본인인증한\n성인만 이용이 가능합니다.\n" +
 | 
				
			||||||
 | 
					                    "캐릭터톡 서비스를 이용하시려면\n본인인증을 하고 이용해주세요.",
 | 
				
			||||||
 | 
					                    confirmButtonTitle: "본인인증 하러가기",
 | 
				
			||||||
 | 
					                    confirmButtonAction: {
 | 
				
			||||||
 | 
					                        isShowAuthConfirmView = false
 | 
				
			||||||
 | 
					                        isShowAuthView = true
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
 | 
					                    cancelButtonTitle: "취소",
 | 
				
			||||||
 | 
					                    cancelButtonAction: {
 | 
				
			||||||
 | 
					                        isShowAuthConfirmView = false
 | 
				
			||||||
 | 
					                        pendingCharacterId = nil
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
 | 
					                    textAlignment: .center
 | 
				
			||||||
 | 
					                )
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,6 +15,7 @@ struct SodaDialog: View {
 | 
				
			|||||||
    let confirmButtonAction: () -> Void
 | 
					    let confirmButtonAction: () -> Void
 | 
				
			||||||
    let cancelButtonTitle: String
 | 
					    let cancelButtonTitle: String
 | 
				
			||||||
    let cancelButtonAction: () -> Void
 | 
					    let cancelButtonAction: () -> Void
 | 
				
			||||||
 | 
					    let textAlignment: TextAlignment
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    init(
 | 
					    init(
 | 
				
			||||||
        title: String,
 | 
					        title: String,
 | 
				
			||||||
@@ -22,7 +23,8 @@ struct SodaDialog: View {
 | 
				
			|||||||
        confirmButtonTitle: String,
 | 
					        confirmButtonTitle: String,
 | 
				
			||||||
        confirmButtonAction: @escaping () -> Void,
 | 
					        confirmButtonAction: @escaping () -> Void,
 | 
				
			||||||
        cancelButtonTitle: String = "",
 | 
					        cancelButtonTitle: String = "",
 | 
				
			||||||
        cancelButtonAction: @escaping () -> Void = {}
 | 
					        cancelButtonAction: @escaping () -> Void = {},
 | 
				
			||||||
 | 
					        textAlignment: TextAlignment = .leading
 | 
				
			||||||
    ) {
 | 
					    ) {
 | 
				
			||||||
        self.title = title
 | 
					        self.title = title
 | 
				
			||||||
        self.desc = desc
 | 
					        self.desc = desc
 | 
				
			||||||
@@ -30,6 +32,7 @@ struct SodaDialog: View {
 | 
				
			|||||||
        self.confirmButtonAction = confirmButtonAction
 | 
					        self.confirmButtonAction = confirmButtonAction
 | 
				
			||||||
        self.cancelButtonTitle = cancelButtonTitle
 | 
					        self.cancelButtonTitle = cancelButtonTitle
 | 
				
			||||||
        self.cancelButtonAction = cancelButtonAction
 | 
					        self.cancelButtonAction = cancelButtonAction
 | 
				
			||||||
 | 
					        self.textAlignment = textAlignment
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    var body: some View {
 | 
					    var body: some View {
 | 
				
			||||||
@@ -48,7 +51,7 @@ struct SodaDialog: View {
 | 
				
			|||||||
                    Text(desc)
 | 
					                    Text(desc)
 | 
				
			||||||
                        .font(.custom(Font.medium.rawValue, size: 15))
 | 
					                        .font(.custom(Font.medium.rawValue, size: 15))
 | 
				
			||||||
                        .foregroundColor(Color.graybb)
 | 
					                        .foregroundColor(Color.graybb)
 | 
				
			||||||
                        .multilineTextAlignment(.leading)
 | 
					                        .multilineTextAlignment(textAlignment)
 | 
				
			||||||
                        .padding(.top, 12)
 | 
					                        .padding(.top, 12)
 | 
				
			||||||
                        .padding(.horizontal, 13.3)
 | 
					                        .padding(.horizontal, 13.3)
 | 
				
			||||||
                        .fixedSize(horizontal: false, vertical: true)
 | 
					                        .fixedSize(horizontal: false, vertical: true)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user