Repo created
This commit is contained in:
parent
4af19165ec
commit
68073add76
12458 changed files with 12350765 additions and 2 deletions
86
iphone/Maps/UI/Settings/Profile/NoExistingProfileView.swift
Normal file
86
iphone/Maps/UI/Settings/Profile/NoExistingProfileView.swift
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
import SwiftUI
|
||||
|
||||
/// View for the OpenStreetMapp profile
|
||||
struct NoExistingProfileView: View {
|
||||
// MARK: Properties
|
||||
|
||||
/// The open url action of the environment
|
||||
@Environment(\.openURL) private var openUrl
|
||||
|
||||
|
||||
/// If the login form should be shown in the Safari view
|
||||
@State private var showLogin: Bool = false
|
||||
|
||||
|
||||
/// The publisher to know when to stop showing the Safari view for the login form
|
||||
private let stopShowingLoginPublisher = NotificationCenter.default.publisher(for: SafariView.dismissNotificationName)
|
||||
|
||||
|
||||
/// The actual view
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
List {
|
||||
VStack(alignment: .leading) {
|
||||
Text("osm_profile_promt")
|
||||
.font(.headline)
|
||||
|
||||
HStack(alignment: .top) {
|
||||
Image(.openStreetMapLogo)
|
||||
.resizable()
|
||||
.aspectRatio(1, contentMode: .fit)
|
||||
.frame(maxWidth: 50)
|
||||
.padding(.top, 6)
|
||||
|
||||
Text("osm_profile_explanation")
|
||||
.tint(.alternativeAccent)
|
||||
}
|
||||
}
|
||||
.padding(.bottom, 8)
|
||||
}
|
||||
|
||||
Spacer(minLength: 0)
|
||||
|
||||
VStack {
|
||||
VStack {
|
||||
Button {
|
||||
showLogin = true
|
||||
} label: {
|
||||
Text("osm_profile_login")
|
||||
.lineLimit(1)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.buttonStyle(BorderedProminentButtonStyle())
|
||||
.controlSize(.large)
|
||||
.font(.headline)
|
||||
.sheet(isPresented: $showLogin) {
|
||||
SafariView(url: Profile.authorizationUrl, dismissButton: .cancel)
|
||||
}
|
||||
}
|
||||
|
||||
Divider()
|
||||
.padding([.top, .bottom])
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text("osm_profile_register_promt")
|
||||
|
||||
Button {
|
||||
openUrl(Profile.registrationUrl)
|
||||
} label: {
|
||||
Text("osm_profile_register")
|
||||
.lineLimit(1)
|
||||
.foregroundStyle(.alternativeAccent)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.buttonStyle(BorderedButtonStyle())
|
||||
.controlSize(.large)
|
||||
.font(.headline)
|
||||
}
|
||||
}
|
||||
.padding([.bottom, .leading, .trailing])
|
||||
.background(Color(uiColor: .systemGroupedBackground))
|
||||
}
|
||||
.onReceive(stopShowingLoginPublisher) { _ in
|
||||
showLogin = false
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue