Skip to content

Commit

Permalink
fix error login
Browse files Browse the repository at this point in the history
  • Loading branch information
xqsadness committed Sep 16, 2023
1 parent d9a6333 commit 87475d3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 25 deletions.
Binary file not shown.
8 changes: 4 additions & 4 deletions DefaultProject/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import SwiftUI

struct ContentView: View {
var body: some View {
if User.shared.userUID != ""{
HomeView()
} else {
// if User.shared.userUID != ""{
// HomeView()
// } else {
LoginDefaultView()
}
// }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class Coordinator: ObservableObject{
case .createUsernameView:
CreateUsernameView()
.environmentObject(Coordinator.shared)
.navigationBarBackButtonHidden(true)
case .homeView:
HomeView()
.environmentObject(Coordinator.shared)
Expand Down
42 changes: 21 additions & 21 deletions DefaultProject/DefaultProjectApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,31 +109,31 @@ struct RootView: SwiftUI.View {
}
}
}
.onReceive(NotificationCenter.default.publisher(for: Notification.Name("PushMessage"))) { (output) in
DispatchQueue.main.async {
guard let str = output.userInfo?["data"] as? String else {return}

appController.MESSAGE_ON_SCREEN = str
withAnimation(.easeInOut(duration: 1)) {
appController.SHOW_MESSAGE_ON_SCREEN = true
}
appController.TIMER_MESSAGE_ON_SCREEN?.invalidate()
appController.TIMER_MESSAGE_ON_SCREEN = Timer.scheduledTimer(withTimeInterval: 3, repeats: false, block: { _ in
withAnimation(.easeInOut(duration: 1)){
appController.SHOW_MESSAGE_ON_SCREEN = false
}
})
}
}
.overlay(alignment: .bottom, content: {
appController.SHOW_MESSAGE_ON_SCREEN ?
NotificationView()
: nil
})
.alert(isPresented: $alerter.isShowingAlert) {
alerter.alert ?? Alert(title: Text(""))
}
}
.onReceive(NotificationCenter.default.publisher(for: Notification.Name("PushMessage"))) { (output) in
DispatchQueue.main.async {
guard let str = output.userInfo?["data"] as? String else {return}

appController.MESSAGE_ON_SCREEN = str
withAnimation(.easeInOut(duration: 1)) {
appController.SHOW_MESSAGE_ON_SCREEN = true
}
appController.TIMER_MESSAGE_ON_SCREEN?.invalidate()
appController.TIMER_MESSAGE_ON_SCREEN = Timer.scheduledTimer(withTimeInterval: 3, repeats: false, block: { _ in
withAnimation(.easeInOut(duration: 1)){
appController.SHOW_MESSAGE_ON_SCREEN = false
}
})
}
}
.overlay(alignment: .bottom, content: {
appController.SHOW_MESSAGE_ON_SCREEN ?
NotificationView()
: nil
})
}

func openApp(){
Expand Down

0 comments on commit 87475d3

Please sign in to comment.