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
989e443a
Commit
989e443a
authored
Jul 25, 2024
by
shigemi miura
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
チャットリセット処理追加
Sign Out時にアプリをリセット Warning表示対応
parent
71f416a7
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
73 additions
and
24 deletions
+73
-24
project.pbxproj
Seilassist/Sailassist.xcodeproj/project.pbxproj
+3
-3
ChatView.swift
Seilassist/Sailassist/Chat/ChatView.swift
+4
-0
ChatInputView.swift
Seilassist/Sailassist/Chat/View/ChatInputView.swift
+31
-5
MyChatContentView.swift
Seilassist/Sailassist/Chat/View/MyChatContentView.swift
+8
-6
FuelSwitchingView.swift
Seilassist/Sailassist/Map/Task/View/FuelSwitchingView.swift
+2
-2
MenuView.swift
Seilassist/Sailassist/Menu/MenuView.swift
+5
-0
SailassistApp.swift
Seilassist/Sailassist/SailassistApp.swift
+18
-8
SharingData.swift
Seilassist/Sailassist/SharingData/SharingData.swift
+1
-0
MainTabView.swift
Seilassist/Sailassist/Tab/MainTabView.swift
+1
-0
No files found.
Seilassist/Sailassist.xcodeproj/project.pbxproj
View file @
989e443a
...
...
@@ -1307,7 +1307,7 @@
CODE_SIGN_ENTITLEMENTS
=
Sailassist/Sailassist.entitlements
;
CODE_SIGN_IDENTITY
=
"Apple Development"
;
CODE_SIGN_STYLE
=
Automatic
;
CURRENT_PROJECT_VERSION
=
4
0
;
CURRENT_PROJECT_VERSION
=
4
1
;
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
=
4
0
;
CURRENT_PROJECT_VERSION
=
4
1
;
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
=
4
0
;
CURRENT_PROJECT_VERSION
=
4
1
;
DEVELOPMENT_ASSET_PATHS
=
"\"Sailassist/Preview Content\""
;
DEVELOPMENT_TEAM
=
D2DC7QNNJ8
;
ENABLE_PREVIEWS
=
YES
;
...
...
Seilassist/Sailassist/Chat/ChatView.swift
View file @
989e443a
...
...
@@ -57,6 +57,10 @@ struct ChatView: View {
withAnimation
{
if
let
id
=
message
.
messages
.
last
?
.
messageId
{
proxy
.
scrollTo
(
id
,
anchor
:
.
bottom
)
let
getMessage
=
GetMessage
()
getMessage
.
readNotification
()
message
.
viewCnt
=
0
}
}
...
...
Seilassist/Sailassist/Chat/View/ChatInputView.swift
View file @
989e443a
...
...
@@ -90,7 +90,7 @@ struct ChatInputView: View {
.
padding
(
.
leading
,
20
)
Button
{
sendChatMessage
(
message
:
inputText
)
sendChatMessage
()
}
label
:
{
Image
(
"send"
)
.
resizable
()
...
...
@@ -167,23 +167,49 @@ struct ChatInputView: View {
/**
* チャット送信
*/
func
sendChatMessage
(
message
:
String
)
{
let
signalRService
=
SignalR
()
signalRService
.
chatMessage
(
message
:
inputText
,
completion
:
responseChatMessage
)
func
sendChatMessage
()
{
if
!
SharingData
.
message
.
sendInf
{
let
signalRService
=
SignalR
()
signalRService
.
chatMessage
(
message
:
inputText
,
completion
:
responseChatMessage
)
SharingData
.
message
.
sendInf
=
true
DispatchQueue
.
main
.
asyncAfter
(
deadline
:
.
now
()
+
3.0
)
{
restartChatMessage
()
}
}
}
/**
* チャットレスポンス
*/
func
responseChatMessage
(
error
:
Error
?)
{
SharingData
.
message
.
sendInf
=
false
if
let
e
=
error
{
msg
.
messages
.
removeLast
()
//最後に追加したメッセージを削除
print
(
debug
:
"chat error
\(
e
)
"
)
// msg.messages.removeLast() //最後に追加したメッセージを削除
isChatAlert
=
true
}
else
{
isKeyboard
=
false
inputText
=
""
}
}
/**
* チャットレスポンスが無かった場合
*/
func
restartChatMessage
()
{
if
SharingData
.
message
.
sendInf
{
let
signalRService
=
SignalR
()
signalRService
.
stopConnection
()
Thread
.
sleep
(
forTimeInterval
:
1.0
)
signalRService
.
startConnection
()
Thread
.
sleep
(
forTimeInterval
:
2.0
)
// signalRService.chatMessage(message: inputText, completion: responseChatMessage)
}
}
}
#Preview {
...
...
Seilassist/Sailassist/Chat/View/MyChatContentView.swift
View file @
989e443a
...
...
@@ -11,7 +11,6 @@ struct MyChatContentView: View {
var
message
:
ChatMessage
var
body
:
some
View
{
HStack
{
Spacer
()
VStack
(
alignment
:
.
trailing
,
spacing
:
6
)
{
Group
{
...
...
@@ -70,12 +69,15 @@ struct MyChatContentView: View {
var
shipViewer
=
0
var
companyViewr
=
0
for
viewer
in
message
.
viewer
{
if
viewer
.
location
==
1
{
companyViewr
+=
1
}
else
{
shipViewer
+=
1
//船のIDは全て同じ
// if viewer.id != String(SharingData.my.id) {
if
viewer
.
location
==
1
{
companyViewr
+=
1
}
else
{
shipViewer
+=
1
}
}
}
//
}
return
(
shipViewer
,
companyViewr
)
}
}
...
...
Seilassist/Sailassist/Map/Task/View/FuelSwitchingView.swift
View file @
989e443a
...
...
@@ -55,8 +55,8 @@ struct FuelSwitchingView: View {
if
let
ecaArea
=
taskViewModel
.
edittingEcaArea
{
var
newData
=
ecaArea
newData
.
isRunning
=
false
newData
.
status
=
EcaState
.
cancel
ecaData
.
editEcaArea
(
key
:
ecaArea
.
areaId
,
value
:
newData
,
type
:
EcaOperation
.
Cancel
)
newData
.
status
=
EcaState
.
end
ecaData
.
editEcaArea
(
key
:
ecaArea
.
areaId
,
value
:
newData
,
type
:
EcaOperation
.
End
)
}
taskViewModel
.
edittingEcaArea
=
nil
}
...
...
Seilassist/Sailassist/Menu/MenuView.swift
View file @
989e443a
...
...
@@ -233,6 +233,11 @@ struct MenuView: View {
SharingData
.
map
.
starboardLine
=
[]
connection
!.
stop
()
UIControl
()
.
sendAction
(
#selector(
URLSessionTask.suspend
)
,
to
:
UIApplication
.
shared
,
for
:
nil
)
Timer
.
scheduledTimer
(
withTimeInterval
:
0.2
,
repeats
:
false
)
{
_
in
exit
(
0
)
}
}
Button
(
"No"
)
{}
}
message
:
{
Text
(
"Are you sure?"
)
}
...
...
Seilassist/Sailassist/SailassistApp.swift
View file @
989e443a
...
...
@@ -121,8 +121,6 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M
.
build
()
if
let
r_connection
=
connection
{
// r_connection.stop()
//callbackが作成されない?
r_connection
.
on
(
method
:
"ChatMessage"
,
callback
:
{
(
message
:
ResChatMessage
)
in
self
.
handleChatMessage
(
message
:
message
)
})
...
...
@@ -206,6 +204,9 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M
}
else
{
self
.
msg
.
mode
=
false
}
let
message
=
GetMessage
()
message
.
start
()
}
//アプリ終了時
...
...
@@ -282,6 +283,17 @@ class SignalR: NSObject {
}
connection
!.
invoke
(
method
:
"ChatMode"
,
request
,
invocationDidComplete
:
completion
)
}
func
stopConnection
()
{
let
test
=
connection
.
debugDescription
print
(
debug
:
"Test: Chat Message
\(
test
)
"
)
connection
!.
stop
()
}
func
startConnection
()
{
connection
!.
start
()
}
}
class
ChatHubConnectionDelegate
:
HubConnectionDelegate
{
...
...
@@ -333,8 +345,7 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
}
let
subtitle
=
arrAlert
[
"subtitle"
]
as?
String
??
""
//送信先名称
let
strTitle
=
arrAlert
[
"title"
]
as?
String
??
""
//船名
let
strBody
=
arrAlert
[
"body"
]
as?
String
??
""
//送信内容
// let strBody = arrAlert["body"] as? String ?? "" //送信内容
// print(debug: "called \(subtitle) \(strTitle) \(strBody)")
if
strTitle
==
"Chat Warning"
{
...
...
@@ -392,10 +403,9 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
completionHandler
()
return
}
let
subtitle
=
arrAlert
[
"subtitle"
]
as?
String
??
""
//送信内容
let
strTitle
=
arrAlert
[
"title"
]
as?
String
??
""
//船名
let
strBody
=
arrAlert
[
"body"
]
as?
String
??
""
//送信先名称
// let subtitle = arrAlert["subtitle"] as? String ?? "" //送信内容
// let strTitle = arrAlert["title"] as? String ?? "" //船名
// let strBody = arrAlert["body"] as? String ?? "" //送信先名称
// print(debug: "called \(subtitle) \(strTitle) \(strBody)")
case
"sailassist"
:
print
(
debug
:
"sailassist"
)
...
...
Seilassist/Sailassist/SharingData/SharingData.swift
View file @
989e443a
...
...
@@ -358,6 +358,7 @@ class SharingData{
@Published
var
messages
:
[
ChatMessage
]
=
[]
@Published
var
users
:
[
ChatUser
]
=
[]
@Published
var
viewCnt
:
Int
=
0
//未読数
@Published
var
sendInf
:
Bool
=
false
func
changeMode
(){
self
.
mode
.
toggle
()
...
...
Seilassist/Sailassist/Tab/MainTabView.swift
View file @
989e443a
...
...
@@ -129,6 +129,7 @@ struct CustomTabBar: View {
location
.
focusOwnShip
=
true
}
else
if
tab
==
.
chat
{
let
message
=
GetMessage
()
message
.
start
()
message
.
readNotification
()
message
.
checkUnreadMessages
()
...
...
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