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
ec125999
Commit
ec125999
authored
Jul 22, 2024
by
shigemi miura
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
チャットワーニングモード対応
チャット・通知 既読マーク
parent
d074fcd0
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
210 additions
and
122 deletions
+210
-122
project.pbxproj
Seilassist/Sailassist.xcodeproj/project.pbxproj
+3
-3
NotificationView.swift
Seilassist/Sailassist/Alert/NotificationView.swift
+9
-0
NotificationContentView.swift
...ssist/Sailassist/Alert/View/NotificationContentView.swift
+0
-3
ChatView.swift
Seilassist/Sailassist/Chat/ChatView.swift
+44
-10
ChatMemberView.swift
Seilassist/Sailassist/Chat/View/ChatMemberView.swift
+5
-3
ChatTitleView.swift
Seilassist/Sailassist/Chat/View/ChatTitleView.swift
+4
-2
ChatUrlImageView.swift
Seilassist/Sailassist/Chat/View/ChatUrlImageView.swift
+5
-2
ChatUrlRawImageView.swift
Seilassist/Sailassist/Chat/View/ChatUrlRawImageView.swift
+1
-0
MyChatContentView.swift
Seilassist/Sailassist/Chat/View/MyChatContentView.swift
+48
-38
OtherChatContentView.swift
Seilassist/Sailassist/Chat/View/OtherChatContentView.swift
+24
-37
ReqMessage.swift
Seilassist/Sailassist/Json/ReqMessage.swift
+1
-0
ResChatMessage.swift
Seilassist/Sailassist/Json/ResChatMessage.swift
+1
-0
ResGetMessages.swift
Seilassist/Sailassist/Json/ResGetMessages.swift
+7
-5
MapRepresentable.swift
Seilassist/Sailassist/Map/MapRepresentable.swift
+7
-3
EcaSettingView.swift
Seilassist/Sailassist/Map/Task/View/EcaSettingView.swift
+1
-0
FuelSwitchingView.swift
Seilassist/Sailassist/Map/Task/View/FuelSwitchingView.swift
+2
-2
SailassistApp.swift
Seilassist/Sailassist/SailassistApp.swift
+9
-4
MainTabView.swift
Seilassist/Sailassist/Tab/MainTabView.swift
+39
-10
No files found.
Seilassist/Sailassist.xcodeproj/project.pbxproj
View file @
ec125999
...
...
@@ -1307,7 +1307,7 @@
CODE_SIGN_ENTITLEMENTS
=
Sailassist/Sailassist.entitlements
;
CODE_SIGN_IDENTITY
=
"Apple Development"
;
CODE_SIGN_STYLE
=
Automatic
;
CURRENT_PROJECT_VERSION
=
39
;
CURRENT_PROJECT_VERSION
=
40
;
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
=
39
;
CURRENT_PROJECT_VERSION
=
40
;
DEVELOPMENT_ASSET_PATHS
=
"\"Sailassist/Preview Content\""
;
DEVELOPMENT_TEAM
=
D2DC7QNNJ8
;
ENABLE_PREVIEWS
=
YES
;
...
...
@@ -1536,7 +1536,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME
=
AccentColor
;
CODE_SIGN_ENTITLEMENTS
=
Sailassist/Sailassist.entitlements
;
CODE_SIGN_STYLE
=
Automatic
;
CURRENT_PROJECT_VERSION
=
39
;
CURRENT_PROJECT_VERSION
=
40
;
DEVELOPMENT_ASSET_PATHS
=
"\"Sailassist/Preview Content\""
;
DEVELOPMENT_TEAM
=
D2DC7QNNJ8
;
ENABLE_PREVIEWS
=
YES
;
...
...
Seilassist/Sailassist/Alert/NotificationView.swift
View file @
ec125999
...
...
@@ -35,6 +35,15 @@ struct NotificationView: View {
Spacer
()
}
.
background
(
ColorSet
.
BackgroundPrimary
.
color
)
.
onAppear
{
let
pushCount
=
pushHist
.
viewCnt
print
(
debug
:
"
\(
pushCount
)
"
)
pushHist
.
viewCnt
=
0
}
// .onChange(of: pushHist.pushHistoryData.count) { newValue in
// let pushCount = pushHist.viewCnt
// print(debug: "\(pushCount)")
// }
}
struct
TitleView
:
View
{
...
...
Seilassist/Sailassist/Alert/View/NotificationContentView.swift
View file @
ec125999
...
...
@@ -47,9 +47,6 @@ struct NotificationContentView: View {
.
font
(
FontStyle
.
SupplementText2
.
font
)
}
.
padding
(
EdgeInsets
(
top
:
17
,
leading
:
30
,
bottom
:
17
,
trailing
:
30
))
.
onAppear
{
SharingData
.
pushHistory
.
viewCnt
=
0
}
}
}
...
...
Seilassist/Sailassist/Chat/ChatView.swift
View file @
ec125999
...
...
@@ -31,28 +31,33 @@ struct ChatView: View {
.
frame
(
height
:
20
)
ForEach
(
message
.
messages
,
id
:
\
.
messageId
)
{
msg
in
if
msg
.
from
==
Preferences
.
UserName
{
//自分のメッセージ
MyChatContentView
(
message
:
msg
)
.
padding
(
.
bottom
,
24
)
}
else
{
//他人のメッセージ
OtherChatContentView
(
message
:
msg
)
if
msg
.
message
!=
nil
{
if
msg
.
from
==
Preferences
.
UserName
{
//自分のメッセージ
MyChatContentView
(
message
:
msg
)
.
padding
(
.
bottom
,
24
)
}
else
{
//他人のメッセージ
OtherChatContentView
(
message
:
msg
)
.
padding
(
.
bottom
,
24
)
}
}
else
{
AlertChatMessage
(
message
:
msg
)
.
padding
(
.
bottom
,
24
)
}
}
}
.
onAppear
{
if
let
id
=
message
.
messages
.
last
?
.
messageId
{
print
(
debug
:
"ChatView:onAppear"
)
proxy
.
scrollTo
(
id
,
anchor
:
.
bottom
)
message
.
viewCnt
=
0
}
}
.
onChange
(
of
:
message
.
messages
.
count
)
{
newValue
in
withAnimation
{
if
let
id
=
message
.
messages
.
last
?
.
messageId
{
print
(
debug
:
"ChatView:onChange"
)
proxy
.
scrollTo
(
id
,
anchor
:
.
bottom
)
message
.
viewCnt
=
0
}
}
}
...
...
@@ -60,8 +65,8 @@ struct ChatView: View {
withAnimation
{
guard
!
value
.
isEmpty
else
{
return
}
if
let
id
=
message
.
messages
.
last
?
.
messageId
{
print
(
debug
:
"ChatView:onReceive"
)
proxy
.
scrollTo
(
id
,
anchor
:
.
bottom
)
message
.
viewCnt
=
0
}
}
}
...
...
@@ -97,6 +102,35 @@ struct ChatView: View {
}
}
struct
AlertChatMessage
:
View
{
@Environment(\ .colorScheme)
var
colorScheme
var
message
:
ChatMessage
var
body
:
some
View
{
if
message
.
mode
==
1
{
Rectangle
()
.
fill
(
colorScheme
==
.
light
?
.
black
:
.
white
)
.
frame
(
width
:
300
,
height
:
1
)
.
overlay
(
Text
(
" Warrning mode start "
+
DateTextLib
.
ISO86012FormatText
(
message
.
time
,
format
:
"yyyy/MM/dd HH:mm "
,
errFormat
:
""
))
.
font
(
FontStyle
.
DateText
.
font
)
.
foregroundColor
(
ColorSet
.
BodyDescriptiion
.
color
)
.
background
(
ColorSet
.
BackgroundPrimary
.
color
)
)
}
else
{
Rectangle
()
.
fill
(
colorScheme
==
.
light
?
.
black
:
.
white
)
.
frame
(
width
:
300
,
height
:
1
)
.
overlay
(
Text
(
" Warrning mode end "
+
DateTextLib
.
ISO86012FormatText
(
message
.
time
,
format
:
"yyyy/MM/dd HH:mm "
,
errFormat
:
""
))
.
font
(
FontStyle
.
DateText
.
font
)
.
foregroundColor
(
ColorSet
.
BodyDescriptiion
.
color
)
.
background
(
ColorSet
.
BackgroundPrimary
.
color
)
)
}
}
}
#Preview {
ChatView
()
}
...
...
Seilassist/Sailassist/Chat/View/ChatMemberView.swift
View file @
ec125999
...
...
@@ -26,9 +26,11 @@ struct ChatMemberView: View {
.
frame
(
width
:
12
,
height
:
12
)
}
Text
(
user
.
name
)
.
foregroundColor
(
ColorSet
.
BodyChat
.
color
)
.
font
(
FontStyle
.
SupplementText
.
font
)
if
let
name
=
user
.
name
{
Text
(
name
)
.
foregroundColor
(
ColorSet
.
BodyChat
.
color
)
.
font
(
FontStyle
.
SupplementText
.
font
)
}
}
}
.
listRowBackground
(
ColorSet
.
ModalWindowFront
.
color
)
...
...
Seilassist/Sailassist/Chat/View/ChatTitleView.swift
View file @
ec125999
...
...
@@ -75,8 +75,10 @@ struct ChatTitleView: View {
func
userName
()
->
String
{
var
usersName
=
""
for
user
in
message
.
users
{
usersName
+=
user
.
name
usersName
+=
","
if
let
name
=
user
.
name
{
usersName
+=
name
usersName
+=
","
}
}
return
usersName
}
...
...
Seilassist/Sailassist/Chat/View/ChatUrlImageView.swift
View file @
ec125999
...
...
@@ -8,10 +8,12 @@
import
SwiftUI
struct
ChatUrlImageView
:
View
{
var
imageUrl
:
String
var
imageUrl
=
""
init
(
message
:
ChatMessage
)
{
self
.
imageUrl
=
message
.
message
if
let
url
=
message
.
message
{
self
.
imageUrl
=
url
}
}
var
body
:
some
View
{
...
...
@@ -43,6 +45,7 @@ struct ChatUrlImageView: View {
location
:
1
,
from
:
"はだだ"
,
fromId
:
"487420489"
,
mode
:
0
,
message
:
"999"
,
stampId
:
0
,
viewer
:
[
...
...
Seilassist/Sailassist/Chat/View/ChatUrlRawImageView.swift
View file @
ec125999
...
...
@@ -51,6 +51,7 @@ struct ChatUrlRawImageView: View {
location
:
1
,
from
:
"はだだ"
,
fromId
:
"487420489"
,
mode
:
0
,
message
:
"999"
,
stampId
:
0
,
viewer
:
[
...
...
Seilassist/Sailassist/Chat/View/MyChatContentView.swift
View file @
ec125999
...
...
@@ -11,50 +11,59 @@ struct MyChatContentView: View {
var
message
:
ChatMessage
var
body
:
some
View
{
HStack
{
Spacer
()
VStack
(
alignment
:
.
trailing
,
spacing
:
6
)
{
Group
{
if
message
.
message
.
contains
(
"https://"
)
{
//TODO: stampIdが0
ChatUrlImageView
(
message
:
message
)
}
else
{
Text
(
message
.
message
)
.
font
(
FontStyle
.
DefaultText
.
font
)
.
foregroundColor
(
ColorSet
.
BodyChat
.
color
)
.
padding
(
15
)
.
background
(
ColorSet
.
ChatBaloon
.
color
)
.
cornerRadius
(
10
,
corners
:
[
.
tl
,
.
tr
,
.
br
])
Spacer
()
VStack
(
alignment
:
.
trailing
,
spacing
:
6
)
{
Group
{
if
let
msg
=
message
.
message
{
if
msg
.
contains
(
"https://"
)
{
ChatUrlImageView
(
message
:
message
)
}
else
{
Text
(
msg
)
.
font
(
FontStyle
.
DefaultText
.
font
)
.
foregroundColor
(
ColorSet
.
BodyChat
.
color
)
.
padding
(
15
)
.
background
(
ColorSet
.
ChatBaloon
.
color
)
.
border
(
Color
.
red
.
gradient
.
opacity
(
0.6
),
width
:
(
message
.
mode
==
1
?
6
:
0
))
.
clipShape
(
.
rect
(
topLeadingRadius
:
10
,
bottomLeadingRadius
:
0
,
bottomTrailingRadius
:
10
,
topTrailingRadius
:
10
))
}
}
}
}
HStack
(
spacing
:
5
){
//既読マーク
Text
(
DateTextLib
.
ISO86012FormatText
(
message
.
time
,
format
:
"yyyy/MM/dd HH:mm"
,
errFormat
:
""
))
.
padding
(
.
trailing
,
8
)
let
viewerCnt
=
viewerCnt
()
Image
(
"chat_company"
)
.
resizable
()
.
scaledToFit
()
.
frame
(
width
:
12
,
height
:
12
)
.
padding
(
.
trailing
,
4
)
Text
(
String
(
viewerCnt
.
0
))
HStack
(
spacing
:
5
){
//既読マーク
Text
(
DateTextLib
.
ISO86012FormatText
(
message
.
time
,
format
:
"yyyy/MM/dd HH:mm"
,
errFormat
:
""
))
.
padding
(
.
trailing
,
8
)
let
viewerCnt
=
viewerCnt
()
Image
(
"chat_company"
)
.
resizable
()
.
scaledToFit
()
.
frame
(
width
:
12
,
height
:
12
)
.
padding
(
.
trailing
,
4
)
Image
(
"chat_ship"
)
.
resizable
()
.
scaledToFit
()
.
frame
(
width
:
12
,
height
:
12
)
.
padding
(
.
trailing
,
4
)
Text
(
String
(
viewerCnt
.
1
))
Text
(
String
(
viewerCnt
.
1
))
Image
(
"chat_ship"
)
.
resizable
()
.
scaledToFit
()
.
frame
(
width
:
12
,
height
:
12
)
.
padding
(
.
trailing
,
4
)
Text
(
String
(
viewerCnt
.
0
))
}
.
font
(
FontStyle
.
DateText
.
font
)
.
foregroundColor
(
ColorSet
.
BodyDescriptiion
.
color
)
}
.
font
(
FontStyle
.
DateText
.
font
)
.
foregroundColor
(
ColorSet
.
BodyDescriptiion
.
color
)
}
.
padding
(
.
trailing
,
20
)
.
padding
(
.
trailing
,
20
)
}
.
padding
(
.
leading
,
80
)
}
func
viewerCnt
()
->
(
Int
,
Int
)
{
...
...
@@ -80,6 +89,7 @@ struct MyChatContentView: View {
location
:
1
,
from
:
"はだだ"
,
fromId
:
"487420489"
,
mode
:
0
,
message
:
"999"
,
stampId
:
0
,
viewer
:
[
...
...
Seilassist/Sailassist/Chat/View/OtherChatContentView.swift
View file @
ec125999
...
...
@@ -12,20 +12,31 @@ struct OtherChatContentView: View {
var
body
:
some
View
{
HStack
{
VStack
(
alignment
:
.
leading
,
spacing
:
4
)
{
Text
(
message
.
from
)
.
font
(
FontStyle
.
EmphasisText
.
font
)
.
foregroundColor
(
ColorSet
.
Body
.
color
)
if
let
from
=
message
.
from
{
Text
(
from
)
.
font
(
FontStyle
.
EmphasisText
.
font
)
.
foregroundColor
(
ColorSet
.
Body
.
color
)
}
VStack
(
alignment
:
.
leading
,
spacing
:
10
)
{
Group
{
if
message
.
message
.
contains
(
"https://"
)
{
//TODO: stampIdが0
ChatUrlImageView
(
message
:
message
)
}
else
{
Text
(
message
.
message
)
.
font
(
FontStyle
.
DefaultText
.
font
)
.
foregroundColor
(
ColorSet
.
BodyChat
.
color
)
.
padding
(
15
)
.
background
(
ColorSet
.
ChatBaloon
.
color
)
.
cornerRadius
(
10
,
corners
:
[
.
tl
,
.
tr
,
.
br
])
if
let
msg
=
message
.
message
{
if
msg
.
contains
(
"https://"
)
{
ChatUrlImageView
(
message
:
message
)
}
else
{
Text
(
msg
)
.
font
(
FontStyle
.
DefaultText
.
font
)
.
foregroundColor
(
ColorSet
.
BodyChat
.
color
)
.
padding
(
15
)
.
background
(
ColorSet
.
ChatBaloon
.
color
)
.
border
(
Color
.
red
.
gradient
.
opacity
(
0.6
),
width
:
(
message
.
mode
==
1
?
6
:
0
))
.
clipShape
(
.
rect
(
topLeadingRadius
:
10
,
bottomLeadingRadius
:
10
,
bottomTrailingRadius
:
0
,
topTrailingRadius
:
10
))
}
}
}
...
...
@@ -39,31 +50,6 @@ struct OtherChatContentView: View {
.
padding
(
.
leading
,
20
)
Spacer
()
}
.
padding
(
.
trailing
,
80
)
}
}
struct
AlertChatMessage
:
View
{
var
message
:
ChatMessage
var
body
:
some
View
{
HStack
{
Image
(
systemName
:
"exclamationmark.triangle.fill"
)
.
foregroundColor
(
.
red
)
.
frame
(
width
:
48
,
height
:
48
)
Text
(
alertStr
())
.
font
(
FontStyle
.
DefaultText
.
font
)
.
foregroundColor
(
ColorSet
.
BodyChat
.
color
)
.
padding
(
15
)
.
background
(
ColorSet
.
ChatBaloon
.
color
)
.
cornerRadius
(
10
,
corners
:
[
.
tl
,
.
tr
,
.
br
])
}
}
func
alertStr
()
->
String
{
var
msg
=
message
.
message
msg
.
removeFirst
()
return
msg
}
}
...
...
@@ -76,6 +62,7 @@ struct AlertChatMessage: View {
location
:
1
,
from
:
"はだだ"
,
fromId
:
"487420489"
,
mode
:
0
,
message
:
"999"
,
stampId
:
0
,
viewer
:
[
...
...
Seilassist/Sailassist/Json/ReqMessage.swift
View file @
ec125999
...
...
@@ -15,6 +15,7 @@ struct ReqMessage : Codable {
var
location
:
Int
=
0
//1:Shore / 2:Ship
var
from
:
String
=
""
//投稿者名
var
fromId
:
String
=
""
//ユーザーID
var
mode
:
Int
=
0
var
message
:
String
=
""
//テキスト
var
stampId
:
Int
=
0
//スタンプ番号 0:Fire〜
...
...
Seilassist/Sailassist/Json/ResChatMessage.swift
View file @
ec125999
...
...
@@ -15,6 +15,7 @@ struct ResChatMessage: Codable {
var
location
:
Int
//1:Shore、2:Ship
var
from
:
String
//投稿者名
var
fromId
:
String
//ユーザーID
var
mode
:
Int
var
message
:
String
//テキスト
var
stampId
:
Int
//スタンプ番号
}
Seilassist/Sailassist/Json/ResGetMessages.swift
View file @
ec125999
...
...
@@ -19,9 +19,10 @@ struct ChatMessage: Codable {
var
type
:
Int
//0:テキスト , 1:スタンプ , 2:画像
var
time
:
String
//投稿日時
var
location
:
Int
//1:Shore , 2:Ship
var
from
:
String
//投稿者名
var
from
:
String
?
//投稿者名
var
fromId
:
String
?
//ユーザーID
var
message
:
String
//テキスト時:テキスト , 画像時:サムネイルのUri
var
mode
:
Int
// 0:通常 , 1:Warning中
var
message
:
String
?
//テキスト時:テキスト , 画像時:サムネイルのUri
var
stampId
:
Int
//スタンプ番号 0:Fire~
var
viewer
:
[
Viewer
]
=
[]
//閲覧者情報
}
...
...
@@ -29,12 +30,13 @@ struct ChatMessage: Codable {
struct
Viewer
:
Codable
{
var
time
:
String
//確認日時
var
location
:
Int
//1:Shore , 2:Ship
var
id
:
String
//ユーザーID
var
id
:
String
?
//ユーザーID
var
name
:
String
?
//ユーザー名
}
struct
ChatUser
:
Codable
{
var
time
:
String
//最終アクセス日時
var
location
:
Int
//1:Shore , 2:Ship
var
id
:
String
//ログイン時のデバイスID
var
name
:
String
//ユーザー名
var
id
:
String
?
//ログイン時のデバイスID
var
name
:
String
?
//ユーザー名
}
Seilassist/Sailassist/Map/MapRepresentable.swift
View file @
ec125999
...
...
@@ -1145,9 +1145,13 @@ class MapViewController : UIViewController {
guard
let
Id
=
jsonData
?
.
rawValue
else
{
return
}
if
SharingData
.
nga
.
editNga
?
.
isLock
==
false
{
if
let
noStr
=
Id
as?
String
{
if
let
no
=
Int
(
noStr
)
{
SharingData
.
nga
.
editNga
?
.
points
.
insert
(
coordinate
,
at
:
no
)
if
let
editNga
=
SharingData
.
nga
.
editNga
{
if
editNga
.
points
.
count
<
ngaAreaPointMax
{
if
let
noStr
=
Id
as?
String
{
if
let
no
=
Int
(
noStr
)
{
SharingData
.
nga
.
editNga
?
.
points
.
insert
(
coordinate
,
at
:
no
)
}
}
}
}
}
...
...
Seilassist/Sailassist/Map/Task/View/EcaSettingView.swift
View file @
ec125999
...
...
@@ -39,6 +39,7 @@ struct EcaSettingView: View {
var
ecaData
=
edittingEca
ecaData
.
isEnable
=
true
SharingData
.
eca
.
editEcaArea
(
key
:
edittingEca
.
areaId
,
value
:
ecaData
,
type
:
EcaOperation
.
Change
)
taskViewModel
.
viewMode
=
.
FuelSwitching
},
label
:
{
Text
(
"Register"
)
.
font
(
FontStyle
.
DefaultText
.
font
)
...
...
Seilassist/Sailassist/Map/Task/View/FuelSwitchingView.swift
View file @
ec125999
...
...
@@ -55,8 +55,8 @@ struct FuelSwitchingView: View {
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
)
newData
.
status
=
EcaState
.
cancel
ecaData
.
editEcaArea
(
key
:
ecaArea
.
areaId
,
value
:
newData
,
type
:
EcaOperation
.
Cancel
)
}
taskViewModel
.
edittingEcaArea
=
nil
}
...
...
Seilassist/Sailassist/SailassistApp.swift
View file @
ec125999
...
...
@@ -179,7 +179,7 @@ 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
,
fromId
:
message
.
fromId
,
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
,
m
ode
:
message
.
mode
,
m
essage
:
message
.
message
,
stampId
:
message
.
stampId
,
viewer
:
[])
self
.
msg
.
messages
.
append
(
ownMsg
)
}
...
...
@@ -244,11 +244,12 @@ class SignalR: NSObject {
request
.
location
=
2
//1:Shore , 2:Ship
request
.
from
=
Preferences
.
UserName
//投稿者名
request
.
fromId
=
String
(
SharingData
.
my
.
id
)
//ユーザーID
if
msg
.
mode
{
request
.
m
essage
=
"⚠️
\n
"
+
message
if
SharingData
.
message
.
mode
{
request
.
m
ode
=
1
}
else
{
request
.
m
essage
=
message
request
.
m
ode
=
0
}
request
.
message
=
message
request
.
stampId
=
0
//スタンプ番号 0:Fire~
if
message
!=
""
{
...
...
@@ -354,18 +355,22 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
}
case
"sailassist"
:
print
(
debug
:
"sailassist"
)
SharingData
.
pushHistory
.
viewCnt
+=
1
let
getPushHistory
=
GetPushHistory
()
getPushHistory
.
start
()
case
"bam"
:
print
(
debug
:
"bam"
)
SharingData
.
pushHistory
.
viewCnt
+=
1
let
getPushHistory
=
GetPushHistory
()
getPushHistory
.
start
()
case
"route"
:
print
(
debug
:
"route"
)
SharingData
.
pushHistory
.
viewCnt
+=
1
let
getPushHistory
=
GetPushHistory
()
getPushHistory
.
start
()
case
"emergency"
:
print
(
debug
:
"emergency"
)
SharingData
.
pushHistory
.
viewCnt
+=
1
let
getPushHistory
=
GetPushHistory
()
getPushHistory
.
start
()
default
:
...
...
Seilassist/Sailassist/Tab/MainTabView.swift
View file @
ec125999
...
...
@@ -145,20 +145,49 @@ struct CustomTabBar: View {
//チャットTab上の既読マーク
if
tab
==
Tab
.
chat
{
if
message
.
viewCnt
!=
0
{
Rectangle
()
.
foregroundColor
(
.
red
)
.
frame
(
width
:
12
,
height
:
12
)
.
cornerRadius
(
60
)
if
message
.
viewCnt
<
10
{
Ellipse
()
.
fill
(
Color
.
red
)
.
frame
(
width
:
12
,
height
:
12
)
.
overlay
(
Text
(
String
(
message
.
viewCnt
))
.
font
(
FontStyle
.
VersionText
.
font
)
.
foregroundColor
(
.
white
)
)
}
else
{
Ellipse
()
.
fill
(
Color
.
red
)
.
frame
(
width
:
12
,
height
:
12
)
.
overlay
(
Text
(
"-"
)
.
font
(
FontStyle
.
VersionText
.
font
)
.
foregroundColor
(
.
white
)
)
}
}
}
//チャットTab上の既読マーク
if
tab
==
Tab
.
map
{
if
tab
==
Tab
.
alert
{
if
pushHistory
.
viewCnt
!=
0
{
Rectangle
()
.
foregroundColor
(
.
red
)
.
frame
(
width
:
12
,
height
:
12
)
.
cornerRadius
(
60
)
if
pushHistory
.
viewCnt
<
10
{
Ellipse
()
.
fill
(
Color
.
red
)
.
frame
(
width
:
12
,
height
:
12
)
.
overlay
(
Text
(
String
(
pushHistory
.
viewCnt
))
.
font
(
FontStyle
.
VersionText
.
font
)
.
foregroundColor
(
.
white
)
)
}
else
{
Ellipse
()
.
fill
(
Color
.
red
)
.
frame
(
width
:
12
,
height
:
12
)
.
overlay
(
Text
(
"-"
)
.
font
(
FontStyle
.
VersionText
.
font
)
.
foregroundColor
(
.
white
)
)
}
}
}
}
...
...
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