Commit b1777788 authored by shigemi miura's avatar shigemi miura

Ver1.0.1

・自船アイコンの状態表記 ・System Information
parent e053d1a2
{ {
"images" : [ "images" : [
{ {
"filename" : "icon_ship_alarm.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "1x" "scale" : "1x"
}, },
...@@ -9,7 +10,6 @@ ...@@ -9,7 +10,6 @@
"scale" : "2x" "scale" : "2x"
}, },
{ {
"filename" : "swStartBack@2x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "3x" "scale" : "3x"
} }
......
{
"images" : [
{
"filename" : "icon_ship_caution.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "icon_ship_emergency.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "icon_ship_necstemergency.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "icon_ship_normal.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "icon_ship_offline.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "icon_ship_unknown.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "icon_ship_warning.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
...@@ -188,9 +188,9 @@ extension ColorSet{ ...@@ -188,9 +188,9 @@ extension ColorSet{
case .ChatDate: case .ChatDate:
"ChatDateColor" "ChatDateColor"
case .BackgroundPrimary: case .BackgroundPrimary:
"PrimaryColor" "BackgroundPrimaryColor"
case .BackgroundSecondary: case .BackgroundSecondary:
"SecondaryColor" "BackgroundSecondaryColor"
case .BottomNav: case .BottomNav:
"BottomNavColor" "BottomNavColor"
case .BackgroundTeriary: case .BackgroundTeriary:
......
...@@ -39,6 +39,8 @@ class EcaTask { ...@@ -39,6 +39,8 @@ class EcaTask {
let serverSession = ServerSession() let serverSession = ServerSession()
let resjson = serverSession.fromJSON(resultData: resultData, resltType: ResShipStatus.self) let resjson = serverSession.fromJSON(resultData: resultData, resltType: ResShipStatus.self)
if let res = resjson { if let res = resjson {
SharingData.location.status = SharingData.location.setShipStatus(status: res.status)
SharingData.location.totalRmsAlarm = SharingData.location.setTotalRmsAlarm(alarm: res.totalRmsAlarm)
SharingData.location.speed = res.speed SharingData.location.speed = res.speed
SharingData.location.course = res.course SharingData.location.course = res.course
SharingData.location.heading = res.heading SharingData.location.heading = res.heading
......
...@@ -27,10 +27,10 @@ enum HttpRequestType : String { ...@@ -27,10 +27,10 @@ enum HttpRequestType : String {
case HubName = "ssv-canary-sailassist-notification" case HubName = "ssv-canary-sailassist-notification"
case storage = "https://ssvcanarystorage.z1.web.core.windows.net/" case storage = "https://ssvcanarystorage.z1.web.core.windows.net/"
case GetManualUrl = "https://ssv-canary-web.azurewebsites.net/api/constantdata/manual?filter=SailAssist" case GetManualUrl = "https://ssv-canary-web.azurewebsites.net/api/constantdata/manual?filter=SailAssist"
case Information = "https://ssv-canary-web.azurewebsites.net/information/4"
// case InfVersion = "https://ssv-canary-web.azurewebsites.net/information/4"
case ContactPage = "https://www.jmarinecloud.com/eng/contact.php?type=ssv_mobile" case ContactPage = "https://www.jmarinecloud.com/eng/contact.php?type=ssv_mobile"
case ApachLicens = "https://raw.githubusercontent.com/Azure/azure-notificationhubs-ios/main/LICENSE" case ApachLicens = "https://raw.githubusercontent.com/Azure/azure-notificationhubs-ios/main/LICENSE"
// case AppStore = "https://apps.apple.com/jp/app/ssv-mobile/id1434022656"
// case AppInfo = "https://itunes.apple.com/lookup?bundleId=com.jrc.tacmi"
case AppStore = "https://apps.apple.com/jp/app/sail-assist/id6473762428" case AppStore = "https://apps.apple.com/jp/app/sail-assist/id6473762428"
case AppInfo = "https://itunes.apple.com/lookup?bundleId=com.jrc.sailassist" case AppInfo = "https://itunes.apple.com/lookup?bundleId=com.jrc.sailassist"
} }
...@@ -53,6 +53,8 @@ enum HttpRequestType : String { ...@@ -53,6 +53,8 @@ enum HttpRequestType : String {
case HubName = "ssv-qc-sailassist-notification" case HubName = "ssv-qc-sailassist-notification"
case storage = "https://tacmiquaritycheckstorage.z31.web.core.windows.net/" case storage = "https://tacmiquaritycheckstorage.z31.web.core.windows.net/"
case GetManualUrl = "https://ssv-qc-web.azurewebsites.net/api/constantdata/manual?filter=SailAssist" case GetManualUrl = "https://ssv-qc-web.azurewebsites.net/api/constantdata/manual?filter=SailAssist"
case Information = "https://ssv-qc-web.azurewebsites.net/information/4"
case InfVersion = "https://ssv-qc-web.azurewebsites.net/information/4"
case ContactPage = "https://www.jmarinecloud.com/eng/contact.php?type=ssv_mobile" case ContactPage = "https://www.jmarinecloud.com/eng/contact.php?type=ssv_mobile"
case ApachLicens = "https://raw.githubusercontent.com/Azure/azure-notificationhubs-ios/main/LICENSE" case ApachLicens = "https://raw.githubusercontent.com/Azure/azure-notificationhubs-ios/main/LICENSE"
case AppStore = "https://apps.apple.com/jp/app/sail-assist/id6473762428" case AppStore = "https://apps.apple.com/jp/app/sail-assist/id6473762428"
...@@ -78,6 +80,8 @@ enum HttpRequestType : String { ...@@ -78,6 +80,8 @@ enum HttpRequestType : String {
case HubName = "ssv-sailassist-notification" case HubName = "ssv-sailassist-notification"
case storage = "https://tacmistorage.z31.web.core.windows.net/" case storage = "https://tacmistorage.z31.web.core.windows.net/"
case GetManualUrl = "https://ssv.jmarinecloud.com/api/constantdata/manual?filter=SailAssist" case GetManualUrl = "https://ssv.jmarinecloud.com/api/constantdata/manual?filter=SailAssist"
case Information = "https://ssv.jmarinecloud.com/information/4"
case InfVersion = "https://ssv.jmarinecloud.com/information/4"
case ContactPage = "https://www.jmarinecloud.com/eng/contact.php?type=ssv_mobile" case ContactPage = "https://www.jmarinecloud.com/eng/contact.php?type=ssv_mobile"
case ApachLicens = "https://raw.githubusercontent.com/Azure/azure-notificationhubs-ios/main/LICENSE" case ApachLicens = "https://raw.githubusercontent.com/Azure/azure-notificationhubs-ios/main/LICENSE"
case AppStore = "https://apps.apple.com/jp/app/sail-assist/id6473762428" case AppStore = "https://apps.apple.com/jp/app/sail-assist/id6473762428"
......
//
// ResInformation.swift
// Sailassist
//
// Created by 三浦薫巳 on 2024/02/29.
//
import Foundation
struct ResInformation: Codable {
var informationId: Int = 0
var ssv: Bool = false
var ssvMobile: Bool = false
var sailAssist: Bool = true
var expirationDate: String = ""
var title: String = ""
var detail: String = ""
var lastUpdateTime: String = ""
}
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
import Foundation import Foundation
struct ResShipStatus : Codable { struct ResShipStatus : Codable {
var status: Int = 0
var totalRmsAlarm: Int = 0
var dataTime: String = "" //2023-11-02T05:25:49.4362123Z var dataTime: String = "" //2023-11-02T05:25:49.4362123Z
var speed: Double = 0.0 var speed: Double = 0.0
var course: Double = 0.0 var course: Double = 0.0
......
//
// InformationView.swift
// Sailassist
//
// Created by 三浦薫巳 on 2024/03/01.
//
import SwiftUI
struct InformationView: View {
@ObservedObject var info = SharingData.information
var body: some View {
VStack{
ScrollView{
VStack(spacing: 0){
ForEach(info.content.sorted{ $0.informationId < $1.informationId }, id: \.informationId){ info in
InformationView(title: info.title, bodyStr: info.detail)
}
}
.padding()
.background(.black)
}
.onAppear(perform: {
let information = GetInformation()
information.start()
})
}
}
private struct InformationView: View {
var title: String
var bodyStr: String
@State var isExtend = false
var body: some View {
VStack(alignment: .leading, spacing: 0){
HStack{
Text(title)
.foregroundColor(.white)
Spacer()
Button {
isExtend.toggle()
} label: {
Image(systemName: isExtend ? "minus" : "plus")
.foregroundColor(.white)
}
}
.padding()
.background(.gray)
if isExtend {
Text(bodyStr)
.multilineTextAlignment(.leading)
.padding(EdgeInsets(top: 5, leading: 10, bottom: 5, trailing: 10))
.foregroundColor(.black)
}
}
.background(.white)
}
}
}
#Preview {
MenuInformationView(path: .constant([]))
}
...@@ -87,7 +87,12 @@ struct LoginView: View { ...@@ -87,7 +87,12 @@ struct LoginView: View {
VStack(spacing: 40){ VStack(spacing: 40){
VStack(spacing: 30) { VStack(spacing: 30) {
if !isProgressView { if !isProgressView {
// Link("Information", destination: URL(string: HttpRequestType.SitePolicy.rawValue)!) NavigationLink {
InformationView()
} label: {
Text("System Information")
}
// Link("Information", destination: URL(string: HttpRequestType.SitePolicy.rawValue)!)
Link("Contact Us", destination: URL(string: HttpRequestType.ContactPage.rawValue)!) Link("Contact Us", destination: URL(string: HttpRequestType.ContactPage.rawValue)!)
NavigationLink { NavigationLink {
AboutAppView() AboutAppView()
......
...@@ -34,11 +34,7 @@ struct MapRepresentable: UIViewControllerRepresentable{ ...@@ -34,11 +34,7 @@ struct MapRepresentable: UIViewControllerRepresentable{
mapVC.updateOneTimeEca(eca: focusEca.points) mapVC.updateOneTimeEca(eca: focusEca.points)
//10秒後削除 //10秒後削除
DispatchQueue.main.asyncAfter(deadline: .now() + 15.0) { DispatchQueue.main.asyncAfter(deadline: .now() + 15.0) {
do{ mapVC.updateOneTimeEca(eca: nil)
mapVC.updateOneTimeEca(eca: nil)
}catch{
print(debug: "called")
}
} }
} }
...@@ -91,11 +87,35 @@ class MapViewController : UIViewController{ ...@@ -91,11 +87,35 @@ class MapViewController : UIViewController{
} }
} }
/**
* 自船アイコンの状態表記
*/
func addImage(){ func addImage(){
do{ do{
if let image = UIImage(named: "ownShip"){ if let image = UIImage(named: "ownShip_normal"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.OwnShip.rawValue) try mapView.mapboxMap.style.addImage(image, id: IconImage.OwnShip_Normal.rawValue)
}
if let image = UIImage(named: "ownShip_alarm"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.OwnShip_Alarm.rawValue)
}
if let image = UIImage(named: "ownShip_caution"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.OwnShip_Caution.rawValue)
}
if let image = UIImage(named: "ownShip_emergency"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.OwnShip_Emergency.rawValue)
}
if let image = UIImage(named: "ownShip_necstemergency"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.OwnShip_NeCST_Emergency.rawValue)
}
if let image = UIImage(named: "ownShip_offline"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.OwnShip_Offline.rawValue)
}
if let image = UIImage(named: "ownShip_unknown"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.OwnShip_Unknown.rawValue)
}
if let image = UIImage(named: "ownShip_warning"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.OwnShip_Warning.rawValue)
} }
if let image = UIImage(named: "swNoticeBack"){ if let image = UIImage(named: "swNoticeBack"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.SwNoticeBack.rawValue) try mapView.mapboxMap.style.addImage(image, id: IconImage.SwNoticeBack.rawValue)
...@@ -106,7 +126,9 @@ class MapViewController : UIViewController{ ...@@ -106,7 +126,9 @@ class MapViewController : UIViewController{
if let image = UIImage(named: "swFinishBack"){ if let image = UIImage(named: "swFinishBack"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.SwFinisheBack.rawValue) try mapView.mapboxMap.style.addImage(image, id: IconImage.SwFinisheBack.rawValue)
} }
}catch{} } catch {
print(debug: "called")
}
} }
func addLayers(){ func addLayers(){
...@@ -213,11 +235,34 @@ class MapViewController : UIViewController{ ...@@ -213,11 +235,34 @@ class MapViewController : UIViewController{
///自船 ///自船
func updateOwnShip(location: CLLocationCoordinate2D, bearing: Double){ func updateOwnShip(location: CLLocationCoordinate2D, bearing: Double){
do { do {
var shipIcon = IconImage.OwnShip_Normal.rawValue
switch SharingData.location.status {
case ShipAlert.Offline:
shipIcon = IconImage.OwnShip_Offline.rawValue
case ShipAlert.Unknown:
shipIcon = IconImage.OwnShip_Unknown.rawValue
case ShipAlert.Normal:
shipIcon = IconImage.OwnShip_Normal.rawValue
case ShipAlert.Caution:
shipIcon = IconImage.OwnShip_Caution.rawValue
case ShipAlert.Warrning:
shipIcon = IconImage.OwnShip_Warning.rawValue
case ShipAlert.Alarm:
shipIcon = IconImage.OwnShip_Alarm.rawValue
case ShipAlert.Emergency:
shipIcon = IconImage.OwnShip_Emergency.rawValue
case ShipAlert.NecstEmergency:
shipIcon = IconImage.OwnShip_NeCST_Emergency.rawValue
}
var geoJSON = Feature(geometry: Point(location)) var geoJSON = Feature(geometry: Point(location))
geoJSON.properties = [PropertyKey.Bearing.rawValue: .number(bearing), geoJSON.properties = [PropertyKey.Bearing.rawValue: .number(bearing),
PropertyKey.IconImage.rawValue: .string(IconImage.OwnShip.rawValue)] PropertyKey.IconImage.rawValue: .string(shipIcon)]
try self.mapView.mapboxMap.style.updateGeoJSONSource(withId: self.ownShipSymbol.sourceId, geoJSON: .feature(geoJSON)) try self.mapView.mapboxMap.style.updateGeoJSONSource(withId: self.ownShipSymbol.sourceId, geoJSON: .feature(geoJSON))
}catch{} } catch {
print(debug: "called")
}
} }
///カメラ ///カメラ
...@@ -396,8 +441,15 @@ class MapViewController : UIViewController{ ...@@ -396,8 +441,15 @@ class MapViewController : UIViewController{
case Text case Text
} }
enum IconImage: String, CaseIterable{ enum IconImage: String, CaseIterable {
case OwnShip case OwnShip_Alarm
case OwnShip_Caution
case OwnShip_Emergency
case OwnShip_NeCST_Emergency
case OwnShip_Normal
case OwnShip_Offline
case OwnShip_Unknown
case OwnShip_Warning
case SwNoticeBack case SwNoticeBack
case SwStartBack case SwStartBack
case SwFinisheBack case SwFinisheBack
......
...@@ -21,7 +21,6 @@ enum TaskViewMode{ ...@@ -21,7 +21,6 @@ enum TaskViewMode{
} }
} }
struct MapTaskView: View { struct MapTaskView: View {
@ObservedObject var taskViewModel = TaskViewModel() @ObservedObject var taskViewModel = TaskViewModel()
@ObservedObject var eca = SharingData.eca @ObservedObject var eca = SharingData.eca
......
...@@ -21,7 +21,7 @@ enum MenuPath: String, Hashable{ ...@@ -21,7 +21,7 @@ enum MenuPath: String, Hashable{
case ManualInmalsatC case ManualInmalsatC
case ManualInternationalVHF case ManualInternationalVHF
case ManualVDR case ManualVDR
// case Information case Information
case Setting case Setting
case GpsSelect case GpsSelect
case Help case Help
...@@ -53,8 +53,8 @@ enum MenuPath: String, Hashable{ ...@@ -53,8 +53,8 @@ enum MenuPath: String, Hashable{
"International VHF" "International VHF"
case .ManualVDR: case .ManualVDR:
"VDR" "VDR"
// case .Information: case .Information:
// "Information" "System Information"
case .Setting: case .Setting:
"Setting" "Setting"
case .GpsSelect: case .GpsSelect:
...@@ -140,11 +140,11 @@ struct MenuView: View { ...@@ -140,11 +140,11 @@ struct MenuView: View {
MenuContentView(content: .Manual) MenuContentView(content: .Manual)
} }
// Button{ Button{
// path.append(.Information) path.append(.Information)
// }label: { }label: {
// MenuContentView(content: .Information) MenuContentView(content: .Information)
// } }
Button{ Button{
path.append(.Setting) path.append(.Setting)
...@@ -186,9 +186,9 @@ struct MenuView: View { ...@@ -186,9 +186,9 @@ struct MenuView: View {
if let htmlPath = Bundle.main.path(forResource: "Manual/help", ofType: "html") { if let htmlPath = Bundle.main.path(forResource: "Manual/help", ofType: "html") {
WebView(isLoading: .constant(false), url: htmlPath) WebView(isLoading: .constant(false), url: htmlPath)
} }
// }else if goto == .Information{ }else if goto == .Information{
// MenuInfomarionView(path: $path) MenuInformationView(path: $path)
// .navigationBarHidden(true) .navigationBarHidden(true)
}else{ }else{
VStack(spacing: 0) { VStack(spacing: 0) {
MenuTitleView(path: $path, title: goto.title) MenuTitleView(path: $path, title: goto.title)
......
// //
// MenuInfomarionView.swift // MenuInformationView.swift
// Sailassist // Sailassist
// //
// Created by Mamoru Sugita on 2023/12/26. // Created by Mamoru Sugita on 2023/12/26.
...@@ -7,25 +7,30 @@ ...@@ -7,25 +7,30 @@
import SwiftUI import SwiftUI
struct MenuInfomarionView: View { struct MenuInformationView: View {
@Binding var path : [MenuPath] @Binding var path : [MenuPath]
@ObservedObject var info = SharingData.information
var body: some View { var body: some View {
VStack{ VStack{
// MenuTitleView(path: $path, title: MenuPath.Information.title) MenuTitleView(path: $path, title: MenuPath.Information.title)
ScrollView{ ScrollView{
VStack(spacing: 0){ VStack(spacing: 0){
InformationView(title: "半角文字", bodyStr: String(repeating: halfString, count: 157)) ForEach(info.content.sorted{ $0.informationId < $1.informationId }, id: \.informationId){ info in
InformationView(title: "全角文字", bodyStr: String(repeating: halfString2, count: 82)) InformationView(title: info.title, bodyStr: info.detail)
}
} }
.padding() .padding()
.background(.black) .background(.black)
} }
.onAppear(perform: {
let information = GetInformation()
information.start()
})
} }
} }
private struct InformationView: View { private struct InformationView: View {
var title: String var title: String
var bodyStr: String var bodyStr: String
...@@ -35,36 +40,31 @@ struct MenuInfomarionView: View { ...@@ -35,36 +40,31 @@ struct MenuInfomarionView: View {
HStack{ HStack{
Text(title) Text(title)
.foregroundColor(.white) .foregroundColor(.white)
Spacer() Spacer()
Button { Button {
isExtend.toggle() isExtend.toggle()
} label: { } label: {
Image(systemName: isExtend ? "plus" : "minus") Image(systemName: isExtend ? "minus" : "plus")
.foregroundColor(.white) .foregroundColor(.white)
} }
} }
.padding() .padding()
.background(.gray) .background(.gray)
if isExtend { if isExtend {
Text(bodyStr) Text(bodyStr)
.multilineTextAlignment(.leading) .multilineTextAlignment(.leading)
.padding(EdgeInsets(top: 5, leading: 10, bottom: 5, trailing: 10)) .padding(EdgeInsets(top: 5, leading: 10, bottom: 5, trailing: 10))
.foregroundColor(.black)
} }
} }
.background(.white) .background(.white)
} }
} }
} }
#Preview { #Preview {
MenuInfomarionView(path: .constant([])) MenuInformationView(path: .constant([]))
} }
let halfString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
let halfString2 = "あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをん"
...@@ -66,8 +66,9 @@ class NotificationTags: NSObject { ...@@ -66,8 +66,9 @@ class NotificationTags: NSObject {
let bamTag = "bam-" + shipId let bamTag = "bam-" + shipId
let taskAlertTag = "taskalert-" + shipId let taskAlertTag = "taskalert-" + shipId
let sailassistTag = "sailassist-" + shipId let sailassistTag = "sailassist-" + shipId
let emergencyTag = "emergency" + shipId
// let chatTag = "chat-" + shipId // let chatTag = "chat-" + shipId
MSNotificationHub.addTags([routeTag, bamTag, taskAlertTag, sailassistTag]) MSNotificationHub.addTags([routeTag, bamTag, taskAlertTag, sailassistTag, emergencyTag])
} }
} }
} }
...@@ -160,15 +161,15 @@ extension AppDelegate: UNUserNotificationCenterDelegate { ...@@ -160,15 +161,15 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
let arrCategory = arrAPS["category"] as? String ?? "" let arrCategory = arrAPS["category"] as? String ?? ""
switch arrCategory { switch arrCategory {
case "chat": // case "chat":
guard let arrAlert = arrAPS["alert"] as? [String: Any] else { // guard let arrAlert = arrAPS["alert"] as? [String: Any] else {
return // return
} // }
// let subtitle = arrAlert["subtitle"] as? String ?? "" //送信先名称 // let subtitle = arrAlert["subtitle"] as? String ?? "" //送信先名称
// let strTitle = arrAlert["title"] as? String ?? "" //送信内容 // let strTitle = arrAlert["title"] as? String ?? "" //送信内容
// let strBody = arrAlert["body"] as? String ?? "" //船名 // let strBody = arrAlert["body"] as? String ?? "" //船名
let message = GetMessage() // let message = GetMessage()
message.start() // message.start()
case "sailassist": case "sailassist":
print(debug: "sailassist") print(debug: "sailassist")
let getPushHistory = GetPushHistory() let getPushHistory = GetPushHistory()
...@@ -181,6 +182,10 @@ extension AppDelegate: UNUserNotificationCenterDelegate { ...@@ -181,6 +182,10 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
print(debug: "route") print(debug: "route")
let getPushHistory = GetPushHistory() let getPushHistory = GetPushHistory()
getPushHistory.start() getPushHistory.start()
case "emergency":
print(debug: "emergency")
let getPushHistory = GetPushHistory()
getPushHistory.start()
default: default:
print(debug: "default") print(debug: "default")
} }
...@@ -203,15 +208,15 @@ extension AppDelegate: UNUserNotificationCenterDelegate { ...@@ -203,15 +208,15 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
let arrCategory = arrAPS["category"] as? String ?? "" let arrCategory = arrAPS["category"] as? String ?? ""
switch arrCategory { switch arrCategory {
case "chat": // case "chat":
guard let arrAlert = arrAPS["alert"] as? [String: Any] else { // guard let arrAlert = arrAPS["alert"] as? [String: Any] else {
return // return
} // }
// let subtitle = arrAlert["subtitle"] as? String ?? "" //送信先名称 // let subtitle = arrAlert["subtitle"] as? String ?? "" //送信先名称
// let strTitle = arrAlert["title"] as? String ?? "" //送信内容 // let strTitle = arrAlert["title"] as? String ?? "" //送信内容
// let strBody = arrAlert["body"] as? String ?? "" //船名 // let strBody = arrAlert["body"] as? String ?? "" //船名
let message = GetMessage() // let message = GetMessage()
message.start() // message.start()
case "sailassist": case "sailassist":
print(debug: "sailassist") print(debug: "sailassist")
let getPushHistory = GetPushHistory() let getPushHistory = GetPushHistory()
...@@ -224,6 +229,10 @@ extension AppDelegate: UNUserNotificationCenterDelegate { ...@@ -224,6 +229,10 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
print(debug: "route") print(debug: "route")
let getPushHistory = GetPushHistory() let getPushHistory = GetPushHistory()
getPushHistory.start() getPushHistory.start()
case "emergency":
print(debug: "emergency")
let getPushHistory = GetPushHistory()
getPushHistory.start()
default: default:
print(debug: "default") print(debug: "default")
} }
......
//
// GetInformation.swift
// Sailassist
//
// Created by 三浦薫巳 on 2024/02/29.
//
import Foundation
class GetInformation {
var sessionInformation = SessionInformation()
func start() {
print(debug: "called")
sessionInformation.RequestInformation(responseInformation)
}
func responseInformation(result: Result<Data, APIError>) {
print(debug: "called")
switch result {
case .success(let resultData):
let serverSession = ServerSession()
let resjson = serverSession.fromJSON(resultData: resultData, resltType: [ResInformation].self)
SharingData.information.content = []
if let res = resjson {
SharingData.information.content = res
}
case .failure(let errorCode):
print(debug: errorCode)
break
}
}
}
//
// SessionInformation.swift
// Sailassist
//
// Created by 三浦薫巳 on 2024/02/29.
//
import Foundation
import SwiftUI
class SessionInformation : ObservableObject {
@Published var status = false
// シングルトン宣言
static let OnlyOne = SessionInformation()
private var serverSession = ServerSession()
private var Calling : Bool = false // 通信中
/**
* System Information取得
*/
func RequestInformation(_ completion: @escaping ((Result<Data, APIError>)) -> Void) {
print(debug: "calld")
if Calling {
return
}
Calling = true
// リクエストURLの組み立て
let url_string : String = HttpRequestType.Information.rawValue
guard let req_url = URL(string : url_string) else {
Calling = false
return
}
serverSession.getJson(req_url, completion: completion)
}
}
...@@ -7,19 +7,6 @@ ...@@ -7,19 +7,6 @@
import Foundation import Foundation
import CoreLocation import CoreLocation
enum EcaOperation {
case Insert
case Delete
case Running
case Notice
case Start
case Finish
case End
case Incomplete
case Change
case Cancel
}
class SharingData{ class SharingData{
static var my = My() static var my = My()
...@@ -41,6 +28,8 @@ class SharingData{ ...@@ -41,6 +28,8 @@ class SharingData{
@Published var gps: CLLocationCoordinate2D? = nil @Published var gps: CLLocationCoordinate2D? = nil
@Published var server: CLLocationCoordinate2D? = nil @Published var server: CLLocationCoordinate2D? = nil
@Published var status: ShipAlert = ShipAlert.Normal
@Published var totalRmsAlarm: AlertStatusType = AlertStatusType.Normal
@Published var speed: Double = 0.0 @Published var speed: Double = 0.0
@Published var course: Double = 0.0 @Published var course: Double = 0.0
@Published var heading: Double = 0.0 @Published var heading: Double = 0.0
...@@ -54,6 +43,56 @@ class SharingData{ ...@@ -54,6 +43,56 @@ class SharingData{
} }
} }
func setShipStatus(status: Int) -> ShipAlert {
var shipAlert = ShipAlert.Normal
switch status {
case -1:
shipAlert = ShipAlert.Offline
case 0:
shipAlert = ShipAlert.Unknown
case 1:
shipAlert = ShipAlert.Normal
case 2:
shipAlert = ShipAlert.Caution
case 3:
shipAlert = ShipAlert.Warrning
case 4:
shipAlert = ShipAlert.Alarm
case 5:
shipAlert = ShipAlert.Emergency
case 6:
shipAlert = ShipAlert.NecstEmergency
default:
shipAlert = ShipAlert.Unknown
}
return shipAlert
}
func setTotalRmsAlarm(alarm: Int) -> AlertStatusType {
var rmsAlarm = AlertStatusType.Normal
switch alarm {
case 0:
rmsAlarm = AlertStatusType.Unknown
case 1:
rmsAlarm = AlertStatusType.Normal
case 2:
rmsAlarm = AlertStatusType.Caution
case 3:
rmsAlarm = AlertStatusType.Warrning
case 4:
rmsAlarm = AlertStatusType.Alarm
case 5:
rmsAlarm = AlertStatusType.Emergency
default:
rmsAlarm = AlertStatusType.Unknown
}
return rmsAlarm
}
func reset() { func reset() {
speed = 0.0 speed = 0.0
course = 0.0 course = 0.0
...@@ -77,6 +116,11 @@ class SharingData{ ...@@ -77,6 +116,11 @@ class SharingData{
@Published var messages: [ChatMessage] = [] @Published var messages: [ChatMessage] = []
} }
static var information = Information()
class Information: ObservableObject {
@Published var content: [ResInformation] = []
}
/** /**
* Eca * Eca
*/ */
......
//
// StatusEnum.swift
// Sailassist
//
// Created by 三浦薫巳 on 2024/02/28.
//
import Foundation
enum EcaOperation {
case Insert
case Delete
case Running
case Notice
case Start
case Finish
case End
case Incomplete
case Change
case Cancel
}
enum ShipAlert {
case Offline
case Unknown
case Normal
case Caution
case Warrning
case Alarm
case Emergency
case NecstEmergency
}
enum AlertStatusType {
case Unknown
case Normal
case Caution
case Warrning
case Alarm
case Emergency
}
// |status|Ssv.Data.Enum.ShipAlarmStatus.cs (Offline = -1, Unknown = 0, Normal = 1, Caution = 2, Warning = 3, Alarm = 4, Emergency = 5, NecstEmergency = 6)|
// |totalRmsAlarm|Ssv.Data.Enum.AlertStatusType.cs (Unknown = 0, Normal = 1, Caution = 2, Warning = 3, Alarm = 4, Emergency = 5)|
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