Commit e91e482b authored by shigemi miura's avatar shigemi miura

Push通知変更

parent 67f17c9c
......@@ -1218,7 +1218,7 @@
CODE_SIGN_ENTITLEMENTS = Sailassist/Sailassist.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 10;
DEVELOPMENT_ASSET_PATHS = "\"Sailassist/Preview Content\"";
DEVELOPMENT_TEAM = D2DC7QNNJ8;
ENABLE_PREVIEWS = YES;
......@@ -1264,7 +1264,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Sailassist/Sailassist.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 10;
DEVELOPMENT_ASSET_PATHS = "\"Sailassist/Preview Content\"";
DEVELOPMENT_TEAM = D2DC7QNNJ8;
ENABLE_PREVIEWS = YES;
......@@ -1447,7 +1447,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Sailassist/Sailassist.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 10;
DEVELOPMENT_ASSET_PATHS = "\"Sailassist/Preview Content\"";
DEVELOPMENT_TEAM = D2DC7QNNJ8;
ENABLE_PREVIEWS = YES;
......
......@@ -27,9 +27,9 @@ class AlertDB {
static let OnlyOne = AlertDB()
private var alertEca : [SwitchingEca: WarnRecord] = [
SwitchingEca.Finish: WarnRecord(title: NSLocalizedString("Eca Finish", comment: ""), body: NSLocalizedString("Arrived at switching finished point", comment: ""))
, SwitchingEca.Start: WarnRecord(title: NSLocalizedString("Eca Start", comment: ""), body: NSLocalizedString("Arrivaed at switching start point", comment: ""))
, SwitchingEca.Notice: WarnRecord(title: NSLocalizedString("Eca Notice", comment: ""), body: NSLocalizedString("Arrived at advance notice point", comment: ""))
SwitchingEca.Finish: WarnRecord(title: NSLocalizedString("No Fuel Switching Finished", comment: ""), body: NSLocalizedString("Arrived at switching finished point.", comment: ""))
, SwitchingEca.Start: WarnRecord(title: NSLocalizedString("Eca Start", comment: ""), body: NSLocalizedString("Arrivaed at switching start point.", comment: ""))
, SwitchingEca.Notice: WarnRecord(title: NSLocalizedString("Eca Notice", comment: ""), body: NSLocalizedString("Arrived at advance notice point.", comment: ""))
]
//Eca通知
......
......@@ -64,30 +64,39 @@ class EcaTask {
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 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)
// 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)
}
}
}
......@@ -98,7 +107,7 @@ class EcaTask {
}
}
func chengeEcaStatus(eca: RegisteredEca) {
private func chengeEcaStatus(eca: RegisteredEca) {
if let status = SharingData.my.ecaStatus{
var newData = eca
newData.status = status
......
......@@ -40,7 +40,7 @@ struct EcaListView: View {
.cornerRadius(50)
.padding()
}else{
Text("Registerd")
Text("Registered")
.font(FontStyle.SupplementText2.font)
.frame(height: 25)
.foregroundColor(ColorSet.ButtonDisable.color)
......
......@@ -68,6 +68,7 @@ struct MapTaskView: View {
Divider()
.background(ColorSet.LineColor03.color)
ScrollViewReader { proxy in
ScrollView(.vertical){
switch taskViewModel.viewMode {
case .SwitchingMenu:
......@@ -80,6 +81,11 @@ struct MapTaskView: View {
EcaListView(taskViewModel: taskViewModel)
}
}
.onChange(of: taskViewModel.viewMode){ newViewMode in
// proxy.scrollTo("scroll", anchor: .top)
proxy.scrollTo(0, anchor: .top)
}
}
Spacer()
.frame(height: 55)
......@@ -89,12 +95,21 @@ struct MapTaskView: View {
appVersionModel.start()
}
.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{
Button("OK"){
let ecaTask = EcaTask()
ecaTask.chengeEcaStatus(eca: ecaArea)
}
}
// let ecaTask = EcaTask()
// ecaTask.chengeEcaStatus(eca: ecaArea)
// if let status = SharingData.my.ecaStatus {
// if status == .finishPass {
// var newData = ecaArea
// newData.isRunning = false
// newData.status = EcaState.incomplete
// SharingData.eca.editEcaArea(key: ecaArea.name, value: newData, type: EcaOperation.Incomplete)
// }
// }
}
// }
} message: {
if let ecaArea = eca.ecaArea.map({ $0.1 }).filter({ $0.isRunning }).first{
if let status = SharingData.my.ecaStatus {
......
......@@ -148,12 +148,39 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
let userInfo = notification.request.content.userInfo
print(debug: userInfo)
if !userInfo.isEmpty {
guard userInfo["sendType"] is String else {
completionHandler([.badge, .sound, .banner, .list])
guard let arrAPS = userInfo["aps"] as? [String: Any] else {
completionHandler([[.banner, .badge, .sound]])
return
}
let arrCategory = arrAPS["category"] as? String ?? ""
switch arrCategory {
case "chat":
guard let arrAlert = arrAPS["alert"] as? [String: Any] else {
completionHandler([[.banner, .badge, .sound]])
return
}
// let subtitle = arrAlert["subtitle"] as? String ?? "" //送信先名称
// let strTitle = arrAlert["title"] as? String ?? "" //送信内容
// let strBody = arrAlert["body"] as? String ?? "" //船名
let message = GetMessage()
message.start()
case "sailassist":
print(debug: "sailassist")
let getPushHistory = GetPushHistory()
getPushHistory.start()
case "bam":
print(debug: "bam")
let getPushHistory = GetPushHistory()
getPushHistory.start()
case "route":
print(debug: "route")
let getPushHistory = GetPushHistory()
getPushHistory.start()
default:
print(debug: "default")
}
}
completionHandler([[.banner, .badge, .sound]])
}
......@@ -164,12 +191,38 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
withCompletionHandler completionHandler: @escaping () -> Void) {
let userInfo = response.notification.request.content.userInfo
print(debug: userInfo)
if !userInfo.isEmpty {
guard let arrAPS = userInfo["aps"] as? [String: Any] else {
completionHandler()
return
}
if let custom = userInfo["key"] as? String {
print(debug: "called \(custom)")
if custom == "map" {
let arrCategory = arrAPS["category"] as? String ?? ""
switch arrCategory {
case "chat":
guard let arrAlert = arrAPS["alert"] as? [String: Any] else {
completionHandler()
return
}
// let subtitle = arrAlert["subtitle"] as? String ?? "" //送信先名称
// let strTitle = arrAlert["title"] as? String ?? "" //送信内容
// let strBody = arrAlert["body"] as? String ?? "" //船名
let message = GetMessage()
message.start()
case "sailassist":
print(debug: "sailassist")
let getPushHistory = GetPushHistory()
getPushHistory.start()
case "bam":
print(debug: "bam")
let getPushHistory = GetPushHistory()
getPushHistory.start()
case "route":
print(debug: "route")
let getPushHistory = GetPushHistory()
getPushHistory.start()
default:
print(debug: "default")
}
}
completionHandler()
......
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