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
54
Merge Requests
54
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
gr-ssv
Sailassist
Commits
d2befa8b
Commit
d2befa8b
authored
Sep 22, 2025
by
shigemi miura
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
チャット複数行対応
parent
f4d8fe36
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
134 additions
and
54 deletions
+134
-54
project.pbxproj
Seilassist/Sailassist.xcodeproj/project.pbxproj
+7
-3
UserInterfaceState.xcuserstate
...userdata/miura.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
ChatView.swift
Seilassist/Sailassist/Chat/ChatView.swift
+11
-3
ImageQualityPreset.swift
Seilassist/Sailassist/Chat/ImageQualityPreset.swift
+31
-0
Imagepicker.swift
Seilassist/Sailassist/Chat/Imagepicker.swift
+19
-11
CameraView.swift
Seilassist/Sailassist/Chat/View/CameraView.swift
+1
-1
ChatInputView.swift
Seilassist/Sailassist/Chat/View/ChatInputView.swift
+51
-24
MyChatContentView.swift
Seilassist/Sailassist/Chat/View/MyChatContentView.swift
+1
-1
OtherChatContentView.swift
Seilassist/Sailassist/Chat/View/OtherChatContentView.swift
+1
-1
MapRepresentable.swift
Seilassist/Sailassist/Map/MapRepresentable.swift
+10
-8
SailassistApp.swift
Seilassist/Sailassist/SailassistApp.swift
+1
-1
MainTabView.swift
Seilassist/Sailassist/Tab/MainTabView.swift
+1
-1
No files found.
Seilassist/Sailassist.xcodeproj/project.pbxproj
View file @
d2befa8b
...
@@ -91,6 +91,7 @@
...
@@ -91,6 +91,7 @@
D55135202B15B030007B66B1
/* SetEcaArea.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D551351F2B15B030007B66B1
/* SetEcaArea.swift */
;
};
D55135202B15B030007B66B1
/* SetEcaArea.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D551351F2B15B030007B66B1
/* SetEcaArea.swift */
;
};
D55135222B15C062007B66B1
/* GetEcaList.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D55135212B15C062007B66B1
/* GetEcaList.swift */
;
};
D55135222B15C062007B66B1
/* GetEcaList.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D55135212B15C062007B66B1
/* GetEcaList.swift */
;
};
D55135242B15C3BF007B66B1
/* DeleteEcaArea.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D55135232B15C3BF007B66B1
/* DeleteEcaArea.swift */
;
};
D55135242B15C3BF007B66B1
/* DeleteEcaArea.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D55135232B15C3BF007B66B1
/* DeleteEcaArea.swift */
;
};
D55186132E7E9158004CD8BD
/* ImageQualityPreset.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D55186122E7E914C004CD8BD
/* ImageQualityPreset.swift */
;
};
D5598B782C435A5C00611AE0
/* ChatUrlImageView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D5598B772C435A5C00611AE0
/* ChatUrlImageView.swift */
;
};
D5598B782C435A5C00611AE0
/* ChatUrlImageView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D5598B772C435A5C00611AE0
/* ChatUrlImageView.swift */
;
};
D5598B7A2C435C4500611AE0
/* ChatUrlRawImageView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D5598B792C435C4500611AE0
/* ChatUrlRawImageView.swift */
;
};
D5598B7A2C435C4500611AE0
/* ChatUrlRawImageView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D5598B792C435C4500611AE0
/* ChatUrlRawImageView.swift */
;
};
D57905FE2C1C069000AF797C
/* SetNgaArea.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D57905FD2C1C069000AF797C
/* SetNgaArea.swift */
;
};
D57905FE2C1C069000AF797C
/* SetNgaArea.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D57905FD2C1C069000AF797C
/* SetNgaArea.swift */
;
};
...
@@ -266,6 +267,7 @@
...
@@ -266,6 +267,7 @@
D551351F2B15B030007B66B1
/* SetEcaArea.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
SetEcaArea.swift
;
path
=
Sailassist/ECA/SetEcaArea.swift
;
sourceTree
=
SOURCE_ROOT
;
};
D551351F2B15B030007B66B1
/* SetEcaArea.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
SetEcaArea.swift
;
path
=
Sailassist/ECA/SetEcaArea.swift
;
sourceTree
=
SOURCE_ROOT
;
};
D55135212B15C062007B66B1
/* GetEcaList.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
GetEcaList.swift
;
path
=
Sailassist/ECA/GetEcaList.swift
;
sourceTree
=
SOURCE_ROOT
;
};
D55135212B15C062007B66B1
/* GetEcaList.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
GetEcaList.swift
;
path
=
Sailassist/ECA/GetEcaList.swift
;
sourceTree
=
SOURCE_ROOT
;
};
D55135232B15C3BF007B66B1
/* DeleteEcaArea.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
DeleteEcaArea.swift
;
path
=
Sailassist/ECA/DeleteEcaArea.swift
;
sourceTree
=
SOURCE_ROOT
;
};
D55135232B15C3BF007B66B1
/* DeleteEcaArea.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
DeleteEcaArea.swift
;
path
=
Sailassist/ECA/DeleteEcaArea.swift
;
sourceTree
=
SOURCE_ROOT
;
};
D55186122E7E914C004CD8BD
/* ImageQualityPreset.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ImageQualityPreset.swift
;
sourceTree
=
"<group>"
;
};
D5598B772C435A5C00611AE0
/* ChatUrlImageView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
ChatUrlImageView.swift
;
path
=
Sailassist/Chat/View/ChatUrlImageView.swift
;
sourceTree
=
SOURCE_ROOT
;
};
D5598B772C435A5C00611AE0
/* ChatUrlImageView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
ChatUrlImageView.swift
;
path
=
Sailassist/Chat/View/ChatUrlImageView.swift
;
sourceTree
=
SOURCE_ROOT
;
};
D5598B792C435C4500611AE0
/* ChatUrlRawImageView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
ChatUrlRawImageView.swift
;
path
=
Sailassist/Chat/View/ChatUrlRawImageView.swift
;
sourceTree
=
SOURCE_ROOT
;
};
D5598B792C435C4500611AE0
/* ChatUrlRawImageView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
ChatUrlRawImageView.swift
;
path
=
Sailassist/Chat/View/ChatUrlRawImageView.swift
;
sourceTree
=
SOURCE_ROOT
;
};
D57905FD2C1C069000AF797C
/* SetNgaArea.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
SetNgaArea.swift
;
sourceTree
=
"<group>"
;
};
D57905FD2C1C069000AF797C
/* SetNgaArea.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
SetNgaArea.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -504,6 +506,7 @@
...
@@ -504,6 +506,7 @@
020B985F2ADD14970029DE4C
/* Chat */
=
{
020B985F2ADD14970029DE4C
/* Chat */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
D55186122E7E914C004CD8BD
/* ImageQualityPreset.swift */
,
020B98622ADD14E40029DE4C
/* ChatView.swift */
,
020B98622ADD14E40029DE4C
/* ChatView.swift */
,
02A1DE2D2AFB497B005BCF55
/* View */
,
02A1DE2D2AFB497B005BCF55
/* View */
,
D5258CA42B036F0700365276
/* GetMessage.swift */
,
D5258CA42B036F0700365276
/* GetMessage.swift */
,
...
@@ -1040,6 +1043,7 @@
...
@@ -1040,6 +1043,7 @@
D57906022C1C0CFB00AF797C
/* ReqNgaList.swift in Sources */
,
D57906022C1C0CFB00AF797C
/* ReqNgaList.swift in Sources */
,
020B98162AD8C3150029DE4C
/* ContentView.swift in Sources */
,
020B98162AD8C3150029DE4C
/* ContentView.swift in Sources */
,
020B98632ADD14E50029DE4C
/* ChatView.swift in Sources */
,
020B98632ADD14E50029DE4C
/* ChatView.swift in Sources */
,
D55186132E7E9158004CD8BD
/* ImageQualityPreset.swift in Sources */
,
02CE4DDA2ADFBA72002E79BC
/* MapRepresentable.swift in Sources */
,
02CE4DDA2ADFBA72002E79BC
/* MapRepresentable.swift in Sources */
,
020B985E2ADCFF130029DE4C
/* PreferencesKey.swift in Sources */
,
020B985E2ADCFF130029DE4C
/* PreferencesKey.swift in Sources */
,
0227890C2AE22E0B00A87787
/* SharingData.swift in Sources */
,
0227890C2AE22E0B00A87787
/* SharingData.swift in Sources */
,
...
@@ -1281,7 +1285,7 @@
...
@@ -1281,7 +1285,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
=
6
2
;
CURRENT_PROJECT_VERSION
=
6
3
;
DEVELOPMENT_ASSET_PATHS
=
"\"Sailassist/Preview Content\""
;
DEVELOPMENT_ASSET_PATHS
=
"\"Sailassist/Preview Content\""
;
DEVELOPMENT_TEAM
=
D2DC7QNNJ8
;
DEVELOPMENT_TEAM
=
D2DC7QNNJ8
;
ENABLE_PREVIEWS
=
YES
;
ENABLE_PREVIEWS
=
YES
;
...
@@ -1330,7 +1334,7 @@
...
@@ -1330,7 +1334,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
=
6
2
;
CURRENT_PROJECT_VERSION
=
6
3
;
DEVELOPMENT_ASSET_PATHS
=
"\"Sailassist/Preview Content\""
;
DEVELOPMENT_ASSET_PATHS
=
"\"Sailassist/Preview Content\""
;
DEVELOPMENT_TEAM
=
D2DC7QNNJ8
;
DEVELOPMENT_TEAM
=
D2DC7QNNJ8
;
ENABLE_PREVIEWS
=
YES
;
ENABLE_PREVIEWS
=
YES
;
...
@@ -1516,7 +1520,7 @@
...
@@ -1516,7 +1520,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
=
6
2
;
CURRENT_PROJECT_VERSION
=
6
3
;
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.xcodeproj/project.xcworkspace/xcuserdata/miura.xcuserdatad/UserInterfaceState.xcuserstate
View file @
d2befa8b
No preview for this file type
Seilassist/Sailassist/Chat/ChatView.swift
View file @
d2befa8b
...
@@ -27,9 +27,6 @@ struct ChatView: View {
...
@@ -27,9 +27,6 @@ struct ChatView: View {
ScrollViewReader
{
proxy
in
ScrollViewReader
{
proxy
in
ScrollView
(
.
vertical
)
{
ScrollView
(
.
vertical
)
{
VStack
{
VStack
{
Spacer
()
.
frame
(
height
:
20
)
ForEach
(
message
.
messages
,
id
:
\
.
messageId
)
{
msg
in
ForEach
(
message
.
messages
,
id
:
\
.
messageId
)
{
msg
in
if
msg
.
message
!=
nil
{
if
msg
.
message
!=
nil
{
if
msg
.
from
==
Preferences
.
UserName
{
if
msg
.
from
==
Preferences
.
UserName
{
...
@@ -47,6 +44,7 @@ struct ChatView: View {
...
@@ -47,6 +44,7 @@ struct ChatView: View {
}
}
}
}
}
}
.
padding
(
.
top
)
.
onAppear
{
.
onAppear
{
guard
!
message
.
messages
.
isEmpty
,
guard
!
message
.
messages
.
isEmpty
,
let
id
=
message
.
messages
.
last
?
.
messageId
else
{
return
}
let
id
=
message
.
messages
.
last
?
.
messageId
else
{
return
}
...
@@ -83,6 +81,16 @@ struct ChatView: View {
...
@@ -83,6 +81,16 @@ struct ChatView: View {
}
}
}
}
}
}
.
onReceive
(
NotificationCenter
.
default
.
publisher
(
for
:
UIResponder
.
keyboardDidShowNotification
))
{
_
in
Task
{
try
await
Task
.
sleep
(
for
:
.
seconds
(
0.1
))
withAnimation
{
if
let
id
=
message
.
messages
.
last
?
.
messageId
{
proxy
.
scrollTo
(
id
,
anchor
:
.
bottom
)
}
}
}
}
}
}
}
}
HStack
{
HStack
{
...
...
Seilassist/Sailassist/Chat/ImageQualityPreset.swift
0 → 100644
View file @
d2befa8b
import
CoreGraphics
import
UIKit
enum
ImageQualityPreset
{
case
low
,
middle
,
high
var
compressionQuality
:
CGFloat
{
switch
self
{
case
.
low
:
return
0.3
case
.
middle
:
return
0.6
case
.
high
:
return
1.0
}
}
var
targetSize
:
CGSize
{
switch
self
{
case
.
low
:
return
CGSize
(
width
:
640
,
height
:
480
)
case
.
middle
:
return
CGSize
(
width
:
1280
,
height
:
960
)
case
.
high
:
return
CGSize
(
width
:
1920
,
height
:
1440
)
}
}
}
extension
UIImage
{
func
resized
(
to
targetSize
:
CGSize
)
->
UIImage
{
let
renderer
=
UIGraphicsImageRenderer
(
size
:
targetSize
)
return
renderer
.
image
{
_
in
self
.
draw
(
in
:
CGRect
(
origin
:
.
zero
,
size
:
targetSize
))
}
}
}
Seilassist/Sailassist/Chat/Imagepicker.swift
View file @
d2befa8b
...
@@ -4,48 +4,56 @@
...
@@ -4,48 +4,56 @@
//
//
// Created by 三浦薫巳 on 2024/01/19.
// Created by 三浦薫巳 on 2024/01/19.
//
//
import
SwiftUI
import
SwiftUI
struct
Imagepicker
:
UIViewControllerRepresentable
{
struct
Imagepicker
:
UIViewControllerRepresentable
{
@Binding
var
show
:
Bool
@Binding
var
show
:
Bool
@Binding
var
image
:
Data
@Binding
var
image
:
Data
var
sourceType
:
UIImagePickerController
.
SourceType
var
sourceType
:
UIImagePickerController
.
SourceType
var
preset
:
ImageQualityPreset
func
makeCoordinator
()
->
Imagepicker
.
Coo
dinator
{
func
makeCoordinator
()
->
Coor
dinator
{
return
Imagepicker
.
Coordinator
(
parent
:
self
)
return
Coordinator
(
parent
:
self
)
}
}
func
makeUIViewController
(
context
:
UIViewControllerRepresentableContext
<
Imagepicker
>
)
->
UIImagePickerController
{
func
makeUIViewController
(
context
:
UIViewControllerRepresentableContext
<
Imagepicker
>
)
->
UIImagePickerController
{
let
controller
=
UIImagePickerController
()
let
controller
=
UIImagePickerController
()
controller
.
sourceType
=
sourceType
controller
.
sourceType
=
sourceType
controller
.
delegate
=
context
.
coordinator
controller
.
delegate
=
context
.
coordinator
// controller.mediaTypes = ["public.image", "public.movie"]
// controller.videoQuality = .type640x480
return
controller
return
controller
}
}
func
updateUIViewController
(
_
uiViewController
:
UIImagePickerController
,
context
:
UIViewControllerRepresentableContext
<
Imagepicker
>
)
{
func
updateUIViewController
(
_
uiViewController
:
UIImagePickerController
,
context
:
UIViewControllerRepresentableContext
<
Imagepicker
>
)
{
}
}
class
Coodinator
:
NSObject
,
UIImagePickerControllerDelegate
,
UINavigationControllerDelegate
{
class
Coo
r
dinator
:
NSObject
,
UIImagePickerControllerDelegate
,
UINavigationControllerDelegate
{
var
parent
:
Imagepicker
var
parent
:
Imagepicker
init
(
parent
:
Imagepicker
){
init
(
parent
:
Imagepicker
){
self
.
parent
=
parent
self
.
parent
=
parent
}
}
//Cancel
//
MARK: -
Cancel
func
imagePickerControllerDidCancel
(
_
picker
:
UIImagePickerController
)
{
func
imagePickerControllerDidCancel
(
_
picker
:
UIImagePickerController
)
{
self
.
parent
.
show
.
toggle
()
self
.
parent
.
show
.
toggle
()
}
}
//Use Photo
//
MARK: -
Use Photo
func
imagePickerController
(
_
picker
:
UIImagePickerController
,
didFinishPickingMediaWithInfo
info
:
[
UIImagePickerController
.
InfoKey
:
Any
])
{
func
imagePickerController
(
_
picker
:
UIImagePickerController
,
didFinishPickingMediaWithInfo
info
:
[
UIImagePickerController
.
InfoKey
:
Any
])
{
let
image
=
info
[
.
originalImage
]
as!
UIImage
if
let
image
=
info
[
.
originalImage
]
as?
UIImage
{
if
let
data
=
image
.
jpegData
(
compressionQuality
:
1.0
)
{
let
resizedImage
=
image
.
resized
(
to
:
parent
.
preset
.
targetSize
)
self
.
parent
.
image
=
data
if
let
data
=
resizedImage
.
jpegData
(
compressionQuality
:
parent
.
preset
.
compressionQuality
)
{
parent
.
image
=
data
}
}
self
.
parent
.
show
.
toggle
()
}
else
if
let
videoURL
=
info
[
.
mediaURL
]
as?
URL
{
// 動画ファイルの処理(例: Dataに変換して保存)
if
let
videoData
=
try
?
Data
(
contentsOf
:
videoURL
)
{
parent
.
image
=
videoData
}
}
parent
.
show
.
toggle
()
}
}
}
}
}
}
Seilassist/Sailassist/Chat/View/CameraView.swift
View file @
d2befa8b
...
@@ -18,7 +18,7 @@ struct CameraView: View {
...
@@ -18,7 +18,7 @@ struct CameraView: View {
NavigationStack
{
NavigationStack
{
List
{
List
{
}
.
navigationDestination
(
isPresented
:
$
isImagePicker
)
{
}
.
navigationDestination
(
isPresented
:
$
isImagePicker
)
{
Imagepicker
(
show
:
$
isImagePicker
,
image
:
$
imageData
,
sourceType
:
source
)
Imagepicker
(
show
:
$
isImagePicker
,
image
:
$
imageData
,
sourceType
:
source
,
preset
:
.
high
)
}
}
}
}
.
ignoresSafeArea
(
.
all
,
edges
:
.
top
)
.
ignoresSafeArea
(
.
all
,
edges
:
.
top
)
...
...
Seilassist/Sailassist/Chat/View/ChatInputView.swift
View file @
d2befa8b
...
@@ -25,6 +25,7 @@ struct ChatInputView: View {
...
@@ -25,6 +25,7 @@ struct ChatInputView: View {
@State
private
var
failedUploadImage
:
ReqUploadImage
?
=
nil
@State
private
var
failedUploadImage
:
ReqUploadImage
?
=
nil
@State
private
var
isRetryDialogPresented
=
false
@State
private
var
isRetryDialogPresented
=
false
@State
private
var
isRecording
=
false
@State
private
var
isRecording
=
false
@State
private
var
textViewHeight
:
CGFloat
=
40
@FocusState
private
var
isKeyboardFocused
:
Bool
@FocusState
private
var
isKeyboardFocused
:
Bool
@Binding
var
isFocus
:
Bool
@Binding
var
isFocus
:
Bool
...
@@ -75,35 +76,51 @@ struct ChatInputView: View {
...
@@ -75,35 +76,51 @@ struct ChatInputView: View {
}
}
//MARK: - 音声入力ボタン
//MARK: - 音声入力ボタン
Button
{
//
Button {
isRecording
.
toggle
()
//
isRecording.toggle()
if
isRecording
{
//
if isRecording {
speechRecognizer
.
transcribedText
=
""
//
speechRecognizer.transcribedText = ""
speechRecognizer
.
startRecording
()
//
speechRecognizer.startRecording()
}
else
{
//
} else {
speechRecognizer
.
stopRecording
()
//
speechRecognizer.stopRecording()
inputText
=
speechRecognizer
.
transcribedText
//
inputText = speechRecognizer.transcribedText
}
//
}
}
label
:
{
//
} label: {
Image
(
systemName
:
isRecording
?
"mic.fill"
:
"mic"
)
//
Image(systemName: isRecording ? "mic.fill" : "mic")
.
resizable
()
//
.resizable()
.
frame
(
width
:
20
,
height
:
20
)
//
.frame(width: 20, height: 20)
.
padding
(
5
)
//
.padding(5)
}
//
}
//MARK: - テキスト入力
//MARK: - テキスト入力
TextField
(
"Enter your message"
,
text
:
$
inputText
,
onEditingChanged
:
{
isEditing
in
TextEditor
(
text
:
$
inputText
)
sceneDelegate
.
tabWindow
?
.
isHidden
=
isEditing
isFocus
=
true
})
.
focused
(
$
isKeyboardFocused
)
.
focused
(
$
isKeyboardFocused
)
.
font
(
FontStyle
.
SupplementText
.
font
)
.
font
(
FontStyle
.
DefaultText
.
font
)
.
scrollContentBackground
(
Visibility
.
hidden
)
.
foregroundColor
(
ColorSet
.
BodyChat
.
color
)
.
foregroundColor
(
ColorSet
.
BodyChat
.
color
)
.
padding
(
10
)
.
background
(
ColorSet
.
ChatBaloon
.
color
)
.
background
(
ColorSet
.
ChatForm
.
color
)
.
cornerRadius
(
5
)
.
cornerRadius
(
5
)
.
padding
(
.
vertical
,
10
)
.
frame
(
height
:
textViewHeight
)
.
padding
(
.
leading
,
10
)
.
onAppear
{
recalculateHeight
()
}
.
onChange
(
of
:
inputText
)
{
_
in
recalculateHeight
()
}
.
overlay
(
alignment
:
.
topLeading
)
{
if
inputText
.
isEmpty
{
Text
(
"Enter your message"
)
.
font
(
FontStyle
.
DefaultText
.
font
)
.
foregroundColor
(
ColorSet
.
BodyNotice
.
color
)
.
background
(
ColorSet
.
ChatBaloon
.
color
)
.
padding
(
10
)
}
}
.
padding
(
EdgeInsets
(
top
:
2
,
leading
:
10
,
bottom
:
3
,
trailing
:
0
))
.
onChange
(
of
:
isKeyboardFocused
)
{
isFocused
in
sceneDelegate
.
tabWindow
?
.
isHidden
=
isFocused
isFocus
=
isFocused
}
//MARK: - 送信ボタン
//MARK: - 送信ボタン
Button
{
Button
{
...
@@ -276,6 +293,16 @@ struct ChatInputView: View {
...
@@ -276,6 +293,16 @@ struct ChatInputView: View {
}
}
}
}
}
}
//MARK: - テキスト高さ
private
func
recalculateHeight
()
{
let
textView
=
UITextView
()
textView
.
text
=
inputText
textView
.
font
=
UIFont
.
preferredFont
(
forTextStyle
:
.
body
)
let
fixedWidth
=
UIScreen
.
main
.
bounds
.
width
-
40
// 適宜調整
let
newSize
=
textView
.
sizeThatFits
(
CGSize
(
width
:
fixedWidth
,
height
:
CGFloat
.
greatestFiniteMagnitude
))
textViewHeight
=
max
(
newSize
.
height
,
40
)
// 最低高さを40に設定
}
}
}
#Preview {
#Preview {
...
...
Seilassist/Sailassist/Chat/View/MyChatContentView.swift
View file @
d2befa8b
...
@@ -23,7 +23,7 @@ struct MyChatContentView: View {
...
@@ -23,7 +23,7 @@ struct MyChatContentView: View {
.
foregroundColor
(
ColorSet
.
BodyChat
.
color
)
.
foregroundColor
(
ColorSet
.
BodyChat
.
color
)
.
padding
(
15
)
.
padding
(
15
)
.
background
(
ColorSet
.
ChatBaloon
.
color
)
.
background
(
ColorSet
.
ChatBaloon
.
color
)
.
border
(
Color
.
red
.
gradient
.
opacity
(
0.8
),
width
:
(
message
.
mode
==
1
?
2
:
0
))
.
border
(
Color
.
red
.
gradient
.
opacity
(
0.8
),
width
:
(
message
.
mode
==
ChatMode
.
warningProgress
.
rawValue
?
2
:
0
))
.
clipShape
(
.
clipShape
(
.
rect
(
.
rect
(
topLeadingRadius
:
10
,
topLeadingRadius
:
10
,
...
...
Seilassist/Sailassist/Chat/View/OtherChatContentView.swift
View file @
d2befa8b
...
@@ -28,7 +28,7 @@ struct OtherChatContentView: View {
...
@@ -28,7 +28,7 @@ struct OtherChatContentView: View {
.
foregroundColor
(
ColorSet
.
BodyChat
.
color
)
.
foregroundColor
(
ColorSet
.
BodyChat
.
color
)
.
padding
(
15
)
.
padding
(
15
)
.
background
(
ColorSet
.
ChatBaloon
.
color
)
.
background
(
ColorSet
.
ChatBaloon
.
color
)
.
border
(
Color
.
red
.
gradient
.
opacity
(
0.8
),
width
:
(
message
.
mode
==
1
?
2
:
0
))
.
border
(
Color
.
red
.
gradient
.
opacity
(
0.8
),
width
:
(
message
.
mode
==
ChatMode
.
warningProgress
.
rawValue
?
2
:
0
))
.
clipShape
(
.
clipShape
(
.
rect
(
.
rect
(
topLeadingRadius
:
10
,
topLeadingRadius
:
10
,
...
...
Seilassist/Sailassist/Map/MapRepresentable.swift
View file @
d2befa8b
...
@@ -23,7 +23,7 @@ struct MapRepresentable: UIViewControllerRepresentable {
...
@@ -23,7 +23,7 @@ struct MapRepresentable: UIViewControllerRepresentable {
mapVC
mapVC
}
}
//Viewが更新された場合に必要な処理を実装
//
MARK: -
Viewが更新された場合に必要な処理を実装
func
updateUIViewController
(
_
uiViewController
:
UIViewControllerType
,
context
:
Context
)
{
func
updateUIViewController
(
_
uiViewController
:
UIViewControllerType
,
context
:
Context
)
{
let
ecaArea
=
ecaData
.
ecaArea
.
map
{
$0
.
1
}
.
filter
{
$0
.
isRunning
}
.
first
let
ecaArea
=
ecaData
.
ecaArea
.
map
{
$0
.
1
}
.
filter
{
$0
.
isRunning
}
.
first
if
let
ecaArea
=
ecaArea
{
if
let
ecaArea
=
ecaArea
{
...
@@ -32,7 +32,7 @@ struct MapRepresentable: UIViewControllerRepresentable {
...
@@ -32,7 +32,7 @@ struct MapRepresentable: UIViewControllerRepresentable {
mapVC
.
removeEcaLine
()
mapVC
.
removeEcaLine
()
}
}
//ECA領域を画面中央に表示
//
MARK: -
ECA領域を画面中央に表示
if
let
focusEcaAreaId
=
ecaData
.
focusEca
,
let
focusEca
=
ecaData
.
ecaArea
[
focusEcaAreaId
]
{
if
let
focusEcaAreaId
=
ecaData
.
focusEca
,
let
focusEca
=
ecaData
.
ecaArea
[
focusEcaAreaId
]
{
mapVC
.
updateCamera
(
location
:
focusEca
.
centerPosition
,
zoomlevel
:
focusEca
.
zoomLevel
)
mapVC
.
updateCamera
(
location
:
focusEca
.
centerPosition
,
zoomlevel
:
focusEca
.
zoomLevel
)
mapVC
.
updateOneTimeEca
(
eca
:
focusEca
.
points
)
mapVC
.
updateOneTimeEca
(
eca
:
focusEca
.
points
)
...
@@ -42,7 +42,7 @@ struct MapRepresentable: UIViewControllerRepresentable {
...
@@ -42,7 +42,7 @@ struct MapRepresentable: UIViewControllerRepresentable {
}
}
}
}
//NGA領域を画面中央に表示
//
MARK: -
NGA領域を画面中央に表示
if
let
AreaId
=
ngaData
.
focusNga
,
let
uuid
=
NSUUID
(
uuidString
:
AreaId
)
{
if
let
AreaId
=
ngaData
.
focusNga
,
let
uuid
=
NSUUID
(
uuidString
:
AreaId
)
{
if
let
focusNga
=
ngaData
.
ngaArea
[
uuid
as
UUID
]
{
if
let
focusNga
=
ngaData
.
ngaArea
[
uuid
as
UUID
]
{
if
focusNga
.
points
.
count
>
0
{
if
focusNga
.
points
.
count
>
0
{
...
@@ -52,7 +52,7 @@ struct MapRepresentable: UIViewControllerRepresentable {
...
@@ -52,7 +52,7 @@ struct MapRepresentable: UIViewControllerRepresentable {
}
}
}
}
//通知場所を画面中央に表示
//
MARK: -
通知場所を画面中央に表示
if
let
focusPushHistoryId
=
pushHistory
.
focusPushHistory
,
let
focusPushHistory
=
pushHistory
.
pushHistoryData
[
focusPushHistoryId
]
{
if
let
focusPushHistoryId
=
pushHistory
.
focusPushHistory
,
let
focusPushHistory
=
pushHistory
.
pushHistoryData
[
focusPushHistoryId
]
{
if
let
position
=
focusPushHistory
.
position
{
if
let
position
=
focusPushHistory
.
position
{
if
let
latitude
=
position
.
lat
,
let
longitude
=
position
.
lon
{
if
let
latitude
=
position
.
lat
,
let
longitude
=
position
.
lon
{
...
@@ -61,9 +61,9 @@ struct MapRepresentable: UIViewControllerRepresentable {
...
@@ -61,9 +61,9 @@ struct MapRepresentable: UIViewControllerRepresentable {
}
}
}
}
//自船を画面中央に表示
//
MARK: -
自船を画面中央に表示
if
location
.
focusOwnShip
{
if
location
.
focusOwnShip
{
mapVC
.
updateCamera
(
location
:
location
.
location
,
zoomlevel
:
nil
)
mapVC
.
updateCamera
(
location
:
location
.
location
,
zoomlevel
:
10.0
)
}
}
if
let
mylocation
=
location
.
location
{
if
let
mylocation
=
location
.
location
{
...
@@ -124,7 +124,7 @@ class MapViewController : UIViewController {
...
@@ -124,7 +124,7 @@ class MapViewController : UIViewController {
self
.
addLayers
()
self
.
addLayers
()
}
}
//地図上クリック
//
MARK: -
地図上クリック
let
singleTap
=
UITapGestureRecognizer
(
target
:
self
,
action
:
#selector(
handleMapTap(sender:)
)
)
let
singleTap
=
UITapGestureRecognizer
(
target
:
self
,
action
:
#selector(
handleMapTap(sender:)
)
)
singleTap
.
numberOfTapsRequired
=
1
singleTap
.
numberOfTapsRequired
=
1
singleTap
.
numberOfTouchesRequired
=
1
singleTap
.
numberOfTouchesRequired
=
1
...
@@ -134,7 +134,7 @@ class MapViewController : UIViewController {
...
@@ -134,7 +134,7 @@ class MapViewController : UIViewController {
// }
// }
mapView
.
addGestureRecognizer
(
singleTap
)
mapView
.
addGestureRecognizer
(
singleTap
)
//地図上長押し
//
MARK: -
地図上長押し
let
longPress
=
UILongPressGestureRecognizer
(
target
:
self
,
action
:
#selector(
handleMapLongPress(sender:)
)
)
let
longPress
=
UILongPressGestureRecognizer
(
target
:
self
,
action
:
#selector(
handleMapLongPress(sender:)
)
)
for
recognizer
in
mapView
.
gestureRecognizers
!
where
recognizer
is
UILongPressGestureRecognizer
{
for
recognizer
in
mapView
.
gestureRecognizers
!
where
recognizer
is
UILongPressGestureRecognizer
{
longPress
.
require
(
toFail
:
recognizer
)
longPress
.
require
(
toFail
:
recognizer
)
...
@@ -1011,11 +1011,13 @@ class MapViewController : UIViewController {
...
@@ -1011,11 +1011,13 @@ class MapViewController : UIViewController {
* カメラ
* カメラ
*/
*/
func
updateCamera
(
location
:
CLLocationCoordinate2D
?,
zoomlevel
:
CGFloat
?){
func
updateCamera
(
location
:
CLLocationCoordinate2D
?,
zoomlevel
:
CGFloat
?){
DispatchQueue
.
main
.
async
{
if
let
level
=
zoomlevel
{
if
let
level
=
zoomlevel
{
self
.
mapView
.
camera
.
ease
(
to
:
CameraOptions
(
center
:
location
,
zoom
:
level
),
duration
:
1
)
self
.
mapView
.
camera
.
ease
(
to
:
CameraOptions
(
center
:
location
,
zoom
:
level
),
duration
:
1
)
}
else
{
}
else
{
self
.
mapView
.
camera
.
ease
(
to
:
CameraOptions
(
center
:
location
),
duration
:
1
)
self
.
mapView
.
camera
.
ease
(
to
:
CameraOptions
(
center
:
location
),
duration
:
1
)
}
}
}
if
SharingData
.
eca
.
focusEca
!=
nil
{
if
SharingData
.
eca
.
focusEca
!=
nil
{
SharingData
.
eca
.
focusEca
=
nil
SharingData
.
eca
.
focusEca
=
nil
}
}
...
...
Seilassist/Sailassist/SailassistApp.swift
View file @
d2befa8b
...
@@ -209,7 +209,7 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M
...
@@ -209,7 +209,7 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M
private
func
handleChatMode
(
message
:
ResChatMode
)
{
private
func
handleChatMode
(
message
:
ResChatMode
)
{
print
(
debug
:
"called"
)
print
(
debug
:
"called"
)
if
message
.
mode
==
1
{
if
message
.
mode
==
ChatMode
.
warningProgress
.
rawValue
{
self
.
msg
.
mode
=
true
self
.
msg
.
mode
=
true
}
else
{
}
else
{
self
.
msg
.
mode
=
false
self
.
msg
.
mode
=
false
...
...
Seilassist/Sailassist/Tab/MainTabView.swift
View file @
d2befa8b
...
@@ -199,7 +199,7 @@ struct CustomTabBar: View {
...
@@ -199,7 +199,7 @@ struct CustomTabBar: View {
}
}
}
}
//チャットTab上の既読マーク
//
MARK: -
チャットTab上の既読マーク
if
tab
==
Tab
.
chat
{
if
tab
==
Tab
.
chat
{
NotificationBadge
(
count
:
message
.
viewCnt
,
font
:
FontStyle
.
VersionText
.
font
)
NotificationBadge
(
count
:
message
.
viewCnt
,
font
:
FontStyle
.
VersionText
.
font
)
.
id
(
message
.
viewCnt
)
.
id
(
message
.
viewCnt
)
...
...
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