Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
Sailassist
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CpjJwWHV
Sailassist
Commits
6a060b4f
Commit
6a060b4f
authored
Jul 19, 2024
by
shigemi miura
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SignalR不具合修正
その他不具合修正
parent
9ef77c06
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
207 additions
and
213 deletions
+207
-213
AzureNotificationHubs-iOS.xcscheme
....xcuserdatad/xcschemes/AzureNotificationHubs-iOS.xcscheme
+1
-1
Pods-SailAssistTests.xcscheme
...miura.xcuserdatad/xcschemes/Pods-SailAssistTests.xcscheme
+1
-1
Pods-Sailassist.xcscheme
...data/miura.xcuserdatad/xcschemes/Pods-Sailassist.xcscheme
+1
-1
SwiftSignalRClient.xcscheme
...a/miura.xcuserdatad/xcschemes/SwiftSignalRClient.xcscheme
+1
-1
project.pbxproj
Seilassist/Sailassist.xcodeproj/project.pbxproj
+4
-5
Canary.xcscheme
...ilassist.xcodeproj/xcshareddata/xcschemes/Canary.xcscheme
+1
-1
QC.xcscheme
...t/Sailassist.xcodeproj/xcshareddata/xcschemes/QC.xcscheme
+1
-1
SailAssistTests.xcscheme
...xcodeproj/xcshareddata/xcschemes/SailAssistTests.xcscheme
+1
-1
Sailassist.xcscheme
...sist.xcodeproj/xcshareddata/xcschemes/Sailassist.xcscheme
+1
-1
GetMessage.swift
Seilassist/Sailassist/Chat/GetMessage.swift
+14
-12
ChatInputView.swift
Seilassist/Sailassist/Chat/View/ChatInputView.swift
+1
-1
ChatMemberView.swift
Seilassist/Sailassist/Chat/View/ChatMemberView.swift
+2
-2
ReqAckMessage.swift
Seilassist/Sailassist/Json/ReqAckMessage.swift
+2
-2
ReqChatModeMessage.swift
Seilassist/Sailassist/Json/ReqChatModeMessage.swift
+0
-1
ReqMessage.swift
Seilassist/Sailassist/Json/ReqMessage.swift
+1
-1
ResAckMessage.swift
Seilassist/Sailassist/Json/ResAckMessage.swift
+1
-1
ResChatMode.swift
Seilassist/Sailassist/Json/ResChatMode.swift
+1
-2
LocationViewModel.swift
Seilassist/Sailassist/LocationViewModel.swift
+6
-12
FuelSwitchingView.swift
Seilassist/Sailassist/Map/Task/View/FuelSwitchingView.swift
+67
-56
NgaNotificationView.swift
...assist/Sailassist/Map/Task/View/NgaNotificationView.swift
+58
-55
SailassistApp.swift
Seilassist/Sailassist/SailassistApp.swift
+19
-44
SharingData.swift
Seilassist/Sailassist/SharingData/SharingData.swift
+9
-9
MainTabView.swift
Seilassist/Sailassist/Tab/MainTabView.swift
+14
-2
No files found.
Seilassist/Pods/Pods.xcodeproj/xcuserdata/miura.xcuserdatad/xcschemes/AzureNotificationHubs-iOS.xcscheme
View file @
6a060b4f
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion =
"15
0
0"
LastUpgradeVersion =
"15
4
0"
version =
"1.3"
>
<BuildAction
parallelizeBuildables =
"YES"
...
...
Seilassist/Pods/Pods.xcodeproj/xcuserdata/miura.xcuserdatad/xcschemes/Pods-SailAssistTests.xcscheme
View file @
6a060b4f
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion =
"15
0
0"
LastUpgradeVersion =
"15
4
0"
version =
"1.3"
>
<BuildAction
parallelizeBuildables =
"YES"
...
...
Seilassist/Pods/Pods.xcodeproj/xcuserdata/miura.xcuserdatad/xcschemes/Pods-Sailassist.xcscheme
View file @
6a060b4f
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion =
"15
0
0"
LastUpgradeVersion =
"15
4
0"
version =
"1.3"
>
<BuildAction
parallelizeBuildables =
"YES"
...
...
Seilassist/Pods/Pods.xcodeproj/xcuserdata/miura.xcuserdatad/xcschemes/SwiftSignalRClient.xcscheme
View file @
6a060b4f
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion =
"15
0
0"
LastUpgradeVersion =
"15
4
0"
version =
"1.3"
>
<BuildAction
parallelizeBuildables =
"YES"
...
...
Seilassist/Sailassist.xcodeproj/project.pbxproj
View file @
6a060b4f
...
...
@@ -892,7 +892,7 @@
attributes
=
{
BuildIndependentTargetsInParallel
=
YES
;
LastSwiftUpdateCheck
=
1500
;
LastUpgradeCheck
=
15
0
0
;
LastUpgradeCheck
=
15
4
0
;
TargetAttributes
=
{
020B980F2AD8C3140029DE4C
=
{
CreatedOnToolsVersion
=
15.0
;
...
...
@@ -1307,7 +1307,7 @@
CODE_SIGN_ENTITLEMENTS
=
Sailassist/Sailassist.entitlements
;
CODE_SIGN_IDENTITY
=
"Apple Development"
;
CODE_SIGN_STYLE
=
Automatic
;
CURRENT_PROJECT_VERSION
=
3
4
;
CURRENT_PROJECT_VERSION
=
3
8
;
DEVELOPMENT_ASSET_PATHS
=
"\"Sailassist/Preview Content\""
;
DEVELOPMENT_TEAM
=
D2DC7QNNJ8
;
ENABLE_PREVIEWS
=
YES
;
...
...
@@ -1353,7 +1353,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME
=
AccentColor
;
CODE_SIGN_ENTITLEMENTS
=
Sailassist/Sailassist.entitlements
;
CODE_SIGN_STYLE
=
Automatic
;
CURRENT_PROJECT_VERSION
=
3
4
;
CURRENT_PROJECT_VERSION
=
3
8
;
DEVELOPMENT_ASSET_PATHS
=
"\"Sailassist/Preview Content\""
;
DEVELOPMENT_TEAM
=
D2DC7QNNJ8
;
ENABLE_PREVIEWS
=
YES
;
...
...
@@ -1524,7 +1524,6 @@
ONLY_ACTIVE_ARCH
=
YES
;
SDKROOT
=
iphoneos
;
SWIFT_ACTIVE_COMPILATION_CONDITIONS
=
"DEBUG $(inherited)"
;
SWIFT_COMPILATION_MODE
=
wholemodule
;
SWIFT_OPTIMIZATION_LEVEL
=
"-Onone"
;
};
name
=
QC
;
...
...
@@ -1537,7 +1536,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME
=
AccentColor
;
CODE_SIGN_ENTITLEMENTS
=
Sailassist/Sailassist.entitlements
;
CODE_SIGN_STYLE
=
Automatic
;
CURRENT_PROJECT_VERSION
=
3
4
;
CURRENT_PROJECT_VERSION
=
3
8
;
DEVELOPMENT_ASSET_PATHS
=
"\"Sailassist/Preview Content\""
;
DEVELOPMENT_TEAM
=
D2DC7QNNJ8
;
ENABLE_PREVIEWS
=
YES
;
...
...
Seilassist/Sailassist.xcodeproj/xcshareddata/xcschemes/Canary.xcscheme
View file @
6a060b4f
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion =
"15
0
0"
LastUpgradeVersion =
"15
4
0"
version =
"1.7"
>
<BuildAction
parallelizeBuildables =
"YES"
...
...
Seilassist/Sailassist.xcodeproj/xcshareddata/xcschemes/QC.xcscheme
View file @
6a060b4f
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion =
"15
0
0"
LastUpgradeVersion =
"15
4
0"
version =
"1.7"
>
<BuildAction
parallelizeBuildables =
"YES"
...
...
Seilassist/Sailassist.xcodeproj/xcshareddata/xcschemes/SailAssistTests.xcscheme
View file @
6a060b4f
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion =
"15
1
0"
LastUpgradeVersion =
"15
4
0"
version =
"1.7"
>
<BuildAction
parallelizeBuildables =
"YES"
...
...
Seilassist/Sailassist.xcodeproj/xcshareddata/xcschemes/Sailassist.xcscheme
View file @
6a060b4f
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion =
"15
0
0"
LastUpgradeVersion =
"15
4
0"
version =
"1.7"
>
<BuildAction
parallelizeBuildables =
"YES"
...
...
Seilassist/Sailassist/Chat/GetMessage.swift
View file @
6a060b4f
...
...
@@ -50,11 +50,9 @@ class GetMessage {
for
message
in
SharingData
.
message
.
messages
{
//SSV Mobileからの受信メッセージ
if
message
.
location
==
1
{
msgCnt
=
msgCnt
+
1
if
((
message
.
viewer
.
first
(
where
:
{
$0
.
location
==
2
}))
!=
nil
){
viewCnt
=
viewCnt
+
1
}
msgCnt
=
msgCnt
+
1
if
((
message
.
viewer
.
first
(
where
:
{
$0
.
id
==
String
(
SharingData
.
my
.
id
)}))
!=
nil
){
viewCnt
=
viewCnt
+
1
}
}
...
...
@@ -68,18 +66,22 @@ class GetMessage {
for
message
in
SharingData
.
message
.
messages
{
//Sail Assist側で既読が無い場合(既読確認)
var
unRead
=
true
if
((
message
.
viewer
.
first
(
where
:
{
$0
.
location
==
2
}))
!=
nil
)
{
if
((
message
.
viewer
.
first
(
where
:
{
$0
.
id
==
String
(
SharingData
.
my
.
id
)}))
!=
nil
)
{
unRead
=
false
//既読状態
}
if
unRead
{
let
signalRService
=
SignalR
()
signalRService
.
ackMessage
(
messageId
:
message
.
messageId
)
let
msgIndex
=
SharingData
.
message
.
messages
.
firstIndex
(
where
:
{
$0
.
messageId
==
message
.
messageId
})
if
let
index
=
msgIndex
{
let
viewer
=
Viewer
(
time
:
DateTextLib
.
Date2ISO8601Text
(
Date
()),
location
:
2
,
id
:
""
)
SharingData
.
message
.
messages
[
index
]
.
viewer
.
append
(
viewer
)
signalRService
.
ackMessage
(
messageId
:
message
.
messageId
)
{
error
in
if
let
e
=
error
{
print
(
debug
:
"error chat:
\(
e
)
"
)
}
else
{
let
msgIndex
=
SharingData
.
message
.
messages
.
firstIndex
(
where
:
{
$0
.
messageId
==
message
.
messageId
})
if
let
index
=
msgIndex
{
let
viewer
=
Viewer
(
time
:
DateTextLib
.
Date2ISO8601Text
(
Date
()),
location
:
2
,
id
:
String
(
SharingData
.
my
.
id
))
SharingData
.
message
.
messages
[
index
]
.
viewer
.
append
(
viewer
)
}
}
}
}
}
...
...
Seilassist/Sailassist/Chat/View/ChatInputView.swift
View file @
6a060b4f
...
...
@@ -177,7 +177,7 @@ struct ChatInputView: View {
*/
func
responseChatMessage
(
error
:
Error
?)
{
if
let
e
=
error
{
print
(
debug
:
"Error:
\(
e
)
"
)
print
(
debug
:
"Error
chat
:
\(
e
)
"
)
msg
.
messages
.
removeLast
()
//最後に追加したメッセージを削除
isChatAlert
=
true
}
else
{
...
...
Seilassist/Sailassist/Chat/View/ChatMemberView.swift
View file @
6a060b4f
...
...
@@ -34,10 +34,10 @@ struct ChatMemberView: View {
.
listRowBackground
(
ColorSet
.
ModalWindowFront
.
color
)
.
listRowSeparatorTint
(
ColorSet
.
LineModal
.
color
)
}
.
scrollDisabled
(
tru
e
)
.
scrollDisabled
(
fals
e
)
.
scrollContentBackground
(
.
hidden
)
.
background
(
ColorSet
.
ModalWindowBack
.
color
)
Spacer
()
}
}
...
...
Seilassist/Sailassist/Json/ReqAckMessage.swift
View file @
6a060b4f
...
...
@@ -11,8 +11,8 @@ struct ReqAckMessage : Codable {
var
shipId
:
Int
=
0
var
messageId
:
String
=
""
//確認したMessageId
var
time
:
String
=
""
//投稿日時 2023-11-02T05:25:49.4362123Z
var
location
:
Int
=
0
//1:Shore / 2:Ship
var
from
e
Id
:
String
=
""
//ユーザーID
var
location
:
Int
=
2
//1:Shore / 2:Ship
var
fromId
:
String
=
""
//ユーザーID
init
(
shipId
:
Int
,
messageId
:
String
)
{
self
.
shipId
=
shipId
...
...
Seilassist/Sailassist/Json/ReqChatModeMessage.swift
View file @
6a060b4f
...
...
@@ -13,7 +13,6 @@ import Foundation
*/
struct
ReqChatModeMessage
:
Codable
{
var
shipId
:
Int
=
0
var
time
:
String
=
""
//投稿日時 2023-11-02T05:25:49.4362123Z
var
location
:
Int
=
0
//1:Shore / 2:Ship
var
fromeId
:
String
=
""
//ユーザーID
var
mode
:
Int
=
0
//0:通常 / 1:Warning中
...
...
Seilassist/Sailassist/Json/ReqMessage.swift
View file @
6a060b4f
...
...
@@ -14,7 +14,7 @@ struct ReqMessage : Codable {
var
time
:
String
=
""
//2023-11-02T05:25:49.4362123Z
var
location
:
Int
=
0
//1:Shore / 2:Ship
var
from
:
String
=
""
//投稿者名
var
from
eId
:
String
=
""
//ユーザーID
var
from
Id
:
String
=
""
//ユーザーID
var
message
:
String
=
""
//テキスト
var
stampId
:
Int
=
0
//スタンプ番号 0:Fire〜
...
...
Seilassist/Sailassist/Json/ResAckMessage.swift
View file @
6a060b4f
...
...
@@ -12,5 +12,5 @@ struct ResAckMessage: Codable {
var
messageId
:
String
//UUID
var
time
:
String
//投稿日時
var
location
:
Int
//1:Shore、2:Ship
var
fromId
:
String
//ユーザーID
var
fromId
:
String
?
//ユーザーID
}
Seilassist/Sailassist/Json/ResChatMode.swift
View file @
6a060b4f
...
...
@@ -9,8 +9,7 @@ import Foundation
struct
ResChatMode
:
Codable
{
var
shipId
:
Int
var
time
:
String
//投稿日時
var
location
:
Int
//1:Shore、2:Ship
var
fromId
:
String
//ユーザーID
var
fromId
:
String
?
//ユーザーID
var
mode
:
Int
//0:通常、1:Warning中
}
Seilassist/Sailassist/LocationViewModel.swift
View file @
6a060b4f
...
...
@@ -76,6 +76,12 @@ class LocationViewModel: NSObject, ObservableObject, CLLocationManagerDelegate {
}
func
locationManager
(
_
manager
:
CLLocationManager
,
didUpdateLocations
locations
:
[
CLLocation
])
{
let
eca
=
EcaTask
()
eca
.
start
()
let
ngaList
=
GetNgaList
()
ngaList
.
start
()
if
let
newLocation
=
locations
.
first
{
print
(
debug
:
"called locationManager"
)
lastSeenLocation
=
newLocation
...
...
@@ -86,26 +92,14 @@ class LocationViewModel: NSObject, ObservableObject, CLLocationManagerDelegate {
if
Preferences
.
LocationType
==
0
{
ecaTask
.
checkEca
()
ngaTask
.
checkNga
()
if
SharingData
.
message
.
mode
{
let
message
=
GetMessage
()
message
.
start
()
}
}
}
if
Preferences
.
LocationType
==
1
{
if
serverLocationInterval
<=
DateTextLib
.
Date2UnixTime
(
date
:
Date
())
{
let
eca
=
EcaTask
()
eca
.
start
()
self
.
ecaTask
.
checkEca
()
self
.
ngaTask
.
checkNga
()
if
SharingData
.
message
.
mode
{
let
message
=
GetMessage
()
message
.
start
()
}
serverLocationInterval
=
DateTextLib
.
Date2UnixTime
(
date
:
Date
())
+
Int64
(
TimerInterval
)
}
}
...
...
Seilassist/Sailassist/Map/Task/View/FuelSwitchingView.swift
View file @
6a060b4f
...
...
@@ -10,12 +10,10 @@ import SwiftUI
struct
FuelSwitchingView
:
View
{
@ObservedObject
var
taskViewModel
:
TaskViewModel
@ObservedObject
var
ecaData
=
SharingData
.
eca
@State
var
isDeleteAlert
:
Bool
=
false
@State
var
isRunningStopAlert
:
Bool
=
false
let
deleteEcaArea
=
DeleteEcaArea
()
var
body
:
some
View
{
VStack
{
VStack
{
ForEach
(
ecaData
.
ecaArea
.
map
{
$0
.
1
}
.
filter
{
$0
.
isEnable
}
.
sorted
{
$0
.
areaId
<
$1
.
areaId
},
id
:
\
.
name
){
eca
in
VStack
{
HStack
{
...
...
@@ -36,7 +34,7 @@ struct FuelSwitchingView: View {
HStack
{
Circle
()
.
frame
(
width
:
14
,
height
:
14
)
.
foregroundColor
(
eca
.
isRunning
?
ColorSet
.
PrimaryActiveIcon
.
color
:
ColorSet
.
TaskStateIcon
.
color
)
.
foregroundColor
(
eca
.
isRunning
==
true
?
ColorSet
.
PrimaryActiveIcon
.
color
:
ColorSet
.
TaskStateIcon
.
color
)
Spacer
()
.
frame
(
width
:
10
)
}
...
...
@@ -51,60 +49,21 @@ struct FuelSwitchingView: View {
Spacer
()
Menu
{
Text
(
eca
.
name
)
Button
{
taskViewModel
.
edittingEcaArea
=
eca
taskViewModel
.
ecaName
=
eca
.
name
taskViewModel
.
viewMode
=
.
EcaSetting
}
label
:
{
Text
(
"Edit Notice Setting"
)
}
Button
{
taskViewModel
.
edittingEcaArea
=
eca
taskViewModel
.
ecaName
=
eca
.
name
isDeleteAlert
=
true
}
label
:
{
Text
(
"Delete ECA Task"
)
}
}
label
:
{
Image
(
systemName
:
"ellipsis"
)
.
frame
(
width
:
22
,
height
:
22
)
.
foregroundColor
(
eca
.
isRunning
?
ColorSet
.
Splash
.
color
:
ColorSet
.
Slidebar
.
color
)
}
.
disabled
(
eca
.
isRunning
)
.
alert
(
"Delete"
,
isPresented
:
$
isDeleteAlert
)
{
Button
(
"Yes"
)
{
if
let
ecaArea
=
taskViewModel
.
edittingEcaArea
{
var
newData
=
ecaArea
newData
.
isEnable
=
false
newData
.
status
=
EcaState
.
cancel
ecaData
.
editEcaArea
(
key
:
ecaArea
.
areaId
,
value
:
newData
,
type
:
EcaOperation
.
Delete
)
deleteEcaArea
.
start
(
ecaId
:
ecaArea
.
areaId
)
}
taskViewModel
.
edittingEcaArea
=
nil
}
Button
(
"No"
){}
}
message
:
{
Text
(
"Have you finished "
+
taskViewModel
.
ecaName
+
" fuel switching?"
)
}
.
alert
(
"Fuel Switching"
,
isPresented
:
$
isRunningStopAlert
)
{
Button
(
"Yes"
)
{
if
let
ecaArea
=
taskViewModel
.
edittingEcaArea
{
var
newData
=
ecaArea
newData
.
isRunning
=
false
newData
.
status
=
EcaState
.
end
ecaData
.
editEcaArea
(
key
:
ecaArea
.
areaId
,
value
:
newData
,
type
:
EcaOperation
.
End
)
EcaMenuView
(
taskViewModel
:
taskViewModel
,
ecaData
:
ecaData
,
eca
:
eca
)
.
alert
(
"Fuel Switching"
,
isPresented
:
$
isRunningStopAlert
)
{
Button
(
"Yes"
)
{
if
let
ecaArea
=
taskViewModel
.
edittingEcaArea
{
var
newData
=
ecaArea
newData
.
isRunning
=
false
newData
.
status
=
EcaState
.
end
ecaData
.
editEcaArea
(
key
:
ecaArea
.
areaId
,
value
:
newData
,
type
:
EcaOperation
.
End
)
}
taskViewModel
.
edittingEcaArea
=
nil
}
taskViewModel
.
edittingEcaArea
=
nil
Button
(
"No"
){}
}
message
:
{
Text
(
"Have you finished "
+
taskViewModel
.
ecaName
+
" fuel switching?"
)
}
Button
(
"No"
){}
}
message
:
{
Text
(
"Have you finished "
+
taskViewModel
.
ecaName
+
" fuel switching?"
)
}
}
.
frame
(
height
:
60
)
.
padding
(
.
horizontal
,
30
)
...
...
@@ -131,6 +90,58 @@ struct FuelSwitchingView: View {
}
}
struct
EcaMenuView
:
View
{
@ObservedObject
var
taskViewModel
:
TaskViewModel
@ObservedObject
var
ecaData
=
SharingData
.
eca
@Environment(\ .colorScheme)
var
colorScheme
@State
var
isDeleteAlert
:
Bool
=
false
let
deleteEcaArea
=
DeleteEcaArea
()
var
eca
:
RegisteredEca
var
body
:
some
View
{
Menu
{
Text
(
eca
.
name
)
Button
{
taskViewModel
.
edittingEcaArea
=
eca
taskViewModel
.
ecaName
=
eca
.
name
taskViewModel
.
viewMode
=
.
EcaSetting
}
label
:
{
Text
(
"Edit Notice Setting"
)
}
Button
{
taskViewModel
.
edittingEcaArea
=
eca
taskViewModel
.
ecaName
=
eca
.
name
isDeleteAlert
=
true
}
label
:
{
Text
(
"Delete ECA Task"
)
}
}
label
:
{
Image
(
systemName
:
"ellipsis"
)
.
frame
(
width
:
22
,
height
:
22
)
.
opacity
(
eca
.
isRunning
==
true
?
0.2
:
1.0
)
.
foregroundColor
(
colorScheme
==
.
light
?
.
black
:
.
white
)
}
.
disabled
(
eca
.
isRunning
)
.
alert
(
"Delete"
,
isPresented
:
$
isDeleteAlert
)
{
Button
(
"Yes"
)
{
if
let
ecaArea
=
taskViewModel
.
edittingEcaArea
{
var
newData
=
ecaArea
newData
.
isEnable
=
false
newData
.
status
=
EcaState
.
cancel
ecaData
.
editEcaArea
(
key
:
ecaArea
.
areaId
,
value
:
newData
,
type
:
EcaOperation
.
Delete
)
deleteEcaArea
.
start
(
ecaId
:
ecaArea
.
areaId
)
}
taskViewModel
.
edittingEcaArea
=
nil
}
Button
(
"No"
){}
}
message
:
{
Text
(
"Have you finished "
+
taskViewModel
.
ecaName
+
" fuel switching?"
)
}
}
}
#Preview {
FuelSwitchingView
(
taskViewModel
:
TaskViewModel
())
...
...
Seilassist/Sailassist/Map/Task/View/NgaNotificationView.swift
View file @
6a060b4f
...
...
@@ -10,14 +10,10 @@ import SwiftUI
struct
NgaNotificationView
:
View
{
@ObservedObject
var
taskViewModel
:
TaskViewModel
@ObservedObject
var
ngaData
=
SharingData
.
nga
@Environment(\ .colorScheme)
var
colorScheme
@State
var
isDelete
:
Bool
=
false
@State
var
isRunningStopNga
:
Bool
=
false
var
body
:
some
View
{
VStack
{
ForEach
(
ngaData
.
ngaArea
.
map
{
$0
.
1
}
.
sorted
{
$0
.
name
<
$1
.
name
},
id
:
\
.
areaId
)
{
nga
in
// ForEach(ngaData.ngaArea.map{ $0.1 }, id: \.areaId) { nga in
VStack
{
HStack
{
//NGA開始・終了ボタン
...
...
@@ -25,11 +21,8 @@ struct NgaNotificationView: View {
var
newData
=
nga
newData
.
isRunning
.
toggle
()
newData
.
passingCnt
=
0
if
newData
.
isRunning
{
ngaData
.
editNgaArea
(
value
:
newData
,
type
:
NgaOperation
.
Running
)
}
else
{
ngaData
.
editNgaArea
(
value
:
newData
,
type
:
NgaOperation
.
Cancel
)
}
ngaData
.
editNgaArea
(
value
:
newData
,
type
:
checkRunning
(
isRunning
:
newData
.
isRunning
))
}
label
:
{
HStack
{
Circle
()
...
...
@@ -50,52 +43,7 @@ struct NgaNotificationView: View {
Spacer
()
Menu
{
Text
(
nga
.
name
)
Button
{
ngaData
.
editNga
=
nga
taskViewModel
.
viewMode
=
.
NgaSetting
ngaData
.
editType
=
EditNgaType
.
nonEdit
}
label
:
{
Text
(
"Edit NGA Setting"
)
}
//削除
Button
{
ngaData
.
editNga
=
nga
isDelete
=
true
}
label
:
{
Text
(
"Delete NGA Notification"
)
}
.
disabled
(
nga
.
isLock
)
}
label
:
{
Image
(
systemName
:
"ellipsis"
)
.
frame
(
width
:
22
,
height
:
22
)
.
opacity
(
nga
.
isRunning
?
0.2
:
1.0
)
.
foregroundColor
(
colorScheme
==
.
light
?
.
black
:
.
white
)
}
.
disabled
(
nga
.
isRunning
)
.
alert
(
"Delete"
,
isPresented
:
$
isDelete
)
{
Button
(
"Yes"
)
{
if
let
newData
=
ngaData
.
editNga
{
ngaData
.
editNgaArea
(
value
:
newData
,
type
:
NgaOperation
.
Delete
)
ngaData
.
editNga
=
nil
}
}
Button
(
"No"
){}
}
message
:
{
Text
(
"Delete "
+
nga
.
name
+
" ?"
)
}
.
alert
(
"NGA Switching"
,
isPresented
:
$
isRunningStopNga
)
{
Button
(
"Yes"
)
{
var
newData
=
nga
newData
.
isRunning
=
false
ngaData
.
editNgaArea
(
value
:
newData
,
type
:
NgaOperation
.
Cancel
)
}
Button
(
"No"
){}
}
message
:
{
Text
(
"Have you finished "
+
nga
.
name
+
"switching?"
)
}
NgaMenuView
(
taskViewModel
:
taskViewModel
,
ngaData
:
ngaData
,
nga
:
nga
)
}
.
frame
(
height
:
60
)
.
padding
(
.
horizontal
,
30
)
...
...
@@ -129,8 +77,63 @@ struct NgaNotificationView: View {
Spacer
()
}
}
func
checkRunning
(
isRunning
:
Bool
)
->
NgaOperation
{
var
type
=
NgaOperation
.
Cancel
if
isRunning
==
true
{
type
=
NgaOperation
.
Running
}
return
type
}
}
struct
NgaMenuView
:
View
{
@ObservedObject
var
taskViewModel
:
TaskViewModel
@ObservedObject
var
ngaData
=
SharingData
.
nga
@Environment(\ .colorScheme)
var
colorScheme
@State
var
isDelete
:
Bool
=
false
var
nga
:
RegisteredNga
var
body
:
some
View
{
Menu
{
Text
(
nga
.
name
)
Button
{
ngaData
.
editNga
=
nga
taskViewModel
.
viewMode
=
.
NgaSetting
ngaData
.
editType
=
EditNgaType
.
nonEdit
}
label
:
{
Text
(
"Edit NGA Setting"
)
}
//削除
Button
{
ngaData
.
editNga
=
nga
isDelete
=
true
}
label
:
{
Text
(
"Delete NGA Notification"
)
}
.
disabled
(
nga
.
isLock
)
}
label
:
{
Image
(
systemName
:
"ellipsis"
)
.
frame
(
width
:
22
,
height
:
22
)
.
opacity
(
nga
.
isRunning
?
0.2
:
1.0
)
.
foregroundColor
(
colorScheme
==
.
light
?
.
black
:
.
white
)
}
.
disabled
(
nga
.
isRunning
)
.
alert
(
"Delete"
,
isPresented
:
$
isDelete
)
{
Button
(
"Yes"
)
{
if
let
newData
=
ngaData
.
editNga
{
ngaData
.
editNgaArea
(
value
:
newData
,
type
:
NgaOperation
.
Delete
)
}
}
Button
(
"No"
){}
}
message
:
{
if
let
editNga
=
ngaData
.
editNga
{
Text
(
"Delete "
+
editNga
.
name
+
" ?"
)
}
}
}
}
#Preview {
NgaNotificationView
(
taskViewModel
:
TaskViewModel
())
...
...
Seilassist/Sailassist/SailassistApp.swift
View file @
6a060b4f
...
...
@@ -111,7 +111,7 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M
connection
=
HubConnectionBuilder
(
url
:
URL
(
string
:
HttpRequestType
.
SignalR
.
rawValue
)
!
)
.
withHubConnectionDelegate
(
delegate
:
hubConnectionDelegate
!
)
.
withAutoReconnect
()
// .withLogging(minLogLevel: .error)
// .withLogging(minLogLevel: .error)
.
withLogging
(
minLogLevel
:
.
debug
)
.
withHubConnectionOptions
(
configureHubConnectionOptions
:
{
options
in
options
.
keepAliveInterval
=
20
})
.
build
()
...
...
@@ -119,30 +119,18 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M
if
let
r_connection
=
connection
{
// r_connection.stop()
//callbackが作成されない?
r_connection
.
on
(
method
:
"
c
hatMessage"
,
callback
:
{
(
message
:
ResChatMessage
)
in
r_connection
.
on
(
method
:
"
C
hatMessage"
,
callback
:
{
(
message
:
ResChatMessage
)
in
self
.
handleChatMessage
(
message
:
message
)
})
r_connection
.
on
(
method
:
"
a
ckMessage"
,
callback
:
{
(
message
:
ResAckMessage
)
in
r_connection
.
on
(
method
:
"
A
ckMessage"
,
callback
:
{
(
message
:
ResAckMessage
)
in
self
.
handleAckMessage
(
message
:
message
)
})
r_connection
.
on
(
method
:
"
c
hatMode"
,
callback
:
{
(
message
:
ResChatMode
)
in
r_connection
.
on
(
method
:
"
C
hatMode"
,
callback
:
{
(
message
:
ResChatMode
)
in
self
.
handleChatMode
(
message
:
message
)
})
// r_connection.on(method: "chatMode", callback: { (jsonResponse: Data) in
// print(debug: "Test:\(jsonResponse)")
//
// do {
// let decoder = JSONDecoder()
// let resChatMode: ResChatMode = try decoder.decode(ResChatMode.self, from: jsonResponse)
// self.handleChatMode(message: resChatMode)
// } catch(let error) {
// print(error.localizedDescription)
// }
// })
r_connection
.
start
()
}
...
...
@@ -191,22 +179,21 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M
}
private
func
handleChatMessage
(
message
:
ResChatMessage
)
{
let
ownMsg
=
ChatMessage
(
shipId
:
message
.
shipId
,
messageId
:
message
.
messageId
,
type
:
message
.
type
,
time
:
message
.
time
,
location
:
message
.
location
,
from
:
message
.
from
,
message
:
message
.
message
,
stampId
:
message
.
stampId
,
viewer
:
[])
let
ownMsg
=
ChatMessage
(
shipId
:
message
.
shipId
,
messageId
:
message
.
messageId
,
type
:
message
.
type
,
time
:
message
.
time
,
location
:
message
.
location
,
from
:
message
.
from
,
fromId
:
message
.
fromId
,
message
:
message
.
message
,
stampId
:
message
.
stampId
,
viewer
:
[])
self
.
msg
.
messages
.
append
(
ownMsg
)
let
message
=
GetMessage
()
message
.
checkUnreadMessages
()
}
private
func
handleAckMessage
(
message
:
ResAckMessage
)
{
let
msgIndex
=
self
.
msg
.
messages
.
firstIndex
(
where
:
{
$0
.
messageId
==
message
.
messageId
})
if
let
index
=
msgIndex
{
let
viewer
=
Viewer
(
time
:
message
.
time
,
location
:
message
.
location
,
id
:
message
.
fromId
)
self
.
msg
.
messages
[
index
]
.
viewer
.
append
(
viewer
)
if
let
fromId
=
message
.
fromId
{
let
viewer
=
Viewer
(
time
:
message
.
time
,
location
:
message
.
location
,
id
:
fromId
)
self
.
msg
.
messages
[
index
]
.
viewer
.
append
(
viewer
)
}
else
{
let
viewer
=
Viewer
(
time
:
message
.
time
,
location
:
message
.
location
,
id
:
""
)
self
.
msg
.
messages
[
index
]
.
viewer
.
append
(
viewer
)
}
}
let
message
=
GetMessage
()
message
.
checkUnreadMessages
()
}
private
func
handleChatMode
(
message
:
ResChatMode
)
{
...
...
@@ -256,7 +243,7 @@ class SignalR: NSObject {
request
.
time
=
DateTextLib
.
Date2ISO8601Text
(
Date
())
request
.
location
=
2
//1:Shore , 2:Ship
request
.
from
=
Preferences
.
UserName
//投稿者名
request
.
from
e
Id
=
String
(
SharingData
.
my
.
id
)
//ユーザーID
request
.
fromId
=
String
(
SharingData
.
my
.
id
)
//ユーザーID
if
msg
.
mode
{
request
.
message
=
"⚠️
\n
"
+
message
}
else
{
...
...
@@ -265,30 +252,22 @@ class SignalR: NSObject {
request
.
stampId
=
0
//スタンプ番号 0:Fire~
if
message
!=
""
{
connection
!.
invoke
(
method
:
"chatMessage"
,
request
,
invocationDidComplete
:
completion
)
let
ownMsg
=
ChatMessage
(
shipId
:
request
.
shipId
,
messageId
:
request
.
messageId
,
type
:
request
.
type
,
time
:
request
.
time
,
location
:
request
.
location
,
from
:
request
.
from
,
message
:
request
.
message
,
stampId
:
request
.
stampId
,
viewer
:
[])
self
.
msg
.
messages
.
append
(
ownMsg
)
connection
!.
invoke
(
method
:
"ChatMessage"
,
request
,
invocationDidComplete
:
completion
)
}
}
func
ackMessage
(
messageId
:
String
)
{
func
ackMessage
(
messageId
:
String
,
completion
:
@escaping
(
_
error
:
Error
?)
->
Void
)
{
var
request
=
ReqAckMessage
(
shipId
:
Preferences
.
shipId
,
messageId
:
messageId
)
request
.
time
=
DateTextLib
.
Date2ISO8601Text
(
Date
())
request
.
location
=
2
//1:Shore , 2:Ship
request
.
from
e
Id
=
String
(
SharingData
.
my
.
id
)
//ユーザーID
request
.
fromId
=
String
(
SharingData
.
my
.
id
)
//ユーザーID
if
messageId
!=
""
{
connection
!.
invoke
(
method
:
"ackMessage"
,
request
)
{
error
in
if
let
e
=
error
{
print
(
debug
:
"Error:
\(
e
)
"
)
}
}
connection
!.
invoke
(
method
:
"AckMessage"
,
request
,
invocationDidComplete
:
completion
)
}
}
func
chatMode
(
mode
:
Bool
)
{
func
chatMode
(
mode
:
Bool
,
completion
:
@escaping
(
_
error
:
Error
?)
->
Void
)
{
var
request
=
ReqChatModeMessage
(
shipId
:
Preferences
.
shipId
)
request
.
time
=
DateTextLib
.
Date2ISO8601Text
(
Date
())
request
.
location
=
2
//1:Shore , 2:Ship
request
.
fromeId
=
String
(
SharingData
.
my
.
id
)
//ユーザーID
if
mode
==
true
{
...
...
@@ -296,11 +275,7 @@ class SignalR: NSObject {
}
else
{
request
.
mode
=
0
}
connection
!.
invoke
(
method
:
"chatMode"
,
request
)
{
error
in
if
let
e
=
error
{
print
(
debug
:
"Error:
\(
e
)
"
)
}
}
connection
!.
invoke
(
method
:
"ChatMode"
,
request
,
invocationDidComplete
:
completion
)
}
}
...
...
Seilassist/Sailassist/SharingData/SharingData.swift
View file @
6a060b4f
...
...
@@ -145,7 +145,7 @@ class SharingData{
task
.
startRange
=
value
.
swStart
task
.
finishRange
=
value
.
swFinish
task
.
status
=
serverRunning
task
.
lastUpdateTime
=
DateTextLib
.
Date2
BCD
Text
(
Date
())
task
.
lastUpdateTime
=
DateTextLib
.
Date2
ISO8601
Text
(
Date
())
setEcaArea
.
start
(
eca
:
task
)
case
EcaOperation
.
Insert
:
task
.
id
=
UUID
()
.
uuidString
...
...
@@ -156,7 +156,7 @@ class SharingData{
task
.
startRange
=
value
.
swStart
task
.
finishRange
=
value
.
swFinish
task
.
status
=
serverRegister
task
.
lastUpdateTime
=
DateTextLib
.
Date2
BCD
Text
(
Date
())
task
.
lastUpdateTime
=
DateTextLib
.
Date2
ISO8601
Text
(
Date
())
setEcaArea
.
start
(
eca
:
task
)
case
EcaOperation
.
Delete
:
let
deleteEcaArea
=
DeleteEcaArea
()
...
...
@@ -172,7 +172,7 @@ class SharingData{
if
value
.
isEnable
&&
value
.
isRunning
{
task
.
status
=
setEcaStatus
(
eca
:
value
)
}
task
.
lastUpdateTime
=
DateTextLib
.
Date2
BCD
Text
(
Date
())
task
.
lastUpdateTime
=
DateTextLib
.
Date2
ISO8601
Text
(
Date
())
setEcaArea
.
start
(
eca
:
task
)
case
EcaOperation
.
Start
:
task
.
id
=
value
.
id
...
...
@@ -185,7 +185,7 @@ class SharingData{
if
value
.
isEnable
&&
value
.
isRunning
{
task
.
status
=
setEcaStatus
(
eca
:
value
)
}
task
.
lastUpdateTime
=
DateTextLib
.
Date2
BCD
Text
(
Date
())
task
.
lastUpdateTime
=
DateTextLib
.
Date2
ISO8601
Text
(
Date
())
setEcaArea
.
start
(
eca
:
task
)
case
EcaOperation
.
Finish
:
task
.
id
=
value
.
id
...
...
@@ -198,7 +198,7 @@ class SharingData{
if
value
.
isEnable
{
task
.
status
=
setEcaStatus
(
eca
:
value
)
}
task
.
lastUpdateTime
=
DateTextLib
.
Date2
BCD
Text
(
Date
())
task
.
lastUpdateTime
=
DateTextLib
.
Date2
ISO8601
Text
(
Date
())
setEcaArea
.
start
(
eca
:
task
)
case
EcaOperation
.
End
:
task
.
id
=
value
.
id
...
...
@@ -211,7 +211,7 @@ class SharingData{
if
value
.
isEnable
{
task
.
status
=
setEcaStatus
(
eca
:
value
)
}
task
.
lastUpdateTime
=
DateTextLib
.
Date2
BCD
Text
(
Date
())
task
.
lastUpdateTime
=
DateTextLib
.
Date2
ISO8601
Text
(
Date
())
setEcaArea
.
start
(
eca
:
task
)
case
EcaOperation
.
Incomplete
:
task
.
id
=
value
.
id
...
...
@@ -224,7 +224,7 @@ class SharingData{
if
value
.
isEnable
{
task
.
status
=
setEcaStatus
(
eca
:
value
)
}
task
.
lastUpdateTime
=
DateTextLib
.
Date2
BCD
Text
(
Date
())
task
.
lastUpdateTime
=
DateTextLib
.
Date2
ISO8601
Text
(
Date
())
setEcaArea
.
start
(
eca
:
task
)
case
EcaOperation
.
Cancel
:
task
.
id
=
value
.
id
...
...
@@ -237,7 +237,7 @@ class SharingData{
if
value
.
isEnable
{
task
.
status
=
setEcaStatus
(
eca
:
value
)
}
task
.
lastUpdateTime
=
DateTextLib
.
Date2
BCD
Text
(
Date
())
task
.
lastUpdateTime
=
DateTextLib
.
Date2
ISO8601
Text
(
Date
())
setEcaArea
.
start
(
eca
:
task
)
case
EcaOperation
.
Change
:
task
.
id
=
value
.
id
...
...
@@ -250,7 +250,7 @@ class SharingData{
if
value
.
isEnable
&&
value
.
isRunning
{
task
.
status
=
setEcaStatus
(
eca
:
value
)
}
task
.
lastUpdateTime
=
DateTextLib
.
Date2
BCD
Text
(
Date
())
task
.
lastUpdateTime
=
DateTextLib
.
Date2
ISO8601
Text
(
Date
())
setEcaArea
.
start
(
eca
:
task
)
}
ecaArea
.
updateValue
(
value
,
forKey
:
key
)
...
...
Seilassist/Sailassist/Tab/MainTabView.swift
View file @
6a060b4f
...
...
@@ -177,9 +177,10 @@ struct CustomTabBar: View {
.
background
(
ColorSet
.
BottomNav
.
color
)
.
alert
(
""
,
isPresented
:
$
selectedTabModel
.
isShowChangeEmrMode
)
{
Button
(
"Yes"
){
SharingData
.
message
.
changeMode
()
var
chatMode
=
SharingData
.
message
.
mode
chatMode
.
toggle
()
let
signalRService
=
SignalR
()
signalRService
.
chatMode
(
mode
:
SharingData
.
message
.
m
ode
)
signalRService
.
chatMode
(
mode
:
chatMode
,
completion
:
responseChatM
ode
)
}
Button
(
"No"
){
...
...
@@ -206,6 +207,17 @@ struct CustomTabBar: View {
Text
(
"A new version of this app is available."
)
}
}
/**
* Warninngモードレスポンス
*/
func
responseChatMode
(
error
:
Error
?)
{
if
let
e
=
error
{
print
(
debug
:
"Error chat:
\(
e
)
"
)
}
else
{
SharingData
.
message
.
changeMode
()
}
}
}
#Preview {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment