Commit e91e482b authored by shigemi miura's avatar shigemi miura

Push通知変更

parent 67f17c9c
...@@ -1218,7 +1218,7 @@ ...@@ -1218,7 +1218,7 @@
CODE_SIGN_ENTITLEMENTS = Sailassist/Sailassist.entitlements; CODE_SIGN_ENTITLEMENTS = Sailassist/Sailassist.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7; CURRENT_PROJECT_VERSION = 10;
DEVELOPMENT_ASSET_PATHS = "\"Sailassist/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"Sailassist/Preview Content\"";
DEVELOPMENT_TEAM = D2DC7QNNJ8; DEVELOPMENT_TEAM = D2DC7QNNJ8;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
...@@ -1264,7 +1264,7 @@ ...@@ -1264,7 +1264,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Sailassist/Sailassist.entitlements; CODE_SIGN_ENTITLEMENTS = Sailassist/Sailassist.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7; CURRENT_PROJECT_VERSION = 10;
DEVELOPMENT_ASSET_PATHS = "\"Sailassist/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"Sailassist/Preview Content\"";
DEVELOPMENT_TEAM = D2DC7QNNJ8; DEVELOPMENT_TEAM = D2DC7QNNJ8;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
...@@ -1447,7 +1447,7 @@ ...@@ -1447,7 +1447,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Sailassist/Sailassist.entitlements; CODE_SIGN_ENTITLEMENTS = Sailassist/Sailassist.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7; CURRENT_PROJECT_VERSION = 10;
DEVELOPMENT_ASSET_PATHS = "\"Sailassist/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"Sailassist/Preview Content\"";
DEVELOPMENT_TEAM = D2DC7QNNJ8; DEVELOPMENT_TEAM = D2DC7QNNJ8;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
......
...@@ -27,9 +27,9 @@ class AlertDB { ...@@ -27,9 +27,9 @@ class AlertDB {
static let OnlyOne = AlertDB() static let OnlyOne = AlertDB()
private var alertEca : [SwitchingEca: WarnRecord] = [ private var alertEca : [SwitchingEca: WarnRecord] = [
SwitchingEca.Finish: WarnRecord(title: NSLocalizedString("Eca Finish", comment: ""), body: NSLocalizedString("Arrived at switching finished 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.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.Notice: WarnRecord(title: NSLocalizedString("Eca Notice", comment: ""), body: NSLocalizedString("Arrived at advance notice point.", comment: ""))
] ]
//Eca通知 //Eca通知
......
...@@ -64,30 +64,39 @@ class EcaTask { ...@@ -64,30 +64,39 @@ class EcaTask {
SharingData.my.ecaStatus = EcaState.running SharingData.my.ecaStatus = EcaState.running
} }
if 0.0 >= Float(distance) && SharingData.my.ecaStatus != EcaState.incomplete{ // if 0.0 >= Float(distance) && SharingData.my.ecaStatus != EcaState.incomplete{
SharingData.my.ecaStatus = EcaState.incomplete // SharingData.my.ecaStatus = EcaState.incomplete
var newData = eca // var newData = eca
newData.isRunning = false // newData.isRunning = false
newData.status = EcaState.incomplete // newData.status = EcaState.incomplete
SharingData.eca.editEcaArea(key: eca.name, value: newData, type: EcaOperation.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{ 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.eca.isShowEcaAlert = true
SharingData.my.ecaStatus = EcaState.finishPass 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{ if eca.swStart >= Float(distance) && eca.swFinish < Float(distance) && SharingData.my.ecaStatus != EcaState.startPass{
notificationEca(point: SwitchingEca.Start) notificationEca(point: SwitchingEca.Start)
SharingData.eca.isShowEcaAlert = true SharingData.eca.isShowEcaAlert = true
SharingData.my.ecaStatus = EcaState.startPass 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{ if eca.swNotice >= Float(distance) && eca.swStart < Float(distance) && SharingData.my.ecaStatus != EcaState.noticePass{
notificationEca(point: SwitchingEca.Notice) notificationEca(point: SwitchingEca.Notice)
SharingData.eca.isShowEcaAlert = true SharingData.eca.isShowEcaAlert = true
SharingData.my.ecaStatus = EcaState.noticePass SharingData.my.ecaStatus = EcaState.noticePass
let ecaTask = EcaTask()
ecaTask.chengeEcaStatus(eca: eca)
} }
} }
} }
...@@ -98,7 +107,7 @@ class EcaTask { ...@@ -98,7 +107,7 @@ class EcaTask {
} }
} }
func chengeEcaStatus(eca: RegisteredEca) { private func chengeEcaStatus(eca: RegisteredEca) {
if let status = SharingData.my.ecaStatus{ if let status = SharingData.my.ecaStatus{
var newData = eca var newData = eca
newData.status = status newData.status = status
......
...@@ -40,7 +40,7 @@ struct EcaListView: View { ...@@ -40,7 +40,7 @@ struct EcaListView: View {
.cornerRadius(50) .cornerRadius(50)
.padding() .padding()
}else{ }else{
Text("Registerd") Text("Registered")
.font(FontStyle.SupplementText2.font) .font(FontStyle.SupplementText2.font)
.frame(height: 25) .frame(height: 25)
.foregroundColor(ColorSet.ButtonDisable.color) .foregroundColor(ColorSet.ButtonDisable.color)
......
...@@ -68,16 +68,22 @@ struct MapTaskView: View { ...@@ -68,16 +68,22 @@ struct MapTaskView: View {
Divider() Divider()
.background(ColorSet.LineColor03.color) .background(ColorSet.LineColor03.color)
ScrollView(.vertical){ ScrollViewReader { proxy in
switch taskViewModel.viewMode { ScrollView(.vertical){
case .SwitchingMenu: switch taskViewModel.viewMode {
if let edittingEcaArea = taskViewModel.edittingEcaArea, taskViewModel.isShowSettingView{ case .SwitchingMenu:
EcaSettingView(isShowSettingEca: $taskViewModel.isShowSettingView, edittingEca: edittingEcaArea) if let edittingEcaArea = taskViewModel.edittingEcaArea, taskViewModel.isShowSettingView{
}else{ EcaSettingView(isShowSettingEca: $taskViewModel.isShowSettingView, edittingEca: edittingEcaArea)
TaskSwitchingMenuView(taskViewModel: taskViewModel) }else{
TaskSwitchingMenuView(taskViewModel: taskViewModel)
}
case .EcaList:
EcaListView(taskViewModel: taskViewModel)
} }
case .EcaList: }
EcaListView(taskViewModel: taskViewModel) .onChange(of: taskViewModel.viewMode){ newViewMode in
// proxy.scrollTo("scroll", anchor: .top)
proxy.scrollTo(0, anchor: .top)
} }
} }
...@@ -89,12 +95,21 @@ struct MapTaskView: View { ...@@ -89,12 +95,21 @@ struct MapTaskView: View {
appVersionModel.start() appVersionModel.start()
} }
.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{
Button("OK"){ Button("OK"){
let ecaTask = EcaTask() // let ecaTask = EcaTask()
ecaTask.chengeEcaStatus(eca: ecaArea) // 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: { } message: {
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 let status = SharingData.my.ecaStatus { if let status = SharingData.my.ecaStatus {
......
...@@ -148,12 +148,39 @@ extension AppDelegate: UNUserNotificationCenterDelegate { ...@@ -148,12 +148,39 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
willPresent notification: UNNotification, willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
let userInfo = notification.request.content.userInfo let userInfo = notification.request.content.userInfo
print(debug: userInfo)
if !userInfo.isEmpty { if !userInfo.isEmpty {
guard userInfo["sendType"] is String else { guard let arrAPS = userInfo["aps"] as? [String: Any] else {
completionHandler([.badge, .sound, .banner, .list]) completionHandler([[.banner, .badge, .sound]])
return 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]]) completionHandler([[.banner, .badge, .sound]])
} }
...@@ -164,12 +191,38 @@ extension AppDelegate: UNUserNotificationCenterDelegate { ...@@ -164,12 +191,38 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
withCompletionHandler completionHandler: @escaping () -> Void) { withCompletionHandler completionHandler: @escaping () -> Void) {
let userInfo = response.notification.request.content.userInfo let userInfo = response.notification.request.content.userInfo
print(debug: 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 { let arrCategory = arrAPS["category"] as? String ?? ""
print(debug: "called \(custom)") switch arrCategory {
case "chat":
if custom == "map" { 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() 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