Commit b1777788 authored by shigemi miura's avatar shigemi miura

Ver1.0.1

・自船アイコンの状態表記 ・System Information
parent e053d1a2
{
"images" : [
{
"filename" : "icon_ship_alarm.png",
"idiom" : "universal",
"scale" : "1x"
},
......@@ -9,7 +10,6 @@
"scale" : "2x"
},
{
"filename" : "swStartBack@2x.png",
"idiom" : "universal",
"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{
case .ChatDate:
"ChatDateColor"
case .BackgroundPrimary:
"PrimaryColor"
"BackgroundPrimaryColor"
case .BackgroundSecondary:
"SecondaryColor"
"BackgroundSecondaryColor"
case .BottomNav:
"BottomNavColor"
case .BackgroundTeriary:
......
......@@ -39,6 +39,8 @@ class EcaTask {
let serverSession = ServerSession()
let resjson = serverSession.fromJSON(resultData: resultData, resltType: ResShipStatus.self)
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.course = res.course
SharingData.location.heading = res.heading
......
......@@ -27,10 +27,10 @@ enum HttpRequestType : String {
case HubName = "ssv-canary-sailassist-notification"
case storage = "https://ssvcanarystorage.z1.web.core.windows.net/"
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 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 AppInfo = "https://itunes.apple.com/lookup?bundleId=com.jrc.sailassist"
}
......@@ -53,6 +53,8 @@ enum HttpRequestType : String {
case HubName = "ssv-qc-sailassist-notification"
case storage = "https://tacmiquaritycheckstorage.z31.web.core.windows.net/"
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 ApachLicens = "https://raw.githubusercontent.com/Azure/azure-notificationhubs-ios/main/LICENSE"
case AppStore = "https://apps.apple.com/jp/app/sail-assist/id6473762428"
......@@ -78,6 +80,8 @@ enum HttpRequestType : String {
case HubName = "ssv-sailassist-notification"
case storage = "https://tacmistorage.z31.web.core.windows.net/"
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 ApachLicens = "https://raw.githubusercontent.com/Azure/azure-notificationhubs-ios/main/LICENSE"
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 @@
import Foundation
struct ResShipStatus : Codable {
var status: Int = 0
var totalRmsAlarm: Int = 0
var dataTime: String = "" //2023-11-02T05:25:49.4362123Z
var speed: 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 {
VStack(spacing: 40){
VStack(spacing: 30) {
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)!)
NavigationLink {
AboutAppView()
......
......@@ -34,11 +34,7 @@ struct MapRepresentable: UIViewControllerRepresentable{
mapVC.updateOneTimeEca(eca: focusEca.points)
//10秒後削除
DispatchQueue.main.asyncAfter(deadline: .now() + 15.0) {
do{
mapVC.updateOneTimeEca(eca: nil)
}catch{
print(debug: "called")
}
}
}
......@@ -92,10 +88,34 @@ class MapViewController : UIViewController{
}
}
/**
* 自船アイコンの状態表記
*/
func addImage(){
do{
if let image = UIImage(named: "ownShip"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.OwnShip.rawValue)
if let image = UIImage(named: "ownShip_normal"){
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"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.SwNoticeBack.rawValue)
......@@ -106,7 +126,9 @@ class MapViewController : UIViewController{
if let image = UIImage(named: "swFinishBack"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.SwFinisheBack.rawValue)
}
}catch{}
} catch {
print(debug: "called")
}
}
func addLayers(){
......@@ -213,11 +235,34 @@ class MapViewController : UIViewController{
///自船
func updateOwnShip(location: CLLocationCoordinate2D, bearing: Double){
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))
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))
}catch{}
} catch {
print(debug: "called")
}
}
///カメラ
......@@ -396,8 +441,15 @@ class MapViewController : UIViewController{
case Text
}
enum IconImage: String, CaseIterable{
case OwnShip
enum IconImage: String, CaseIterable {
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 SwStartBack
case SwFinisheBack
......
......@@ -21,7 +21,6 @@ enum TaskViewMode{
}
}
struct MapTaskView: View {
@ObservedObject var taskViewModel = TaskViewModel()
@ObservedObject var eca = SharingData.eca
......
......@@ -21,7 +21,7 @@ enum MenuPath: String, Hashable{
case ManualInmalsatC
case ManualInternationalVHF
case ManualVDR
// case Information
case Information
case Setting
case GpsSelect
case Help
......@@ -53,8 +53,8 @@ enum MenuPath: String, Hashable{
"International VHF"
case .ManualVDR:
"VDR"
// case .Information:
// "Information"
case .Information:
"System Information"
case .Setting:
"Setting"
case .GpsSelect:
......@@ -140,11 +140,11 @@ struct MenuView: View {
MenuContentView(content: .Manual)
}
// Button{
// path.append(.Information)
// }label: {
// MenuContentView(content: .Information)
// }
Button{
path.append(.Information)
}label: {
MenuContentView(content: .Information)
}
Button{
path.append(.Setting)
......@@ -186,9 +186,9 @@ struct MenuView: View {
if let htmlPath = Bundle.main.path(forResource: "Manual/help", ofType: "html") {
WebView(isLoading: .constant(false), url: htmlPath)
}
// }else if goto == .Information{
// MenuInfomarionView(path: $path)
// .navigationBarHidden(true)
}else if goto == .Information{
MenuInformationView(path: $path)
.navigationBarHidden(true)
}else{
VStack(spacing: 0) {
MenuTitleView(path: $path, title: goto.title)
......
//
// MenuInfomarionView.swift
// MenuInformationView.swift
// Sailassist
//
// Created by Mamoru Sugita on 2023/12/26.
......@@ -7,25 +7,30 @@
import SwiftUI
struct MenuInfomarionView: View {
struct MenuInformationView: View {
@Binding var path : [MenuPath]
@ObservedObject var info = SharingData.information
var body: some View {
VStack{
// MenuTitleView(path: $path, title: MenuPath.Information.title)
MenuTitleView(path: $path, title: MenuPath.Information.title)
ScrollView{
VStack(spacing: 0){
InformationView(title: "半角文字", bodyStr: String(repeating: halfString, count: 157))
InformationView(title: "全角文字", bodyStr: String(repeating: halfString2, count: 82))
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
......@@ -41,10 +46,9 @@ struct MenuInfomarionView: View {
Button {
isExtend.toggle()
} label: {
Image(systemName: isExtend ? "plus" : "minus")
Image(systemName: isExtend ? "minus" : "plus")
.foregroundColor(.white)
}
}
.padding()
.background(.gray)
......@@ -53,18 +57,14 @@ struct MenuInfomarionView: View {
Text(bodyStr)
.multilineTextAlignment(.leading)
.padding(EdgeInsets(top: 5, leading: 10, bottom: 5, trailing: 10))
.foregroundColor(.black)
}
}
.background(.white)
}
}
}
#Preview {
MenuInfomarionView(path: .constant([]))
MenuInformationView(path: .constant([]))
}
let halfString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
let halfString2 = "あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをん"
......@@ -66,8 +66,9 @@ class NotificationTags: NSObject {
let bamTag = "bam-" + shipId
let taskAlertTag = "taskalert-" + shipId
let sailassistTag = "sailassist-" + shipId
let emergencyTag = "emergency" + 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 {
let arrCategory = arrAPS["category"] as? String ?? ""
switch arrCategory {
case "chat":
guard let arrAlert = arrAPS["alert"] as? [String: Any] else {
return
}
// case "chat":
// guard let arrAlert = arrAPS["alert"] as? [String: Any] else {
// return
// }
// let subtitle = arrAlert["subtitle"] as? String ?? "" //送信先名称
// let strTitle = arrAlert["title"] as? String ?? "" //送信内容
// let strBody = arrAlert["body"] as? String ?? "" //船名
let message = GetMessage()
message.start()
// let message = GetMessage()
// message.start()
case "sailassist":
print(debug: "sailassist")
let getPushHistory = GetPushHistory()
......@@ -181,6 +182,10 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
print(debug: "route")
let getPushHistory = GetPushHistory()
getPushHistory.start()
case "emergency":
print(debug: "emergency")
let getPushHistory = GetPushHistory()
getPushHistory.start()
default:
print(debug: "default")
}
......@@ -203,15 +208,15 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
let arrCategory = arrAPS["category"] as? String ?? ""
switch arrCategory {
case "chat":
guard let arrAlert = arrAPS["alert"] as? [String: Any] else {
return
}
// case "chat":
// guard let arrAlert = arrAPS["alert"] as? [String: Any] else {
// return
// }
// let subtitle = arrAlert["subtitle"] as? String ?? "" //送信先名称
// let strTitle = arrAlert["title"] as? String ?? "" //送信内容
// let strBody = arrAlert["body"] as? String ?? "" //船名
let message = GetMessage()
message.start()
// let message = GetMessage()
// message.start()
case "sailassist":
print(debug: "sailassist")
let getPushHistory = GetPushHistory()
......@@ -224,6 +229,10 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
print(debug: "route")
let getPushHistory = GetPushHistory()
getPushHistory.start()
case "emergency":
print(debug: "emergency")
let getPushHistory = GetPushHistory()
getPushHistory.start()
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 @@
import Foundation
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{
static var my = My()
......@@ -41,6 +28,8 @@ class SharingData{
@Published var gps: 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 course: Double = 0.0
@Published var heading: Double = 0.0
......@@ -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() {
speed = 0.0
course = 0.0
......@@ -77,6 +116,11 @@ class SharingData{
@Published var messages: [ChatMessage] = []
}
static var information = Information()
class Information: ObservableObject {
@Published var content: [ResInformation] = []
}
/**
* 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