Commit c3dcabeb authored by shigemi miura's avatar shigemi miura

ECAタスク有効のままアプリをアップデートするとクラッシュする不具合を修正

parent 503948c3
......@@ -1238,7 +1238,7 @@
CODE_SIGN_ENTITLEMENTS = Sailassist/Sailassist.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 20;
CURRENT_PROJECT_VERSION = 22;
DEVELOPMENT_ASSET_PATHS = "\"Sailassist/Preview Content\"";
DEVELOPMENT_TEAM = D2DC7QNNJ8;
ENABLE_PREVIEWS = YES;
......@@ -1262,7 +1262,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.1;
MARKETING_VERSION = 1.0.2;
OTHER_SWIFT_FLAGS = "-D CANARY -D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = com.jrc.sailassist.canary;
PRODUCT_NAME = "Sail Assist";
......@@ -1284,7 +1284,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Sailassist/Sailassist.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 20;
CURRENT_PROJECT_VERSION = 22;
DEVELOPMENT_ASSET_PATHS = "\"Sailassist/Preview Content\"";
DEVELOPMENT_TEAM = D2DC7QNNJ8;
ENABLE_PREVIEWS = YES;
......@@ -1305,7 +1305,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.1;
MARKETING_VERSION = 1.0.2;
OTHER_SWIFT_FLAGS = "-D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = com.jrc.sailassist;
PRODUCT_NAME = "Sail Assist";
......@@ -1468,7 +1468,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Sailassist/Sailassist.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 20;
CURRENT_PROJECT_VERSION = 22;
DEVELOPMENT_ASSET_PATHS = "\"Sailassist/Preview Content\"";
DEVELOPMENT_TEAM = D2DC7QNNJ8;
ENABLE_PREVIEWS = YES;
......@@ -1492,7 +1492,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.1;
MARKETING_VERSION = 1.0.2;
OTHER_SWIFT_FLAGS = "-D QC -D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = com.jrc.sailassist.qc;
PRODUCT_NAME = "Sail Assist";
......
......@@ -57,12 +57,14 @@ class EcaArea {
}
func start() {
print(debug: "called")
tableInit()
sessionEcaArea.RequestEcaArea(responseEcaArea)
}
/**
* ECA領域読み込み
*/
private func responseEcaArea(result: Result<Data, APIError>) {
print(debug: "called")
switch result {
......
......@@ -49,7 +49,6 @@ class EcaTask {
SharingData.location.setLocation()
print(debug: "Location:\(res)")
checkEca()
}
case .failure(let errorCode):
print(debug: errorCode)
......@@ -60,45 +59,47 @@ class EcaTask {
func checkEca() {
let runningEca = eca.ecaArea.first(where: {(key, value) in value.isRunning == true})
if let eca = runningEca?.value {
if let location = SharingData.location.location {
if let distance = LocationCalculation.checkPolyline(objPos: eca.points, shipPos: location){
if SharingData.my.ecaStatus == nil {
SharingData.my.ecaStatus = EcaState.running
}
// if 0.0 >= Float(distance) && SharingData.my.ecaStatus != EcaState.incomplete{
// SharingData.my.ecaStatus = EcaState.incomplete
// var newData = eca
// newData.isRunning = false
// newData.status = EcaState.incomplete
// SharingData.eca.editEcaArea(key: eca.name, value: newData, type: EcaOperation.Incomplete)
// }
if eca.swFinish >= Float(distance) && 0.0 < Float(distance) && SharingData.my.ecaStatus != EcaState.finishPass{
// notificationEca(point: SwitchingEca.Finish)
SharingData.eca.isShowEcaAlert = true
SharingData.my.ecaStatus = EcaState.finishPass
let ecaTask = EcaTask()
ecaTask.chengeEcaStatus(eca: eca)
}
if eca.swStart >= Float(distance) && eca.swFinish < Float(distance) && SharingData.my.ecaStatus != EcaState.startPass{
notificationEca(point: SwitchingEca.Start)
SharingData.eca.isShowEcaAlert = true
SharingData.my.ecaStatus = EcaState.startPass
let ecaTask = EcaTask()
ecaTask.chengeEcaStatus(eca: eca)
}
if eca.swNotice >= Float(distance) && eca.swStart < Float(distance) && SharingData.my.ecaStatus != EcaState.noticePass{
notificationEca(point: SwitchingEca.Notice)
SharingData.eca.isShowEcaAlert = true
SharingData.my.ecaStatus = EcaState.noticePass
let ecaTask = EcaTask()
ecaTask.chengeEcaStatus(eca: eca)
if eca.points.count != 0 {
if let location = SharingData.location.location {
if let distance = LocationCalculation.checkPolyline(objPos: eca.points, shipPos: location){
if SharingData.my.ecaStatus == nil {
SharingData.my.ecaStatus = EcaState.running
}
// if 0.0 >= Float(distance) && SharingData.my.ecaStatus != EcaState.incomplete{
// SharingData.my.ecaStatus = EcaState.incomplete
// var newData = eca
// newData.isRunning = false
// newData.status = EcaState.incomplete
// SharingData.eca.editEcaArea(key: eca.name, value: newData, type: EcaOperation.Incomplete)
// }
if eca.swFinish >= Float(distance) && 0.0 < Float(distance) && SharingData.my.ecaStatus != EcaState.finishPass{
// notificationEca(point: SwitchingEca.Finish)
SharingData.eca.isShowEcaAlert = true
SharingData.my.ecaStatus = EcaState.finishPass
let ecaTask = EcaTask()
ecaTask.chengeEcaStatus(eca: eca)
}
if eca.swStart >= Float(distance) && eca.swFinish < Float(distance) && SharingData.my.ecaStatus != EcaState.startPass{
notificationEca(point: SwitchingEca.Start)
SharingData.eca.isShowEcaAlert = true
SharingData.my.ecaStatus = EcaState.startPass
let ecaTask = EcaTask()
ecaTask.chengeEcaStatus(eca: eca)
}
if eca.swNotice >= Float(distance) && eca.swStart < Float(distance) && SharingData.my.ecaStatus != EcaState.noticePass{
notificationEca(point: SwitchingEca.Notice)
SharingData.eca.isShowEcaAlert = true
SharingData.my.ecaStatus = EcaState.noticePass
let ecaTask = EcaTask()
ecaTask.chengeEcaStatus(eca: eca)
}
}
}
}
......
......@@ -16,6 +16,9 @@ class LocationViewModel: NSObject, ObservableObject, CLLocationManagerDelegate {
let ecaTask = EcaTask()
override init() {
let ecaArea = EcaArea()
ecaArea.start()
locationManager = CLLocationManager()
authorizationStatus = locationManager.authorizationStatus
......
......@@ -207,9 +207,6 @@ struct LoginView: View {
Preferences.lastLoginDate_Int64 = DateTextLib.Date2UnixTime(date: Date())
isLogin = true
let ecaArea = EcaArea()
ecaArea.start()
timer = Timer.scheduledTimer(withTimeInterval: TimerInterval, repeats: true) { _ in
print(debug: "called timer")
let eca = EcaTask()
......
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