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
54
Merge Requests
54
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
gr-ssv
Sailassist
Commits
a31f3a2d
Commit
a31f3a2d
authored
Dec 25, 2023
by
shigemi miura
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ECAタスク修正
parent
575810d0
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
202 additions
and
131 deletions
+202
-131
project.pbxproj
Seilassist/Sailassist.xcodeproj/project.pbxproj
+3
-3
EcaTask.swift
Seilassist/Sailassist/ECA/EcaTask.swift
+129
-63
LoginView.swift
Seilassist/Sailassist/Login/LoginView.swift
+3
-0
MapRepresentable.swift
Seilassist/Sailassist/Map/MapRepresentable.swift
+2
-2
MapTaskView.swift
Seilassist/Sailassist/Map/Task/View/MapTaskView.swift
+4
-20
TaskSwitchingMenuView.swift
...sist/Sailassist/Map/Task/View/TaskSwitchingMenuView.swift
+50
-43
SharingData.swift
Seilassist/Sailassist/SharingData/SharingData.swift
+11
-0
No files found.
Seilassist/Sailassist.xcodeproj/project.pbxproj
View file @
a31f3a2d
...
@@ -1230,7 +1230,7 @@
...
@@ -1230,7 +1230,7 @@
"$(inherited)"
,
"$(inherited)"
,
"@executable_path/Frameworks"
,
"@executable_path/Frameworks"
,
);
);
MARKETING_VERSION
=
0.9.
4
;
MARKETING_VERSION
=
0.9.
5
;
OTHER_SWIFT_FLAGS
=
"-D CANARY -D COCOAPODS"
;
OTHER_SWIFT_FLAGS
=
"-D CANARY -D COCOAPODS"
;
PRODUCT_BUNDLE_IDENTIFIER
=
com.jrc.sailassist.canary
;
PRODUCT_BUNDLE_IDENTIFIER
=
com.jrc.sailassist.canary
;
PRODUCT_NAME
=
"Sail Assist"
;
PRODUCT_NAME
=
"Sail Assist"
;
...
@@ -1273,7 +1273,7 @@
...
@@ -1273,7 +1273,7 @@
"$(inherited)"
,
"$(inherited)"
,
"@executable_path/Frameworks"
,
"@executable_path/Frameworks"
,
);
);
MARKETING_VERSION
=
0.9.
4
;
MARKETING_VERSION
=
0.9.
5
;
OTHER_SWIFT_FLAGS
=
"-D COCOAPODS"
;
OTHER_SWIFT_FLAGS
=
"-D COCOAPODS"
;
PRODUCT_BUNDLE_IDENTIFIER
=
com.jrc.sailassist
;
PRODUCT_BUNDLE_IDENTIFIER
=
com.jrc.sailassist
;
PRODUCT_NAME
=
"Sail Assist"
;
PRODUCT_NAME
=
"Sail Assist"
;
...
@@ -1459,7 +1459,7 @@
...
@@ -1459,7 +1459,7 @@
"$(inherited)"
,
"$(inherited)"
,
"@executable_path/Frameworks"
,
"@executable_path/Frameworks"
,
);
);
MARKETING_VERSION
=
0.9.
4
;
MARKETING_VERSION
=
0.9.
5
;
OTHER_SWIFT_FLAGS
=
"-D QC -D COCOAPODS"
;
OTHER_SWIFT_FLAGS
=
"-D QC -D COCOAPODS"
;
PRODUCT_BUNDLE_IDENTIFIER
=
com.jrc.sailassist.qc
;
PRODUCT_BUNDLE_IDENTIFIER
=
com.jrc.sailassist.qc
;
PRODUCT_NAME
=
"Sail Assist"
;
PRODUCT_NAME
=
"Sail Assist"
;
...
...
Seilassist/Sailassist/ECA/EcaTask.swift
View file @
a31f3a2d
...
@@ -46,7 +46,7 @@ class EcaTask {
...
@@ -46,7 +46,7 @@ class EcaTask {
SharingData
.
location
.
dataTime
=
res
.
dataTime
//2023-11-02T05:25:49.4362123Z
SharingData
.
location
.
dataTime
=
res
.
dataTime
//2023-11-02T05:25:49.4362123Z
SharingData
.
location
.
setLocation
()
SharingData
.
location
.
setLocation
()
print
(
debug
:
"Location:
\(
res
)
"
)
checkEca
()
checkEca
()
}
}
case
.
failure
(
let
errorCode
):
case
.
failure
(
let
errorCode
):
...
@@ -57,36 +57,37 @@ class EcaTask {
...
@@ -57,36 +57,37 @@ class EcaTask {
func
checkEca
()
{
func
checkEca
()
{
let
runningEca
=
eca
.
ecaArea
.
first
(
where
:
{(
key
,
value
)
in
value
.
isRunning
==
true
})
let
runningEca
=
eca
.
ecaArea
.
first
(
where
:
{(
key
,
value
)
in
value
.
isRunning
==
true
})
if
var
eca
=
runningEca
?
.
value
{
if
let
eca
=
runningEca
?
.
value
{
if
let
location
=
SharingData
.
location
.
location
{
if
let
location
=
SharingData
.
location
.
location
{
if
let
distance
=
LocationCalculation
.
checkPolyline
(
objPos
:
eca
.
points
,
shipPos
:
location
)
{
if
let
distance
=
LocationCalculation
.
checkPolyline
(
objPos
:
eca
.
points
,
shipPos
:
location
){
//起動時に状態を設定
if
SharingData
.
my
.
ecaStatus
==
nil
{
if
SharingData
.
my
.
ecaStatus
==
nil
{
eca
=
runningEcaStatus
(
eca
:
eca
,
distance
:
distance
)
SharingData
.
my
.
ecaStatus
=
EcaState
.
running
}
}
if
eca
.
swNotice
>=
Float
(
distance
)
&&
eca
.
status
==
EcaState
.
running
{
if
0.0
>=
Float
(
distance
)
&&
SharingData
.
my
.
ecaStatus
!=
EcaState
.
incomplete
{
notificationEca
(
point
:
SwitchingEca
.
Notice
)
SharingData
.
my
.
ecaStatus
=
EcaState
.
incomplete
SharingData
.
eca
.
isShowEcaAlert
=
true
var
newData
=
eca
SharingData
.
my
.
ecaStatus
=
EcaState
.
noticePass
newData
.
isRunning
=
false
newData
.
status
=
EcaState
.
incomplete
SharingData
.
eca
.
editEcaArea
(
key
:
eca
.
name
,
value
:
newData
,
type
:
EcaOperation
.
Incomplete
)
}
}
if
eca
.
sw
Start
>=
Float
(
distance
)
&&
eca
.
status
==
EcaState
.
noticePass
{
if
eca
.
sw
Finish
>=
Float
(
distance
)
&&
0.0
<
Float
(
distance
)
&&
SharingData
.
my
.
ecaStatus
!=
EcaState
.
finishPass
{
notificationEca
(
point
:
SwitchingEca
.
Start
)
notificationEca
(
point
:
SwitchingEca
.
Finish
)
SharingData
.
eca
.
isShowEcaAlert
=
true
SharingData
.
eca
.
isShowEcaAlert
=
true
SharingData
.
my
.
ecaStatus
=
EcaState
.
start
Pass
SharingData
.
my
.
ecaStatus
=
EcaState
.
finish
Pass
}
}
if
eca
.
sw
Finish
>=
Float
(
distance
)
&&
0.0
<
Float
(
distance
)
&&
eca
.
status
==
EcaState
.
startPass
{
if
eca
.
sw
Start
>=
Float
(
distance
)
&&
eca
.
swFinish
<
Float
(
distance
)
&&
SharingData
.
my
.
ecaStatus
!=
EcaState
.
startPass
{
notificationEca
(
point
:
SwitchingEca
.
Finish
)
notificationEca
(
point
:
SwitchingEca
.
Start
)
SharingData
.
eca
.
isShowEcaAlert
=
true
SharingData
.
eca
.
isShowEcaAlert
=
true
SharingData
.
my
.
ecaStatus
=
EcaState
.
finish
Pass
SharingData
.
my
.
ecaStatus
=
EcaState
.
start
Pass
}
}
if
0.0
>=
Float
(
distance
)
&&
eca
.
status
==
EcaState
.
finishPass
{
if
eca
.
swNotice
>=
Float
(
distance
)
&&
eca
.
swStart
<
Float
(
distance
)
&&
SharingData
.
my
.
ecaStatus
!=
EcaState
.
noticePass
{
notificationEca
(
point
:
SwitchingEca
.
Notice
)
SharingData
.
eca
.
isShowEcaAlert
=
true
SharingData
.
eca
.
isShowEcaAlert
=
true
SharingData
.
my
.
ecaStatus
=
EcaState
.
incomplete
SharingData
.
my
.
ecaStatus
=
EcaState
.
noticePass
}
}
}
}
}
}
...
@@ -97,54 +98,119 @@ class EcaTask {
...
@@ -97,54 +98,119 @@ class EcaTask {
}
}
}
}
func
runningEcaStatus
(
eca
:
RegisteredEca
,
distance
:
Double
)
->
RegisteredEca
{
var
result
=
false
var
newData
=
eca
if
0.0
>=
Float
(
distance
){
newData
.
status
=
EcaState
.
finishPass
result
=
true
}
if
eca
.
swFinish
>=
Float
(
distance
)
&&
result
==
false
{
newData
.
status
=
EcaState
.
startPass
result
=
true
}
if
eca
.
swStart
>=
Float
(
distance
)
&&
result
==
false
{
newData
.
status
=
EcaState
.
noticePass
result
=
true
}
if
eca
.
swNotice
>=
Float
(
distance
)
&&
result
==
false
{
newData
.
status
=
EcaState
.
running
}
return
newData
}
func
chengeEcaStatus
(
eca
:
RegisteredEca
)
{
func
chengeEcaStatus
(
eca
:
RegisteredEca
)
{
if
eca
.
status
==
EcaState
.
running
{
if
let
status
=
SharingData
.
my
.
ecaStatus
{
var
newData
=
eca
var
newData
=
eca
newData
.
status
=
EcaState
.
noticePass
newData
.
status
=
status
SharingData
.
eca
.
editEcaArea
(
key
:
eca
.
name
,
value
:
newData
,
type
:
EcaOperation
.
Notice
)
}
if
eca
.
status
==
EcaState
.
noticePass
{
var
newData
=
eca
newData
.
status
=
EcaState
.
startPass
SharingData
.
eca
.
editEcaArea
(
key
:
eca
.
name
,
value
:
newData
,
type
:
EcaOperation
.
Start
)
}
if
eca
.
status
==
EcaState
.
startPass
{
var
newData
=
eca
newData
.
status
=
EcaState
.
finishPass
SharingData
.
eca
.
editEcaArea
(
key
:
eca
.
name
,
value
:
newData
,
type
:
EcaOperation
.
Finish
)
}
if
eca
.
status
==
EcaState
.
finishPass
{
if
status
==
EcaState
.
noticePass
{
//ECA通知円到達
var
newData
=
eca
SharingData
.
eca
.
editEcaArea
(
key
:
eca
.
name
,
value
:
newData
,
type
:
EcaOperation
.
Notice
)
newData
.
status
=
EcaState
.
incomplete
}
SharingData
.
eca
.
editEcaArea
(
key
:
eca
.
name
,
value
:
newData
,
type
:
EcaOperation
.
Incomplete
)
if
status
==
EcaState
.
startPass
{
//ECA開始円到達
SharingData
.
eca
.
editEcaArea
(
key
:
eca
.
name
,
value
:
newData
,
type
:
EcaOperation
.
Start
)
}
if
status
==
EcaState
.
finishPass
{
//ECAタスク終了円到達
SharingData
.
eca
.
editEcaArea
(
key
:
eca
.
name
,
value
:
newData
,
type
:
EcaOperation
.
Finish
)
}
if
status
==
EcaState
.
end
{
//ECAタスク完了(燃料切替実施済み)
SharingData
.
eca
.
editEcaArea
(
key
:
eca
.
name
,
value
:
newData
,
type
:
EcaOperation
.
End
)
}
}
}
}
}
// func checkEca() {
// let runningEca = eca.ecaArea.first(where: {(key, value) in value.isRunning == true})
// if var eca = runningEca?.value {
// if let location = SharingData.location.location {
// if let distance = LocationCalculation.checkPolyline(objPos: eca.points, shipPos: location) {
//
// //ECA実行時に状態を取得
// if SharingData.my.ecaStatus == nil {
// eca = runningEcaStatus(eca: eca, distance: distance)
// }
//
// if eca.swNotice >= Float(distance) && eca.status == EcaState.running {
// notificationEca(point: SwitchingEca.Notice)
// SharingData.eca.isShowEcaAlert = true
// SharingData.my.ecaStatus = EcaState.noticePass
// }
//
// if eca.swStart >= Float(distance) && eca.status == EcaState.noticePass {
// notificationEca(point: SwitchingEca.Start)
// SharingData.eca.isShowEcaAlert = true
// SharingData.my.ecaStatus = EcaState.startPass
// }
//
// if eca.swFinish >= Float(distance) && 0.0 < Float(distance) && eca.status == EcaState.startPass {
// notificationEca(point: SwitchingEca.Finish)
// SharingData.eca.isShowEcaAlert = true
// SharingData.my.ecaStatus = EcaState.finishPass
// }
//
// if 0.0 >= Float(distance) && eca.status == EcaState.incomplete {
// SharingData.eca.isShowEcaAlert = true
// SharingData.my.ecaStatus = EcaState.incomplete
// }
// }
// }
// } else {
// if SharingData.my.ecaStatus != nil {
// SharingData.my.ecaStatus = nil
// }
// }
// }
// func runningEcaStatus(eca: RegisteredEca, distance: Double) -> RegisteredEca {
// var result = false
// var newData = eca
//
// newData.status = EcaState.running
//
// if 0.0 >= Float(distance){
// newData.status = EcaState.incomplete
// result = true
// }
//
// if eca.swFinish >= Float(distance) && result == false{
// newData.status = EcaState.startPass
// result = true
// }
//
// if eca.swStart >= Float(distance) && result == false{
// newData.status = EcaState.noticePass
// result = true
// }
//
// if eca.swNotice >= Float(distance) && result == false{
// newData.status = EcaState.running
// }
//
// return newData
// }
// func chengeEcaStatus(eca: RegisteredEca) {
// if eca.status == EcaState.running {
// var newData = eca
// newData.status = EcaState.noticePass
// SharingData.eca.editEcaArea(key: eca.name, value: newData, type: EcaOperation.Notice)
// }
//
// if eca.status == EcaState.noticePass {
// var newData = eca
// newData.status = EcaState.startPass
// SharingData.eca.editEcaArea(key: eca.name, value: newData, type: EcaOperation.Start)
// }
//
// if eca.status == EcaState.startPass {
// var newData = eca
// newData.status = EcaState.finishPass
// SharingData.eca.editEcaArea(key: eca.name, value: newData, type: EcaOperation.Finish)
// }
//
// if eca.status == EcaState.finishPass {
// var newData = eca
// newData.status = EcaState.incomplete
// SharingData.eca.editEcaArea(key: eca.name, value: newData, type: EcaOperation.Incomplete)
// }
// }
}
}
Seilassist/Sailassist/Login/LoginView.swift
View file @
a31f3a2d
...
@@ -256,6 +256,9 @@ struct LoginView: View {
...
@@ -256,6 +256,9 @@ struct LoginView: View {
// let ecaArea = EcaArea()
// let ecaArea = EcaArea()
// ecaArea.start()
// ecaArea.start()
let
eca
=
EcaTask
()
eca
.
start
()
timer
=
Timer
.
scheduledTimer
(
withTimeInterval
:
TimerInterval
,
repeats
:
true
)
{
_
in
timer
=
Timer
.
scheduledTimer
(
withTimeInterval
:
TimerInterval
,
repeats
:
true
)
{
_
in
print
(
debug
:
"called timer"
)
print
(
debug
:
"called timer"
)
let
eca
=
EcaTask
()
let
eca
=
EcaTask
()
...
...
Seilassist/Sailassist/Map/MapRepresentable.swift
View file @
a31f3a2d
...
@@ -32,8 +32,8 @@ struct MapRepresentable: UIViewControllerRepresentable{
...
@@ -32,8 +32,8 @@ struct MapRepresentable: UIViewControllerRepresentable{
if
let
focusEcaName
=
ecaData
.
focusEca
,
let
focusEca
=
ecaData
.
ecaArea
[
focusEcaName
]{
if
let
focusEcaName
=
ecaData
.
focusEca
,
let
focusEca
=
ecaData
.
ecaArea
[
focusEcaName
]{
mapVC
.
updateCamera
(
location
:
focusEca
.
centerPosition
,
zoomlevel
:
focusEca
.
zoomLevel
)
mapVC
.
updateCamera
(
location
:
focusEca
.
centerPosition
,
zoomlevel
:
focusEca
.
zoomLevel
)
mapVC
.
updateOneTimeEca
(
eca
:
focusEca
.
points
)
mapVC
.
updateOneTimeEca
(
eca
:
focusEca
.
points
)
//
5
秒後削除
//
10
秒後削除
DispatchQueue
.
main
.
asyncAfter
(
deadline
:
.
now
()
+
5
.0
)
{
DispatchQueue
.
main
.
asyncAfter
(
deadline
:
.
now
()
+
10
.0
)
{
do
{
do
{
mapVC
.
updateOneTimeEca
(
eca
:
nil
)
mapVC
.
updateOneTimeEca
(
eca
:
nil
)
}
catch
{
}
catch
{
...
...
Seilassist/Sailassist/Map/Task/View/MapTaskView.swift
View file @
a31f3a2d
...
@@ -88,31 +88,15 @@ struct MapTaskView: View {
...
@@ -88,31 +88,15 @@ struct MapTaskView: View {
Spacer
()
Spacer
()
.
frame
(
height
:
55
)
.
frame
(
height
:
55
)
}
}
.
onAppear
{
.
onAppear
{
EcaCoordinatesTable
()
.
setEcaData
()
EcaCoordinatesTable
()
.
setEcaData
()
}
}
.
alert
(
""
,
isPresented
:
$
eca
.
isShowEcaAlert
)
{
.
alert
(
""
,
isPresented
:
$
eca
.
isShowEcaAlert
)
{
if
let
ecaArea
=
eca
.
ecaArea
.
map
({
$0
.
1
})
.
filter
({
$0
.
isRunning
})
.
first
{
if
let
ecaArea
=
eca
.
ecaArea
.
map
({
$0
.
1
})
.
filter
({
$0
.
isRunning
})
.
first
{
if
SharingData
.
my
.
ecaStatus
==
.
finishPass
{
Button
(
"OK"
){
Button
(
"Yes"
){
let
ecaTask
=
EcaTask
()
var
newData
=
ecaArea
ecaTask
.
chengeEcaStatus
(
eca
:
ecaArea
)
newData
.
isRunning
=
false
newData
.
status
=
EcaState
.
end
SharingData
.
eca
.
editEcaArea
(
key
:
ecaArea
.
name
,
value
:
newData
,
type
:
EcaOperation
.
Finish
)
}
Button
(
"No"
){
var
newData
=
ecaArea
newData
.
isRunning
=
false
newData
.
status
=
EcaState
.
incomplete
SharingData
.
eca
.
editEcaArea
(
key
:
ecaArea
.
name
,
value
:
newData
,
type
:
EcaOperation
.
Incomplete
)
}
}
else
{
Button
(
"OK"
){
let
ecaTask
=
EcaTask
()
ecaTask
.
chengeEcaStatus
(
eca
:
ecaArea
)
}
}
}
}
}
}
message
:
{
}
message
:
{
...
@@ -124,7 +108,7 @@ struct MapTaskView: View {
...
@@ -124,7 +108,7 @@ struct MapTaskView: View {
case
.
startPass
:
case
.
startPass
:
Text
(
"Arrived at switching start point."
)
Text
(
"Arrived at switching start point."
)
case
.
finishPass
:
case
.
finishPass
:
Text
(
"Have you finished
\(
ecaArea
.
name
)
fuel switching?"
)
Text
(
"Have you finished
\(
ecaArea
.
name
)
fuel switching?
\n
If you finish, you disable it.
"
)
case
.
incomplete
:
case
.
incomplete
:
Text
(
"Have you finished
\(
ecaArea
.
name
)
fuel switching?
\n
If you finish, you disable it."
)
Text
(
"Have you finished
\(
ecaArea
.
name
)
fuel switching?
\n
If you finish, you disable it."
)
default
:
default
:
...
...
Seilassist/Sailassist/Map/Task/View/TaskSwitchingMenuView.swift
View file @
a31f3a2d
...
@@ -7,16 +7,18 @@
...
@@ -7,16 +7,18 @@
import
SwiftUI
import
SwiftUI
enum
EcaAlertType
:
String
{
//
enum EcaAlertType: String {
case
ecaDelete
//
case ecaDelete
case
ecaRunningStop
//
case ecaRunningStop
}
//
}
struct
TaskSwitchingMenuView
:
View
{
struct
TaskSwitchingMenuView
:
View
{
@ObservedObject
var
taskViewModel
:
TaskViewModel
@ObservedObject
var
taskViewModel
:
TaskViewModel
@ObservedObject
var
ecaData
=
SharingData
.
eca
@ObservedObject
var
ecaData
=
SharingData
.
eca
@State
var
isEcaAlert
:
Bool
=
false
// @State var isEcaAlert : Bool = false
@State
var
ecaAlertType
:
EcaAlertType
=
.
ecaDelete
// @State var ecaAlertType: EcaAlertType = .ecaDelete
@State
var
isDeleteAlert
:
Bool
=
false
@State
var
isRunningStopAlert
:
Bool
=
false
let
deleteEcaArea
=
DeleteEcaArea
()
let
deleteEcaArea
=
DeleteEcaArea
()
var
body
:
some
View
{
var
body
:
some
View
{
...
@@ -29,10 +31,9 @@ struct TaskSwitchingMenuView: View {
...
@@ -29,10 +31,9 @@ struct TaskSwitchingMenuView: View {
for
runningEca
in
ecaData
.
ecaArea
.
map
({
$0
.
1
})
.
filter
({
$0
.
isRunning
}){
for
runningEca
in
ecaData
.
ecaArea
.
map
({
$0
.
1
})
.
filter
({
$0
.
isRunning
}){
taskViewModel
.
edittingEcaArea
=
runningEca
taskViewModel
.
edittingEcaArea
=
runningEca
taskViewModel
.
ecaName
=
runningEca
.
name
taskViewModel
.
ecaName
=
runningEca
.
name
isEcaAlert
=
true
isRunningStopAlert
=
true
ecaAlertType
=
.
ecaRunningStop
}
}
if
is
Eca
Alert
==
false
{
if
is
RunningStop
Alert
==
false
{
var
newData
=
eca
var
newData
=
eca
newData
.
isRunning
=
true
newData
.
isRunning
=
true
newData
.
status
=
EcaState
.
running
newData
.
status
=
EcaState
.
running
...
@@ -54,9 +55,9 @@ struct TaskSwitchingMenuView: View {
...
@@ -54,9 +55,9 @@ struct TaskSwitchingMenuView: View {
.
onTapGesture
{
.
onTapGesture
{
ecaData
.
focusEca
=
eca
.
name
ecaData
.
focusEca
=
eca
.
name
}
}
Spacer
()
Spacer
()
Menu
{
Menu
{
Text
(
eca
.
name
)
Text
(
eca
.
name
)
...
@@ -67,12 +68,11 @@ struct TaskSwitchingMenuView: View {
...
@@ -67,12 +68,11 @@ struct TaskSwitchingMenuView: View {
}
label
:
{
}
label
:
{
Text
(
"Edit Notice Setting"
)
Text
(
"Edit Notice Setting"
)
}
}
Button
{
Button
{
taskViewModel
.
edittingEcaArea
=
eca
taskViewModel
.
edittingEcaArea
=
eca
taskViewModel
.
ecaName
=
eca
.
name
taskViewModel
.
ecaName
=
eca
.
name
isEcaAlert
=
true
isDeleteAlert
=
true
ecaAlertType
=
.
ecaDelete
}
label
:
{
}
label
:
{
Text
(
"Delete ECA Task"
)
Text
(
"Delete ECA Task"
)
}
}
...
@@ -82,37 +82,44 @@ struct TaskSwitchingMenuView: View {
...
@@ -82,37 +82,44 @@ struct TaskSwitchingMenuView: View {
.
foregroundColor
(
eca
.
isRunning
?
ColorSet
.
Splash
.
color
:
ColorSet
.
Slidebar
.
color
)
.
foregroundColor
(
eca
.
isRunning
?
ColorSet
.
Splash
.
color
:
ColorSet
.
Slidebar
.
color
)
}
}
.
disabled
(
eca
.
isRunning
)
.
disabled
(
eca
.
isRunning
)
.
alert
(
isPresented
:
$
isEcaAlert
)
{
.
alert
(
"Delete"
,
isPresented
:
$
isDeleteAlert
)
{
switch
ecaAlertType
{
Button
(
"Yes"
)
{
case
.
ecaDelete
:
if
let
ecaArea
=
taskViewModel
.
edittingEcaArea
{
return
Alert
(
title
:
Text
(
"Delete"
),
var
newData
=
ecaArea
message
:
Text
(
"Do you delete "
+
taskViewModel
.
ecaName
+
"?"
),
newData
.
isEnable
=
false
primaryButton
:
.
default
(
Text
(
"No"
)),
newData
.
status
=
EcaState
.
cancel
secondaryButton
:
.
cancel
(
Text
(
"Yes"
),
action
:
{
if
let
ecaArea
=
taskViewModel
.
edittingEcaArea
{
var
newData
=
ecaArea
newData
.
isEnable
=
false
newData
.
status
=
EcaState
.
cancel
ecaData
.
editEcaArea
(
key
:
ecaArea
.
name
,
value
:
newData
,
type
:
EcaOperation
.
Delete
)
ecaData
.
editEcaArea
(
key
:
ecaArea
.
name
,
value
:
newData
,
type
:
EcaOperation
.
Delete
)
deleteEcaArea
.
start
(
ecaId
:
ecaArea
.
id
)
deleteEcaArea
.
start
(
ecaId
:
ecaArea
.
id
)
}
}
taskViewModel
.
edittingEcaArea
=
nil
taskViewModel
.
edittingEcaArea
=
nil
}))
}
case
.
ecaRunningStop
:
Button
(
"No"
){}
return
Alert
(
title
:
Text
(
"Stop"
),
}
message
:
{
message
:
Text
(
"Do you want to stop "
+
taskViewModel
.
ecaName
+
"?"
),
Text
(
"Do you delete "
+
taskViewModel
.
ecaName
+
"?"
)
primaryButton
:
.
default
(
Text
(
"Cancel"
)),
}
secondaryButton
:
.
cancel
(
Text
(
"Stop"
),
action
:
{
.
alert
(
"Fuel Switching"
,
isPresented
:
$
isRunningStopAlert
)
{
if
let
ecaArea
=
taskViewModel
.
edittingEcaArea
{
Button
(
"Yes"
)
{
var
newData
=
ecaArea
if
let
ecaArea
=
taskViewModel
.
edittingEcaArea
{
newData
.
isRunning
=
false
var
newData
=
ecaArea
newData
.
status
=
EcaState
.
cancel
newData
.
isRunning
=
false
ecaData
.
editEcaArea
(
key
:
ecaArea
.
name
,
value
:
newData
,
type
:
EcaOperation
.
Cancel
)
newData
.
status
=
EcaState
.
end
}
ecaData
.
editEcaArea
(
key
:
ecaArea
.
name
,
value
:
newData
,
type
:
EcaOperation
.
End
)
taskViewModel
.
edittingEcaArea
=
nil
}
}))
taskViewModel
.
edittingEcaArea
=
nil
}
}
Button
(
"No"
){}
// Button("Cancel"){¥
// if let ecaArea = taskViewModel.edittingEcaArea {
// var newData = ecaArea
// newData.isRunning = false
// newData.status = EcaState.cancel
// ecaData.editEcaArea(key: ecaArea.name, value: newData, type: EcaOperation.Cancel)
// }
// taskViewModel.edittingEcaArea = nil
// }
}
message
:
{
Text
(
"Do you delete "
+
taskViewModel
.
ecaName
+
"?"
)
}
}
}
}
.
frame
(
height
:
60
)
.
frame
(
height
:
60
)
...
...
Seilassist/Sailassist/SharingData/SharingData.swift
View file @
a31f3a2d
...
@@ -14,6 +14,7 @@ enum EcaOperation {
...
@@ -14,6 +14,7 @@ enum EcaOperation {
case
Notice
case
Notice
case
Start
case
Start
case
Finish
case
Finish
case
End
case
Incomplete
case
Incomplete
case
Change
case
Change
case
Cancel
case
Cancel
...
@@ -186,6 +187,16 @@ class SharingData{
...
@@ -186,6 +187,16 @@ class SharingData{
task
.
status
=
setEcaStatus
(
eca
:
value
)
task
.
status
=
setEcaStatus
(
eca
:
value
)
}
}
setEcaArea
.
start
(
eca
:
task
)
setEcaArea
.
start
(
eca
:
task
)
case
EcaOperation
.
End
:
task
.
areaId
=
value
.
id
task
.
taskName
=
value
.
name
task
.
noticeRange
=
value
.
swNotice
task
.
startRange
=
value
.
swStart
task
.
finishRange
=
value
.
swFinish
if
value
.
isEnable
{
task
.
status
=
setEcaStatus
(
eca
:
value
)
}
setEcaArea
.
start
(
eca
:
task
)
case
EcaOperation
.
Incomplete
:
case
EcaOperation
.
Incomplete
:
task
.
areaId
=
value
.
id
task
.
areaId
=
value
.
id
task
.
taskName
=
value
.
name
task
.
taskName
=
value
.
name
...
...
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