Skip to content

Commit 379c9a7

Browse files
committed
✨[feat]: 앱이 삭제 되었을때 로그아웃 구현
1 parent 8b9c861 commit 379c9a7

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

MarketApp/MarketApp.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,7 +1713,7 @@
17131713
"$(inherited)",
17141714
"@executable_path/Frameworks",
17151715
);
1716-
MARKETING_VERSION = 1.0.3;
1716+
MARKETING_VERSION = 1.0.4;
17171717
OTHER_SWIFT_FLAGS = "$(inherited) -D DEVELOPE";
17181718
PRODUCT_BUNDLE_IDENTIFIER = com.shoping.MarketApps;
17191719
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1757,7 +1757,7 @@
17571757
"$(inherited)",
17581758
"@executable_path/Frameworks",
17591759
);
1760-
MARKETING_VERSION = 1.0.3;
1760+
MARKETING_VERSION = 1.0.4;
17611761
OTHER_SWIFT_FLAGS = "$(inherited)";
17621762
PRODUCT_BUNDLE_IDENTIFIER = com.shoping.MarketApps;
17631763
PRODUCT_NAME = "$(TARGET_NAME)";

MarketApp/MarketApp/Soreces/Application/AppDelegate.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ class AppDelegate: UIViewController, UIApplicationDelegate, MessagingDelegate, U
5959
}
6060
}
6161

62+
//MARK: - 앱이 삭제 되었을때 로그아웃 처리
63+
func applicationWillTerminate(_ application: UIApplication) {
64+
do {
65+
try Auth.auth().signOut()
66+
} catch let error {
67+
print("rror signing out: \(error.localizedDescription)")
68+
}
69+
}
70+
71+
72+
73+
//MARK: - push 메세지 처리
6274
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
6375
Messaging.messaging().apnsToken = deviceToken
6476
print("devoice token = \(deviceToken)")

MarketApp/MarketApp/Soreces/UI/View/Profile/ProfileView.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ struct ProfileView: View {
4747
.onAppear {
4848
profileViewModel.getUserInformation()
4949
}
50+
.onReceive(NotificationCenter.default.publisher(for: UIApplication.willTerminateNotification)) { _ in
51+
viewModel.signOut()
52+
}
5053
//MARK: - 로그아웃 후
5154
.fullScreenCover(isPresented: $viewModel.loginStatus) {
5255
LoginView()

MarketApp/MarketApp/Soreces/ViewModel/ProfileViewModel/ProfileViewModel.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ class ProfileViewModel: ObservableObject {
3838
}
3939

4040
for document in snap!.documentChanges {
41-
self.userEmail = document.document.get("email") as? String
42-
self.userNickName = document.document.get("nickname") as? String
41+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
42+
self.userEmail = document.document.get("email") as? String
43+
self.userNickName = document.document.get("nickname") as? String
44+
}
4345
}
4446
}
4547

0 commit comments

Comments
 (0)