Commit 9bbc6b0d authored by shigemi miura's avatar shigemi miura

chat一部機能対応

parent 448f2347
...@@ -77,6 +77,8 @@ ...@@ -77,6 +77,8 @@
02F4DB672B2C173F00E86C41 /* SessionGetManualUrl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02F4DB662B2C173F00E86C41 /* SessionGetManualUrl.swift */; }; 02F4DB672B2C173F00E86C41 /* SessionGetManualUrl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02F4DB662B2C173F00E86C41 /* SessionGetManualUrl.swift */; };
A0F472F6BC78C5F1C5471836 /* Pods_SailAssistTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0D252BA721FD314FAE4C2B4C /* Pods_SailAssistTests.framework */; }; A0F472F6BC78C5F1C5471836 /* Pods_SailAssistTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0D252BA721FD314FAE4C2B4C /* Pods_SailAssistTests.framework */; };
D51AA4072B099FCC00EBBDD4 /* AlertDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = D51AA4062B099FCC00EBBDD4 /* AlertDB.swift */; }; D51AA4072B099FCC00EBBDD4 /* AlertDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = D51AA4062B099FCC00EBBDD4 /* AlertDB.swift */; };
D524DAF82B5A6D3600A399DD /* Imagepicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = D524DAF72B5A6D3600A399DD /* Imagepicker.swift */; };
D524DAFA2B5A6F5F00A399DD /* CameraView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D524DAF92B5A6F5F00A399DD /* CameraView.swift */; };
D5258C992B0334BF00365276 /* SessionShipStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5258C982B0334BF00365276 /* SessionShipStatus.swift */; }; D5258C992B0334BF00365276 /* SessionShipStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5258C982B0334BF00365276 /* SessionShipStatus.swift */; };
D5258C9B2B03401E00365276 /* MonitoringRoute.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5258C9A2B03401E00365276 /* MonitoringRoute.swift */; }; D5258C9B2B03401E00365276 /* MonitoringRoute.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5258C9A2B03401E00365276 /* MonitoringRoute.swift */; };
D5258C9D2B03507A00365276 /* ResMonitoringRoute.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5258C9C2B03507A00365276 /* ResMonitoringRoute.swift */; }; D5258C9D2B03507A00365276 /* ResMonitoringRoute.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5258C9C2B03507A00365276 /* ResMonitoringRoute.swift */; };
...@@ -88,6 +90,7 @@ ...@@ -88,6 +90,7 @@
D52D213A2AEBAC0500324D58 /* HttpRequestType.swift in Sources */ = {isa = PBXBuildFile; fileRef = D52D21392AEBAC0500324D58 /* HttpRequestType.swift */; }; D52D213A2AEBAC0500324D58 /* HttpRequestType.swift in Sources */ = {isa = PBXBuildFile; fileRef = D52D21392AEBAC0500324D58 /* HttpRequestType.swift */; };
D52D213F2AEBB7D700324D58 /* RegisteredEca.swift in Sources */ = {isa = PBXBuildFile; fileRef = D52D213E2AEBB7D700324D58 /* RegisteredEca.swift */; }; D52D213F2AEBB7D700324D58 /* RegisteredEca.swift in Sources */ = {isa = PBXBuildFile; fileRef = D52D213E2AEBB7D700324D58 /* RegisteredEca.swift */; };
D52D21412AEDE18F00324D58 /* EcaCoordinatesTable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D52D21402AEDE18F00324D58 /* EcaCoordinatesTable.swift */; }; D52D21412AEDE18F00324D58 /* EcaCoordinatesTable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D52D21402AEDE18F00324D58 /* EcaCoordinatesTable.swift */; };
D536F6712B678D8900A5BCF9 /* ReqUploadImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = D536F6702B678D8900A5BCF9 /* ReqUploadImage.swift */; };
D5384AFC2B306CEF006228C6 /* TermsView.html in Resources */ = {isa = PBXBuildFile; fileRef = D5384AFB2B306CEF006228C6 /* TermsView.html */; }; D5384AFC2B306CEF006228C6 /* TermsView.html in Resources */ = {isa = PBXBuildFile; fileRef = D5384AFB2B306CEF006228C6 /* TermsView.html */; };
D5384AFE2B3121F2006228C6 /* PrivacyView.html in Resources */ = {isa = PBXBuildFile; fileRef = D5384AFD2B3121F2006228C6 /* PrivacyView.html */; }; D5384AFE2B3121F2006228C6 /* PrivacyView.html in Resources */ = {isa = PBXBuildFile; fileRef = D5384AFD2B3121F2006228C6 /* PrivacyView.html */; };
D53B97262B341867000B3D29 /* AboutAppView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D53B97252B341867000B3D29 /* AboutAppView.swift */; }; D53B97262B341867000B3D29 /* AboutAppView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D53B97252B341867000B3D29 /* AboutAppView.swift */; };
...@@ -238,6 +241,8 @@ ...@@ -238,6 +241,8 @@
C0CBB553F04E0BB4ACC72BD1 /* Pods-Sailassist.qc.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sailassist.qc.xcconfig"; path = "Target Support Files/Pods-Sailassist/Pods-Sailassist.qc.xcconfig"; sourceTree = "<group>"; }; C0CBB553F04E0BB4ACC72BD1 /* Pods-Sailassist.qc.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sailassist.qc.xcconfig"; path = "Target Support Files/Pods-Sailassist/Pods-Sailassist.qc.xcconfig"; sourceTree = "<group>"; };
CA31D32D54D7C200EF057679 /* Pods-SailAssistTests.canary.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SailAssistTests.canary.xcconfig"; path = "Target Support Files/Pods-SailAssistTests/Pods-SailAssistTests.canary.xcconfig"; sourceTree = "<group>"; }; CA31D32D54D7C200EF057679 /* Pods-SailAssistTests.canary.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SailAssistTests.canary.xcconfig"; path = "Target Support Files/Pods-SailAssistTests/Pods-SailAssistTests.canary.xcconfig"; sourceTree = "<group>"; };
D51AA4062B099FCC00EBBDD4 /* AlertDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AlertDB.swift; path = Sailassist/DataSource/AlertDB.swift; sourceTree = SOURCE_ROOT; }; D51AA4062B099FCC00EBBDD4 /* AlertDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AlertDB.swift; path = Sailassist/DataSource/AlertDB.swift; sourceTree = SOURCE_ROOT; };
D524DAF72B5A6D3600A399DD /* Imagepicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Imagepicker.swift; path = Sailassist/Chat/Imagepicker.swift; sourceTree = SOURCE_ROOT; };
D524DAF92B5A6F5F00A399DD /* CameraView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = CameraView.swift; path = Sailassist/Chat/View/CameraView.swift; sourceTree = SOURCE_ROOT; };
D5258C982B0334BF00365276 /* SessionShipStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SessionShipStatus.swift; path = Sailassist/ServerSession/SessionShipStatus.swift; sourceTree = SOURCE_ROOT; }; D5258C982B0334BF00365276 /* SessionShipStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SessionShipStatus.swift; path = Sailassist/ServerSession/SessionShipStatus.swift; sourceTree = SOURCE_ROOT; };
D5258C9A2B03401E00365276 /* MonitoringRoute.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MonitoringRoute.swift; path = Sailassist/Map/MonitoringRoute.swift; sourceTree = SOURCE_ROOT; }; D5258C9A2B03401E00365276 /* MonitoringRoute.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MonitoringRoute.swift; path = Sailassist/Map/MonitoringRoute.swift; sourceTree = SOURCE_ROOT; };
D5258C9C2B03507A00365276 /* ResMonitoringRoute.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ResMonitoringRoute.swift; path = Sailassist/Json/ResMonitoringRoute.swift; sourceTree = SOURCE_ROOT; }; D5258C9C2B03507A00365276 /* ResMonitoringRoute.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ResMonitoringRoute.swift; path = Sailassist/Json/ResMonitoringRoute.swift; sourceTree = SOURCE_ROOT; };
...@@ -249,6 +254,7 @@ ...@@ -249,6 +254,7 @@
D52D21392AEBAC0500324D58 /* HttpRequestType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = HttpRequestType.swift; path = Sailassist/Http/HttpRequestType.swift; sourceTree = SOURCE_ROOT; }; D52D21392AEBAC0500324D58 /* HttpRequestType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = HttpRequestType.swift; path = Sailassist/Http/HttpRequestType.swift; sourceTree = SOURCE_ROOT; };
D52D213E2AEBB7D700324D58 /* RegisteredEca.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = RegisteredEca.swift; path = Sailassist/ECA/RegisteredEca.swift; sourceTree = SOURCE_ROOT; }; D52D213E2AEBB7D700324D58 /* RegisteredEca.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = RegisteredEca.swift; path = Sailassist/ECA/RegisteredEca.swift; sourceTree = SOURCE_ROOT; };
D52D21402AEDE18F00324D58 /* EcaCoordinatesTable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = EcaCoordinatesTable.swift; path = Sailassist/ECA/EcaCoordinatesTable.swift; sourceTree = SOURCE_ROOT; }; D52D21402AEDE18F00324D58 /* EcaCoordinatesTable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = EcaCoordinatesTable.swift; path = Sailassist/ECA/EcaCoordinatesTable.swift; sourceTree = SOURCE_ROOT; };
D536F6702B678D8900A5BCF9 /* ReqUploadImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ReqUploadImage.swift; path = Sailassist/Json/ReqUploadImage.swift; sourceTree = SOURCE_ROOT; };
D5384AFB2B306CEF006228C6 /* TermsView.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = TermsView.html; path = SailAssist/html/TermsView.html; sourceTree = SOURCE_ROOT; }; D5384AFB2B306CEF006228C6 /* TermsView.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = TermsView.html; path = SailAssist/html/TermsView.html; sourceTree = SOURCE_ROOT; };
D5384AFD2B3121F2006228C6 /* PrivacyView.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = PrivacyView.html; path = SailAssist/html/PrivacyView.html; sourceTree = SOURCE_ROOT; }; D5384AFD2B3121F2006228C6 /* PrivacyView.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = PrivacyView.html; path = SailAssist/html/PrivacyView.html; sourceTree = SOURCE_ROOT; };
D53ACA752B0AECF8008DCB18 /* Sailassist.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = Sailassist.entitlements; path = Sailassist/Sailassist.entitlements; sourceTree = "<group>"; }; D53ACA752B0AECF8008DCB18 /* Sailassist.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = Sailassist.entitlements; path = Sailassist/Sailassist.entitlements; sourceTree = "<group>"; };
...@@ -482,6 +488,7 @@ ...@@ -482,6 +488,7 @@
020B98622ADD14E40029DE4C /* ChatView.swift */, 020B98622ADD14E40029DE4C /* ChatView.swift */,
02A1DE2D2AFB497B005BCF55 /* View */, 02A1DE2D2AFB497B005BCF55 /* View */,
D5258CA42B036F0700365276 /* GetMessage.swift */, D5258CA42B036F0700365276 /* GetMessage.swift */,
D524DAF72B5A6D3600A399DD /* Imagepicker.swift */,
); );
path = Chat; path = Chat;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -595,6 +602,7 @@ ...@@ -595,6 +602,7 @@
02C3E5CD2AFCA04700AF7837 /* OtherChatContentView.swift */, 02C3E5CD2AFCA04700AF7837 /* OtherChatContentView.swift */,
02A1DE322AFB654A005BCF55 /* CustomCornerRadius.swift */, 02A1DE322AFB654A005BCF55 /* CustomCornerRadius.swift */,
02C3E6082AFDF30000AF7837 /* ChatMemberView.swift */, 02C3E6082AFDF30000AF7837 /* ChatMemberView.swift */,
D524DAF92B5A6F5F00A399DD /* CameraView.swift */,
); );
path = View; path = View;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -740,6 +748,7 @@ ...@@ -740,6 +748,7 @@
D5FCEF542B478985009A81D0 /* ResChatMessage.swift */, D5FCEF542B478985009A81D0 /* ResChatMessage.swift */,
D5FCEF562B4789A8009A81D0 /* ResAckMessage.swift */, D5FCEF562B4789A8009A81D0 /* ResAckMessage.swift */,
D5FCEF582B4789D2009A81D0 /* ResChatMode.swift */, D5FCEF582B4789D2009A81D0 /* ResChatMode.swift */,
D536F6702B678D8900A5BCF9 /* ReqUploadImage.swift */,
); );
path = Json; path = Json;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -975,6 +984,7 @@ ...@@ -975,6 +984,7 @@
D5AE351D2AEBA6FC00059889 /* SessionLogin.swift in Sources */, D5AE351D2AEBA6FC00059889 /* SessionLogin.swift in Sources */,
D5258C9F2B03527400365276 /* ResGetMessages.swift in Sources */, D5258C9F2B03527400365276 /* ResGetMessages.swift in Sources */,
D55135242B15C3BF007B66B1 /* DeleteEcaArea.swift in Sources */, D55135242B15C3BF007B66B1 /* DeleteEcaArea.swift in Sources */,
D524DAFA2B5A6F5F00A399DD /* CameraView.swift in Sources */,
D5FCEF592B4789D2009A81D0 /* ResChatMode.swift in Sources */, D5FCEF592B4789D2009A81D0 /* ResChatMode.swift in Sources */,
024EDE1B2B0C41E40013BAC8 /* MenuSettingView.swift in Sources */, 024EDE1B2B0C41E40013BAC8 /* MenuSettingView.swift in Sources */,
020B98552AD924930029DE4C /* QrCodeScannerView.swift in Sources */, 020B98552AD924930029DE4C /* QrCodeScannerView.swift in Sources */,
...@@ -1005,6 +1015,7 @@ ...@@ -1005,6 +1015,7 @@
D545FC742B09C74300F206D0 /* AlertManager.swift in Sources */, D545FC742B09C74300F206D0 /* AlertManager.swift in Sources */,
0210CF302B3A8FE800968F33 /* MenuInfomarionView.swift in Sources */, 0210CF302B3A8FE800968F33 /* MenuInfomarionView.swift in Sources */,
020B98692ADD221E0029DE4C /* Preferences.swift in Sources */, 020B98692ADD221E0029DE4C /* Preferences.swift in Sources */,
D536F6712B678D8900A5BCF9 /* ReqUploadImage.swift in Sources */,
02CD06932AE88970005F8D8F /* ServerSession.swift in Sources */, 02CD06932AE88970005F8D8F /* ServerSession.swift in Sources */,
02A1DE312AFB61D8005BCF55 /* MyChatContentView.swift in Sources */, 02A1DE312AFB61D8005BCF55 /* MyChatContentView.swift in Sources */,
D58E1F522B142A3F0092D8FE /* ResEcaArea.swift in Sources */, D58E1F522B142A3F0092D8FE /* ResEcaArea.swift in Sources */,
...@@ -1048,6 +1059,7 @@ ...@@ -1048,6 +1059,7 @@
02C3E5D12AFCC16800AF7837 /* ChatTitleView.swift in Sources */, 02C3E5D12AFCC16800AF7837 /* ChatTitleView.swift in Sources */,
024EDE1D2B0C42F70013BAC8 /* MenuGpsSelectView.swift in Sources */, 024EDE1D2B0C42F70013BAC8 /* MenuGpsSelectView.swift in Sources */,
020B98472AD8FEE30029DE4C /* ColorSet.swift in Sources */, 020B98472AD8FEE30029DE4C /* ColorSet.swift in Sources */,
D524DAF82B5A6D3600A399DD /* Imagepicker.swift in Sources */,
D51AA4072B099FCC00EBBDD4 /* AlertDB.swift in Sources */, D51AA4072B099FCC00EBBDD4 /* AlertDB.swift in Sources */,
020B98652ADD14F60029DE4C /* NotificationView.swift in Sources */, 020B98652ADD14F60029DE4C /* NotificationView.swift in Sources */,
); );
......
...@@ -11,6 +11,7 @@ struct ChatView: View { ...@@ -11,6 +11,7 @@ struct ChatView: View {
@EnvironmentObject private var selectedTabModel: SelectedTabModel @EnvironmentObject private var selectedTabModel: SelectedTabModel
@ObservedObject var message = SharingData.message @ObservedObject var message = SharingData.message
@State var isShowMember: Bool = false @State var isShowMember: Bool = false
@StateObject var scrollBottom = ScrollBottom()
var body: some View { var body: some View {
ZStack { ZStack {
if message.mode == true{ if message.mode == true{
...@@ -21,12 +22,15 @@ struct ChatView: View { ...@@ -21,12 +22,15 @@ struct ChatView: View {
ChatTitleView(isShowMember: $isShowMember) ChatTitleView(isShowMember: $isShowMember)
ZStack{ ZStack{
ScrollViewReader { proxy in
ScrollView(.vertical) { ScrollView(.vertical) {
VStack {
Spacer() Spacer()
.frame(height: 20) .frame(height: 20)
ForEach(message.messages, id: \.messageId) { msg in ForEach(message.messages, id: \.messageId) { msg in
if msg.fromId == String(SharingData.my.id){ // if msg.fromId == String(SharingData.my.id) {
if msg.from == Preferences.UserName {
//自分のメッセージ //自分のメッセージ
MyChatContentView(message: msg) MyChatContentView(message: msg)
.padding(.bottom, 24) .padding(.bottom, 24)
...@@ -37,6 +41,23 @@ struct ChatView: View { ...@@ -37,6 +41,23 @@ struct ChatView: View {
} }
} }
} }
.onAppear {
self.scrollBottom.onAppear()
}
}
.onReceive(message.$messages) { (value) in
withAnimation {
guard !value.isEmpty else {return}
proxy.scrollTo(value.last?.messageId, anchor: .center)
if let lastId = value.last?.messageId {
print(debug: "\(String(describing: lastId))")
}
}
}
.onChange(of: scrollBottom.scrollID) { id in
proxy.scrollTo(id, anchor: .center)
}
}
HStack { HStack {
Spacer() Spacer()
VStack{ VStack{
...@@ -56,14 +77,25 @@ struct ChatView: View { ...@@ -56,14 +77,25 @@ struct ChatView: View {
ChatMemberView() ChatMemberView()
} }
} }
}
ChatInputView() ChatInputView()
} }
}
.background(ColorSet.BackgroundPrimary.color) .background(ColorSet.BackgroundPrimary.color)
} }
} }
class ScrollBottom: ObservableObject {
@Published var scrollID: String = ""
func onAppear() {
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
if let id = SharingData.message.messages.last?.messageId {
self.scrollID = id
}
}
}
}
#Preview { #Preview {
ChatView() ChatView()
} }
...@@ -27,6 +27,10 @@ class GetMessage { ...@@ -27,6 +27,10 @@ class GetMessage {
if let msg = res.messages { if let msg = res.messages {
SharingData.message.messages = msg SharingData.message.messages = msg
} }
SharingData.message.users = []
if let users = res.users {
SharingData.message.users = users
}
} }
case .failure(let errorCode): case .failure(let errorCode):
print(debug: errorCode) print(debug: errorCode)
......
//
// Imagepicker.swift
// Sailassist
//
// Created by 三浦薫巳 on 2024/01/19.
//
import SwiftUI
struct Imagepicker : UIViewControllerRepresentable {
@Binding var show: Bool
@Binding var image: Data
var sourceType: UIImagePickerController.SourceType
func makeCoordinator() -> Imagepicker.Coodinator {
return Imagepicker.Coordinator(parent: self)
}
func makeUIViewController(context: UIViewControllerRepresentableContext<Imagepicker>) -> UIImagePickerController {
let controller = UIImagePickerController()
controller.sourceType = sourceType
controller.delegate = context.coordinator
return controller
}
func updateUIViewController(_ uiViewController: UIImagePickerController, context: UIViewControllerRepresentableContext<Imagepicker>) {
}
class Coodinator: NSObject,UIImagePickerControllerDelegate,UINavigationControllerDelegate {
var parent : Imagepicker
init(parent : Imagepicker){
self.parent = parent
}
//Cancel
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
self.parent.show.toggle()
}
//Use Photo
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
let image = info[.originalImage] as! UIImage
let data = image.pngData()
self.parent.image = data!
self.parent.show.toggle()
}
}
}
//
// CameraView.swift
// Sailassist
//
// Created by 三浦薫巳 on 2024/01/19.
//
import SwiftUI
struct CameraView: View {
@Binding var imageData : Data
@Binding var source: UIImagePickerController.SourceType
@Binding var isActionSheet: Bool
@Binding var isImagePicker: Bool
var body: some View {
NavigationStack {
List {
}.navigationDestination(isPresented: $isImagePicker) {
Imagepicker(show: $isImagePicker, image: $imageData, sourceType: source)
}
}
.ignoresSafeArea(.all, edges: .top)
.background(Color.primary.opacity(0.06).ignoresSafeArea(.all, edges: .all))
}
}
...@@ -9,7 +9,16 @@ import SwiftUI ...@@ -9,7 +9,16 @@ import SwiftUI
struct ChatInputView: View { struct ChatInputView: View {
@EnvironmentObject private var sceneDelegate: SceneDelegate @EnvironmentObject private var sceneDelegate: SceneDelegate
@ObservedObject var sessionUploadImage: SessionUploadImage = SessionUploadImage()
@State var inputText = "" @State var inputText = ""
@State private var selectionValue = 3
@State var isCamera: Bool = false
@State var isPhoto: Bool = false
@State var isImportFile: Bool = false
@State var imageData : Data = .init(capacity:0)
@State var source:UIImagePickerController.SourceType = .photoLibrary
@State var isActionSheet = false
@State var isImagePicker = false
@FocusState var isKeyboard : Bool @FocusState var isKeyboard : Bool
var body: some View { var body: some View {
...@@ -18,6 +27,51 @@ struct ChatInputView: View { ...@@ -18,6 +27,51 @@ struct ChatInputView: View {
Divider() Divider()
HStack(spacing: 10){ HStack(spacing: 10){
Button {
sceneDelegate.tabWindow?.isHidden = true
isCamera = true
source = .camera
isImagePicker.toggle()
} label: {
Image(systemName: "camera")
.resizable()
.frame(width: 24, height: 24)
.padding(10)
}
Menu {
Button(action: {
print("Photo Library")
sceneDelegate.tabWindow?.isHidden = true
isCamera = true
source = .photoLibrary
isImagePicker.toggle()
}) {
Label("Photo Library", systemImage: "photo.on.rectangle")
}
Button(action: {
print("Take Photo")
sceneDelegate.tabWindow?.isHidden = true
isImportFile = true
}) {
Label("Take Phot", systemImage: "camera")
}
Button(action: {
print("Choose File")
sceneDelegate.tabWindow?.isHidden = true
isCamera = true
source = .photoLibrary
isImagePicker.toggle()
}) {
Label("Choose File", systemImage: "folder")
}
} label: {
Image(systemName: "photo")
.resizable()
.frame(width: 24, height: 24)
.padding(10)
}
TextField("", text: $inputText, onEditingChanged: { isEdit in TextField("", text: $inputText, onEditingChanged: { isEdit in
sceneDelegate.tabWindow?.isHidden = isEdit sceneDelegate.tabWindow?.isHidden = isEdit
}) })
...@@ -45,8 +99,47 @@ struct ChatInputView: View { ...@@ -45,8 +99,47 @@ struct ChatInputView: View {
.padding(.trailing, 11) .padding(.trailing, 11)
} }
.background(ColorSet.BackgroundSecondary.color) .background(ColorSet.BackgroundSecondary.color)
.fullScreenCover(isPresented: .constant(isImagePicker), onDismiss: {
//シートを閉じる時に実行する処理
sceneDelegate.tabWindow?.isHidden = false
if imageData.count != 0 {
let jpegData = UIImage(data: imageData)!.jpegData(compressionQuality: 1.0)
let uploadImage = ReqUploadImage(shipId: Preferences.shipId, messageId: UUID().uuidString, location: 2, from: Preferences.UserName, fromId: String(SharingData.my.id), files: jpegData!)
sessionUploadImage.RequestUploadImage(uploadImage, completion: responseUploadImage)
}
}, content: {
CameraView(imageData: $imageData, source: $source, isActionSheet: $isActionSheet, isImagePicker: $isImagePicker)
})
.fileImporter(isPresented: $isImportFile, allowedContentTypes: [.png, .jpeg, .pdf]) { result in
switch result {
case .success(let url):
guard let imageData = try? Data(contentsOf: url) else { return }
if imageData.count != 0 {
let jpegData = UIImage(data: imageData)!.jpegData(compressionQuality: 1.0)
let uploadImage = ReqUploadImage(shipId: Preferences.shipId, messageId: UUID().uuidString, location: 2, from: Preferences.UserName, fromId: String(SharingData.my.id), files: jpegData!)
sessionUploadImage.RequestUploadImage(uploadImage, completion: responseUploadImage)
} }
case .failure:
print("failure")
}
}
}
.frame(maxHeight: 55)
}
func responseUploadImage(result: Result<Data, APIError>) {
print(debug: "calld")
switch result {
case .success(let resultData):
let serverSession = ServerSession()
let resjson = serverSession.fromJSON(resultData: resultData, resltType: ResLogin.self)
case .failure(let errorCode):
print(debug: errorCode)
break
}
} }
} }
......
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
import SwiftUI import SwiftUI
struct ChatMemberView: View { struct ChatMemberView: View {
var members = ["Yokoyama", "Nogami", "Arahira", "Enokido"] @ObservedObject var message = SharingData.message
// var members = ["Yokoyama", "Nogami", "Arahira", "Enokido"]
var body: some View { var body: some View {
VStack { VStack {
List { List {
ForEach(members, id: \.self) { member in ForEach(message.users, id: \.id) { user in
Text(member) Text(user.name)
.foregroundColor(ColorSet.BodyChat.color) .foregroundColor(ColorSet.BodyChat.color)
.font(FontStyle.SupplementText.font) .font(FontStyle.SupplementText.font)
} }
......
...@@ -9,10 +9,10 @@ import SwiftUI ...@@ -9,10 +9,10 @@ import SwiftUI
struct ChatTitleView: View { struct ChatTitleView: View {
@Binding var isShowMember: Bool @Binding var isShowMember: Bool
var body: some View { @ObservedObject var message = SharingData.message
var body: some View {
VStack { VStack {
HStack { HStack {
Button{ Button{
...@@ -25,11 +25,15 @@ struct ChatTitleView: View { ...@@ -25,11 +25,15 @@ struct ChatTitleView: View {
Spacer() Spacer()
HStack(spacing: 8) { HStack(spacing: 8) {
VStack{ VStack{
Text("JMB-Demo(0518)") Text(SharingData.my.shipName)
.font(FontStyle.TitleL.font) .font(FontStyle.TitleL.font)
Text("Yokoyama,Nogami,Arahira,Enokida")
.font(FontStyle.TitleSBold.font)
HStack {
ForEach(message.users, id: \.id) { user in
Text(user.name + ",")
.font(FontStyle.TitleS.font)
}
}
} }
.foregroundColor(ColorSet.Body.color) .foregroundColor(ColorSet.Body.color)
.frame(width: 162,height: 44) .frame(width: 162,height: 44)
......
...@@ -13,12 +13,59 @@ struct MyChatContentView: View { ...@@ -13,12 +13,59 @@ struct MyChatContentView: View {
HStack { HStack {
Spacer() Spacer()
VStack(alignment: .trailing, spacing: 6) { VStack(alignment: .trailing, spacing: 6) {
Group {
if message.message.contains("https://") { //TODO: stampIdが0
AsyncImage(url: URL(string: message.message)) { image in
image.resizable()
.frame(width: 200, height: 200)
.contextMenu {
Button(action: {
print("fight")
}) {
Text("Share...")
Image(systemName: "square.and.arrow.up")
}
Button(action: {
print("bag")
}) {
Text("Save to Photos")
Image(systemName: "square.and.arrow.down")
}
Button(action: {
print("pokemon")
}) {
Text("Copy")
Image(systemName: "doc.on.doc")
}
Button(action: {
print("run")
}) {
Text("Copy Subject")
Image(systemName: "circle.dashed.rectangle")
}
Button(action: {
print("run")
}) {
Text("Show Text")
Image(systemName: "text.viewfinder")
}
}
} placeholder: {
ProgressView()
}
} else {
Text(message.message) Text(message.message)
.font(FontStyle.DefaultText.font) .font(FontStyle.DefaultText.font)
.foregroundColor(ColorSet.BodyChat.color) .foregroundColor(ColorSet.BodyChat.color)
.padding(15) .padding(15)
.background(ColorSet.ChatBaloon.color) .background(ColorSet.ChatBaloon.color)
.cornerRadius(10, corners: [.tl, .tr, .bl]) .cornerRadius(10, corners: [.tl, .tr, .br])
}
}
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: ""))
......
...@@ -16,12 +16,59 @@ struct OtherChatContentView: View { ...@@ -16,12 +16,59 @@ struct OtherChatContentView: View {
.font(FontStyle.EmphasisText.font) .font(FontStyle.EmphasisText.font)
.foregroundColor(ColorSet.Body.color) .foregroundColor(ColorSet.Body.color)
VStack(alignment: .leading, spacing: 10) { VStack(alignment: .leading, spacing: 10) {
Group {
if message.message.contains("https://") { //TODO: stampIdが0
AsyncImage(url: URL(string: message.message)) { image in
image.resizable()
.frame(width: 200, height: 200)
.contextMenu {
Button(action: {
print("fight")
}) {
Text("Share...")
Image(systemName: "square.and.arrow.up")
}
Button(action: {
print("bag")
}) {
Text("Save to Photos")
Image(systemName: "square.and.arrow.down")
}
Button(action: {
print("pokemon")
}) {
Text("Copy")
Image(systemName: "doc.on.doc")
}
Button(action: {
print("run")
}) {
Text("Copy Subject")
Image(systemName: "circle.dashed.rectangle")
}
Button(action: {
print("run")
}) {
Text("Show Text")
Image(systemName: "text.viewfinder")
}
}
} placeholder: {
ProgressView()
}
} else {
Text(message.message) Text(message.message)
.font(FontStyle.DefaultText.font) .font(FontStyle.DefaultText.font)
.foregroundColor(ColorSet.BodyChat.color) .foregroundColor(ColorSet.BodyChat.color)
.padding(15) .padding(15)
.background(ColorSet.ChatBaloon.color) .background(ColorSet.ChatBaloon.color)
.cornerRadius(10, corners: [.tl, .tr, .br]) .cornerRadius(10, corners: [.tl, .tr, .br])
}
}
HStack(alignment: .top){ HStack(alignment: .top){
Text(DateTextLib.ISO86012FormatText(message.time, format: "yyyy/MM/dd hh:mm", errFormat: "")) Text(DateTextLib.ISO86012FormatText(message.time, format: "yyyy/MM/dd hh:mm", errFormat: ""))
......
...@@ -12,7 +12,7 @@ struct ReqAckMessage : Codable { ...@@ -12,7 +12,7 @@ struct ReqAckMessage : Codable {
var messageId: String = "" //確認したMessageId var messageId: String = "" //確認したMessageId
var time: String = "" //投稿日時 2023-11-02T05:25:49.4362123Z var time: String = "" //投稿日時 2023-11-02T05:25:49.4362123Z
var location: Int = 0 //1:Shore / 2:Ship var location: Int = 0 //1:Shore / 2:Ship
var fromeId: Int = 0 //ユーザーID var fromeId: String = "" //ユーザーID
init(shipId: Int, messageId: String) { init(shipId: Int, messageId: String) {
self.shipId = shipId self.shipId = shipId
......
...@@ -15,7 +15,7 @@ struct ReqChatModeMessage : Codable { ...@@ -15,7 +15,7 @@ struct ReqChatModeMessage : Codable {
var shipId: Int = 0 var shipId: Int = 0
var time: String = "" //投稿日時 2023-11-02T05:25:49.4362123Z var time: String = "" //投稿日時 2023-11-02T05:25:49.4362123Z
var location: Int = 0 //1:Shore / 2:Ship var location: Int = 0 //1:Shore / 2:Ship
var fromeId: Int = 0 //ユーザーID var fromeId: String = "" //ユーザーID
var mode: Int = 0 //0:通常 / 1:Warning中 var mode: Int = 0 //0:通常 / 1:Warning中
init(shipId: Int) { init(shipId: Int) {
......
...@@ -14,9 +14,9 @@ struct ReqMessage : Codable { ...@@ -14,9 +14,9 @@ struct ReqMessage : Codable {
var time: String = "" //2023-11-02T05:25:49.4362123Z var time: String = "" //2023-11-02T05:25:49.4362123Z
var location: Int = 0 //1:Shore / 2:Ship var location: Int = 0 //1:Shore / 2:Ship
var from: String = "" //投稿者名 var from: String = "" //投稿者名
var fromeId: Int = 0 //ユーザーID var fromeId: String = "" //ユーザーID
var message: String = "" //テキスト var message: String = "" //テキスト
var stampId: Int? //スタンプ番号 0:Fire〜 var stampId: Int = 0 //スタンプ番号 0:Fire〜
init(shipId: Int, messageId: String) { init(shipId: Int, messageId: String) {
self.shipId = shipId self.shipId = shipId
......
//
// ReqUploadImage.swift
// Sailassist
//
// Created by 三浦薫巳 on 2024/01/29.
//
import Foundation
struct ReqUploadImage : Codable {
var shipId: Int
var messageId: String //UUID
var location: Int //1:Shore、2:Ship
var from: String //投稿者名
var fromId: String //ユーザーID
var files: Data
}
...@@ -100,6 +100,7 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M ...@@ -100,6 +100,7 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M
Preferences.DeviceId = UUID().uuidString Preferences.DeviceId = UUID().uuidString
} }
//SignalR初期化
hubConnectionDelegate = ChatHubConnectionDelegate(app: self) hubConnectionDelegate = ChatHubConnectionDelegate(app: self)
connection = HubConnectionBuilder(url: URL(string : HttpRequestType.SignalR.rawValue)!) connection = HubConnectionBuilder(url: URL(string : HttpRequestType.SignalR.rawValue)!)
.withHubConnectionDelegate(delegate: hubConnectionDelegate!) .withHubConnectionDelegate(delegate: hubConnectionDelegate!)
...@@ -190,9 +191,9 @@ class SignalR: NSObject { ...@@ -190,9 +191,9 @@ class SignalR: NSObject {
request.time = DateTextLib.Date2ISO8601Text(Date()) request.time = DateTextLib.Date2ISO8601Text(Date())
request.location = 2 //1:Shore , 2:Ship request.location = 2 //1:Shore , 2:Ship
request.from = Preferences.UserName //投稿者名 request.from = Preferences.UserName //投稿者名
request.fromeId = SharingData.my.id //ユーザーID request.fromeId = String(SharingData.my.id) //ユーザーID
request.message = message //テキスト request.message = message //テキスト
// request.stampId = //スタンプ番号 0:Fire~ request.stampId = 0 //スタンプ番号 0:Fire~
if message != "" { if message != "" {
connection!.invoke(method: "chatMessage", request) { error in connection!.invoke(method: "chatMessage", request) { error in
...@@ -207,7 +208,7 @@ class SignalR: NSObject { ...@@ -207,7 +208,7 @@ class SignalR: NSObject {
var request = ReqAckMessage(shipId: Preferences.shipId, messageId: messageId) var request = ReqAckMessage(shipId: Preferences.shipId, messageId: messageId)
request.time = DateTextLib.Date2ISO8601Text(Date()) request.time = DateTextLib.Date2ISO8601Text(Date())
request.location = 2 //1:Shore , 2:Ship request.location = 2 //1:Shore , 2:Ship
request.fromeId = SharingData.my.id //ユーザーID request.fromeId = String(SharingData.my.id) //ユーザーID
if messageId != "" { if messageId != "" {
connection!.invoke(method: "ackMessage", request) { error in connection!.invoke(method: "ackMessage", request) { error in
if let e = error { if let e = error {
...@@ -221,7 +222,7 @@ class SignalR: NSObject { ...@@ -221,7 +222,7 @@ class SignalR: NSObject {
var request = ReqChatModeMessage(shipId: Preferences.shipId) var request = ReqChatModeMessage(shipId: Preferences.shipId)
request.time = DateTextLib.Date2ISO8601Text(Date()) request.time = DateTextLib.Date2ISO8601Text(Date())
request.location = 2 //1:Shore , 2:Ship request.location = 2 //1:Shore , 2:Ship
request.fromeId = SharingData.my.id //ユーザーID request.fromeId = String(SharingData.my.id) //ユーザーID
if mode == true{ if mode == true{
request.mode = 1 request.mode = 1
} else { } else {
...@@ -282,17 +283,24 @@ extension AppDelegate: UNUserNotificationCenterDelegate { ...@@ -282,17 +283,24 @@ 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 ?? "" //船名
let message = GetMessage() let message = GetMessage()
message.start() message.start()
case "sailassist": case "sailassist":
print(debug: "sailassist") print(debug: "sailassist")
let getPushHistory = GetPushHistory()
getPushHistory.start()
case "bam": case "bam":
print(debug: "bam") print(debug: "bam")
let getPushHistory = GetPushHistory()
getPushHistory.start()
case "route": case "route":
print(debug: "route") print(debug: "route")
let getPushHistory = GetPushHistory()
getPushHistory.start()
default: default:
print(debug: "default") print(debug: "default")
} }
...@@ -319,17 +327,24 @@ extension AppDelegate: UNUserNotificationCenterDelegate { ...@@ -319,17 +327,24 @@ 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 ?? "" //船名
let message = GetMessage() let message = GetMessage()
message.start() message.start()
case "sailassist": case "sailassist":
print(debug: "sailassist") print(debug: "sailassist")
let getPushHistory = GetPushHistory()
getPushHistory.start()
case "bam": case "bam":
print(debug: "bam") print(debug: "bam")
let getPushHistory = GetPushHistory()
getPushHistory.start()
case "route": case "route":
print(debug: "route") print(debug: "route")
let getPushHistory = GetPushHistory()
getPushHistory.start()
default: default:
print(debug: "default") print(debug: "default")
} }
...@@ -367,7 +382,6 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, ObservableObject { ...@@ -367,7 +382,6 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, ObservableObject {
} }
} }
class PassThroughWindow: UIWindow{ class PassThroughWindow: UIWindow{
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
guard let view = super.hitTest(point, with: event) else { return nil} guard let view = super.hitTest(point, with: event) else { return nil}
......
...@@ -79,6 +79,50 @@ class ServerSession{ ...@@ -79,6 +79,50 @@ class ServerSession{
}).resume() }).resume()
} }
func postForm(boundary: String, _ req_url : URL, _ postdata : Data, completion: @escaping (SessionResponse) -> Void){
var req = URLRequest(url: req_url)
req.httpMethod = "POST"
req.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
req.setValue("\(postdata.count)", forHTTPHeaderField: "Content-Length")
req.httpBody = postdata
req.timeoutInterval = 20 // タイムアウト3秒 → Amedasでタイムアウトエラー20秒に変更
// サーバー送信
let session = URLSession(configuration: .default, delegate: nil, delegateQueue: OperationQueue.main)
session.dataTask(with: req, completionHandler: {(data, response, error) in
session.finishTasksAndInvalidate()
do{
if error != nil{
throw APIError.clientError
}
guard let indata = data, let inresponse = response as? HTTPURLResponse else {
throw APIError.responseError
}
if inresponse.statusCode != 200 {
throw APIError.serverError
}
//Cookieを保存
if let fields = inresponse.allHeaderFields as? [String: String], let url = inresponse.url {
for cookie in HTTPCookie.cookies(withResponseHeaderFields: fields, for: url) {
HTTPCookieStorage.shared.setCookie(cookie)
}
}
DispatchQueue.main.async {
completion(.success(indata))
}
}catch{
if error as? APIError != nil{
completion(.failure(error as! APIError))
}
else{
completion(.failure(.unknown))
}
}
}).resume()
}
func getJson(_ req_url : URL, completion: @escaping (SessionResponse) -> Void){ func getJson(_ req_url : URL, completion: @escaping (SessionResponse) -> Void){
var req = URLRequest(url: req_url) var req = URLRequest(url: req_url)
...@@ -164,4 +208,44 @@ class ServerSession{ ...@@ -164,4 +208,44 @@ class ServerSession{
} }
return false return false
} }
func httpBody(boundary: String, _ uploadImage : ReqUploadImage) -> Data! {
var httpBody1 = "--\(boundary)\r\n"
httpBody1 += "Content-Disposition: form-data; name=\"shipId\"\r\n"
httpBody1 += "\r\n"
httpBody1 += "\(uploadImage.shipId)\r\n"
httpBody1 += "--\(boundary)\r\n"
httpBody1 += "Content-Disposition: form-data; name=\"messageId\"\r\n"
httpBody1 += "\r\n"
httpBody1 += "\(uploadImage.messageId)\r\n"
httpBody1 += "--\(boundary)\r\n"
httpBody1 += "Content-Disposition: form-data; name=\"location\"\r\n"
httpBody1 += "\r\n"
httpBody1 += "\(uploadImage.location)\r\n"
httpBody1 += "--\(boundary)\r\n"
httpBody1 += "Content-Disposition: form-data; name=\"from\"\r\n"
httpBody1 += "\r\n"
httpBody1 += "\(uploadImage.from)\r\n"
httpBody1 += "--\(boundary)\r\n"
httpBody1 += "Content-Disposition: form-data; name=\"fromId\"\r\n"
httpBody1 += "\r\n"
httpBody1 += "\(uploadImage.fromId)\r\n"
httpBody1 += "--\(boundary)\r\n"
// httpBody1 += "Content-Disposition: form-data; name=\"files\"; filename=\"\(uploadImage.files)\"\r\n"
httpBody1 += "Content-Type: image/jpeg\r\n"
httpBody1 += "\r\n"
var tmp = httpBody1.data(using: .utf8)!
var httpBody = Data()
httpBody.append(httpBody1.data(using: .utf8)!)
httpBody.append(uploadImage.files)
var httpBody2 = "\r\n"
httpBody2 += "--\(boundary)--\r\n"
httpBody.append(httpBody2.data(using: .utf8)!)
return httpBody
}
} }
...@@ -19,7 +19,7 @@ class SessionUploadImage : ObservableObject { ...@@ -19,7 +19,7 @@ class SessionUploadImage : ObservableObject {
/** /**
* メッセージ * メッセージ
*/ */
func RequestGetUploadImage(_ completion: @escaping ((Result<Data, APIError>)) -> Void) { func RequestUploadImage(_ uploadImage : ReqUploadImage ,completion: @escaping ((Result<Data, APIError>)) -> Void) {
print(debug: "calld") print(debug: "calld")
if Calling { if Calling {
return return
...@@ -27,19 +27,20 @@ class SessionUploadImage : ObservableObject { ...@@ -27,19 +27,20 @@ class SessionUploadImage : ObservableObject {
Calling = true Calling = true
// リクエストURLの組み立て // リクエストURLの組み立て
// リクエストURLの組み立て let url_string : String = HttpRequestType.UploadImage.rawValue
// let url_string : String = HttpRequestType.UploadImage.rawValue guard let req_url = URL(string : url_string) else {
// guard let req_url = URL(string : url_string) else { Calling = false
// Calling = false return
// return }
// }
// if let postdata = serverSession.toJSON(login) { // let boundary = "----------" + UUID().uuidString
// serverSession.postJson(req_url, postdata, completion: completion) let boundary = "----WebKitFormBoundaryZLdHZy8HNaBmUX0d"
// } if let postdata = serverSession.httpBody(boundary: boundary, uploadImage) {
// else { serverSession.postForm(boundary: boundary, req_url, postdata, completion: completion)
// Calling = false }
// return else {
// } Calling = false
return
}
} }
} }
...@@ -75,6 +75,7 @@ class SharingData{ ...@@ -75,6 +75,7 @@ class SharingData{
class Message: ObservableObject { class Message: ObservableObject {
@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] = []
func changeMode(){ func changeMode(){
self.mode.toggle() self.mode.toggle()
......
...@@ -24,7 +24,6 @@ struct MainTabView: View { ...@@ -24,7 +24,6 @@ struct MainTabView: View {
@EnvironmentObject var selectedTabModel: SelectedTabModel @EnvironmentObject var selectedTabModel: SelectedTabModel
@EnvironmentObject private var sceneDelegate: SceneDelegate @EnvironmentObject private var sceneDelegate: SceneDelegate
@State var isSignout = false @State var isSignout = false
@State var isLogin = false
init() { init() {
let appearance: UITabBarAppearance = UITabBarAppearance() let appearance: UITabBarAppearance = UITabBarAppearance()
...@@ -81,12 +80,20 @@ struct CustomTabBar: View { ...@@ -81,12 +80,20 @@ struct CustomTabBar: View {
selectedTabModel.activeTab = tab selectedTabModel.activeTab = tab
}, label: { }, label: {
VStack{ VStack{
ZStack(alignment: .bottomTrailing) {
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 {
// Rectangle()
// .foregroundColor(.red)
// .frame(width: 12, height: 12)
// .cornerRadius(60)
// }
}
Text(tab.title) Text(tab.title)
.font(.caption) .font(.caption)
} }
.frame(maxWidth: .infinity, maxHeight: .infinity) .frame(maxWidth: .infinity, maxHeight: .infinity)
.contentShape(.rect) .contentShape(.rect)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment