Skip to content

Commit

Permalink
[FEAT] #235 마이페이지 유저디폴트 수정, 유저디폴트 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
comeheredart committed Jun 24, 2022
1 parent d22ce76 commit b9a247b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ class MyPageVC: UIViewController {
let userheight = UIScreen.main.bounds.height
var tabbarBottomConstraint: Int = 0

// var isLogin: Bool = UserDefaults.standard.bool(forKey: "isLogin") ?? true
var isLogin: Bool = true
var isLogin: Bool = UserDefaults.standard.bool(forKey: Constants.UserDefaultsKey.isLogin) ?? false

private var userProfileData: [UserInformation] = []
//var writenPostData: [MyPagePost] = []
Expand All @@ -31,7 +30,7 @@ class MyPageVC: UIViewController {
var currentState: String = "인기순"

//무한스크롤을 위함
var myId: String = UserDefaults.standard.string(forKey: "userId") ?? "[email protected]"
var myId: String = UserDefaults.standard.string(forKey: Constants.UserDefaultsKey.userEmail) ?? "[email protected]"
var lastId: Int = 0
var lastFavorite: Int = 0
var isLast: Bool = false
Expand Down
11 changes: 9 additions & 2 deletions ChaRo-iOS/ChaRo-iOS/Source/Views/VCs/SignScene/SNSLoginVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class SNSLoginVC: UIViewController {

@objc func lookAroundButtonClicked() {
//isLogin 값을 false로 설정 - 둘러보기이므로 계정 없음
Constants.removeAllUserDefaults()
UserDefaults.standard.set(false, forKey: Constants.UserDefaultsKey.isLogin)
self.goToHomeVC()
}
Expand Down Expand Up @@ -118,7 +119,14 @@ class SNSLoginVC: UIViewController {
snsType = "G"
GIDSignIn.sharedInstance.signIn(with: signInConfig, presenting: self) { user, error in
guard error == nil else { return }
let userEmail = user?.profile?.email

guard let userEmail = user?.profile?.email else {
self.makeAlert(title: "로그인 오류",
message: "선택된 구글 아이디가 없습니다.")
return
}

self.socialLogin(email: userEmail, profileImage: nil, nickname: nil)
//여기 유저 이미지 ... String 으로 변환 모루겟다
// do {
// var userProfileImageString = try String(contentsOf: URL(string: (user?.profile?.imageURL(withDimension: 320)!)!)!)
Expand All @@ -128,7 +136,6 @@ class SNSLoginVC: UIViewController {
// }

//로그인
self.socialLogin(email: userEmail!, profileImage: nil, nickname: nil)
}
}

Expand Down

0 comments on commit b9a247b

Please sign in to comment.