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

PDF表示サイズ変更

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