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
fbbb1ea7
Commit
fbbb1ea7
authored
Apr 24, 2024
by
shigemi miura
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
既読マーク(未完成)
画面タッチ(未完成)
parent
5e4e2e3c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
184 additions
and
16 deletions
+184
-16
GetMessage.swift
Seilassist/Sailassist/Chat/GetMessage.swift
+18
-0
ChatInputView.swift
Seilassist/Sailassist/Chat/View/ChatInputView.swift
+1
-1
MyChatContentView.swift
Seilassist/Sailassist/Chat/View/MyChatContentView.swift
+1
-0
MapRepresentable.swift
Seilassist/Sailassist/Map/MapRepresentable.swift
+138
-0
SailassistApp.swift
Seilassist/Sailassist/SailassistApp.swift
+14
-7
SharingData.swift
Seilassist/Sailassist/SharingData/SharingData.swift
+1
-0
MainTabView.swift
Seilassist/Sailassist/Tab/MainTabView.swift
+11
-8
No files found.
Seilassist/Sailassist/Chat/GetMessage.swift
View file @
fbbb1ea7
...
@@ -25,7 +25,25 @@ class GetMessage {
...
@@ -25,7 +25,25 @@ class GetMessage {
}
}
SharingData
.
message
.
messages
=
[]
SharingData
.
message
.
messages
=
[]
if
let
msg
=
res
.
messages
{
if
let
msg
=
res
.
messages
{
//既読マーク確認
SharingData
.
message
.
messages
=
msg
SharingData
.
message
.
messages
=
msg
var
msgCnt
=
0
//受信メッセージ数
var
viewCnt
=
0
//既読メッセージ数
for
message
in
SharingData
.
message
.
messages
{
// print(debug: "message \(message)")
if
message
.
fromId
!=
Preferences
.
UserName
{
msgCnt
=
msgCnt
+
1
}
//SSV Mobileで既読
for
view
in
message
.
viewer
{
if
view
.
location
==
1
{
viewCnt
=
viewCnt
+
1
}
}
}
// if msgCnt != viewCnt {
// SharingData.message.viewCnt = msgCnt - viewCnt
// }
}
}
SharingData
.
message
.
users
=
[]
SharingData
.
message
.
users
=
[]
if
let
users
=
res
.
users
{
if
let
users
=
res
.
users
{
...
...
Seilassist/Sailassist/Chat/View/ChatInputView.swift
View file @
fbbb1ea7
...
@@ -54,7 +54,7 @@ struct ChatInputView: View {
...
@@ -54,7 +54,7 @@ struct ChatInputView: View {
sceneDelegate
.
tabWindow
?
.
isHidden
=
true
sceneDelegate
.
tabWindow
?
.
isHidden
=
true
isImportFile
=
true
isImportFile
=
true
})
{
})
{
Label
(
"Take Phot"
,
systemImage
:
"camera"
)
Label
(
"Take Phot
o
"
,
systemImage
:
"camera"
)
}
}
Button
(
action
:
{
Button
(
action
:
{
print
(
"Choose File"
)
print
(
"Choose File"
)
...
...
Seilassist/Sailassist/Chat/View/MyChatContentView.swift
View file @
fbbb1ea7
...
@@ -68,6 +68,7 @@ struct MyChatContentView: View {
...
@@ -68,6 +68,7 @@ struct MyChatContentView: View {
}
}
HStack
(
spacing
:
0
){
HStack
(
spacing
:
0
){
//既読マーク
Text
(
DateTextLib
.
ISO86012FormatText
(
message
.
time
,
format
:
"yyyy/MM/dd hh:mm"
,
errFormat
:
""
))
Text
(
DateTextLib
.
ISO86012FormatText
(
message
.
time
,
format
:
"yyyy/MM/dd hh:mm"
,
errFormat
:
""
))
.
padding
(
.
trailing
,
8
)
.
padding
(
.
trailing
,
8
)
...
...
Seilassist/Sailassist/Map/MapRepresentable.swift
View file @
fbbb1ea7
...
@@ -95,6 +95,144 @@ class MapViewController : UIViewController{
...
@@ -95,6 +95,144 @@ class MapViewController : UIViewController{
mapView
.
mapboxMap
.
onNext
(
event
:
.
mapLoaded
)
{
[
self
]
_
in
mapView
.
mapboxMap
.
onNext
(
event
:
.
mapLoaded
)
{
[
self
]
_
in
self
.
addLayers
()
self
.
addLayers
()
}
}
//地図上クリック
let
singleTap
=
UITapGestureRecognizer
(
target
:
self
,
action
:
#selector(
handleMapTap(sender:)
)
)
singleTap
.
numberOfTapsRequired
=
1
for
recognizer
in
mapView
.
gestureRecognizers
!
where
recognizer
is
UITapGestureRecognizer
{
singleTap
.
require
(
toFail
:
recognizer
)
}
mapView
.
addGestureRecognizer
(
singleTap
)
//地図上ダブルクリック
let
doubleTap
=
UITapGestureRecognizer
(
target
:
self
,
action
:
#selector(
handleMapTap(sender:)
)
)
doubleTap
.
numberOfTapsRequired
=
2
for
recognizer
in
mapView
.
gestureRecognizers
!
where
recognizer
is
UITapGestureRecognizer
{
doubleTap
.
require
(
toFail
:
recognizer
)
}
mapView
.
addGestureRecognizer
(
doubleTap
)
// 両方を有効にするために必要
singleTap
.
require
(
toFail
:
doubleTap
)
//地図上長押し
let
longPress
=
UILongPressGestureRecognizer
(
target
:
self
,
action
:
#selector(
handleMapLongPress(sender:)
)
)
for
recognizer
in
mapView
.
gestureRecognizers
!
where
recognizer
is
UILongPressGestureRecognizer
{
longPress
.
require
(
toFail
:
recognizer
)
}
mapView
.
addGestureRecognizer
(
longPress
)
//地図上ドラッグ
let
drug
=
UIPanGestureRecognizer
(
target
:
self
,
action
:
#selector(
handleMapDrug
)
)
// if isRocked{
mapView
.
removeGestureRecognizer
(
drug
)
for
recognizer
in
mapView
.
gestureRecognizers
!
where
recognizer
is
UIPanGestureRecognizer
{
recognizer
.
isEnabled
=
true
}
// }else{
// for recognizer in mapView.gestureRecognizers!where recognizer is UIPanGestureRecognizer{
// recognizer.isEnabled = false
// drug.require(toFail: recognizer)
// }
// mapView.addGestureRecognizer(drug)
// }
// updateUserMark()
}
/**
* 地図上クリックアクション
*/
@objc
func
handleMapTap
(
sender
:
UITapGestureRecognizer
)
{
print
(
debug
:
"called"
)
// setTapObjInfoDisp(isHidden: true)
// SharingData.UserMark.selectedPointId = nil
// SharingData.UserMark.selectedPointInfo = nil
// SharingData.UserMark.movePointLocation = nil
// setUserMarkRock(isRocked: true)
//
let
spot
=
sender
.
location
(
in
:
mapView
)
// mapboxMapManager.targetInfo = nil
// guard let touchedFeature = mapboxMapManager?.mapClick(pos: spot) else { return }
// // print(debug: "touchedFeature OK")
// mapboxMapManager.targetInfo = touchedFeature
// guard let type = touchedFeature.attribute(forKey: MapboxMapManager.PropertyKey.ObjectType.rawValue) as? String else { return }
// print(debug: "type = \(type)")
//
// guard let id = touchedFeature.attribute(forKey: MapboxMapManager.PropertyKey.Id.rawValue) else { return }
// print(debug: "id = \(id)")
//
// if let dataType = MapboxMapManager.DataType(rawValue: type){
// updataDetailInfo(type: dataType, id: id)
// switch dataType{
// case .AroundPhone:
// if let id = id as? String{
// //行き先シェア#128
// shareCourceparam.destinationShip = id
// self.destinationShip = id
// performSegue(withIdentifier: ActivityMap.InterruptShareCourse, sender: self)
// }
// default:
// break
// }
// }
}
/**
* 地図上長押しアクション
*/
@objc
func
handleMapLongPress
(
sender
:
UILongPressGestureRecognizer
){
print
(
debug
:
"calld"
)
// // AIS情報問い合わせ
// //if SharingData.Vessels.distantTimer <= 0 { // 現在表示中でない
// // 長押し位置の緯度経度を得る
// let spot = sender.location(in: mapView)
// let tapCoordinate: CLLocationCoordinate2D = mapView.convert(spot, toCoordinateFrom: nil)
//
// let semaphore = DispatchSemaphore(value: 0)
// SessionManager().prepareSession(semaphore: semaphore)
//
// DispatchQueue(label: "WebAppRequest").async {
// semaphore.wait()
// self.distantWorkVessel.ErrCnt = 0
// self.distantWorkVessel.RequestWorkVessel( around : false, ActivityMap.noticeWorkVesselDist, tapCoordinate )
// }
// //}
}
/**
* 地図上ドラッグアクション
*/
@objc
func
handleMapDrug
(
sender
:
UIPanGestureRecognizer
){
print
(
debug
:
"calld"
)
// if let id = SharingData.UserMark.selectedPointId,
// let point = SharingData.UserMark.selectedPointInfo{
// let pos = sender.location(in: mapView)
// let newLocation = mapView.convert(pos, toCoordinateFrom: nil)
// if sender.state == .began{
// guard let touchedFeature = mapboxMapManager.mapClick(pos: pos) else { return }
// guard let type = touchedFeature.attribute(forKey: MapboxMapManager.PropertyKey.ObjectType.rawValue) as? String else { return }
// if let _ = touchedFeature.attribute(forKey: MapboxMapManager.PropertyKey.Id.rawValue) as? Int64,
// type == MapboxMapManager.DataType.UserMark.rawValue &&
// id == SharingData.UserMark.selectedPointId{
// SharingData.UserMark.movePointLocation = newLocation
// }
// }else if let _ = SharingData.UserMark.movePointLocation,
// let _ = SharingData.UserMark.selectedPointId{
// if sender.state == .changed{
// SharingData.UserMark.movePointLocation = newLocation
// }else if sender.state == .ended{
// let markManager = UserMarkManager()
// point.latitude = newLocation.latitude
// point.longitude = newLocation.longitude
// markManager.updatePoint(point: point)
// updateUserMarkDetail(point: point)
// SharingData.UserMark.movePointLocation = nil
// }
// }
// }
// updateUserMark()
// updateRootNavigation()
// mapboxMapManager.updateTarget()
}
}
/**
/**
...
...
Seilassist/Sailassist/SailassistApp.swift
View file @
fbbb1ea7
...
@@ -191,9 +191,12 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M
...
@@ -191,9 +191,12 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M
// print(debug: "called \(ResChatMode)")
// print(debug: "called \(ResChatMode)")
}
}
// func applicationWillTerminate(_ aNotification: Notification) {
//アプリ終了時
// connection.stop()
func
applicationWillTerminate
(
_
aNotification
:
UIApplication
)
{
// }
if
let
connect
=
connection
{
connect
.
stop
()
}
}
}
}
class
SignalR
:
NSObject
{
class
SignalR
:
NSObject
{
...
@@ -305,10 +308,11 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
...
@@ -305,10 +308,11 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
completionHandler
([[
.
banner
,
.
badge
,
.
sound
]])
completionHandler
([[
.
banner
,
.
badge
,
.
sound
]])
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
)
"
)
let
message
=
GetMessage
()
let
message
=
GetMessage
()
message
.
start
()
message
.
start
()
case
"sailassist"
:
case
"sailassist"
:
...
@@ -331,6 +335,7 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
...
@@ -331,6 +335,7 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
print
(
debug
:
"default"
)
print
(
debug
:
"default"
)
}
}
}
}
completionHandler
([[
.
banner
,
.
badge
,
.
sound
]])
}
}
// バックグラウンド状態で通知を受信して表示する
// バックグラウンド状態で通知を受信して表示する
...
@@ -352,10 +357,11 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
...
@@ -352,10 +357,11 @@ 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
)
"
)
let
message
=
GetMessage
()
let
message
=
GetMessage
()
message
.
start
()
message
.
start
()
case
"sailassist"
:
case
"sailassist"
:
...
@@ -378,6 +384,7 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
...
@@ -378,6 +384,7 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
print
(
debug
:
"default"
)
print
(
debug
:
"default"
)
}
}
}
}
completionHandler
()
}
}
}
}
...
...
Seilassist/Sailassist/SharingData/SharingData.swift
View file @
fbbb1ea7
...
@@ -119,6 +119,7 @@ class SharingData{
...
@@ -119,6 +119,7 @@ class SharingData{
@Published
var
mode
:
Bool
=
false
// false:通常 , true:Warning中
@Published
var
mode
:
Bool
=
false
// false:通常 , true:Warning中
@Published
var
messages
:
[
ChatMessage
]
=
[]
@Published
var
messages
:
[
ChatMessage
]
=
[]
@Published
var
users
:
[
ChatUser
]
=
[]
@Published
var
users
:
[
ChatUser
]
=
[]
@Published
var
viewCnt
:
Int
=
0
//未読数
func
changeMode
(){
func
changeMode
(){
self
.
mode
.
toggle
()
self
.
mode
.
toggle
()
...
...
Seilassist/Sailassist/Tab/MainTabView.swift
View file @
fbbb1ea7
...
@@ -69,10 +69,9 @@ struct MainTabView: View {
...
@@ -69,10 +69,9 @@ struct MainTabView: View {
@State
var
isPopover
:
Bool
=
selectedTabModel
.
isPoppver
@State
var
isPopover
:
Bool
=
selectedTabModel
.
isPoppver
TabView
(
selection
:
$
selectedTabModel
.
activeTab
){
TabView
(
selection
:
$
selectedTabModel
.
activeTab
){
#if CANARY
ChatView
()
ChatView
()
.
tag
(
Tab
.
chat
)
.
tag
(
Tab
.
chat
)
#endif
MapRepresentable
()
MapRepresentable
()
.
ignoresSafeArea
()
.
ignoresSafeArea
()
.
tag
(
Tab
.
task
)
.
tag
(
Tab
.
task
)
...
@@ -104,6 +103,7 @@ struct CustomTabBar: View {
...
@@ -104,6 +103,7 @@ struct CustomTabBar: View {
@State
var
isLocationAlert
=
false
@State
var
isLocationAlert
=
false
@Environment(\.openURL)
var
openURL
@Environment(\.openURL)
var
openURL
@ObservedObject
var
my
=
SharingData
.
my
@ObservedObject
var
my
=
SharingData
.
my
@ObservedObject
var
message
=
SharingData
.
message
@ObservedObject
var
location
=
SharingData
.
location
@ObservedObject
var
location
=
SharingData
.
location
var
body
:
some
View
{
var
body
:
some
View
{
...
@@ -126,12 +126,15 @@ struct CustomTabBar: View {
...
@@ -126,12 +126,15 @@ struct CustomTabBar: View {
Image
(
selectedTabModel
.
activeTab
==
tab
?
tab
.
rawValue
+
"_selected"
:
tab
.
rawValue
)
Image
(
selectedTabModel
.
activeTab
==
tab
?
tab
.
rawValue
+
"_selected"
:
tab
.
rawValue
)
.
font
(
.
title2
)
.
font
(
.
title2
)
// if tab == Tab.chat {
//チャットTab上の既読マーク
// Rectangle()
if
tab
==
Tab
.
chat
{
// .foregroundColor(.red)
if
message
.
viewCnt
!=
0
{
// .frame(width: 12, height: 12)
Rectangle
()
// .cornerRadius(60)
.
foregroundColor
(
.
red
)
// }
.
frame
(
width
:
12
,
height
:
12
)
.
cornerRadius
(
60
)
}
}
}
}
Text
(
tab
.
title
)
Text
(
tab
.
title
)
...
...
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