Commit 853238a3 authored by shigemi miura's avatar shigemi miura

PDF表示サイズ変更

ログアウト時にデータを消去 ユーザー名の1文字目がスペースの場合無効にする
parent abc71913
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
// //
import SwiftUI import SwiftUI
import Combine
struct InputUserNameView: View { struct InputUserNameView: View {
@ObservedObject var sessionLogin: SessionLogin = SessionLogin() @ObservedObject var sessionLogin: SessionLogin = SessionLogin()
...@@ -16,8 +17,11 @@ struct InputUserNameView: View { ...@@ -16,8 +17,11 @@ struct InputUserNameView: View {
@Binding var isAlert : Bool @Binding var isAlert : Bool
@Binding var alertType: AlertType @Binding var alertType: AlertType
@State private var isEmptyAlert = false @State private var isEmptyAlert = false
@State private var isSpaceAlert = false
@State var timer :Timer? @State var timer :Timer?
let textLimit = 127
var body: some View { var body: some View {
VStack{ VStack{
VStack(alignment: .leading, spacing: 0) { VStack(alignment: .leading, spacing: 0) {
...@@ -36,6 +40,11 @@ struct InputUserNameView: View { ...@@ -36,6 +40,11 @@ struct InputUserNameView: View {
) )
.frame(height: 49) .frame(height: 49)
.padding(.zero) .padding(.zero)
.onReceive(Just(param.userName)) { _ in
if param.userName.count > textLimit {
param.userName = String(param.userName.prefix(textLimit))
}
}
} }
Divider() Divider()
...@@ -47,6 +56,9 @@ struct InputUserNameView: View { ...@@ -47,6 +56,9 @@ struct InputUserNameView: View {
Button(action: { Button(action: {
if param.userName.isEmpty { if param.userName.isEmpty {
isEmptyAlert = true isEmptyAlert = true
} else if param.userName.first == " " || param.userName.first == " " {
param.userName = ""
isSpaceAlert = true
} else { } else {
print(debug: "signin: id(\(param.shipId)), pass(\(param.password)), name(\(param.userName))") print(debug: "signin: id(\(param.shipId)), pass(\(param.password)), name(\(param.userName))")
isAlert = false isAlert = false
...@@ -63,10 +75,13 @@ struct InputUserNameView: View { ...@@ -63,10 +75,13 @@ struct InputUserNameView: View {
.foregroundColor(ColorSet.ButtonText.color) .foregroundColor(ColorSet.ButtonText.color)
.background(ColorSet.LoginBk01.color) .background(ColorSet.LoginBk01.color)
}) })
.alert(isPresented: $isEmptyAlert) { .alert("Error", isPresented: $isEmptyAlert) {
return Alert(title: Text("Error"), } message: {
message: Text("User Name not entered.") Text("User Name not entered.")
) }
.alert("Error", isPresented: $isSpaceAlert) {
} message: {
Text("Spaces are not allowed in the first character.")
} }
.padding(.top, 40) .padding(.top, 40)
} }
......
...@@ -212,6 +212,12 @@ struct MenuView: View { ...@@ -212,6 +212,12 @@ struct MenuView: View {
Preferences.UserName = "" Preferences.UserName = ""
loginViewModel.isLogin = false loginViewModel.isLogin = false
sceneDelegate.tabWindow?.isHidden = true sceneDelegate.tabWindow?.isHidden = true
SharingData.message.mode = 0
SharingData.message.messages = []
SharingData.pushHistory.focusPushHistory = nil
SharingData.pushHistory.pushHistoryData = [:]
} }
Button("No") {} Button("No") {}
} message: { Text("Are you sure?") } } message: { Text("Are you sure?") }
......
...@@ -15,6 +15,8 @@ struct PDFViewer: UIViewRepresentable{ ...@@ -15,6 +15,8 @@ struct PDFViewer: UIViewRepresentable{
func makeUIView(context: Context) -> some PDFView { func makeUIView(context: Context) -> some PDFView {
let pdfView = PDFView() let pdfView = PDFView()
pdfView.document = PDFDocument(url: self.url) pdfView.document = PDFDocument(url: self.url)
pdfView.autoScales = true
pdfView.displayMode = .singlePageContinuous
return pdfView return pdfView
} }
......
...@@ -74,50 +74,7 @@ class SharingData{ ...@@ -74,50 +74,7 @@ class SharingData{
static var message = Message() static var message = Message()
class Message: ObservableObject { class Message: ObservableObject {
@Published var mode: Int = 0 // 0:通常 , 1:Warning中 @Published var mode: Int = 0 // 0:通常 , 1:Warning中
@Published var messages: [ChatMessage] = [ @Published var messages: [ChatMessage] = []
ChatMessage(
shipId: 10000003,
messageId: "92c2dfb5-f5ed-4943-98a3-9848d7f9a962",
type: 0,
time: "2023-10-06T01:51:01.872Z",
location: 1,
from: "はだだ",
fromId: "487420489",
message: "999",
stampId: 0,
viewer: [
Viewer(
time: "2023-10-06T01:51:12.973Z",
location: 1,
id: ""),
Viewer(
time: "2023-10-06T01:51:12.973Z",
location: 2,
id: "")
]
),
ChatMessage(
shipId: 10000001,
messageId: "92c2dfb5-f5ed-4943-98a3-a848d7f9a962",
type: 0,
time: "2023-10-06T01:51:01.872Z",
location: 1,
from: "はだだ",
fromId: "487420489",
message: "999",
stampId: 0,
viewer: [
Viewer(
time: "2023-10-06T01:51:12.973Z",
location: 1,
id: ""),
Viewer(
time: "2023-10-06T01:51:12.973Z",
location: 2,
id: "")
]
),
]
} }
/** /**
......
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