Commit a31f3a2d authored by shigemi miura's avatar shigemi miura

ECAタスク修正

parent 575810d0
......@@ -1230,7 +1230,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.9.4;
MARKETING_VERSION = 0.9.5;
OTHER_SWIFT_FLAGS = "-D CANARY -D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = com.jrc.sailassist.canary;
PRODUCT_NAME = "Sail Assist";
......@@ -1273,7 +1273,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.9.4;
MARKETING_VERSION = 0.9.5;
OTHER_SWIFT_FLAGS = "-D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = com.jrc.sailassist;
PRODUCT_NAME = "Sail Assist";
......@@ -1459,7 +1459,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.9.4;
MARKETING_VERSION = 0.9.5;
OTHER_SWIFT_FLAGS = "-D QC -D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = com.jrc.sailassist.qc;
PRODUCT_NAME = "Sail Assist";
......
This diff is collapsed.
......@@ -256,6 +256,9 @@ struct LoginView: View {
// let ecaArea = EcaArea()
// ecaArea.start()
let eca = EcaTask()
eca.start()
timer = Timer.scheduledTimer(withTimeInterval: TimerInterval, repeats: true) { _ in
print(debug: "called timer")
let eca = EcaTask()
......
......@@ -32,8 +32,8 @@ struct MapRepresentable: UIViewControllerRepresentable{
if let focusEcaName = ecaData.focusEca, let focusEca = ecaData.ecaArea[focusEcaName]{
mapVC.updateCamera(location: focusEca.centerPosition, zoomlevel: focusEca.zoomLevel)
mapVC.updateOneTimeEca(eca: focusEca.points)
//5秒後削除
DispatchQueue.main.asyncAfter(deadline: .now() + 5.0) {
//10秒後削除
DispatchQueue.main.asyncAfter(deadline: .now() + 10.0) {
do{
mapVC.updateOneTimeEca(eca: nil)
}catch{
......
......@@ -88,31 +88,15 @@ struct MapTaskView: View {
Spacer()
.frame(height: 55)
}
.onAppear{
EcaCoordinatesTable().setEcaData()
}
.alert("", isPresented: $eca.isShowEcaAlert) {
if let ecaArea = eca.ecaArea.map({ $0.1 }).filter({ $0.isRunning }).first{
if SharingData.my.ecaStatus == .finishPass{
Button("Yes"){
var newData = 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)
}
Button("OK"){
let ecaTask = EcaTask()
ecaTask.chengeEcaStatus(eca: ecaArea)
}
}
} message: {
......@@ -124,7 +108,7 @@ struct MapTaskView: View {
case .startPass:
Text("Arrived at switching start point.")
case .finishPass:
Text("Have you finished \(ecaArea.name) fuel switching?")
Text("Have you finished \(ecaArea.name) fuel switching?\nIf you finish, you disable it.")
case .incomplete:
Text("Have you finished \(ecaArea.name) fuel switching?\nIf you finish, you disable it.")
default:
......
......@@ -7,16 +7,18 @@
import SwiftUI
enum EcaAlertType: String {
case ecaDelete
case ecaRunningStop
}
//enum EcaAlertType: String {
// case ecaDelete
// case ecaRunningStop
//}
struct TaskSwitchingMenuView: View {
@ObservedObject var taskViewModel: TaskViewModel
@ObservedObject var ecaData = SharingData.eca
@State var isEcaAlert : Bool = false
@State var ecaAlertType: EcaAlertType = .ecaDelete
// @State var isEcaAlert : Bool = false
// @State var ecaAlertType: EcaAlertType = .ecaDelete
@State var isDeleteAlert: Bool = false
@State var isRunningStopAlert: Bool = false
let deleteEcaArea = DeleteEcaArea()
var body: some View {
......@@ -29,10 +31,9 @@ struct TaskSwitchingMenuView: View {
for runningEca in ecaData.ecaArea.map({ $0.1 }).filter({ $0.isRunning }){
taskViewModel.edittingEcaArea = runningEca
taskViewModel.ecaName = runningEca.name
isEcaAlert = true
ecaAlertType = .ecaRunningStop
isRunningStopAlert = true
}
if isEcaAlert == false {
if isRunningStopAlert == false {
var newData = eca
newData.isRunning = true
newData.status = EcaState.running
......@@ -54,9 +55,9 @@ struct TaskSwitchingMenuView: View {
.onTapGesture {
ecaData.focusEca = eca.name
}
Spacer()
Menu {
Text(eca.name)
......@@ -67,12 +68,11 @@ struct TaskSwitchingMenuView: View {
} label: {
Text("Edit Notice Setting")
}
Button{
taskViewModel.edittingEcaArea = eca
taskViewModel.ecaName = eca.name
isEcaAlert = true
ecaAlertType = .ecaDelete
isDeleteAlert = true
} label: {
Text("Delete ECA Task")
}
......@@ -82,37 +82,44 @@ struct TaskSwitchingMenuView: View {
.foregroundColor(eca.isRunning ? ColorSet.Splash.color : ColorSet.Slidebar.color)
}
.disabled(eca.isRunning)
.alert(isPresented: $isEcaAlert) {
switch ecaAlertType {
case .ecaDelete:
return Alert(title: Text("Delete"),
message: Text("Do you delete " + taskViewModel.ecaName + "?"),
primaryButton: .default(Text("No")),
secondaryButton: .cancel(Text("Yes"), action: {
if let ecaArea = taskViewModel.edittingEcaArea {
var newData = ecaArea
newData.isEnable = false
newData.status = EcaState.cancel
.alert("Delete", isPresented: $isDeleteAlert) {
Button("Yes") {
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)
deleteEcaArea.start(ecaId: ecaArea.id)
}
taskViewModel.edittingEcaArea = nil
}))
case .ecaRunningStop:
return Alert(title: Text("Stop"),
message: Text("Do you want to stop " + taskViewModel.ecaName + "?"),
primaryButton: .default(Text("Cancel")),
secondaryButton: .cancel(Text("Stop"), action: {
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
}))
ecaData.editEcaArea(key: ecaArea.name, value: newData, type: EcaOperation.Delete)
deleteEcaArea.start(ecaId: ecaArea.id)
}
taskViewModel.edittingEcaArea = nil
}
Button("No"){}
} message: {
Text("Do you delete " + taskViewModel.ecaName + "?")
}
.alert("Fuel Switching", isPresented:$isRunningStopAlert) {
Button("Yes") {
if let ecaArea = taskViewModel.edittingEcaArea {
var newData = ecaArea
newData.isRunning = false
newData.status = EcaState.end
ecaData.editEcaArea(key: ecaArea.name, value: newData, type: EcaOperation.End)
}
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)
......
......@@ -14,6 +14,7 @@ enum EcaOperation {
case Notice
case Start
case Finish
case End
case Incomplete
case Change
case Cancel
......@@ -186,6 +187,16 @@ class SharingData{
task.status = setEcaStatus(eca: value)
}
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:
task.areaId = value.id
task.taskName = value.name
......
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