Commit 08eaee57 authored by shigemi miura's avatar shigemi miura

新ログイン対応

Information削除
parent 22f57ea7
......@@ -90,9 +90,10 @@
D52D21412AEDE18F00324D58 /* EcaCoordinatesTable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D52D21402AEDE18F00324D58 /* EcaCoordinatesTable.swift */; };
D5384AFC2B306CEF006228C6 /* TermsView.html in Resources */ = {isa = PBXBuildFile; fileRef = D5384AFB2B306CEF006228C6 /* TermsView.html */; };
D5384AFE2B3121F2006228C6 /* PrivacyView.html in Resources */ = {isa = PBXBuildFile; fileRef = D5384AFD2B3121F2006228C6 /* PrivacyView.html */; };
D5384B012B312F2D006228C6 /* MenuLocalHtmlView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5384B002B312F2D006228C6 /* MenuLocalHtmlView.swift */; };
D53B97262B341867000B3D29 /* AboutAppView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D53B97252B341867000B3D29 /* AboutAppView.swift */; };
D545FC742B09C74300F206D0 /* AlertManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D545FC732B09C74300F206D0 /* AlertManager.swift */; };
D545FC762B09C81300F206D0 /* PushNotificationTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = D545FC752B09C81300F206D0 /* PushNotificationTypes.swift */; };
D54D174B2B35137A00A0EAA5 /* LocalWebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D54D174A2B35137A00A0EAA5 /* LocalWebView.swift */; };
D55135202B15B030007B66B1 /* SetEcaArea.swift in Sources */ = {isa = PBXBuildFile; fileRef = D551351F2B15B030007B66B1 /* SetEcaArea.swift */; };
D55135222B15C062007B66B1 /* GetEcaList.swift in Sources */ = {isa = PBXBuildFile; fileRef = D55135212B15C062007B66B1 /* GetEcaList.swift */; };
D55135242B15C3BF007B66B1 /* DeleteEcaArea.swift in Sources */ = {isa = PBXBuildFile; fileRef = D55135232B15C3BF007B66B1 /* DeleteEcaArea.swift */; };
......@@ -245,10 +246,11 @@
D52D21402AEDE18F00324D58 /* EcaCoordinatesTable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = EcaCoordinatesTable.swift; path = Sailassist/ECA/EcaCoordinatesTable.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; };
D5384AFD2B3121F2006228C6 /* PrivacyView.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = PrivacyView.html; path = SailAssist/html/PrivacyView.html; sourceTree = SOURCE_ROOT; };
D5384B002B312F2D006228C6 /* MenuLocalHtmlView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MenuLocalHtmlView.swift; path = Sailassist/Menu/View/MenuLocalHtmlView.swift; sourceTree = SOURCE_ROOT; };
D53ACA752B0AECF8008DCB18 /* Sailassist.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = Sailassist.entitlements; path = Sailassist/Sailassist.entitlements; sourceTree = "<group>"; };
D53B97252B341867000B3D29 /* AboutAppView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AboutAppView.swift; path = Sailassist/Login/AboutAppView.swift; sourceTree = SOURCE_ROOT; };
D545FC732B09C74300F206D0 /* AlertManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AlertManager.swift; path = Sailassist/VoiceManager/AlertManager.swift; sourceTree = SOURCE_ROOT; };
D545FC752B09C81300F206D0 /* PushNotificationTypes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = PushNotificationTypes.swift; path = Sailassist/DataSource/PushNotificationTypes.swift; sourceTree = SOURCE_ROOT; };
D54D174A2B35137A00A0EAA5 /* LocalWebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = LocalWebView.swift; path = Sailassist/Menu/View/LocalWebView.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; };
D55135232B15C3BF007B66B1 /* DeleteEcaArea.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = DeleteEcaArea.swift; path = Sailassist/ECA/DeleteEcaArea.swift; sourceTree = SOURCE_ROOT; };
......@@ -398,6 +400,7 @@
020B98402AD8C3810029DE4C /* LoginView.swift */,
020B98492AD915510029DE4C /* ViewModel */,
020B98482AD915480029DE4C /* View */,
D53B97252B341867000B3D29 /* AboutAppView.swift */,
);
path = Login;
sourceTree = "<group>";
......@@ -604,7 +607,7 @@
D5E008732B2ADD3F00C4070A /* MenuManualECDISView.swift */,
D5E008752B2ADD5900C4070A /* MenuManualRADARView.swift */,
D5E008772B2B022200C4070A /* MenuAboutAppView.swift */,
D5384B002B312F2D006228C6 /* MenuLocalHtmlView.swift */,
D54D174A2B35137A00A0EAA5 /* LocalWebView.swift */,
);
path = View;
sourceTree = "<group>";
......@@ -997,6 +1000,7 @@
025F99702B2AC2C100C9A18A /* YesNoButtons.swift in Sources */,
025C27FE2B0206D700BADC49 /* PDFDownloadManager.swift in Sources */,
D59908CA2B1AC381000E13DD /* GetPushHistory.swift in Sources */,
D54D174B2B35137A00A0EAA5 /* LocalWebView.swift in Sources */,
025C27FC2AFE191A00BADC49 /* MenuManualView.swift in Sources */,
D58E1F502B142A260092D8FE /* EcaArea.swift in Sources */,
020B98592AD92A4C0029DE4C /* MainTabView.swift in Sources */,
......@@ -1004,6 +1008,7 @@
D5AE351A2AEBA66A00059889 /* ReqLogin.swift in Sources */,
020B98512AD9189A0029DE4C /* InputIdPassWordView.swift in Sources */,
D52D213A2AEBAC0500324D58 /* HttpRequestType.swift in Sources */,
D53B97262B341867000B3D29 /* AboutAppView.swift in Sources */,
D5258CA12B03593500365276 /* SessionMonitoringRoute.swift in Sources */,
D5E03A672B04484D00D65FCE /* SessionTaskList.swift in Sources */,
020B986E2ADD3E8D0029DE4C /* DateTextLib.swift in Sources */,
......@@ -1028,7 +1033,6 @@
D5E008762B2ADD5900C4070A /* MenuManualRADARView.swift in Sources */,
D59908C62B19EA70000E13DD /* ResPushHistory.swift in Sources */,
020B986C2ADD3E810029DE4C /* InTextLib.swift in Sources */,
D5384B012B312F2D006228C6 /* MenuLocalHtmlView.swift in Sources */,
02C3E5D12AFCC16800AF7837 /* ChatTitleView.swift in Sources */,
024EDE1D2B0C42F70013BAC8 /* MenuGpsSelectView.swift in Sources */,
020B98472AD8FEE30029DE4C /* ColorSet.swift in Sources */,
......
......@@ -13,7 +13,7 @@ enum HttpRequestType : String {
// case Terms = "https://tacmistorage.blob.core.windows.net/$web/terms/terms.mobile.html?sv=2021-10-04&st=2023-11-22T06%3A26%3A32Z&se=2023-11-23T06%3A26%3A32Z&sr=b&sp=r&sig=wS6kbbT5SvNVTkRsnRk%2BiDceZAsQ3Y56vrqTUO1X50E%3D"
case RegisterLogin = "https://ssv-canary-web.azurewebsites.net/sailassistlogin"
case SitePolicy = "https://ssv-canary-web.azurewebsites.net/sitepolicy"
case CookiePolicy = "https://ssv-canary-web.azurewebsites.net/cookiepolicy"
// case CookiePolicy = "https://ssv-canary-web.azurewebsites.net/cookiepolicy"
// case PrivacyPolicy = "https://ssv-canary-web.azurewebsites.net/inapp?" //+バージョン番号
case TaskList = "https://ssv-canary-web.azurewebsites.net/api/sailassist/tasklist/XXXXX"
case EcaArea = "https://ssv-canary-web.azurewebsites.net/api/sailassist/ecaarea/XXXXX"
......@@ -35,7 +35,7 @@ enum HttpRequestType : String {
// case Terms = "https://tacmistorage.blob.core.windows.net/$web/terms/terms.mobile.html?sv=2021-10-04&st=2023-11-22T06%3A26%3A32Z&se=2023-11-23T06%3A26%3A32Z&sr=b&sp=r&sig=wS6kbbT5SvNVTkRsnRk%2BiDceZAsQ3Y56vrqTUO1X50E%3D"
case RegisterLogin = "https://ssv-qc-web.azurewebsites.net/sailassistlogin"
case SitePolicy = "https://ssv-qc-web.azurewebsites.net/sitepolicy"
case CookiePolicy = "https://ssv-qc-web.azurewebsites.net/cookiepolicy"
// case CookiePolicy = "https://ssv-qc-web.azurewebsites.net/cookiepolicy"
// case PrivacyPolicy = "https://ssv-qc-web.azurewebsites.net/inapp?" //+バージョン番号
case TaskList = "https://ssv-qc-web.azurewebsites.net/api/sailassist/tasklist/XXXXX"
case EcaArea = "https://ssv-qc-web.azurewebsites.net/api/sailassist/ecaarea"
......@@ -58,7 +58,7 @@ enum HttpRequestType : String {
// case Terms = "https://tacmistorage.blob.core.windows.net/$web/terms/terms.mobile.html?sv=2021-10-04&st=2023-11-22T06%3A26%3A32Z&se=2023-11-23T06%3A26%3A32Z&sr=b&sp=r&sig=wS6kbbT5SvNVTkRsnRk%2BiDceZAsQ3Y56vrqTUO1X50E%3D"
case RegisterLogin = "https://ssv.jmarinecloud.com/sailassistlogin"
case SitePolicy = "https://ssv.jmarinecloud.com/sitepolicy"
case CookiePolicy = "https://ssv.jmarinecloud.com/cookiepolicy"
// case CookiePolicy = "https://ssv.jmarinecloud.com/cookiepolicy"
// case PrivacyPolicy = "https://ssv.jmarinecloud.com/inapp?" //+バージョン番号
case TaskList = "https://ssv.jmarinecloud.com/api/sailassist/tasklist/XXXXX"
case EcaArea = "https://ssv.jmarinecloud.com/api/sailassist/ecaarea"
......
......@@ -10,10 +10,14 @@ import Foundation
struct ReqLogin : Codable {
var id: String
var password: String
var deviceid: String
var username: String
init(Id: String, Password: String) {
init(Id: String, Password: String, DeviceId: String, UserName: String) {
self.id = Id
self.password = Password
self.deviceid = DeviceId
self.username = UserName
}
}
......
//
// AboutAppView.swift
// Sailassist
//
// Created by 三浦薫巳 on 2023/12/21.
//
import SwiftUI
import PDFKit
enum Policy: String, Hashable{
case TermsOfUse
case PrivacyStatement
var title: String{
switch self {
case .TermsOfUse:
"Terms Of Use"
case .PrivacyStatement:
"Privacy Statement"
}
}
}
struct AboutAppView: View {
// @State var policy: Policy = .TermsOfUse
let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String
var body: some View {
VStack{
HStack {
VStack(alignment: .leading, spacing: 10){
Text("Version")
.font(FontStyle.SupplementText.font)
.foregroundColor(ColorSet.BodyDescriptiion.color)
#if CANARY
Text("\(version)" + " Canary")
.font(FontStyle.SupplementText.font)
.foregroundColor(ColorSet.Body.color)
.padding(.leading, 20)
#elseif QC
Text("\(version)" + " QC")
.font(FontStyle.TitleS.font)
.foregroundColor(ColorSet.Body.color)
#else
Text("\(version)")
.font(FontStyle.TitleS.font)
.foregroundColor(ColorSet.Body.color)
#endif
}
.padding(.horizontal, 30)
.padding(.vertical, 17)
Spacer()
}
Divider()
.background(ColorSet.LineColor04.color)
Spacer().frame(height: 50)
Text("Policy")
.font(FontStyle.SupplementText.font)
.foregroundColor(ColorSet.BodyDescriptiion.color)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.leading, 30)
Divider()
.background(ColorSet.LineColor04.color)
HStack {
NavigationLink {
LocalWebView()
} label: {
Text("Terms Of Use")
.font(FontStyle.EmphasisText.font)
.foregroundColor(ColorSet.Body.color)
Spacer()
Image("ink_01")
.resizable()
.frame(width: 22, height: 22)
}
.padding(.vertical, 17)
.padding(.horizontal, 30)
}
HStack {
NavigationLink {
// policy = PrivacyStatement
LocalWebView()
} label: {
Text("Privacy Statement")
.font(FontStyle.EmphasisText.font)
.foregroundColor(ColorSet.Body.color)
Spacer()
Image("ink_01")
.resizable()
.frame(width: 22, height: 22)
}
.padding(.vertical, 17)
.padding(.horizontal, 30)
}
Spacer().frame(height: 50)
Text("Open Source Licenses")
.font(FontStyle.SupplementText.font)
.foregroundColor(ColorSet.BodyDescriptiion.color)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.leading, 30)
Divider()
.background(ColorSet.LineColor04.color)
Text("Azure Notification Hubs SDK for Apple")
.font(FontStyle.EmphasisText.font)
.foregroundColor(ColorSet.Body.color)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.leading, 50)
.padding(.top, 17)
VStack(spacing: 30) {
Link("https://github.com/Azure/azure-notificationhubs-ios/blob/main/LICENSE", destination: URL(string: HttpRequestType.ApachLicens.rawValue)!)
}
.padding(.top, 2)
.padding(.horizontal, 50)
.font(FontStyle.RadioButtonText.font)
.foregroundColor(ColorSet.Body.color)
Spacer()
}
.background(ColorSet.BackgroundPrimary.color)
}
}
#Preview {
AboutAppView()
}
......@@ -26,6 +26,7 @@ enum AlertType: String {
class LoginViewParam: ObservableObject{
@Published var shipId: String = ""
@Published var password: String = ""
@Published var deviceid: String = ""
@Published var userName: String = ""
}
......@@ -47,105 +48,110 @@ struct LoginView: View {
let sessionLogin = SessionLogin()
var body: some View {
ZStack{
Triangle()
.fill(ColorSet.LoginBk03.color)
.ignoresSafeArea()
VStack{
//ロゴ
VStack(spacing: 20){
Image("logo_signin")
.resizable()
.scaledToFit()
.frame(width: 135, height: 66.85)
Image("h1_signin")
.frame(width: 250, height: 21.94)
}
.padding(.top, 64)
Spacer()
if !isProgressView {
switch viewMode{
case .SelectType:
LoginTypeSelectView(isQrRead: $scannerViewModel.isShowing, viewMode: $viewMode)
case .InputIdPassword:
InputIdPassWordView(isLogin: $isLogin, viewMode: $viewMode, param: $loginViewParam, isProgressView: $isProgressView, isAlert: $isAlert, alertType: $alertType)
case .InputUserName:
InputUserNameView(isLogin: $isLogin, param: $loginViewParam, viewMode: $viewMode)
NavigationView {
ZStack{
Triangle()
.fill(ColorSet.LoginBk03.color)
.ignoresSafeArea()
VStack{
//ロゴ
VStack(spacing: 20){
Image("logo_signin")
.resizable()
.scaledToFit()
.frame(width: 135, height: 66.85)
Image("h1_signin")
.frame(width: 250, height: 21.94)
}
} else {
Text("Login Check").padding()
ProgressView()
}
Spacer()
VStack(spacing: 40){
VStack(spacing: 30) {
if !isProgressView {
Link("Site policy", destination: URL(string: HttpRequestType.SitePolicy.rawValue)!)
Link("Cookie policy", destination: URL(string: HttpRequestType.CookiePolicy.rawValue)!)
if let htmlPath = Bundle.main.path(forResource: "PrivacyView", ofType: "html") {
Link("Privacy policy", destination: URL(fileURLWithPath: htmlPath))
.padding(.top, 64)
Spacer()
if !isProgressView {
switch viewMode{
case .SelectType:
LoginTypeSelectView(isQrRead: $scannerViewModel.isShowing, viewMode: $viewMode)
case .InputIdPassword:
InputIdPassWordView(viewMode: $viewMode, param: $loginViewParam)
case .InputUserName:
InputUserNameView(isLogin: $isLogin, param: $loginViewParam, viewMode: $viewMode, isProgressView: $isProgressView, isAlert: $isAlert, alertType: $alertType)
}
} else {
Text("Login Check").padding()
ProgressView()
}
Spacer()
VStack(spacing: 40){
VStack(spacing: 30) {
if !isProgressView {
// Link("Information", destination: URL(string: HttpRequestType.SitePolicy.rawValue)!)
Link("Contact Us", destination: URL(string: HttpRequestType.ContactPage.rawValue)!)
NavigationLink {
AboutAppView()
} label: {
Text("About This App")
}
} else {
EmptyView()
}
// Link("Privacy policy", destination: URL(string: HttpRequestType.CookiePolicy.rawValue)!)
} else {
EmptyView()
}
.font(FontStyle.SupplementText.font)
.foregroundColor(ColorSet.Body.color)
Text("Ver. \(Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String)")
.font(FontStyle.VersionText.font)
.foregroundColor(ColorSet.BodyDescriptiion.color)
}
.font(FontStyle.SupplementText.font)
.foregroundColor(ColorSet.Body.color)
Text("Ver. \(Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String)")
.font(FontStyle.VersionText.font)
.foregroundColor(ColorSet.BodyDescriptiion.color)
}
.padding(.bottom, 30)
.alert(isPresented: $isAlert) {
switch alertType {
case .loginFailure:
return Alert(title: Text("Error"),
message: Text("Ship ID or Password is incorrect."),
dismissButton: .default(Text("OK"), action: {viewMode = .SelectType})
)
case .QrFailure:
return Alert(title: Text("Error"),
message: Text("QR code is incorrect."),
dismissButton: .default(Text("OK"), action: {viewMode = .SelectType})
)
case .ClientError:
return Alert(title: Text("Error"),
message: Text("Not connected to network."),
dismissButton: .default(Text("OK"), action: {viewMode = .SelectType})
)
case .Expired:
return Alert(title: Text("Error"),
message: Text("Expired."),
dismissButton: .default(Text("OK"), action: {viewMode = .SelectType})
)
.padding(.bottom, 30)
.alert(isPresented: $isAlert) {
switch alertType {
case .loginFailure:
return Alert(title: Text("Error"),
message: Text("Ship ID or Password is incorrect."),
dismissButton: .default(Text("OK"), action: {viewMode = .SelectType})
)
case .QrFailure:
return Alert(title: Text("Error"),
message: Text("QR code is incorrect."),
dismissButton: .default(Text("OK"), action: {viewMode = .SelectType})
)
case .ClientError:
return Alert(title: Text("Error"),
message: Text("Not connected to network."),
dismissButton: .default(Text("OK"), action: {viewMode = .SelectType})
)
case .Expired:
return Alert(title: Text("Error"),
message: Text("Expired."),
dismissButton: .default(Text("OK"), action: {viewMode = .SelectType})
)
}
}
}
}
.background(ColorSet.BackgroundPrimary.color)
.fullScreenCover(isPresented: $scannerViewModel.isShowing, onDismiss: {LoginCheckQR()}, content: {
QRReadView(viewMode: .constant(.SelectType), viewModel: scannerViewModel)
})
.onAppear() {
LoginCheck()
selectedTabModel.isLocationAlert = locationViewModel.requestPermission()
}
.preferredColorScheme(.dark)
}
.background(ColorSet.BackgroundPrimary.color)
.fullScreenCover(isPresented: $scannerViewModel.isShowing, onDismiss: {LoginCheckQR()}, content: {
QRReadView(viewMode: .constant(.SelectType), viewModel: scannerViewModel)
})
.onAppear() {
LoginCheck()
selectedTabModel.isLocationAlert = locationViewModel.requestPermission()
}
.preferredColorScheme(.dark)
}
func LoginCheckQR() -> () {
isProgressView = true
loginViewParam.shipId = Preferences.Id
loginViewParam.password = Preferences.Password
loginViewParam.deviceid = Preferences.DeviceId
loginViewParam.userName = Preferences.UserName
let login = ReqLogin(Id: Preferences.Id, Password: Preferences.Password)
let login = ReqLogin(Id: Preferences.Id, Password: Preferences.Password, DeviceId: Preferences.DeviceId, UserName: Preferences.UserName)
sessionLogin.RequestLogin(login, completion: responseQrLogin)
}
......@@ -155,9 +161,9 @@ struct LoginView: View {
let interval = Date.now.timeIntervalSince(lastDate)
if interval < 2592000 {
if Preferences.Id != "" && Preferences.Password != "" && Preferences.UserName != ""{
if Preferences.Id != "" && Preferences.Password != "" && Preferences.UserName != "" && Preferences.DeviceId != ""{
isProgressView = true
let login = ReqLogin(Id: Preferences.Id, Password: Preferences.Password)
let login = ReqLogin(Id: Preferences.Id, Password: Preferences.Password, DeviceId: Preferences.DeviceId, UserName: Preferences.UserName)
sessionLogin.RequestLogin(login, completion: responseLogin)
}
}
......
......@@ -9,15 +9,10 @@ import SwiftUI
import Combine
struct InputIdPassWordView: View {
@Binding var isLogin: Bool
@Binding var viewMode : LoginViewMode
@Binding var param : LoginViewParam
@Binding var isProgressView : Bool
@Binding var isAlert : Bool
@Binding var alertType: AlertType
@State private var isUserNmaeEmpty = false
@State private var isIdPassWordEmpty = false
@State var timer :Timer?
let sessionLogin = SessionLogin()
......@@ -35,7 +30,7 @@ struct InputIdPassWordView: View {
text: $param.shipId,
prompt: Text("Ship ID")
.font(FontStyle.DefaultText.font)
.foregroundColor(ColorSet.BodyDescriptiion.color) )
.foregroundColor(ColorSet.BodyDescriptiion.color))
.frame(height: 49)
.padding(.zero)
.autocapitalization(.none)
......@@ -62,7 +57,6 @@ struct InputIdPassWordView: View {
}
.padding(.top, 16)
Divider()
.frame(height: 1)
.background(ColorSet.LineColor03.color)
......@@ -72,10 +66,7 @@ struct InputIdPassWordView: View {
if param.shipId.isEmpty || param.password.isEmpty {
isIdPassWordEmpty = true
} else {
isAlert = false
isProgressView = true
let login = ReqLogin(Id: param.shipId, Password: param.password)
sessionLogin.RequestLogin(login, completion: responseLogin)
viewMode = .InputUserName
}
}, label: {
Text("Sign In")
......@@ -96,68 +87,8 @@ struct InputIdPassWordView: View {
.background(ColorSet.LoginBk02.color)
.padding(.horizontal, 30)
}
func responseLogin(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)
if let res = resjson {
SharingData.my.id = res.id
SharingData.my.shipName = res.shipName
SharingData.my.imo = res.imo
SharingData.my.mmsi = res.mmsi
Preferences.shipId = res.shipId
let notificationTags = NotificationTags()
notificationTags.addTags()
}
Preferences.lastLoginDate_Int64 = DateTextLib.Date2UnixTime(date: Date())
viewMode = .InputUserName
// let ecaArea = EcaArea()
// ecaArea.start()
timer = Timer.scheduledTimer(withTimeInterval: TimerInterval, repeats: true) { _ in
print(debug: "called timer")
let eca = EcaTask()
eca.start()
let message = GetMessage()
message.start()
let route = MonitoringRoute()
route.start()
let ecaList = GetEcaList()
ecaList.start()
let pushHistory = GetPushHistory()
pushHistory.start()
}
timer?.fire()
case .failure(let errorCode):
print(debug: errorCode)
switch errorCode {
case .clientError:
alertType = .ClientError
case .serverError:
alertType = .loginFailure
default:
alertType = .loginFailure
}
isLogin = false
isAlert = true
break
}
isProgressView = false
}
}
#Preview {
InputIdPassWordView(isLogin: .constant(false), viewMode: .constant(.InputIdPassword), param: .constant(LoginViewParam()), isProgressView: .constant(false), isAlert: .constant(false), alertType: .constant(.loginFailure))
InputIdPassWordView(viewMode: .constant(.InputIdPassword), param: .constant(LoginViewParam()))
}
......@@ -12,16 +12,15 @@ struct InputUserNameView: View {
@Binding var isLogin: Bool
@Binding var param: LoginViewParam
@Binding var viewMode : LoginViewMode
@Binding var isProgressView : Bool
@Binding var isAlert : Bool
@Binding var alertType: AlertType
@State private var isEmptyAlert = false
@State var timer :Timer?
var body: some View {
VStack{
VStack(alignment: .leading, spacing: 0) {
Text(SharingData.my.shipName)
.font(FontStyle.TitleSBold.font)
.padding(.leading, 10)
.foregroundColor(.white)
HStack(spacing: 0){
Image("account")
.resizable()
......@@ -49,8 +48,12 @@ struct InputUserNameView: View {
if param.userName.isEmpty {
isEmptyAlert = true
} else {
print(debug: "signin: id(\(param.shipId)), pass(\(param.password)), name(\(param.userName))")
isAlert = false
isProgressView = true
Preferences.UserName = param.userName
isLogin = true
let login = ReqLogin(Id: param.shipId, Password: param.password, DeviceId: param.deviceid, UserName: param.userName)
sessionLogin.RequestLogin(login, completion: responseLogin)
}
}, label: {
Text("Sign In")
......@@ -71,8 +74,63 @@ struct InputUserNameView: View {
.background(ColorSet.LoginBk02.color)
.padding(.horizontal, 30)
}
func responseLogin(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)
if let res = resjson {
SharingData.my.id = res.id
SharingData.my.shipName = res.shipName
SharingData.my.imo = res.imo
SharingData.my.mmsi = res.mmsi
Preferences.shipId = res.shipId
let notification = NotificationTags()
notification.addTags()
}
Preferences.Id = param.shipId
Preferences.Password = param.password
Preferences.lastLoginDate_Int64 = DateTextLib.Date2UnixTime(date: Date())
timer = Timer.scheduledTimer(withTimeInterval: 60.0, repeats: true) { _ in
print(debug: "called timer")
let eca = EcaTask()
eca.start()
let message = GetMessage()
message.start()
let route = MonitoringRoute()
route.start()
let ecaList = GetEcaList()
ecaList.start()
let pushHistory = GetPushHistory()
pushHistory.start()
}
timer?.fire()
isProgressView = false
isLogin = true
isAlert = false
case .failure(let errorCode):
print(debug: errorCode)
isProgressView = false
isLogin = false
isAlert = true
alertType = .loginFailure
break
}
}
}
#Preview {
InputUserNameView(isLogin: .constant(false), param: .constant(LoginViewParam()), viewMode: .constant(.InputIdPassword))
InputUserNameView(isLogin: .constant(false), param: .constant(LoginViewParam()), viewMode: .constant(.InputIdPassword), isProgressView: .constant(false), isAlert: .constant(false), alertType: .constant(.loginFailure))
}
......@@ -36,7 +36,9 @@ struct MapRepresentable: UIViewControllerRepresentable{
DispatchQueue.main.asyncAfter(deadline: .now() + 5.0) {
do{
mapVC.updateOneTimeEca(eca: nil)
}catch{}
}catch{
print(debug: "called")
}
}
}
......
......@@ -12,7 +12,7 @@ struct EcaListView: View {
@ObservedObject var ecaData = SharingData.eca
var body: some View {
ForEach(ecaData.ecaArea.map{ $0.1 }.sorted{ $0.id ?? 0 < $1.id ?? 0 }, id: \.name){ eca in
ForEach(ecaData.ecaArea.map{ $0.1 }.sorted{ $0.id < $1.id }, id: \.name){ eca in
HStack {
Text(eca.name)
.font(FontStyle.DefaultText.font)
......
......@@ -21,7 +21,7 @@ struct TaskSwitchingMenuView: View {
var body: some View {
VStack{
ForEach(ecaData.ecaArea.map{ $0.1 }.filter{ $0.isEnable }.sorted{ $0.id ?? 0 < $1.id ?? 0 }, id: \.name){ eca in
ForEach(ecaData.ecaArea.map{ $0.1 }.filter{ $0.isEnable }.sorted{ $0.id < $1.id }, id: \.name){ eca in
VStack {
HStack {
//ECA開始・終了ボタン
......
......@@ -7,6 +7,7 @@
import SwiftUI
import PDFKit
import WindowsAzureMessaging
enum MenuPath: String, Hashable{
case Manual
......@@ -20,7 +21,7 @@ enum MenuPath: String, Hashable{
case ManualInmalsatC
case ManualInternationalVHF
case ManualVDR
case Information
// case Information
case Setting
case GpsSelect
case Help
......@@ -33,7 +34,7 @@ enum MenuPath: String, Hashable{
var title: String{
switch self {
case .Manual:
"Equipment manual"
"Equipment Manual"
case .ManualECDIS:
"ECDIS"
case .ManualECDISBasic:
......@@ -54,8 +55,8 @@ enum MenuPath: String, Hashable{
"International VHF"
case .ManualVDR:
"VDR"
case .Information:
"Information"
// case .Information:
// "Information"
case .Setting:
"Setting"
case .GpsSelect:
......@@ -112,6 +113,7 @@ enum MenuPath: String, Hashable{
struct MenuView: View {
@EnvironmentObject private var sceneDelegate: SceneDelegate
@EnvironmentObject private var loginViewModel : LoginViewModel
@Environment(\.openURL) var openURL
@State var path: [MenuPath] = []
@Binding var isSignout: Bool
......@@ -142,11 +144,11 @@ struct MenuView: View {
MenuContentView(content: .Manual)
}
Button{
path.append(.Information)
}label: {
MenuContentView(content: .Information)
}
// Button{
// path.append(.Information)
// }label: {
// MenuContentView(content: .Information)
// }
Button{
path.append(.Setting)
......@@ -185,13 +187,13 @@ struct MenuView: View {
MenuAboutAppView(path: $path)
.navigationBarHidden(true)
}else if goto == .TermsOfUse{
MenuLocalHtmlView(path: $path)
.navigationBarHidden(true)
if let htmlPath = Bundle.main.path(forResource: "TermsView", ofType: "html") {
WebView(isLoading: .constant(false), url: htmlPath)
}
}else if goto == .PrivacyStatement{
MenuLocalHtmlView(path: $path)
.navigationBarHidden(true)
}else if goto == .ContactUs{
WebView(isLoading: .constant(false), url: HttpRequestType.ContactPage.rawValue)
if let htmlPath = Bundle.main.path(forResource: "PrivacyView", ofType: "html") {
WebView(isLoading: .constant(false), url: htmlPath)
}
}else{
VStack(spacing: 0) {
MenuTitleView(path: $path, title: goto.title)
......@@ -209,6 +211,7 @@ struct MenuView: View {
.alert("Sign Out", isPresented: $isSignout) {
Button("Yes") {
MSNotificationHub.clearTags()
Preferences.Id = ""
Preferences.Password = ""
loginViewModel.isLogin = false
......
//
// LocalWebView.swift
// Sailassist
//
// Created by 三浦薫巳 on 2023/12/22.
//
import SwiftUI
struct LocalWebView: View {
// @Binding var policy: Policy
var body: some View {
VStack{
if let htmlPath = Bundle.main.path(forResource: "TermsView", ofType: "html") {
WebView(isLoading: .constant(false), url: htmlPath)
}
Spacer()
}
.background(ColorSet.BackgroundPrimary.color)
}
}
#Preview {
LocalWebView()
}
......@@ -24,6 +24,7 @@ struct MenuAboutAppView: View {
Text("\(version)" + " Canary")
.font(FontStyle.SupplementText.font)
.foregroundColor(ColorSet.Body.color)
.padding(.leading, 20)
#elseif QC
Text("\(version)" + " QC")
.font(FontStyle.TitleS.font)
......@@ -56,11 +57,14 @@ struct MenuAboutAppView: View {
}label: {
MenuContentView(content: .TermsOfUse)
}
.padding(.leading, 20)
Button{
path.append(.PrivacyStatement)
}label: {
MenuContentView(content: .PrivacyStatement)
}
.padding(.leading, 20)
Spacer().frame(height: 50)
Text("Open Source Licenses")
......@@ -76,10 +80,14 @@ struct MenuAboutAppView: View {
.font(FontStyle.EmphasisText.font)
.foregroundColor(ColorSet.Body.color)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.leading, 30)
.padding(.leading, 50)
.padding(.top, 17)
VStack(spacing: 30) {
Link("https://github.com/Azure/azure-notificationhubs-ios/blob/main/LICENSE", destination: URL(string: HttpRequestType.ApachLicens.rawValue)!)
}
.padding(.top, 2)
.padding(.horizontal, 50)
.font(FontStyle.RadioButtonText.font)
.foregroundColor(ColorSet.Body.color)
Spacer()
......
//
// MenuLocalHtmlView.swift
// Sailassist
//
// Created by 三浦薫巳 on 2023/12/19.
//
import Foundation
import SwiftUI
struct MenuLocalHtmlView: View {
@State var isAlert: Bool = false
@Binding var path : [MenuPath]
var body: some View {
VStack{
let aaa = path
MenuTitleView(path: $path, title: MenuPath.ManualRADAR.title)
// if content.rawValue != "TermsOfUse" {
// if let htmlPath = Bundle.main.path(forResource: "TermsView", ofType: "html") {
// WebView(isLoading: .constant(false), url: htmlPath)
// }
// } else if content.rawValue != "PrivacyStatement" {
// if let htmlPath = Bundle.main.path(forResource: "PrivacyView", ofType: "html") {
// WebView(isLoading: .constant(false), url: htmlPath)
// }
// }
Spacer()
}
.background(ColorSet.BackgroundPrimary.color)
.alert("delete", isPresented: $isAlert) {
Button(role: .destructive) {
} label: {
Text("delete")
}
} message: {
Text("eca delete")
}
}
}
#Preview {
MenuLocalHtmlView(path: .constant([.ManualRADAR]))
}
......@@ -8,6 +8,7 @@
import SwiftUI
struct MenuSettingView: View {
@Environment(\.openURL) private var openURL
@Binding var path : [MenuPath]
var body: some View {
VStack{
......@@ -32,7 +33,9 @@ struct MenuSettingView: View {
}
Button{
path.append(.ContactUs)
if let url = URL(string: HttpRequestType.ContactPage.rawValue) {
openURL(url)
}
}label: {
MenuContentView(content: .ContactUs)
}
......
......@@ -45,7 +45,6 @@ struct MenuTitleView: View {
Divider()
.background(ColorSet.LineColor04.color)
}
}
}
......
......@@ -51,6 +51,7 @@ class Preferences{
@AppStorage(wrappedValue:"", PreferencesKey.TypeString.Id.rawValue) static var Id: String
@AppStorage(wrappedValue:"", PreferencesKey.TypeString.Password.rawValue) static var Password: String
@AppStorage(wrappedValue:"", PreferencesKey.TypeString.DeviceId.rawValue) static var DeviceId: String
@AppStorage(wrappedValue:"", PreferencesKey.TypeString.UserName.rawValue) static var UserName: String
@AppStorage(wrappedValue:0, PreferencesKey.TypeInt.shipId.rawValue) static var shipId: Int
......
......@@ -15,7 +15,8 @@ class PreferencesKey{
case Id
case Password
case UserName
case DeviceId
//Manual類Version
case ECDISBasic
case ECDISFunction
......
......@@ -60,7 +60,6 @@ struct SailassistApp: App {
}
}
private func getManualUrl(){
let session = SessionGetManualUrl()
......@@ -88,6 +87,7 @@ struct SailassistApp: App {
class NotificationTags: NSObject {
func addTags() {
MSNotificationHub.clearTags()
if Preferences.shipId != 0 {
let shipId = String(Preferences.shipId)
let routeTag = "route-" + shipId
......@@ -119,6 +119,11 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M
}
application.registerForRemoteNotifications()
//ユニークな値の生成
if Preferences.DeviceId == "" {
Preferences.DeviceId = UUID().uuidString
}
return true
}
......
......@@ -93,7 +93,7 @@ class ServerSession{
do{
if let error = error{
let err = APIError.clientError
// let err = APIError.clientError
throw APIError.clientError
}
guard let indata = data, let inresponse = response as? HTTPURLResponse else {
......
......@@ -51,5 +51,5 @@ struct WebView: UIViewRepresentable {
}
#Preview {
WebView(isLoading: .constant(false), url: "https://ssv-canary-web.azurewebsites.net/login?ReturnUrl=%2F")
WebView(isLoading: .constant(false), url: "https://www.jmarinecloud.com/eng/contact.php?type=ssv_mobile")
}
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