Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
Sailassist
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CpjJwWHV
Sailassist
Commits
13ed1e3f
Commit
13ed1e3f
authored
Dec 18, 2023
by
sugita mamoru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
マニュアル取得処理作成
parent
e03cae43
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
131 additions
and
143 deletions
+131
-143
project.pbxproj
Seilassist/Sailassist.xcodeproj/project.pbxproj
+0
-4
ResGetManualUrl.swift
Seilassist/Sailassist/Json/ResGetManualUrl.swift
+5
-0
MenuView.swift
Seilassist/Sailassist/Menu/MenuView.swift
+34
-1
MenuManualECDISView.swift
Seilassist/Sailassist/Menu/View/MenuManualECDISView.swift
+7
-23
MenuManualRADARView.swift
Seilassist/Sailassist/Menu/View/MenuManualRADARView.swift
+8
-23
MenuManualView.swift
Seilassist/Sailassist/Menu/View/MenuManualView.swift
+42
-45
Preferences.swift
Seilassist/Sailassist/Preferences/Preferences.swift
+8
-8
PreferencesKey.swift
Seilassist/Sailassist/Preferences/PreferencesKey.swift
+10
-10
SailassistApp.swift
Seilassist/Sailassist/SailassistApp.swift
+2
-2
PDFDownloadManager.swift
Seilassist/Sailassist/ServerSession/PDFDownloadManager.swift
+7
-8
ServerSession.swift
Seilassist/Sailassist/ServerSession/ServerSession.swift
+5
-6
SessionGetManualUrl.swift
...assist/Sailassist/ServerSession/SessionGetManualUrl.swift
+2
-5
SharingData.swift
Seilassist/Sailassist/SharingData/SharingData.swift
+1
-8
No files found.
Seilassist/Sailassist.xcodeproj/project.pbxproj
View file @
13ed1e3f
...
@@ -110,7 +110,6 @@
...
@@ -110,7 +110,6 @@
D5CB6F9B2B021C4F00EC2010
/* LocationViewModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D5CB6F9A2B021C4F00EC2010
/* LocationViewModel.swift */
;
};
D5CB6F9B2B021C4F00EC2010
/* LocationViewModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D5CB6F9A2B021C4F00EC2010
/* LocationViewModel.swift */
;
};
D5CB6F9F2B0220A700EC2010
/* ErrorView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D5CB6F9E2B0220A700EC2010
/* ErrorView.swift */
;
};
D5CB6F9F2B0220A700EC2010
/* ErrorView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D5CB6F9E2B0220A700EC2010
/* ErrorView.swift */
;
};
D5CB6FA12B023F7F00EC2010
/* EcaTask.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D5CB6FA02B023F7F00EC2010
/* EcaTask.swift */
;
};
D5CB6FA12B023F7F00EC2010
/* EcaTask.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D5CB6FA02B023F7F00EC2010
/* EcaTask.swift */
;
};
D5D9AA832B2C24030011EB13
/* ResManualUrl.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D5D9AA822B2C24030011EB13
/* ResManualUrl.swift */
;
};
D5E008742B2ADD3F00C4070A
/* MenuManualECDISView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D5E008732B2ADD3F00C4070A
/* MenuManualECDISView.swift */
;
};
D5E008742B2ADD3F00C4070A
/* MenuManualECDISView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D5E008732B2ADD3F00C4070A
/* MenuManualECDISView.swift */
;
};
D5E008762B2ADD5900C4070A
/* MenuManualRADARView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D5E008752B2ADD5900C4070A
/* MenuManualRADARView.swift */
;
};
D5E008762B2ADD5900C4070A
/* MenuManualRADARView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D5E008752B2ADD5900C4070A
/* MenuManualRADARView.swift */
;
};
D5E008782B2B022200C4070A
/* MenuAboutAppView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D5E008772B2B022200C4070A
/* MenuAboutAppView.swift */
;
};
D5E008782B2B022200C4070A
/* MenuAboutAppView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D5E008772B2B022200C4070A
/* MenuAboutAppView.swift */
;
};
...
@@ -264,7 +263,6 @@
...
@@ -264,7 +263,6 @@
D5CB6F9A2B021C4F00EC2010
/* LocationViewModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
LocationViewModel.swift
;
path
=
Sailassist/LocationViewModel.swift
;
sourceTree
=
SOURCE_ROOT
;
};
D5CB6F9A2B021C4F00EC2010
/* LocationViewModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
LocationViewModel.swift
;
path
=
Sailassist/LocationViewModel.swift
;
sourceTree
=
SOURCE_ROOT
;
};
D5CB6F9E2B0220A700EC2010
/* ErrorView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
ErrorView.swift
;
path
=
Sailassist/ErrorView.swift
;
sourceTree
=
SOURCE_ROOT
;
};
D5CB6F9E2B0220A700EC2010
/* ErrorView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
ErrorView.swift
;
path
=
Sailassist/ErrorView.swift
;
sourceTree
=
SOURCE_ROOT
;
};
D5CB6FA02B023F7F00EC2010
/* EcaTask.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
EcaTask.swift
;
path
=
Sailassist/ECA/EcaTask.swift
;
sourceTree
=
SOURCE_ROOT
;
};
D5CB6FA02B023F7F00EC2010
/* EcaTask.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
EcaTask.swift
;
path
=
Sailassist/ECA/EcaTask.swift
;
sourceTree
=
SOURCE_ROOT
;
};
D5D9AA822B2C24030011EB13
/* ResManualUrl.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
ResManualUrl.swift
;
path
=
Sailassist/Json/ResManualUrl.swift
;
sourceTree
=
SOURCE_ROOT
;
};
D5E008732B2ADD3F00C4070A
/* MenuManualECDISView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
MenuManualECDISView.swift
;
path
=
Sailassist/Menu/View/MenuManualECDISView.swift
;
sourceTree
=
SOURCE_ROOT
;
};
D5E008732B2ADD3F00C4070A
/* MenuManualECDISView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
MenuManualECDISView.swift
;
path
=
Sailassist/Menu/View/MenuManualECDISView.swift
;
sourceTree
=
SOURCE_ROOT
;
};
D5E008752B2ADD5900C4070A
/* MenuManualRADARView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
MenuManualRADARView.swift
;
path
=
Sailassist/Menu/View/MenuManualRADARView.swift
;
sourceTree
=
SOURCE_ROOT
;
};
D5E008752B2ADD5900C4070A
/* MenuManualRADARView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
MenuManualRADARView.swift
;
path
=
Sailassist/Menu/View/MenuManualRADARView.swift
;
sourceTree
=
SOURCE_ROOT
;
};
D5E008772B2B022200C4070A
/* MenuAboutAppView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
MenuAboutAppView.swift
;
path
=
Sailassist/Menu/View/MenuAboutAppView.swift
;
sourceTree
=
SOURCE_ROOT
;
};
D5E008772B2B022200C4070A
/* MenuAboutAppView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
MenuAboutAppView.swift
;
path
=
Sailassist/Menu/View/MenuAboutAppView.swift
;
sourceTree
=
SOURCE_ROOT
;
};
...
@@ -715,7 +713,6 @@
...
@@ -715,7 +713,6 @@
D592D5282B0F198100B91A1C
/* ReqChatModeMessage.swift */
,
D592D5282B0F198100B91A1C
/* ReqChatModeMessage.swift */
,
D59908C52B19EA70000E13DD
/* ResPushHistory.swift */
,
D59908C52B19EA70000E13DD
/* ResPushHistory.swift */
,
025F99732B2C125900C9A18A
/* ResGetManualUrl.swift */
,
025F99732B2C125900C9A18A
/* ResGetManualUrl.swift */
,
D5D9AA822B2C24030011EB13
/* ResManualUrl.swift */
,
);
);
path
=
Json
;
path
=
Json
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -942,7 +939,6 @@
...
@@ -942,7 +939,6 @@
025F99742B2C125900C9A18A
/* ResGetManualUrl.swift in Sources */
,
025F99742B2C125900C9A18A
/* ResGetManualUrl.swift in Sources */
,
D58E1F542B142A510092D8FE
/* SessionEcaArea.swift in Sources */
,
D58E1F542B142A510092D8FE
/* SessionEcaArea.swift in Sources */
,
025C28002B034A1900BADC49
/* PDFViewer.swift in Sources */
,
025C28002B034A1900BADC49
/* PDFViewer.swift in Sources */
,
D5D9AA832B2C24030011EB13
/* ResManualUrl.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 */
,
...
...
Seilassist/Sailassist/Json/ResGetManualUrl.swift
View file @
13ed1e3f
...
@@ -10,4 +10,9 @@ import Foundation
...
@@ -10,4 +10,9 @@ import Foundation
struct
ResGetManualUrl
:
Codable
{
struct
ResGetManualUrl
:
Codable
{
var
name
:
String
var
name
:
String
var
path
:
String
var
path
:
String
var
identifer
:
String
?
{
get
{
URL
(
string
:
path
)?
.
lastPathComponent
.
removingPercentEncoding
?
.
components
(
separatedBy
:
"(Ed"
)
.
first
}
}
}
}
Seilassist/Sailassist/Menu/MenuView.swift
View file @
13ed1e3f
...
@@ -74,6 +74,39 @@ enum MenuPath: String, Hashable{
...
@@ -74,6 +74,39 @@ enum MenuPath: String, Hashable{
"Sign Out"
"Sign Out"
}
}
}
}
var
fileIdntifer
:
String
?{
switch
self
{
case
.
ManualECDISBasic
:
"JAN-7201_9201(E)7ZPNA4449M"
case
.
ManualECDISFunction
:
"JAN-7201_9201(E)7ZPNA4450K"
case
.
ManualVDR
:
"JCY-1900(E)7ZPNA4384H"
case
.
ManualAIS
:
"JHS-183(E)7ZPJD0553E"
case
.
ManualInternationalVHF
:
"JHS-800S(E)7ZPJD0714B"
case
.
ManualRADARBasic
:
"JMR-7200_9200(E)7ZPNA4446K"
case
.
ManualRADARFunction
:
"JMR-7200_9200(E)7ZPNA4447H"
case
.
ManualInmalsatC
:
"JUE-87(E)7ZPSC0444A"
default
:
nil
}
}
var
fileSavePath
:
URL
?{
guard
let
docPath
=
FileManager
.
default
.
urls
(
for
:
.
documentDirectory
,
in
:
.
userDomainMask
)
.
last
else
{
return
nil
}
switch
self
{
case
.
ManualECDISBasic
,
.
ManualECDISFunction
,
.
ManualVDR
,
.
ManualAIS
,
.
ManualInternationalVHF
,
.
ManualRADARBasic
,
.
ManualRADARFunction
,
.
ManualInmalsatC
:
return
docPath
.
appendingPathComponent
(
"
\(
self
.
rawValue
)
.pdf"
)
default
:
return
nil
}
}
}
}
struct
MenuView
:
View
{
struct
MenuView
:
View
{
...
@@ -155,7 +188,7 @@ struct MenuView: View {
...
@@ -155,7 +188,7 @@ struct MenuView: View {
VStack
(
spacing
:
0
)
{
VStack
(
spacing
:
0
)
{
MenuTitleView
(
path
:
$
path
,
title
:
goto
.
title
)
MenuTitleView
(
path
:
$
path
,
title
:
goto
.
title
)
if
let
url
=
Preferences
.
ECDISBasicUrl
{
if
let
url
=
goto
.
fileSavePath
{
PDFViewer
(
url
:
url
)
PDFViewer
(
url
:
url
)
}
else
{
}
else
{
Spacer
()
Spacer
()
...
...
Seilassist/Sailassist/Menu/View/MenuManualECDISView.swift
View file @
13ed1e3f
...
@@ -15,34 +15,18 @@ struct MenuManualECDISView: View {
...
@@ -15,34 +15,18 @@ struct MenuManualECDISView: View {
VStack
{
VStack
{
MenuTitleView
(
path
:
$
path
,
title
:
MenuPath
.
ManualECDIS
.
title
)
MenuTitleView
(
path
:
$
path
,
title
:
MenuPath
.
ManualECDIS
.
title
)
Button
{
if
let
manual
=
SharingData
.
my
.
manualUrls
.
filter
({
$0
.
identifer
==
MenuPath
.
ManualECDISBasic
.
fileIdntifer
})
.
first
{
if
Preferences
.
ECDISBasicUrl
!=
nil
{
ManualDownloadButton
(
manualType
:
.
ManualECDISBasic
,
downloadUrl
:
manual
.
path
,
version
:
Preferences
.
ECDISBasicManualVer
,
newVersion
:
manual
.
name
,
isAlert
:
$
isAlert
)
{
path
.
append
(
.
ManualECDISBasic
)
path
.
append
(
.
ManualECDISBasic
)
}
else
{
Preferences
.
ECDISBasicManualVer
=
manual
.
name
if
let
url
=
PDFDownloadManager
.
main
.
downloadFile
(
urlString
:
"https://samsdbg.jmarinesafety.jp/gps_editor/gps_help.pdf"
,
fileName
:
"ECDIS.pdf"
){
Preferences
.
ECDISBasicUrl
=
url
path
.
append
(
.
ManualECDISBasic
)
}
else
{
isAlert
=
true
}
}
}
}
label
:
{
MenuContentView
(
content
:
.
ManualECDISBasic
)
}
}
Button
{
if
let
manual
=
SharingData
.
my
.
manualUrls
.
filter
({
$0
.
identifer
==
MenuPath
.
ManualECDISFunction
.
fileIdntifer
})
.
first
{
if
Preferences
.
ECDISFunctionUrl
!=
nil
{
ManualDownloadButton
(
manualType
:
.
ManualECDISFunction
,
downloadUrl
:
manual
.
path
,
version
:
Preferences
.
ECDISFunctionManualVer
,
newVersion
:
manual
.
name
,
isAlert
:
$
isAlert
)
{
path
.
append
(
.
ManualECDISFunction
)
path
.
append
(
.
ManualECDISFunction
)
}
else
{
Preferences
.
ECDISFunctionManualVer
=
manual
.
name
if
let
url
=
PDFDownloadManager
.
main
.
downloadFile
(
urlString
:
"https://samsdbg.jmarinesafety.jp/gps_editor/gps_help.pdf"
,
fileName
:
"ECDIS.pdf"
){
Preferences
.
ECDISFunctionUrl
=
url
path
.
append
(
.
ManualECDISFunction
)
}
else
{
isAlert
=
true
}
}
}
}
label
:
{
MenuContentView
(
content
:
.
ManualECDISFunction
)
}
}
Spacer
()
Spacer
()
...
...
Seilassist/Sailassist/Menu/View/MenuManualRADARView.swift
View file @
13ed1e3f
...
@@ -15,34 +15,19 @@ struct MenuManualRADARView: View {
...
@@ -15,34 +15,19 @@ struct MenuManualRADARView: View {
VStack
{
VStack
{
MenuTitleView
(
path
:
$
path
,
title
:
MenuPath
.
ManualRADAR
.
title
)
MenuTitleView
(
path
:
$
path
,
title
:
MenuPath
.
ManualRADAR
.
title
)
Button
{
if
Preferences
.
RADARBasicUrl
!=
nil
{
if
let
manual
=
SharingData
.
my
.
manualUrls
.
filter
({
$0
.
identifer
==
MenuPath
.
ManualRADARBasic
.
fileIdntifer
})
.
first
{
ManualDownloadButton
(
manualType
:
.
ManualRADARBasic
,
downloadUrl
:
manual
.
path
,
version
:
Preferences
.
RADARBasicManualVer
,
newVersion
:
manual
.
name
,
isAlert
:
$
isAlert
){
path
.
append
(
.
ManualRADARBasic
)
path
.
append
(
.
ManualRADARBasic
)
}
else
{
Preferences
.
RADARBasicManualVer
=
manual
.
name
if
let
url
=
PDFDownloadManager
.
main
.
downloadFile
(
urlString
:
"https://samsdbg.jmarinesafety.jp/gps_editor/gps_help.pdf"
,
fileName
:
"ECDIS.pdf"
){
Preferences
.
ECDISBasicUrl
=
url
path
.
append
(
.
ManualRADARBasic
)
}
else
{
isAlert
=
true
}
}
}
}
label
:
{
MenuContentView
(
content
:
.
ManualRADARBasic
)
}
}
Button
{
if
let
manual
=
SharingData
.
my
.
manualUrls
.
filter
({
$0
.
identifer
==
MenuPath
.
ManualRADARFunction
.
fileIdntifer
})
.
first
{
if
Preferences
.
RADARFunctionUrl
!=
nil
{
ManualDownloadButton
(
manualType
:
.
ManualRADARFunction
,
downloadUrl
:
manual
.
path
,
version
:
Preferences
.
RADARFunctionManualVer
,
newVersion
:
manual
.
name
,
isAlert
:
$
isAlert
)
{
path
.
append
(
.
ManualRADARFunction
)
path
.
append
(
.
ManualRADARFunction
)
}
else
{
Preferences
.
RADARFunctionManualVer
=
manual
.
name
if
let
url
=
PDFDownloadManager
.
main
.
downloadFile
(
urlString
:
"https://samsdbg.jmarinesafety.jp/gps_editor/gps_help.pdf"
,
fileName
:
"ECDIS.pdf"
){
Preferences
.
RADARFunctionUrl
=
url
path
.
append
(
.
ManualRADARFunction
)
}
else
{
isAlert
=
true
}
}
}
}
label
:
{
MenuContentView
(
content
:
.
ManualRADARFunction
)
}
}
Spacer
()
Spacer
()
...
...
Seilassist/Sailassist/Menu/View/MenuManualView.swift
View file @
13ed1e3f
...
@@ -27,64 +27,32 @@ struct MenuManualView: View {
...
@@ -27,64 +27,32 @@ struct MenuManualView: View {
MenuContentView
(
content
:
.
ManualRADAR
)
MenuContentView
(
content
:
.
ManualRADAR
)
}
}
Button
{
if
let
manual
=
SharingData
.
my
.
manualUrls
.
filter
({
$0
.
identifer
==
MenuPath
.
ManualAIS
.
fileIdntifer
})
.
first
{
if
Preferences
.
AISUrl
!=
nil
{
ManualDownloadButton
(
manualType
:
.
ManualAIS
,
downloadUrl
:
manual
.
path
,
version
:
Preferences
.
AISManualVer
,
newVersion
:
manual
.
name
,
isAlert
:
$
isAlert
)
{
path
.
append
(
.
ManualAIS
)
path
.
append
(
.
ManualAIS
)
}
else
{
Preferences
.
AISManualVer
=
manual
.
name
if
let
url
=
PDFDownloadManager
.
main
.
downloadFile
(
urlString
:
"https://samsdbg.jmarinesafety.jp/gps_editor/gps_help.pdf"
,
fileName
:
"ECDIS.pdf"
){
Preferences
.
AISUrl
=
url
path
.
append
(
.
ManualAIS
)
}
else
{
isAlert
=
true
}
}
}
}
label
:
{
MenuContentView
(
content
:
.
ManualAIS
)
}
}
Button
{
if
let
manual
=
SharingData
.
my
.
manualUrls
.
filter
({
$0
.
identifer
==
MenuPath
.
ManualInmalsatC
.
fileIdntifer
})
.
first
{
if
Preferences
.
InmalsatCUrl
!=
nil
{
ManualDownloadButton
(
manualType
:
.
ManualInmalsatC
,
downloadUrl
:
manual
.
path
,
version
:
Preferences
.
InmalsatCManualVer
,
newVersion
:
manual
.
name
,
isAlert
:
$
isAlert
)
{
path
.
append
(
.
ManualInmalsatC
)
path
.
append
(
.
ManualInmalsatC
)
}
else
{
Preferences
.
InmalsatCManualVer
=
manual
.
name
if
let
url
=
PDFDownloadManager
.
main
.
downloadFile
(
urlString
:
"https://samsdbg.jmarinesafety.jp/gps_editor/gps_help.pdf"
,
fileName
:
"ECDIS.pdf"
){
Preferences
.
InmalsatCUrl
=
url
path
.
append
(
.
ManualInmalsatC
)
}
else
{
isAlert
=
true
}
}
}
}
label
:
{
MenuContentView
(
content
:
.
ManualInmalsatC
)
}
}
Button
{
if
let
manual
=
SharingData
.
my
.
manualUrls
.
filter
({
$0
.
identifer
==
MenuPath
.
ManualInternationalVHF
.
fileIdntifer
})
.
first
{
if
Preferences
.
InternationalVHFUrl
!=
nil
{
ManualDownloadButton
(
manualType
:
.
ManualInternationalVHF
,
downloadUrl
:
manual
.
path
,
version
:
Preferences
.
InternationalVHFManualVer
,
newVersion
:
manual
.
name
,
isAlert
:
$
isAlert
)
{
path
.
append
(
.
ManualInternationalVHF
)
path
.
append
(
.
ManualInternationalVHF
)
}
else
{
Preferences
.
InternationalVHFManualVer
=
manual
.
name
if
let
url
=
PDFDownloadManager
.
main
.
downloadFile
(
urlString
:
"https://samsdbg.jmarinesafety.jp/gps_editor/gps_help.pdf"
,
fileName
:
"ECDIS.pdf"
){
Preferences
.
InternationalVHFUrl
=
url
path
.
append
(
.
ManualInternationalVHF
)
}
else
{
isAlert
=
true
}
}
}
}
label
:
{
MenuContentView
(
content
:
.
ManualInternationalVHF
)
}
}
Button
{
if
let
manual
=
SharingData
.
my
.
manualUrls
.
filter
({
$0
.
identifer
==
MenuPath
.
ManualVDR
.
fileIdntifer
})
.
first
{
if
Preferences
.
VDRURL
!=
nil
{
ManualDownloadButton
(
manualType
:
.
ManualVDR
,
downloadUrl
:
manual
.
path
,
version
:
Preferences
.
VDRManualVer
,
newVersion
:
manual
.
name
,
isAlert
:
$
isAlert
)
{
path
.
append
(
.
ManualVDR
)
path
.
append
(
.
ManualVDR
)
}
else
{
Preferences
.
VDRManualVer
=
manual
.
name
if
let
url
=
PDFDownloadManager
.
main
.
downloadFile
(
urlString
:
"https://samsdbg.jmarinesafety.jp/gps_editor/gps_help.pdf"
,
fileName
:
"ECDIS.pdf"
){
Preferences
.
VDRURL
=
url
path
.
append
(
.
ManualVDR
)
}
else
{
isAlert
=
true
}
}
}
}
label
:
{
MenuContentView
(
content
:
.
ManualVDR
)
}
}
Spacer
()
Spacer
()
...
@@ -103,6 +71,35 @@ struct MenuManualView: View {
...
@@ -103,6 +71,35 @@ struct MenuManualView: View {
}
}
}
}
struct
ManualDownloadButton
:
View
{
var
manualType
:
MenuPath
var
downloadUrl
:
String
var
version
:
String
?
var
newVersion
:
String
@Binding
var
isAlert
:
Bool
var
complition
:
()
->
Void
var
body
:
some
View
{
Button
{
if
let
version
=
version
,
version
==
newVersion
{
complition
()
}
else
{
Task
{
if
await
PDFDownloadManager
.
main
.
downloadFile
(
urlString
:
downloadUrl
,
manualType
.
fileSavePath
!
){
complition
()
}
else
{
isAlert
=
true
}
}
}
}
label
:
{
MenuContentView
(
content
:
manualType
)
}
}
}
#Preview {
#Preview {
MenuManualView
(
path
:
.
constant
([
.
Manual
]))
MenuManualView
(
path
:
.
constant
([
.
Manual
]))
}
}
Seilassist/Sailassist/Preferences/Preferences.swift
View file @
13ed1e3f
...
@@ -57,14 +57,14 @@ class Preferences{
...
@@ -57,14 +57,14 @@ class Preferences{
@AppStorage(wrappedValue:0, PreferencesKey.TypeInt.LocationType.rawValue)
static
var
LocationType
:
Int
@AppStorage(wrappedValue:0, PreferencesKey.TypeInt.LocationType.rawValue)
static
var
LocationType
:
Int
// func getPreferences(key)
// func getPreferences(key)
@AppStorage(PreferencesKey.Type
URL.ECDISBasic.rawValue)
static
var
ECDISBasicUrl
:
URL
?
@AppStorage(PreferencesKey.Type
String.ECDISBasic.rawValue)
static
var
ECDISBasicManualVer
:
String
?
@AppStorage(PreferencesKey.Type
URL.ECDISFunction.rawValue)
static
var
ECDISFunctionUrl
:
URL
?
@AppStorage(PreferencesKey.Type
String.ECDISFunction.rawValue)
static
var
ECDISFunctionManualVer
:
String
?
@AppStorage(PreferencesKey.Type
URL.RADARBasic.rawValue)
static
var
RADARBasicUrl
:
URL
?
@AppStorage(PreferencesKey.Type
String.RADARBasic.rawValue)
static
var
RADARBasicManualVer
:
String
?
@AppStorage(PreferencesKey.Type
URL.RADARFunction.rawValue)
static
var
RADARFunctionUrl
:
URL
?
@AppStorage(PreferencesKey.Type
String.RADARFunction.rawValue)
static
var
RADARFunctionManualVer
:
String
?
@AppStorage(PreferencesKey.Type
URL.AIS.rawValue)
static
var
AISUrl
:
URL
?
@AppStorage(PreferencesKey.Type
String.AIS.rawValue)
static
var
AISManualVer
:
String
?
@AppStorage(PreferencesKey.Type
URL.InmalsatC.rawValue)
static
var
InmalsatCUrl
:
URL
?
@AppStorage(PreferencesKey.Type
String.InmalsatC.rawValue)
static
var
InmalsatCManualVer
:
String
?
@AppStorage(PreferencesKey.Type
URL.InternationalVHF.rawValue)
static
var
InternationalVHFUrl
:
URL
?
@AppStorage(PreferencesKey.Type
String.InternationalVHF.rawValue)
static
var
InternationalVHFManualVer
:
String
?
@AppStorage(PreferencesKey.Type
URL.VDR.rawValue)
static
var
VDRURL
:
URL
?
@AppStorage(PreferencesKey.Type
String.VDR.rawValue)
static
var
VDRManualVer
:
String
?
}
}
...
...
Seilassist/Sailassist/Preferences/PreferencesKey.swift
View file @
13ed1e3f
...
@@ -15,6 +15,16 @@ class PreferencesKey{
...
@@ -15,6 +15,16 @@ class PreferencesKey{
case
Id
case
Id
case
Password
case
Password
case
UserName
case
UserName
//Manual類Version
case
ECDISBasic
case
ECDISFunction
case
RADARBasic
case
RADARFunction
case
AIS
case
InmalsatC
case
InternationalVHF
case
VDR
}
}
///Int型
///Int型
...
@@ -27,15 +37,5 @@ class PreferencesKey{
...
@@ -27,15 +37,5 @@ class PreferencesKey{
case
PrivacyPolicyAgreeDate
case
PrivacyPolicyAgreeDate
}
}
enum
TypeURL
:
String
{
case
ECDISBasic
case
ECDISFunction
case
RADARBasic
case
RADARFunction
case
AIS
case
InmalsatC
case
InternationalVHF
case
VDR
}
}
}
Seilassist/Sailassist/SailassistApp.swift
View file @
13ed1e3f
...
@@ -64,9 +64,9 @@ struct SailassistApp: App {
...
@@ -64,9 +64,9 @@ struct SailassistApp: App {
case
.
success
(
let
resultData
):
case
.
success
(
let
resultData
):
print
(
debug
:
String
(
data
:
resultData
,
encoding
:
.
utf8
))
print
(
debug
:
String
(
data
:
resultData
,
encoding
:
.
utf8
))
let
serverSession
=
ServerSession
()
let
serverSession
=
ServerSession
()
let
resjson
=
serverSession
.
fromJSON
(
resultData
:
resultData
,
resltType
:
[
ResManualUrl
]
.
self
)
let
resjson
=
serverSession
.
fromJSON
(
resultData
:
resultData
,
resltType
:
[
Res
Get
ManualUrl
]
.
self
)
if
let
res
=
resjson
{
if
let
res
=
resjson
{
print
(
debug
:
res
)
SharingData
.
my
.
manualUrls
=
res
}
}
case
.
failure
(
let
errorCode
):
case
.
failure
(
let
errorCode
):
print
(
debug
:
errorCode
)
print
(
debug
:
errorCode
)
...
...
Seilassist/Sailassist/ServerSession/PDFDownloadManager.swift
View file @
13ed1e3f
...
@@ -10,16 +10,15 @@ import Foundation
...
@@ -10,16 +10,15 @@ import Foundation
class
PDFDownloadManager
{
class
PDFDownloadManager
{
static
let
main
=
PDFDownloadManager
()
static
let
main
=
PDFDownloadManager
()
func
downloadFile
(
urlString
:
String
,
fileName
:
String
)
->
URL
?{
///URLからファイルをダウンロードする
guard
let
url
=
URL
(
string
:
urlString
)
else
{
return
nil
}
func
downloadFile
(
urlString
:
String
,
_
savePath
:
URL
)
async
->
Bool
{
guard
let
resDocPath
=
FileManager
.
default
.
urls
(
for
:
.
documentDirectory
,
in
:
.
userDomainMask
)
.
last
else
{
return
nil
}
guard
let
url
=
URL
(
string
:
urlString
)
else
{
return
false
}
var
filePath
:
URL
?
=
resDocPath
.
appendingPathComponent
(
fileName
)
do
{
do
{
let
pdfData
=
try
Data
.
init
(
contentsOf
:
url
)
let
pdfData
=
try
await
URLSession
.
shared
.
data
(
from
:
url
)
.
0
try
pdfData
.
write
(
to
:
filePath
!
,
options
:
.
atomic
)
try
pdfData
.
write
(
to
:
savePath
,
options
:
.
atomic
)
}
catch
{
}
catch
{
filePath
=
nil
return
false
}
}
return
filePath
return
true
}
}
}
}
Seilassist/Sailassist/ServerSession/ServerSession.swift
View file @
13ed1e3f
...
@@ -11,7 +11,7 @@ typealias SessionResponse = Result<Data, APIError>
...
@@ -11,7 +11,7 @@ typealias SessionResponse = Result<Data, APIError>
class
ServerSession
{
class
ServerSession
{
// JSON 文字列に変換
//
/
JSON 文字列に変換
func
toJSON
<
T
>
(
_
reqparam
:
T
)
->
Data
!
where
T
:
Encodable
{
func
toJSON
<
T
>
(
_
reqparam
:
T
)
->
Data
!
where
T
:
Encodable
{
let
Jencoder
=
JSONEncoder
()
let
Jencoder
=
JSONEncoder
()
var
postdata
:
Data
!
var
postdata
:
Data
!
...
@@ -23,7 +23,7 @@ class ServerSession{
...
@@ -23,7 +23,7 @@ class ServerSession{
return
postdata
return
postdata
}
}
// JSON 文字列から変換
//
/
JSON 文字列から変換
func
fromJSON
<
T
>
(
resultData
:
Data
,
resltType
:
T
.
Type
)
->
T
!
where
T
:
Decodable
{
func
fromJSON
<
T
>
(
resultData
:
Data
,
resltType
:
T
.
Type
)
->
T
!
where
T
:
Decodable
{
do
{
do
{
let
decoder
=
JSONDecoder
()
let
decoder
=
JSONDecoder
()
...
@@ -36,8 +36,7 @@ class ServerSession{
...
@@ -36,8 +36,7 @@ class ServerSession{
}
}
}
}
func
postJson
(
_
req_url
:
URL
,
_
postdata
:
Data
,
completion
:
@escaping
((
Result
<
Data
,
APIError
>
))
->
Void
){
func
postJson
(
_
req_url
:
URL
,
_
postdata
:
Data
,
completion
:
@escaping
(
SessionResponse
)
->
Void
){
var
req
=
URLRequest
(
url
:
req_url
)
var
req
=
URLRequest
(
url
:
req_url
)
req
.
httpMethod
=
"POST"
req
.
httpMethod
=
"POST"
req
.
addValue
(
"application/json"
,
forHTTPHeaderField
:
"Content-Type"
)
req
.
addValue
(
"application/json"
,
forHTTPHeaderField
:
"Content-Type"
)
...
@@ -80,7 +79,7 @@ class ServerSession{
...
@@ -80,7 +79,7 @@ class ServerSession{
})
.
resume
()
})
.
resume
()
}
}
func
getJson
(
_
req_url
:
URL
,
completion
:
@escaping
(
(
Result
<
Data
,
APIError
>
)
)
->
Void
){
func
getJson
(
_
req_url
:
URL
,
completion
:
@escaping
(
SessionResponse
)
->
Void
){
var
req
=
URLRequest
(
url
:
req_url
)
var
req
=
URLRequest
(
url
:
req_url
)
req
.
addValue
(
"application/json"
,
forHTTPHeaderField
:
"Content-Type"
)
req
.
addValue
(
"application/json"
,
forHTTPHeaderField
:
"Content-Type"
)
...
@@ -117,7 +116,7 @@ class ServerSession{
...
@@ -117,7 +116,7 @@ class ServerSession{
})
.
resume
()
})
.
resume
()
}
}
func
deleteJson
(
_
req_url
:
URL
,
completion
:
@escaping
(
(
Result
<
Data
,
APIError
>
)
)
->
Void
){
func
deleteJson
(
_
req_url
:
URL
,
completion
:
@escaping
(
SessionResponse
)
->
Void
){
var
req
=
URLRequest
(
url
:
req_url
)
var
req
=
URLRequest
(
url
:
req_url
)
req
.
httpMethod
=
"DELETE"
req
.
httpMethod
=
"DELETE"
...
...
Seilassist/Sailassist/ServerSession/SessionGetManualUrl.swift
View file @
13ed1e3f
...
@@ -7,10 +7,7 @@
...
@@ -7,10 +7,7 @@
import
Foundation
import
Foundation
class
SessionGetManualUrl
{
class
SessionGetManualUrl
:
ServerSession
{
private
let
serverSession
=
ServerSession
()
/**
/**
* マニュアル類のURL取得
* マニュアル類のURL取得
*/
*/
...
@@ -21,6 +18,6 @@ class SessionGetManualUrl{
...
@@ -21,6 +18,6 @@ class SessionGetManualUrl{
guard
let
req_url
=
URL
(
string
:
url_string
)
else
{
guard
let
req_url
=
URL
(
string
:
url_string
)
else
{
return
return
}
}
serverSession
.
getJson
(
req_url
,
completion
:
completion
)
getJson
(
req_url
,
completion
:
completion
)
}
}
}
}
Seilassist/Sailassist/SharingData/SharingData.swift
View file @
13ed1e3f
...
@@ -54,14 +54,7 @@ class SharingData{
...
@@ -54,14 +54,7 @@ class SharingData{
heading
=
0.0
heading
=
0.0
}
}
@Published
var
ECDISBasicUrl
:
URL
?
var
manualUrls
:
[
ResGetManualUrl
]
=
[]
@Published
var
ECDISFunctionUrl
:
URL
?
@Published
var
RADARBasicUrl
:
URL
?
@Published
var
RADARFunctionUrl
:
URL
?
@Published
var
AISUrl
:
URL
?
@Published
var
InmalsatCUrl
:
URL
?
@Published
var
InternationalVHFUrl
:
URL
?
@Published
var
VDRURL
:
URL
?
}
}
static
var
map
=
Map
()
static
var
map
=
Map
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment