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