Commit d63ac4ca authored by shigemi miura's avatar shigemi miura

通知表示

タスク表示順序
parent e3319fdc
......@@ -1166,11 +1166,14 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 0.9;
OTHER_SWIFT_FLAGS = "-D CANARY -D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = com.jrc.sailassist.canary;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
......@@ -1206,10 +1209,13 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 0.9;
OTHER_SWIFT_FLAGS = "-D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = com.jrc.sailassist;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
......@@ -1389,10 +1395,13 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 0.9;
OTHER_SWIFT_FLAGS = "-D QC -D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = com.jrc.sailassist.qc;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
......
......@@ -71,7 +71,7 @@
buildConfiguration = "Canary">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
buildConfiguration = "Canary"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
......@@ -8,14 +8,23 @@
import SwiftUI
struct NotificationView: View {
@EnvironmentObject var selectedTabModel: SelectedTabModel
@ObservedObject var pushHist = SharingData.pushHistory
var body: some View {
VStack(spacing: 0){
TitleView()
ScrollView {
ForEach(pushHist.pushHistoryData.map{ $1 }.sorted{ DateTextLib.ISO8601Text2UnixTime($0.time) > DateTextLib.ISO8601Text2UnixTime($1.time)}, id: \.id){ data in
ForEach(pushHist.pushHistoryData.map{ $1 }.sorted{ $0.id ?? 0 > $1.id ?? 0 }, id: \.id){ data in
NotificationContentView(pushData: data)
.onTapGesture {
if let position = data.position {
if position.lat != nil && position.lon != nil {
selectedTabModel.activeTab = .task
pushHist.focusPushHistory = data.id
}
}
}
Divider()
.frame(height: 1)
......@@ -33,6 +42,7 @@ struct NotificationView: View {
VStack {
HStack {
Button{
print(debug: "called")
}label: {
}
.disabled(true)
......@@ -48,6 +58,7 @@ struct NotificationView: View {
Spacer()
Button{
print(debug: "called")
}label: {
}
.disabled(true)
......
......@@ -4,10 +4,12 @@
//
// Created by Mamoru Sugita on 2023/11/27.
//
import SwiftUI
import CoreLocation
struct NotificationContentView: View {
@EnvironmentObject var selectedTabModel: SelectedTabModel
var pushData: ResPushHistory
var body: some View {
VStack(alignment: .leading, spacing: 4){
......@@ -24,11 +26,22 @@ struct NotificationContentView: View {
Spacer()
}
HStack(spacing: 10) {
Text(pushData.title ?? "JTest-Ship")
.foregroundColor(ColorSet.Body.color)
.font(FontStyle.EmphasisText.font)
Spacer()
if let position = pushData.position {
if position.lat != nil && position.lon != nil {
Image("map_pin")
.resizable()
.frame(width: 20, height: 20)
}
}
}
Text(pushData.message ?? "Fire emergency notice from ship")
.foregroundColor(ColorSet.BodyDescriptiion.color)
.font(FontStyle.SupplementText2.font)
......
{
"images" : [
{
"filename" : "app_icon40.png",
"idiom" : "universal",
"platform" : "ios",
"scale" : "2x",
"size" : "20x20"
},
{
"filename" : "app_icon60.png",
"idiom" : "universal",
"platform" : "ios",
"scale" : "3x",
"size" : "20x20"
},
{
"filename" : "app_icon58.png",
"idiom" : "universal",
"platform" : "ios",
"scale" : "2x",
"size" : "29x29"
},
{
"filename" : "app_icon87.png",
"idiom" : "universal",
"platform" : "ios",
"scale" : "3x",
"size" : "29x29"
},
{
"filename" : "app_icon76.png",
"idiom" : "universal",
"platform" : "ios",
"scale" : "2x",
"size" : "38x38"
},
{
"filename" : "app_icon114.png",
"idiom" : "universal",
"platform" : "ios",
"scale" : "3x",
"size" : "38x38"
},
{
"filename" : "app_icon80.png",
"idiom" : "universal",
"platform" : "ios",
"scale" : "2x",
"size" : "40x40"
},
{
"filename" : "app_icon120 1.png",
"idiom" : "universal",
"platform" : "ios",
"scale" : "3x",
"size" : "40x40"
},
{
"filename" : "app_icon120.png",
"idiom" : "universal",
"platform" : "ios",
"scale" : "2x",
"size" : "60x60"
},
{
"filename" : "app_icon180.png",
"idiom" : "universal",
"platform" : "ios",
"scale" : "3x",
"size" : "60x60"
},
{
"filename" : "app_icon128.png",
"idiom" : "universal",
"platform" : "ios",
"scale" : "2x",
"size" : "64x64"
},
{
"filename" : "app_icon192.png",
"idiom" : "universal",
"platform" : "ios",
"scale" : "3x",
"size" : "64x64"
},
{
"filename" : "app_icon136.png",
"idiom" : "universal",
"platform" : "ios",
"scale" : "2x",
"size" : "68x68"
},
{
"filename" : "app_icon152.png",
"idiom" : "universal",
"platform" : "ios",
"scale" : "2x",
"size" : "76x76"
},
{
"filename" : "app_icon167.png",
"idiom" : "universal",
"platform" : "ios",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"filename" : "app_icon1024.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
......
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "map_pin.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "map_pin_dark.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -19,11 +19,7 @@ class DeleteEcaArea {
print(debug: "called")
switch result {
case .success(let resultData):
let serverSession = ServerSession()
let resjson = serverSession.fromJSON(resultData: resultData, resltType: ReqTaskList.self)
if let res = resjson {
//ECA保存
}
print(debug: resultData)
case .failure(let errorCode):
print(debug: errorCode)
break
......
......@@ -23,7 +23,7 @@ class EcaArea {
let serverSession = ServerSession()
let resjson = serverSession.fromJSON(resultData: resultData, resltType: [ResEcaArea].self)
if let res = resjson {
var area = res
print(debug: res)
}
case .failure(let errorCode):
print(debug: errorCode)
......
......@@ -59,7 +59,7 @@ class EcaTask {
let runningEca = eca.ecaArea.first(where: {(key, value) in value.isRunning == true})
if var eca = runningEca?.value {
if let location = SharingData.my.location {
if var distance = LocationCalculation.checkPolyline(objPos: eca.points, shipPos: location) {
if let distance = LocationCalculation.checkPolyline(objPos: eca.points, shipPos: location) {
//起動時に状態を設定
if SharingData.my.ecaStatus == nil {
......@@ -109,12 +109,12 @@ class EcaTask {
}
if eca.swStart >= Float(distance) && result == false{
newData.status = EcaState.startPass
newData.status = EcaState.noticePass
result = true
}
if eca.swNotice >= Float(distance) && result == false{
newData.status = EcaState.noticePass
newData.status = EcaState.running
}
return newData
......
......@@ -42,46 +42,28 @@ enum HttpRequestType : String {
case SignalR = "https://ssv-qc-web.azurewebsites.net/signalr/shore"
case PushHistory = "https://ssv-qc-web.azurewebsites.net/api/sailassist/pushhistory/XXXXX"
case UploadImage = "https://ssv-qc-web.azurewebsites.net/api/chatdata/uploadimage"
case ConnectionString = "Endpoint=sb://tacmiqchub.servicebus.windows.net/;SharedAccessKeyName=DefaultListenSharedAccessSignature;SharedAccessKey=mjGZyOensA5D/T6bMiDDwX6hwhoZNsDcK+GtBBBiUXk="
case HubName = "tacmiqchub"
case ConnectionString = "Endpoint=sb://ssv-qc-notification.servicebus.windows.net/;SharedAccessKeyName=DefaultListenSharedAccessSignature;SharedAccessKey=qjI5K38IyGfh2arFherVgp5tNUBE2U4eVClgTEQip54="
case HubName = "ssv-qc-sailassist-notification"
case storage = "https://tacmiquaritycheckstorage.z31.web.core.windows.net/"
}
#else
//MARK: 運用サーバー用
enum HttpRequestType : String {
case Terms = "https://tacmistorage.blob.core.windows.net/$web/terms/terms.mobile.html?sv=2021-10-04&st=2023-11-22T06%3A26%3A32Z&se=2023-11-23T06%3A26%3A32Z&sr=b&sp=r&sig=wS6kbbT5SvNVTkRsnRk%2BiDceZAsQ3Y56vrqTUO1X50E%3D"
case RegisterLogin = "https://ssv-canary-web.azurewebsites.net/sailassistlogin"
case SitePolicy = "https://ssv-canary-web.azurewebsites.net/sitepolicy"
case CookiePolicy = "https://ssv-canary-web.azurewebsites.net/cookiepolicy"
case PrivacyPolicy = "https://ssv-canary-web.azurewebsites.net/inapp?" //+バージョン番号
case TaskList = "https://ssv-canary-web.azurewebsites.net/api/sailassist/tasklist/XXXXX"
case EcaArea = "https://ssv-canary-web.azurewebsites.net/api/sailassist/ecaarea/XXXXX"
case ShipStatus = "https://ssv-canary-web.azurewebsites.net/api/sailassist/shipstatus/XXXXX"
case ShipMonitoringRoute = "https://ssv-canary-web.azurewebsites.net/api/sailassist/shipmonitoringroute/XXXXX"
case GetMessage = "https://ssv-canary-web.azurewebsites.net/api/chatdata/getmessages?shipId=XXXXX"
case SignalR = "https://ssv-canary-web.azurewebsites.net/signalr/shore"
case PushHistory = "https://ssv-canary-web.azurewebsites.net/api/sailassist/pushhistory/XXXXX"
case UploadImage = "https://ssv-canary-web.azurewebsites.net/api/chatdata/uploadimage"
case ConnectionString = "Endpoint=sb://ssv-canary-notification.servicebus.windows.net/;SharedAccessKeyName=DefaultListenSharedAccessSignature;SharedAccessKey=zHzVMA757FciMum5jVG4NMl82YpYVzclUgCiKOVRKf8="
case HubName = "ssv-canary-sailassist-notification"
case storage = "https://ssvcanarystorage.z1.web.core.windows.net/"
case RegisterLogin = "https://ssv.jmarinecloud.com/sailassistlogin"
case SitePolicy = "https://ssv.jmarinecloud.com/sitepolicy"
case CookiePolicy = "https://ssv.jmarinecloud.com/cookiepolicy"
case PrivacyPolicy = "https://ssv.jmarinecloud.com/inapp?" //+バージョン番号
case TaskList = "https://ssv.jmarinecloud.com/api/sailassist/tasklist/XXXXX"
case EcaArea = "https://ssv.jmarinecloud.com/api/sailassist/ecaarea"
case ShipStatus = "https://ssv.jmarinecloud.com/api/sailassist/shipstatus/XXXXX"
case ShipMonitoringRoute = "https://ssv.jmarinecloud.com/api/sailassist/shipmonitoringroute/XXXXX"
case GetMessage = "https://ssv.jmarinecloud.com/api/chatdata/getmessages?shipId=XXXXX"
case SignalR = "https://ssv.jmarinecloud.com/signalr/shore"
case PushHistory = "https://ssv.jmarinecloud.com/api/sailassist/pushhistory/XXXXX"
case UploadImage = "https://ssv.jmarinecloud.com/api/chatdata/uploadimage"
case ConnectionString = "Endpoint=sb://ssv-notification.servicebus.windows.net/;SharedAccessKeyName=DefaultListenSharedAccessSignature;SharedAccessKey=IzbO7Lo+PenhlIaHBw1MA7+NE9XaLikwieOFwCzZC50="
case HubName = "ssv-sailassist-notification"
case storage = "https://tacmistorage.z31.web.core.windows.net/"
}
//enum HttpRequestType : String {
// case Terms = "https://tacmistorage.blob.core.windows.net/$web/terms/terms.mobile.html?sv=2021-10-04&st=2023-11-22T06%3A26%3A32Z&se=2023-11-23T06%3A26%3A32Z&sr=b&sp=r&sig=wS6kbbT5SvNVTkRsnRk%2BiDceZAsQ3Y56vrqTUO1X50E%3D"
// case RegisterLogin = "https://ssv.jmarinecloud.com/sailassistlogin"
// case SitePolicy = "https://ssv.jmarinecloud.com/sitepolicy"
// case CookiePolicy = "https://ssv.jmarinecloud.com/cookiepolicy"
// case PrivacyPolicy = "https://ssv.jmarinecloud.com/inapp?" //+バージョン番号
// case TaskList = "https://ssv.jmarinecloud.com/api/sailassist/tasklist/XXXXX"
// case EcaArea = "https://ssv.jmarinecloud.com/api/sailassist/ecaarea"
// case ShipStatus = "https://ssv.jmarinecloud.com/api/sailassist/shipstatus/XXXXX"
// case ShipMonitoringRoute = "https://ssv.jmarinecloud.com/api/sailassist/shipmonitoringroute/XXXXX"
// case GetMessage = "https://ssv.jmarinecloud.com/api/chatdata/getmessages?shipId=XXXXX"
// case SignalR = "https://ssv.jmarinecloud.com/signalr/shore"
// case PushHistory = "https://ssv.jmarinecloud.com/api/sailassist/pushhistory/XXXXX"
// case UploadImage = "https://ssv.jmarinecloud.com/api/chatdata/uploadimage"
// case ConnectionString = "Endpoint=sb://tacmihub.servicebus.windows.net/;SharedAccessKeyName=DefaultListenSharedAccessSignature;SharedAccessKey=/IOJAYGLZmS2JvlsHT5aT+ETlPXqNt1+VGuMNDt4bzw="
// case HubName = "tacmihub"
// case storage = "https://tacmistorage.z31.web.core.windows.net/"
//}
#endif
......@@ -19,6 +19,27 @@ class LocationViewModel: NSObject, ObservableObject, CLLocationManagerDelegate {
authorizationStatus = locationManager.authorizationStatus
super.init()
}
func requestPermission() {
locationManager.requestAlwaysAuthorization()
let status = CLLocationManager().authorizationStatus
switch status {
case .authorizedAlways :
print(debug: "authorizationStatus : .authorizedAlways")
case .notDetermined:
print(debug: "authorizationStatus : .notDetermined")
case .restricted:
print(debug: "authorizationStatus : .restricted")
case .denied:
print(debug: "authorizationStatus : .denied")
case .authorizedWhenInUse:
print(debug: "authorizationStatus : .authorizedWhenInUse")
@unknown default:
print(debug: "authorizationStatus : Unknown")
}
if status == .authorizedAlways || status == .authorizedWhenInUse {
locationManager.delegate = self
locationManager.allowsBackgroundLocationUpdates = true // バックグラウンド実行中も座標取得する場合、trueにする
locationManager.desiredAccuracy = kCLLocationAccuracyBest
......@@ -28,10 +49,6 @@ class LocationViewModel: NSObject, ObservableObject, CLLocationManagerDelegate {
locationManager.startUpdatingLocation()
}
func requestPermission() {
locationManager.requestWhenInUseAuthorization()
locationManager.requestAlwaysAuthorization() // バックグラウンド実行中も座標取得する場合はこちら
}
func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) {
......
......@@ -14,6 +14,7 @@ struct MapRepresentable: UIViewControllerRepresentable{
@ObservedObject var ecaData = SharingData.eca
@ObservedObject var my = SharingData.my
@ObservedObject var map = SharingData.map
@ObservedObject var pushHistory = SharingData.pushHistory
@State var mapVC = MapViewController()
func makeUIViewController(context: Context) -> some UIViewController {
......@@ -24,10 +25,20 @@ struct MapRepresentable: UIViewControllerRepresentable{
let ecaArea = ecaData.ecaArea.map{ $0.1 }.filter{ $0.isRunning }.first
if let ecaArea = ecaArea{
mapVC.updateEcaLine(line: ecaArea.points)
} else {
mapVC.removeEcaLine()
}
if let foucusEcaName = ecaData.foucusEca, let foucusEca = ecaData.ecaArea[foucusEcaName]{
mapVC.updateCamera(location: foucusEca.points.first)
if let focusEcaName = ecaData.focusEca, let focusEca = ecaData.ecaArea[focusEcaName]{
mapVC.updateCamera(location: focusEca.points.first)
}
if let focusPushHistoryId = pushHistory.focusPushHistory, let focusPushHistory = pushHistory.pushHistoryData[focusPushHistoryId]{
if let position = focusPushHistory.position {
if let latitude = position.lat, let longitude = position.lon {
mapVC.updateCamera(location: CLLocationCoordinate2D(latitude: latitude, longitude: longitude))
}
}
}
if let mylocation = my.location {
......@@ -35,6 +46,8 @@ struct MapRepresentable: UIViewControllerRepresentable{
if let ecaArea = ecaArea{
mapVC.updateEcaSwitchingLine(center: mylocation, notice: ecaArea.swNotice, start: ecaArea.swStart, finish: ecaArea.swFinish)
} else {
mapVC.removeEcaSwitchingLine()
}
}
mapVC.updateWakeLines(legLine: map.legLine, portLine: map.portLine, starboardLine: map.starboardLine)
......@@ -56,20 +69,17 @@ class MapViewController : UIViewController{
override func viewDidLoad() {
super.viewDidLoad()
let centerCoordinate = CLLocationCoordinate2D(latitude: 37.8, longitude: -96)
let options = MapInitOptions(cameraOptions: CameraOptions(center: centerCoordinate,
zoom: 2))
let options = MapInitOptions(cameraOptions: CameraOptions(center: centerCoordinate, zoom: 2))
mapView = MapView(frame: view.bounds, mapInitOptions: options)
mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.view.addSubview(mapView)
mapView.mapboxMap.onNext(event: .mapLoaded) { [self] _ in
self.addLayers()
}
}
func addImage(){
......@@ -112,7 +122,7 @@ class MapViewController : UIViewController{
let ecaLineString = LineString([LocationCoordinate2D(latitude: 0, longitude: 0)])
var ecaLinefeature = Feature(geometry: ecaLineString)
let ecaLinefeature = Feature(geometry: ecaLineString)
ecaLine.source.data = .feature(ecaLinefeature)
var ecaLineLayer = LineLayer(id: ecaLine.layerId)
ecaLineLayer.source = ecaLine.sourceId
......@@ -190,8 +200,14 @@ class MapViewController : UIViewController{
///カメラ
func updateCamera(location: CLLocationCoordinate2D?){
self.mapView.camera.ease(to: CameraOptions(center: location), duration: 1)
SharingData.eca.foucusEca = nil
if let eca = SharingData.eca.focusEca {
SharingData.eca.focusEca = nil
}
if let push = SharingData.pushHistory.focusPushHistory {
SharingData.pushHistory.focusPushHistory = nil
}
}
///Ecaの線3本
func updateEcaSwitchingLine(center: CLLocationCoordinate2D, notice: Float, start: Float, finish: Float){
do{
......@@ -242,6 +258,18 @@ class MapViewController : UIViewController{
}catch{}
}
func removeEcaSwitchingLine(){
do{
let switchingLines : [Feature] = []
let switchingLabels : [Feature] = []
let lineGeoJson = FeatureCollection(features: switchingLines)
let labelGeoJson = FeatureCollection(features: switchingLabels)
try self.mapView.mapboxMap.style.updateGeoJSONSource(withId: ecaSwitchingLine.sourceId, geoJSON: .featureCollection(lineGeoJson))
try self.mapView.mapboxMap.style.updateGeoJSONSource(withId: ecaSwLineLabel.sourceId, geoJSON: .featureCollection(labelGeoJson))
}catch{}
}
///円の位置情報を返す
private func getCirclePoints(center: CLLocationCoordinate2D, radiusKm: Double) -> [CLLocationCoordinate2D]{
var circlePoints : [CLLocationCoordinate2D] = []
......@@ -257,7 +285,6 @@ class MapViewController : UIViewController{
return circlePoints
}
func updateEcaLine(line: [CLLocationCoordinate2D]){
do{
var geoJson = Feature(geometry: LineString(line))
......@@ -267,6 +294,14 @@ class MapViewController : UIViewController{
}catch{}
}
func removeEcaLine(){
do{
let line: [CLLocationCoordinate2D] = []
let geoJson = Feature(geometry: LineString(line))
try self.mapView.mapboxMap.style.updateGeoJSONSource(withId: ecaLine.sourceId, geoJSON: .feature(geoJson))
}catch{}
}
func updateWakeLines(legLine: [CLLocationCoordinate2D], portLine: [CLLocationCoordinate2D], starboardLine: [CLLocationCoordinate2D]){
do{
var legLineFeature = Feature(geometry: LineString(legLine))
......@@ -314,8 +349,6 @@ class MapViewController : UIViewController{
}catch{}
}
enum PropertyKey : String {
case IconImage
case Bearing
......
......@@ -11,13 +11,13 @@ struct EcaListView: View {
@ObservedObject var ecaData = SharingData.eca
var body: some View {
ForEach(ecaData.ecaArea.map{ $0.1 }, id: \.name){ eca in
ForEach(ecaData.ecaArea.map{ $0.1 }.sorted{ $0.id ?? 0 < $1.id ?? 0 }, id: \.name){ eca in
HStack {
Text(eca.name)
.font(FontStyle.DefaultText.font)
.foregroundColor(ColorSet.Body.color)
.onTapGesture {
ecaData.foucusEca = eca.name
ecaData.focusEca = eca.name
}
Spacer()
if !eca.isEnable{
......
......@@ -54,7 +54,6 @@ struct MapTaskView: View {
})
.frame(width: 48, height: 48)
Spacer()
Text(viewMode.title)
......@@ -73,7 +72,6 @@ struct MapTaskView: View {
}
.padding(EdgeInsets(top: 10, leading: 8, bottom: 13, trailing: 17))
Divider()
.background(ColorSet.LineColor03.color)
......@@ -88,7 +86,6 @@ struct MapTaskView: View {
case .EcaList:
EcaListView()
}
}
Spacer()
......@@ -99,7 +96,7 @@ struct MapTaskView: View {
EcaCoordinatesTable().setEcaData()
}
.alert("", isPresented: $eca.isShowEcaAlert) {
if var ecaArea = eca.ecaArea.map{ $0.1 }.filter{ $0.isRunning }.first{
if let ecaArea = eca.ecaArea.map{ $0.1 }.filter{ $0.isRunning }.first{
if SharingData.my.ecaStatus == .finishPass{
Button("Yes"){
var newData = ecaArea
......
......@@ -23,9 +23,10 @@ struct TaskSwitchingMenuView: View {
var body: some View {
VStack{
ForEach(ecaData.ecaArea.map{ $0.1 }.filter{ $0.isEnable }, id: \.name){ eca in
ForEach(ecaData.ecaArea.map{ $0.1 }.filter{ $0.isEnable }.sorted{ $0.id ?? 0 < $1.id ?? 0 }, id: \.name){ eca in
VStack {
HStack {
//ECA開始・終了ボタン
Button {
for runningEca in ecaData.ecaArea.map{ $0.1 }.filter{ $0.isRunning }{
edittingEcaArea = runningEca
......@@ -52,7 +53,7 @@ struct TaskSwitchingMenuView: View {
.font(FontStyle.DefaultText.font)
.foregroundColor(ColorSet.Body.color)
.onTapGesture {
ecaData.foucusEca = eca.name
ecaData.focusEca = eca.name
}
Spacer()
......
......@@ -19,6 +19,7 @@ enum MenuPath: String, Hashable{
case Help
case AboutApp
case ContactUs
case SignOut
var title: String{
switch self {
......@@ -42,12 +43,15 @@ enum MenuPath: String, Hashable{
"About this App"
case .ContactUs:
"Contact Us"
case .SignOut:
"Sign Out"
}
}
}
struct MenuView: View {
@State var path: [MenuPath] = []
@Binding var isSignout: Bool
var body: some View {
NavigationStack(path: $path){
......@@ -56,10 +60,10 @@ struct MenuView: View {
HStack {
VStack(alignment: .leading, spacing: 10){
Text(SharingData.my.company)
Text("Group")
.font(FontStyle.TitleL.font)
.foregroundColor(ColorSet.Body.color)
Text("Company name general")
Text(SharingData.my.company)
.font(FontStyle.EmphasisText.font)
.foregroundColor(ColorSet.BodyDescriptiion.color)
}
......@@ -70,12 +74,10 @@ struct MenuView: View {
Divider()
.background(ColorSet.LineColor04.color)
Button{
path.append(.Manual)
}label: {
MenuContentView(content: .Manual)
}
Button{
......@@ -90,6 +92,12 @@ struct MenuView: View {
MenuContentView(content: .Setting)
}
Button{
isSignout = true
}label: {
MenuContentView(content: .SignOut)
}
Spacer()
}
.background(ColorSet.BackgroundPrimary.color)
......@@ -120,10 +128,20 @@ struct MenuView: View {
}
}
.alert(isPresented: $isSignout) {
return Alert(title: Text("Sign Out"),
message: Text("Are you sure?"),
primaryButton: .default(Text("Yes"), action: {
Preferences.Id = ""
Preferences.Password = ""
Preferences.UserName = ""
}), secondaryButton: .cancel(Text("No")))
}
}
}
}
#Preview {
MenuView()
MenuView(isSignout: .constant(false))
}
......@@ -72,12 +72,16 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M
MSNotificationHub.start(connectionString: HttpRequestType.ConnectionString.rawValue, hubName: HttpRequestType.HubName.rawValue)
let notification = notificationTags()
notification.addTags()
// addTags()
// let notification = notificationTags()
// notification.addTags()
self.addTags()
// let testTag = "aaa"
// MSNotificationHub.addTags([testTag])
}
}
DispatchQueue.main.async {
application.registerForRemoteNotifications()
}
return true
}
......@@ -92,23 +96,34 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M
func addTags() {
if Preferences.shipId != 0 {
let shipId = String(Preferences.shipId)
let testTag = "aaa"
let routeTag = "route-" + shipId
let bamTag = "bam-" + shipId
let taskAlertTag = "taskalert-" + shipId
let sailassistTag = "sailassist-" + shipId
MSNotificationHub.addTags([testTag, routeTag, bamTag, taskAlertTag, sailassistTag])
// MSNotificationHub.addTags([routeTag, bamTag, taskAlertTag, sailassistTag])
MSNotificationHub.addTags([routeTag])
}
}
// Push通知を受信した時(サイレントプッシュ)
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
print(debug: "called")
// Forward to MSNotificationHub
MSNotificationHub.didReceiveRemoteNotification(userInfo)
// Complete handling the notification
// Complete handling the notificationposition
completionHandler(.noData)
// guard let data = userInfo["data"] as? [String: Any],
// let newTitle = data["newTitle"] as? String,
// let newBody = data["newBody"] as? String else {
// completionHandler(.noData)
// return
// }
// // ローカル通知で表示するタイトルとメッセージを変更する
// showLocalNotification(identifier: "SilentPush", title: newTitle, body: newBody)
// completionHandler(.newData)
}
func notificationHub(_ notificationHub: MSNotificationHub!, didReceivePushNotification notification: MSNotificationHubMessage!) {
......@@ -122,8 +137,19 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M
let alertController = UIAlertController(title: title, message: body, preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "OK", style: .cancel))
// self.present(alertController, animated: true)
// self.present(alertController, animated: true)
}
}
// APNs 登録成功時に呼ばれる
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
let token = deviceToken.map { String(format: "%.2hhx", $0) }.joined()
print("デバイストークン : \(token)")
}
// APNs 登録失敗時に呼ばれる
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
print("APNs 登録に失敗しました : \(error.localizedDescription)")
}
}
......@@ -134,7 +160,33 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
let userInfo = notification.request.content.userInfo
print(debug: userInfo)
if !userInfo.isEmpty {
guard let senTypeStr = userInfo["sendType"] as? String else {
completionHandler([.badge, .sound, .banner, .list])
return
}
// switch PushNotificationTypes.SendType(Int32(sendTypeStr) ?? -1){
// case .NewChatMessage:
// //foreground時、通知の内容種別がチャットなら通知を表示しない
// let semaphore = DispatchSemaphore(value: 0)
// SessionManager().prepareSession(semaphore: semaphore)
// let sessionGetWatchingApp = SessionGetWatchingApp()
// let sessionGetWatcherApp = SessionGetWatcherApp()
//
// DispatchQueue(label: "WebAppRequest").async {
// semaphore.wait()
// sessionGetWatchingApp.ErrCnt = 0
// sessionGetWatchingApp.RequestGetWatchingApp("arrivedChatPush")
//
// sessionGetWatcherApp.ErrCnt = 0
// sessionGetWatcherApp.RequestGetWatcherApp("arrivedChatPush")
// }
// completionHandler([])
// return
// default:
// break
// }
}
completionHandler([[.banner, .badge, .sound]])
}
......
......@@ -50,7 +50,6 @@ class ServerSession{
do{
if let error = error{
let err = APIError.clientError
throw APIError.clientError
}
guard let indata = data, let inresponse = response as? HTTPURLResponse else {
......@@ -119,7 +118,7 @@ class ServerSession{
func deleteJson(_ req_url : URL, completion: @escaping ((Result<Data, APIError>)) -> Void){
var req = URLRequest(url: req_url)
req.httpMethod = "DELTE"
req.httpMethod = "DELETE"
req.addValue("application/json", forHTTPHeaderField: "Content-Type")
req.timeoutInterval = 20 // タイムアウト3秒 → Amedasでタイムアウトエラー20秒に変更
......
......@@ -118,7 +118,7 @@ class SharingData{
static var eca = Eca()
class Eca: ObservableObject{
@Published var ecaArea: Dictionary<String, RegisteredEca> = [:]
@Published var foucusEca: String? = nil
@Published var focusEca: String? = nil
@Published var isShowEcaAlert: Bool = false
func setEcaArea(key: String, value: RegisteredEca) {
......@@ -241,6 +241,7 @@ class SharingData{
static var pushHistory = PushHistory()
class PushHistory: ObservableObject{
@Published var pushHistoryData: Dictionary<Int, ResPushHistory> = [:]
@Published var focusPushHistory: Int? = nil
func setPushHistory(key: Int, value: ResPushHistory) {
pushHistoryData.updateValue(value, forKey: key)
......
......@@ -18,11 +18,13 @@ enum Tab: String, CaseIterable{
}
}
struct MainTabView: View {
@EnvironmentObject private var selectedTabModel: SelectedTabModel
@EnvironmentObject var selectedTabModel: SelectedTabModel
@EnvironmentObject private var sceneDelegate: SceneDelegate
@ObservedObject var my = SharingData.my
@State var isSignout = false
@State var isLogin = false
init() {
let appearance: UITabBarAppearance = UITabBarAppearance()
appearance.backgroundColor = .clear
......@@ -44,7 +46,7 @@ struct MainTabView: View {
NotificationView()
.tag(Tab.alert)
MenuView()
MenuView(isSignout: $isSignout)
.tag(Tab.menu)
}
.hideNativeTabBar()
......@@ -103,11 +105,9 @@ struct CustomTabBar: View {
} message: {
Text("Do you change an emargency mode?")
}
}
}
#Preview {
MainTabView()
.environmentObject(SelectedTabModel())
......
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