Skip to content

Commit

Permalink
🪛[chore]: 팝업처리
Browse files Browse the repository at this point in the history
  • Loading branch information
Byeonjinha committed Dec 4, 2023
1 parent 3706fa3 commit 78f8890
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,15 @@ public class AuthorizationViewModel: ObservableObject {
}
}

@AppStorage("deleteAuth") public var deleteAuth : Bool = false


@Published public var isDeletAuth: Bool = false
@AppStorage("deleteAuth") public var deleteAuth : Bool = false {
@Published public var loginStatus: Bool = false
@Published var deleteUser: Bool = false {
didSet {
self.isDeletAuth = deleteAuth
print("\(deleteUser) 바뀌었어")
}
}

@Published public var loginStatus: Bool = false
@Published var deleteUser: Bool = false


var userNickNameCheckCancellable: AnyCancellable?
@Published var userNickNameModel: NickNameValidateModel?
Expand All @@ -74,8 +71,6 @@ public class AuthorizationViewModel: ObservableObject {
uid = UserDefaults.standard.string(forKey: "Uid") ?? ""
userid = UserDefaults.standard.integer(forKey: "userId")
userUid = UserDefaults.standard.string(forKey: "userUid") ?? ""
isNotification = UserDefaults.standard.bool(forKey: "isNotification")
deleteAuth = UserDefaults.standard.bool(forKey: "deleteAuth")
randomAuthNickName = UserDefaults.standard.string(forKey: "randomNickName") ?? ""

}
Expand All @@ -99,7 +94,6 @@ public class AuthorizationViewModel: ObservableObject {
let firebaseAuth = Auth.auth()

firebaseAuth.currentUser?.delete(completion: { error in
self.deleteUser = true
self.userSession = nil
print("유저가 삭제 되었습니다 \(String(describing: error?.localizedDescription))")
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,10 @@ public class CommonViewViewModel: ObservableObject {

public init() {
isLogin = UserDefaults.standard.bool(forKey: "isLogin")
isFirstUserPOPUP = UserDefaults.standard.bool(forKey: "isFirstUserPOPUP")


}
@AppStorage("isFirstUserPOPUP") public var isFirstUserPOPUP: Bool = false {
didSet {
self.firstUserPOPUP = isFirstUserPOPUP
}
}
@AppStorage("isFirstUserPOPUP") public var isFirstUserPOPUP: Bool = true

@Published public var isLoginCheck: Bool = false {
didSet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,15 @@ public struct CoreView: View {
.ignoresSafeArea(.keyboard)
}
.modal(with: sheetManager, viewModel: viewModel)
.onAppear {
if viewModel.isFirstUserPOPUP {
self.viewModel.isFirstUserPOPUP = true
} else {
self.viewModel.isFirstUserPOPUP = false

}
}

.popup(isPresented: $viewModel.isFirstUserPOPUP) {
CustomPOPUP(
image: .empty,
title: "좌우를 넘기며",
title1: "명언을 확인해보세요",
subTitle: "", useGif: true, confirmAction: {
isFistUserPOPUP = false
viewModel.isFirstUserPOPUP = true
// viewModel.isFirstUserPOPUP = true
})
} customize: { popup in
popup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ public struct LoginView: View {
}
.onAppear{
authViewModel.getRefreshToken()
if authViewModel.isDeletAuth {
authViewModel.deleteAuth = true
}
}
.popup(isPresented: $authViewModel.deleteAuth) {
WithDrawPOPUP(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public class OnBoardingViewModel: ObservableObject {
@Published public var isSignUP: Bool = false
@AppStorage("completdSignUP") public var completdSignUP: Bool = false
@Published public var alreadySignUP: Bool = false
@AppStorage("isFirstUserPOPUP") public var isFirstUserPOPUP: Bool = false

let unicodeArray: [Character] = CheckRegister.generateUnicodeArray()
@Published var flavorArray: SearchViewButtonInfo = SearchViewButtonInfo(title: .flavor, options: [
Expand Down Expand Up @@ -99,7 +98,6 @@ public class OnBoardingViewModel: ObservableObject {


public init() {
isFirstUserPOPUP = UserDefaults.standard.bool(forKey: "isFirstUserPOPUP")
isSignUP = UserDefaults.standard.bool(forKey: "isSignUP")
completdSignUP = UserDefaults.standard.bool(forKey: "completdSignUP")
alreadySignUP = UserDefaults.standard.bool(forKey: "alreadySignUP")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ struct WithDrawView: View {
Task {
await profileViewModel.withDrawPost(userID: "\(authViewModel.userid)", reason: profileViewModel.selectWithDrawReason, successCompletion: {
authViewModel.deleteAuth = true
authViewModel.isDeletAuth = true
viewModel.isLoginCheck = false
profileViewModel.randomNickName = ""

Expand Down

0 comments on commit 78f8890

Please sign in to comment.