Commit 86fc559a authored by sugita mamoru's avatar sugita mamoru

メニュー画面作成、デザイン調整

parent e591465a
...@@ -44,6 +44,10 @@ ...@@ -44,6 +44,10 @@
022789092AE1FE4C00A87787 /* Turf.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 022788F72AE1FE3C00A87787 /* Turf.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 022789092AE1FE4C00A87787 /* Turf.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 022788F72AE1FE3C00A87787 /* Turf.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
0227890C2AE22E0B00A87787 /* SharingData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0227890B2AE22E0B00A87787 /* SharingData.swift */; }; 0227890C2AE22E0B00A87787 /* SharingData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0227890B2AE22E0B00A87787 /* SharingData.swift */; };
022A98202AF8B8960079C55A /* LocationCalculation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 022A981F2AF8B8960079C55A /* LocationCalculation.swift */; }; 022A98202AF8B8960079C55A /* LocationCalculation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 022A981F2AF8B8960079C55A /* LocationCalculation.swift */; };
025C27FA2AFE119D00BADC49 /* MenuTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 025C27F92AFE119D00BADC49 /* MenuTitleView.swift */; };
025C27FC2AFE191A00BADC49 /* MenuManualView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 025C27FB2AFE191A00BADC49 /* MenuManualView.swift */; };
025C27FE2B0206D700BADC49 /* PDFDownloadManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 025C27FD2B0206D700BADC49 /* PDFDownloadManager.swift */; };
025C28002B034A1900BADC49 /* PDFViewer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 025C27FF2B034A1900BADC49 /* PDFViewer.swift */; };
02A1DE2F2AFB4AA0005BCF55 /* ChatInputView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02A1DE2E2AFB4AA0005BCF55 /* ChatInputView.swift */; }; 02A1DE2F2AFB4AA0005BCF55 /* ChatInputView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02A1DE2E2AFB4AA0005BCF55 /* ChatInputView.swift */; };
02A1DE312AFB61D8005BCF55 /* MyChatContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02A1DE302AFB61D8005BCF55 /* MyChatContentView.swift */; }; 02A1DE312AFB61D8005BCF55 /* MyChatContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02A1DE302AFB61D8005BCF55 /* MyChatContentView.swift */; };
02A1DE332AFB654A005BCF55 /* CustomCornerRadius.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02A1DE322AFB654A005BCF55 /* CustomCornerRadius.swift */; }; 02A1DE332AFB654A005BCF55 /* CustomCornerRadius.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02A1DE322AFB654A005BCF55 /* CustomCornerRadius.swift */; };
...@@ -141,6 +145,10 @@ ...@@ -141,6 +145,10 @@
022788FA2AE1FE3D00A87787 /* MapboxMaps.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = MapboxMaps.xcframework; sourceTree = "<group>"; }; 022788FA2AE1FE3D00A87787 /* MapboxMaps.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = MapboxMaps.xcframework; sourceTree = "<group>"; };
0227890B2AE22E0B00A87787 /* SharingData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharingData.swift; sourceTree = "<group>"; }; 0227890B2AE22E0B00A87787 /* SharingData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharingData.swift; sourceTree = "<group>"; };
022A981F2AF8B8960079C55A /* LocationCalculation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LocationCalculation.swift; path = Sailassist/Location/LocationCalculation.swift; sourceTree = SOURCE_ROOT; }; 022A981F2AF8B8960079C55A /* LocationCalculation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LocationCalculation.swift; path = Sailassist/Location/LocationCalculation.swift; sourceTree = SOURCE_ROOT; };
025C27F92AFE119D00BADC49 /* MenuTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MenuTitleView.swift; path = Sailassist/Menu/View/MenuTitleView.swift; sourceTree = SOURCE_ROOT; };
025C27FB2AFE191A00BADC49 /* MenuManualView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MenuManualView.swift; path = Sailassist/Menu/View/MenuManualView.swift; sourceTree = SOURCE_ROOT; };
025C27FD2B0206D700BADC49 /* PDFDownloadManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = PDFDownloadManager.swift; path = Sailassist/ServerSession/PDFDownloadManager.swift; sourceTree = SOURCE_ROOT; };
025C27FF2B034A1900BADC49 /* PDFViewer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = PDFViewer.swift; path = Sailassist/Menu/View/PDFViewer.swift; sourceTree = SOURCE_ROOT; };
02A1DE2E2AFB4AA0005BCF55 /* ChatInputView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ChatInputView.swift; path = Sailassist/Chat/View/ChatInputView.swift; sourceTree = SOURCE_ROOT; }; 02A1DE2E2AFB4AA0005BCF55 /* ChatInputView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ChatInputView.swift; path = Sailassist/Chat/View/ChatInputView.swift; sourceTree = SOURCE_ROOT; };
02A1DE302AFB61D8005BCF55 /* MyChatContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MyChatContentView.swift; path = Sailassist/Chat/View/MyChatContentView.swift; sourceTree = SOURCE_ROOT; }; 02A1DE302AFB61D8005BCF55 /* MyChatContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MyChatContentView.swift; path = Sailassist/Chat/View/MyChatContentView.swift; sourceTree = SOURCE_ROOT; };
02A1DE322AFB654A005BCF55 /* CustomCornerRadius.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = CustomCornerRadius.swift; path = Sailassist/Chat/View/CustomCornerRadius.swift; sourceTree = SOURCE_ROOT; }; 02A1DE322AFB654A005BCF55 /* CustomCornerRadius.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = CustomCornerRadius.swift; path = Sailassist/Chat/View/CustomCornerRadius.swift; sourceTree = SOURCE_ROOT; };
...@@ -418,6 +426,7 @@ ...@@ -418,6 +426,7 @@
D5AE351C2AEBA6FC00059889 /* SessionLogin.swift */, D5AE351C2AEBA6FC00059889 /* SessionLogin.swift */,
02CD06922AE88970005F8D8F /* ServerSession.swift */, 02CD06922AE88970005F8D8F /* ServerSession.swift */,
02CD06942AE895F5005F8D8F /* APIError.swift */, 02CD06942AE895F5005F8D8F /* APIError.swift */,
025C27FD2B0206D700BADC49 /* PDFDownloadManager.swift */,
); );
path = ServerSession; path = ServerSession;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -446,6 +455,9 @@ ...@@ -446,6 +455,9 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
02CE4D7E2ADE42A9002E79BC /* MenuContentView.swift */, 02CE4D7E2ADE42A9002E79BC /* MenuContentView.swift */,
025C27F92AFE119D00BADC49 /* MenuTitleView.swift */,
025C27FB2AFE191A00BADC49 /* MenuManualView.swift */,
025C27FF2B034A1900BADC49 /* PDFViewer.swift */,
); );
path = View; path = View;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -651,6 +663,7 @@ ...@@ -651,6 +663,7 @@
02CD06952AE895F5005F8D8F /* APIError.swift in Sources */, 02CD06952AE895F5005F8D8F /* APIError.swift in Sources */,
022A98202AF8B8960079C55A /* LocationCalculation.swift in Sources */, 022A98202AF8B8960079C55A /* LocationCalculation.swift in Sources */,
02CE4DC82ADF97E8002E79BC /* View+Extensions.swift in Sources */, 02CE4DC82ADF97E8002E79BC /* View+Extensions.swift in Sources */,
025C28002B034A1900BADC49 /* PDFViewer.swift in Sources */,
02C3E6092AFDF30000AF7837 /* ChatMemberView.swift in Sources */, 02C3E6092AFDF30000AF7837 /* ChatMemberView.swift in Sources */,
020B98412AD8C3810029DE4C /* LoginView.swift in Sources */, 020B98412AD8C3810029DE4C /* LoginView.swift in Sources */,
D5AE351D2AEBA6FC00059889 /* SessionLogin.swift in Sources */, D5AE351D2AEBA6FC00059889 /* SessionLogin.swift in Sources */,
...@@ -672,6 +685,8 @@ ...@@ -672,6 +685,8 @@
020B98692ADD221E0029DE4C /* Preferences.swift in Sources */, 020B98692ADD221E0029DE4C /* Preferences.swift in Sources */,
02CD06932AE88970005F8D8F /* ServerSession.swift in Sources */, 02CD06932AE88970005F8D8F /* ServerSession.swift in Sources */,
02A1DE312AFB61D8005BCF55 /* MyChatContentView.swift in Sources */, 02A1DE312AFB61D8005BCF55 /* MyChatContentView.swift in Sources */,
025C27FE2B0206D700BADC49 /* PDFDownloadManager.swift in Sources */,
025C27FC2AFE191A00BADC49 /* MenuManualView.swift in Sources */,
020B98592AD92A4C0029DE4C /* MainTabView.swift in Sources */, 020B98592AD92A4C0029DE4C /* MainTabView.swift in Sources */,
020B984F2AD9182D0029DE4C /* InputUserNameView.swift in Sources */, 020B984F2AD9182D0029DE4C /* InputUserNameView.swift in Sources */,
D5AE351A2AEBA66A00059889 /* ReqLogin.swift in Sources */, D5AE351A2AEBA66A00059889 /* ReqLogin.swift in Sources */,
...@@ -683,6 +698,7 @@ ...@@ -683,6 +698,7 @@
02CD068F2AE6535F005F8D8F /* MapSource.swift in Sources */, 02CD068F2AE6535F005F8D8F /* MapSource.swift in Sources */,
02C3E5CE2AFCA04700AF7837 /* OtherChatContentView.swift in Sources */, 02C3E5CE2AFCA04700AF7837 /* OtherChatContentView.swift in Sources */,
020B98442AD8E4910029DE4C /* FontStyle.swift in Sources */, 020B98442AD8E4910029DE4C /* FontStyle.swift in Sources */,
025C27FA2AFE119D00BADC49 /* MenuTitleView.swift in Sources */,
02CE4D892ADF62E1002E79BC /* EcaSettingView.swift in Sources */, 02CE4D892ADF62E1002E79BC /* EcaSettingView.swift in Sources */,
02CE4D872ADF62A7002E79BC /* EcaListView.swift in Sources */, 02CE4D872ADF62A7002E79BC /* EcaListView.swift in Sources */,
020B986C2ADD3E810029DE4C /* InTextLib.swift in Sources */, 020B986C2ADD3E810029DE4C /* InTextLib.swift in Sources */,
......
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xD1",
"green" : "0xBD",
"red" : "0x21"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
...@@ -60,6 +60,7 @@ struct ChatTitleView: View { ...@@ -60,6 +60,7 @@ struct ChatTitleView: View {
} }
.frame(width: 48, height: 48) .frame(width: 48, height: 48)
} }
.frame(height: 60)
Divider() Divider()
.background(ColorSet.LineColor04.color) .background(ColorSet.LineColor04.color)
......
...@@ -97,6 +97,8 @@ enum ColorSet: String, CaseIterable{ ...@@ -97,6 +97,8 @@ enum ColorSet: String, CaseIterable{
case ToggleOn case ToggleOn
/// Button - Slidebar /// Button - Slidebar
case Slidebar case Slidebar
/// Button - Slidebar Active
case SlidebarActive
/// Button - Coning active /// Button - Coning active
case ConingActive case ConingActive
...@@ -237,6 +239,8 @@ extension ColorSet{ ...@@ -237,6 +239,8 @@ extension ColorSet{
"ToggleOnColor" "ToggleOnColor"
case .Slidebar: case .Slidebar:
"SliderColor" "SliderColor"
case .SlidebarActive:
"SliderActiveColor"
case .ConingActive: case .ConingActive:
"ConingActiveColor" "ConingActiveColor"
case .PrimaryActiveIcon: case .PrimaryActiveIcon:
......
...@@ -13,24 +13,23 @@ struct ContentView: View { ...@@ -13,24 +13,23 @@ struct ContentView: View {
var selectedTabModel = SelectedTabModel() var selectedTabModel = SelectedTabModel()
var body: some View { var body: some View {
NavigationStack{
MainTabView() MainTabView()
.environmentObject(selectedTabModel) .environmentObject(selectedTabModel)
.onAppear(){ .onAppear(){
if isLogin{ if isLogin{
guard sceneDelegate.tabWindow == nil else{ return } guard sceneDelegate.tabWindow == nil else{ return }
sceneDelegate.addTabBar(selectedTabModel) sceneDelegate.addTabBar(selectedTabModel)
selectedTabModel.activeTab = .task selectedTabModel.activeTab = .task
}
} }
} }
.fullScreenCover(isPresented: .constant(!isLogin), onDismiss: { .fullScreenCover(isPresented: .constant(!isLogin), onDismiss: {
guard sceneDelegate.tabWindow == nil else{ return } guard sceneDelegate.tabWindow == nil else{ return }
sceneDelegate.addTabBar(selectedTabModel) sceneDelegate.addTabBar(selectedTabModel)
selectedTabModel.activeTab = .task selectedTabModel.activeTab = .task
}, content: { }, content: {
LoginView(isLogin: $isLogin) LoginView(isLogin: $isLogin)
}) })
} }
} }
......
...@@ -6,18 +6,25 @@ ...@@ -6,18 +6,25 @@
// //
import SwiftUI import SwiftUI
import UIKit
struct EcaSettingView: View { struct EcaSettingView: View {
@Binding var isShowSettingEca: Bool @Binding var isShowSettingEca: Bool
@State var edittingEca: RegisteredEca @State var edittingEca: RegisteredEca
var body: some View { var body: some View {
VStack{ VStack(spacing: 0){
SliderView(param: $edittingEca.swFinish, title: "Switching Finish - ECA") SliderView(param: $edittingEca.swFinish, title: "Switching Finish - ECA")
.padding(.horizontal, 30)
.padding(.vertical, 17)
Divider() Divider()
SliderView(param: $edittingEca.swStart, title: "Switching Start - ECA") SliderView(param: $edittingEca.swStart, title: "Switching Start - ECA")
.padding(.horizontal, 30)
.padding(.vertical, 17)
Divider() Divider()
SliderView(param: $edittingEca.swNotice, title: "Switching Notice - ECA") SliderView(param: $edittingEca.swNotice, title: "Switching Notice - ECA")
.padding(.horizontal, 30)
.padding(.vertical, 17)
Button(action: { Button(action: {
...@@ -25,17 +32,28 @@ struct EcaSettingView: View { ...@@ -25,17 +32,28 @@ struct EcaSettingView: View {
isShowSettingEca = false isShowSettingEca = false
}, label: { }, label: {
Text("Register") Text("Register")
.font(FontStyle.DefaultText.font)
.padding() .padding()
}) })
.frame(width: 153, height: 42)
.foregroundColor(ColorSet.ButtonText.color)
.background(ColorSet.PrimaryActiveIcon.color) .background(ColorSet.PrimaryActiveIcon.color)
.cornerRadius(30) .cornerRadius(30)
.padding(.vertical, 20)
} }
.padding(.horizontal)
} }
} }
fileprivate struct SliderView: View { fileprivate struct SliderView: View {
init(param: Binding<Float>, title: String, min: Float = 1, max: Float = 10) {
var thumb = UIImage(systemName: "circle.fill")
UISlider.appearance().setThumbImage(thumb, for: .normal)
UISlider.appearance().maximumTrackTintColor = UIColor(ColorSet.Slidebar.color)
self._param = param
self.title = title
self.min = min
self.max = max
}
@Binding var param: Float @Binding var param: Float
let title: String let title: String
var min : Float = 1 var min : Float = 1
...@@ -43,31 +61,45 @@ fileprivate struct SliderView: View { ...@@ -43,31 +61,45 @@ fileprivate struct SliderView: View {
var body: some View { var body: some View {
VStack(alignment: .leading){ VStack(alignment: .leading){
Text(title) Text(title)
.foregroundColor(ColorSet.Body.color) .font(FontStyle.EmphasisText.font)
HStack{ HStack(alignment: .bottom){
Text(String(format: "%d", Int(param))) Text(String(format: "%d", Int(param)))
.font(.system(size: 20))
Text("NM") Text("NM")
.font(FontStyle.SupplementText2.font)
.foregroundColor(ColorSet.BodyDescriptiion
.color)
} }
.foregroundColor(ColorSet.Body.color)
HStack{ HStack(spacing: 9){
Button(action: { Button(action: {
param -= 1 param -= 1
}, label: { }, label: {
Image(systemName: "minus.circle") Image(systemName: "minus.circle")
.resizable()
.frame(width: 28, height: 28)
}) })
.disabled(param <= min) .disabled(param <= min)
Slider(value: $param, in: min...max, step: 1)
Slider(value: $param, in: min...max, step: 1)
Button(action: { Button(action: {
param += 1 param += 1
}, label: { }, label: {
Image(systemName: "plus.circle") Image(systemName: "plus.circle")
.resizable()
.frame(width: 28, height: 28)
}) })
.disabled(param >= max) .disabled(param >= max)
Spacer()
} }
.tint(ColorSet.SlidebarActive.color)
.foregroundColor(ColorSet.SlidebarActive.color)
} }
.foregroundColor(ColorSet.Body.color)
} }
} }
......
...@@ -65,7 +65,7 @@ struct TaskSwitchingMenuView: View { ...@@ -65,7 +65,7 @@ struct TaskSwitchingMenuView: View {
} label: { } label: {
Image(systemName: "ellipsis") Image(systemName: "ellipsis")
.frame(width: 22, height: 22) .frame(width: 22, height: 22)
// .padding() .foregroundColor(ColorSet.Slidebar.color)
} }
.disabled(eca.isRunning) .disabled(eca.isRunning)
.alert("delete", isPresented: $isDeleteAlert) { .alert("delete", isPresented: $isDeleteAlert) {
......
...@@ -6,45 +6,121 @@ ...@@ -6,45 +6,121 @@
// //
import SwiftUI import SwiftUI
import PDFKit
enum MenuPath: String, Hashable{
case Manual
case ManualECDIS
case ManualRADAR
case ManualJmarineNeCST
case Information
case Help
case AboutApp
case ContactUs
var title: String{
switch self {
case .Manual:
"Equipment manual"
case .ManualECDIS:
"ECDIS"
case .ManualRADAR:
"RADAR"
case .ManualJmarineNeCST:
"J-marine NeCST"
case .Information:
"Information"
case .Help:
"Help"
case .AboutApp:
"About this App"
case .ContactUs:
"Contact Us"
}
}
}
struct MenuView: View { struct MenuView: View {
let contentTitles = ["content1", "content2"] @State var path: [MenuPath] = []
let dividerColor = ColorSet.LineColor03.color
var body: some View { var body: some View {
NavigationStack{ NavigationStack(path: $path){
VStack(spacing: 0) { VStack(spacing: 0) {
Divider() MenuTitleView(path: $path)
MenuContentView(contentTitle: .constant("title1")) HStack {
VStack(alignment: .leading, spacing: 10){
Text("Japan Radio Co.,Ltd.")
.font(FontStyle.TitleL.font)
.foregroundColor(ColorSet.Body.color)
Text("会社名一般")
.font(FontStyle.EmphasisText.font)
.foregroundColor(ColorSet.BodyDescriptiion.color)
}
.padding(.horizontal, 30)
.padding(.vertical, 17)
Spacer()
}
Divider() Divider()
.background(ColorSet.LineColor04.color)
.background(dividerColor) Button{
path.append(.Manual)
}label: {
MenuContentView(content: .Manual)
}
Button{
path.append(.Information)
}label: {
MenuContentView(content: .Information)
}
Button{
path.append(.Help)
}label: {
MenuContentView(content: .Help)
}
MenuContentView(contentTitle: .constant("title2")) Button{
path.append(.AboutApp)
}label: {
MenuContentView(content: .AboutApp)
}
Button{
path.append(.ContactUs)
}label: {
MenuContentView(content: .ContactUs)
}
Spacer() Spacer()
} }
// .toolbar{
// ToolbarItem(placement: .principal) {
// Text("aaaaa")
// }
// }
.navigationTitle("JMB-Demo")
.navigationBarTitleDisplayMode(.inline)
.background(ColorSet.BackgroundPrimary.color) .background(ColorSet.BackgroundPrimary.color)
.navigationTitle("")
.navigationBarHidden(true)
.navigationDestination(for: MenuPath.self) { goto in
if goto == .Manual{
MenuManualView(path: $path)
.navigationBarHidden(true)
}else{
VStack(spacing: 0) {
MenuTitleView(path: $path, title: goto.title)
if let url = Preferences.ECDISUrl{
PDFViewer(url: url)
}else{
Spacer()
}
}
.navigationBarHidden(true)
.background(ColorSet.BackgroundPrimary.color)
}
}
} }
// List{
// ForEach(contentTitles, id: \.self) { title in
// MenuContentView(contentTitle: .constant(title))
// }
// }
// .listStyle(.plain)
} }
} }
......
...@@ -8,25 +8,29 @@ ...@@ -8,25 +8,29 @@
import SwiftUI import SwiftUI
struct MenuContentView: View { struct MenuContentView: View {
@Binding var contentTitle: String var content: MenuPath
var body: some View { var body: some View {
VStack(spacing: 0){
HStack {
HStack { Text(content.title)
Text(contentTitle) .font(FontStyle.EmphasisText.font)
.font(FontStyle.TitleM.font) .foregroundColor(ColorSet.Body.color)
.foregroundColor(ColorSet.Body.color)
.padding() Spacer()
Spacer() Image("ink_01")
.resizable()
.frame(width: 22, height: 22)
}
.padding(.vertical, 17)
.padding(.horizontal, 30)
Image("ink_01") Divider()
.padding() .background(ColorSet.LineColor04.color)
} }
.background(ColorSet.BackgroundPrimary.color)
} }
} }
#Preview { #Preview {
MenuContentView(contentTitle: .constant("Title")) MenuContentView(content: .Manual)
} }
//
// MenuManualView.swift
// Sailassist
//
// Created by Mamoru Sugita on 2023/11/10.
//
import SwiftUI
import PDFKit
struct MenuManualView: View {
@State var isAlert: Bool = false
@Binding var path : [MenuPath]
var body: some View {
VStack{
MenuTitleView(path: $path, title: MenuPath.Manual.title)
Button{
if Preferences.ECDISUrl != nil{
path.append(.ManualECDIS)
}else{
if let url = PDFDownloadManager.main.downloadFile(urlString: "https://samsdbg.jmarinesafety.jp/gps_editor/gps_help.pdf", fileName: "ECDIS.pdf"){
Preferences.ECDISUrl = url
path.append(.ManualECDIS)
}else{
isAlert = true
}
}
}label: {
MenuContentView(content: .ManualECDIS)
}
Button{
path.append(.ManualRADAR)
}label: {
MenuContentView(content: .ManualRADAR)
}
Button{
path.append(.ManualJmarineNeCST)
}label: {
MenuContentView(content: .ManualJmarineNeCST)
}
Spacer()
}
.background(ColorSet.BackgroundPrimary.color)
.alert("delete", isPresented: $isAlert) {
Button(role: .destructive) {
} label: {
Text("delete")
}
} message: {
Text("eca delete")
}
}
}
#Preview {
MenuManualView(path: .constant([.Manual]))
}
//
// MenuTitleView.swift
// Sailassist
//
// Created by Mamoru Sugita on 2023/11/10.
//
import SwiftUI
struct MenuTitleView: View {
@Binding var path : [MenuPath]
var title = "Menu"
var body: some View {
VStack {
HStack{
Button{
path.removeLast()
}label: {
if !path.isEmpty{
Image("ink_02")
}
}
.disabled(path.isEmpty)
.frame(width: 48, height: 48)
Spacer()
Text(title)
.font(FontStyle.TitleL.font)
.foregroundColor(ColorSet.Body.color)
Spacer()
Button{
}label: {
// Image("ink_02")
}
.disabled(true)
.frame(width: 48, height: 48)
}
.frame(height: 60)
Divider()
.background(ColorSet.LineColor04.color)
}
}
}
#Preview {
MenuTitleView(path: .constant([]))
}
//
// PDFViewer.swift
// Sailassist
//
// Created by Mamoru Sugita on 2023/11/14.
//
import Foundation
import SwiftUI
import PDFKit
struct PDFViewer: UIViewRepresentable{
let url: URL
func makeUIView(context: Context) -> some PDFView {
let pdfView = PDFView()
pdfView.document = PDFDocument(url: self.url)
return pdfView
}
func updateUIView(_ uiView: UIViewType, context: Context) {
}
}
...@@ -30,6 +30,8 @@ class Preferences{ ...@@ -30,6 +30,8 @@ class Preferences{
@AppStorage(wrappedValue:"", PreferencesKey.TypeString.GroupName.rawValue) static var GroupName: String @AppStorage(wrappedValue:"", PreferencesKey.TypeString.GroupName.rawValue) static var GroupName: String
@AppStorage(wrappedValue:"", PreferencesKey.TypeString.UserName.rawValue) static var UserName: String @AppStorage(wrappedValue:"", PreferencesKey.TypeString.UserName.rawValue) static var UserName: String
// func getPreferences(key) // func getPreferences(key)
@AppStorage(PreferencesKey.TypeURL.ECDIS.rawValue) static var ECDISUrl: URL?
} }
......
...@@ -24,6 +24,13 @@ class PreferencesKey{ ...@@ -24,6 +24,13 @@ class PreferencesKey{
enum TypeInt: String{ enum TypeInt: String{
case AppStartUsingDate case AppStartUsingDate
case LastLoginDate case LastLoginDate
}
enum TypeURL: String{
case ECDIS
case RADAR
case NeCST
} }
......
//
// PDFDownloadManager.swift
// Sailassist
//
// Created by Mamoru Sugita on 2023/11/13.
//
import Foundation
class PDFDownloadManager{
static let main = PDFDownloadManager()
func downloadFile(urlString: String, fileName: String) -> URL?{
let semaphore = DispatchSemaphore(value: 0)
guard let url = URL(string: urlString) else { return nil }
guard let resDocPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).last else { return nil }
var filePath: URL? = resDocPath.appendingPathComponent(fileName)
do {
let pdfData = try Data.init(contentsOf: url)
try pdfData.write(to: filePath!, options: .atomic)
}catch{
filePath = nil
}
return filePath
}
}
...@@ -34,33 +34,22 @@ struct MainTabView: View { ...@@ -34,33 +34,22 @@ struct MainTabView: View {
@State var isTabShow: Bool = sceneDelegate.tabWindow != nil @State var isTabShow: Bool = sceneDelegate.tabWindow != nil
@State var isTaskSel: Bool = selectedTabModel.activeTab == .task @State var isTaskSel: Bool = selectedTabModel.activeTab == .task
TabView(selection: $selectedTabModel.activeTab){ TabView(selection: $selectedTabModel.activeTab){
NavigationStack{ ChatView()
ChatView() .tag(Tab.chat)
}
.tag(Tab.chat)
NavigationStack{ MapRepresentable()
MapRepresentable() .ignoresSafeArea()
.ignoresSafeArea() .tag(Tab.task)
}
.tag(Tab.task)
NavigationStack{ NotificationView()
NotificationView() .tag(Tab.alert)
}
.tag(Tab.alert)
NavigationStack{
MenuView()
}
.tag(Tab.menu)
MenuView()
.tag(Tab.menu)
} }
.hideNativeTabBar() .hideNativeTabBar()
.sheet(isPresented: .constant(isTaskSel && isTabShow), content: { .sheet(isPresented: .constant(isTaskSel && isTabShow), content: {
NavigationStack{ MapTaskView()
MapTaskView()
}
.zIndex(0) .zIndex(0)
.presentationDragIndicator(.hidden) .presentationDragIndicator(.hidden)
.presentationDetents([.height(150), .medium, .fraction(0.99)]) .presentationDetents([.height(150), .medium, .fraction(0.99)])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment