2022-11-23 22:34:02 +01:00
|
|
|
//
|
|
|
|
|
// AddSourceView.swift
|
|
|
|
|
// SideStore
|
|
|
|
|
//
|
|
|
|
|
// Created by Fabian Thies on 20.11.22.
|
|
|
|
|
// Copyright © 2022 Fabian Thies. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
import SwiftUI
|
2022-12-23 15:21:16 +01:00
|
|
|
import SFSafeSymbols
|
2022-11-23 22:34:02 +01:00
|
|
|
|
|
|
|
|
struct AddSourceView: View {
|
|
|
|
|
|
|
|
|
|
@State var sourceUrlText: String = ""
|
|
|
|
|
|
|
|
|
|
var continueHandler: (_ urlText: String) -> ()
|
|
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
|
List {
|
|
|
|
|
Section {
|
|
|
|
|
TextField("https://connect.altstore.ml", text: $sourceUrlText)
|
|
|
|
|
.keyboardType(.URL)
|
|
|
|
|
.autocapitalization(.none)
|
|
|
|
|
.autocorrectionDisabled()
|
|
|
|
|
} header: {
|
2022-12-24 21:06:28 -07:00
|
|
|
Text(L10n.AddSourceView.sourceURL)
|
2022-11-23 22:34:02 +01:00
|
|
|
} footer: {
|
|
|
|
|
VStack(alignment: .leading, spacing: 4) {
|
2022-12-24 21:06:28 -07:00
|
|
|
Text(L10n.AddSourceView.sourceWarning)
|
2022-11-23 22:34:02 +01:00
|
|
|
|
|
|
|
|
HStack(alignment: .top) {
|
2022-12-23 15:21:16 +01:00
|
|
|
Image(systemSymbol: .exclamationmarkTriangleFill)
|
2022-11-23 22:34:02 +01:00
|
|
|
|
2022-12-24 21:06:28 -07:00
|
|
|
Text(L10n.AddSourceView.sourceWarningContinued)
|
2022-11-23 22:34:02 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SwiftUI.Button {
|
|
|
|
|
self.continueHandler(self.sourceUrlText)
|
|
|
|
|
} label: {
|
2022-12-24 21:06:28 -07:00
|
|
|
Text(L10n.AddSourceView.continue)
|
2022-11-23 22:34:02 +01:00
|
|
|
}
|
|
|
|
|
.disabled(URL(string: self.sourceUrlText)?.host == nil)
|
|
|
|
|
}
|
|
|
|
|
.listStyle(InsetGroupedListStyle())
|
2022-12-24 21:06:28 -07:00
|
|
|
.navigationTitle(L10n.AddSourceView.title)
|
2022-11-23 22:34:02 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct AddSourceView_Previews: PreviewProvider {
|
|
|
|
|
static var previews: some View {
|
|
|
|
|
AddSourceView(continueHandler: { _ in })
|
|
|
|
|
}
|
|
|
|
|
}
|