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
0
Merge Requests
0
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
CpjJwWHV
Sailassist
Commits
6764045b
Commit
6764045b
authored
Mar 22, 2024
by
shigemi miura
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ログインエラー追加
・期間 ・QR
parent
22287f71
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
47 additions
and
71 deletions
+47
-71
project.pbxproj
Seilassist/Sailassist.xcodeproj/project.pbxproj
+3
-3
LoginView.swift
Seilassist/Sailassist/Login/LoginView.swift
+20
-67
InputIdPassWordView.swift
Seilassist/Sailassist/Login/View/InputIdPassWordView.swift
+1
-0
InputUserNameView.swift
Seilassist/Sailassist/Login/View/InputUserNameView.swift
+19
-1
ScannerViewModel.swift
Seilassist/Sailassist/Login/ViewModel/ScannerViewModel.swift
+2
-0
Preferences.swift
Seilassist/Sailassist/Preferences/Preferences.swift
+1
-0
PreferencesKey.swift
Seilassist/Sailassist/Preferences/PreferencesKey.swift
+1
-0
No files found.
Seilassist/Sailassist.xcodeproj/project.pbxproj
View file @
6764045b
...
...
@@ -1238,7 +1238,7 @@
CODE_SIGN_ENTITLEMENTS
=
Sailassist/Sailassist.entitlements
;
CODE_SIGN_IDENTITY
=
"Apple Development"
;
CODE_SIGN_STYLE
=
Automatic
;
CURRENT_PROJECT_VERSION
=
1
8
;
CURRENT_PROJECT_VERSION
=
1
9
;
DEVELOPMENT_ASSET_PATHS
=
"\"Sailassist/Preview Content\""
;
DEVELOPMENT_TEAM
=
D2DC7QNNJ8
;
ENABLE_PREVIEWS
=
YES
;
...
...
@@ -1284,7 +1284,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME
=
AccentColor
;
CODE_SIGN_ENTITLEMENTS
=
Sailassist/Sailassist.entitlements
;
CODE_SIGN_STYLE
=
Automatic
;
CURRENT_PROJECT_VERSION
=
1
8
;
CURRENT_PROJECT_VERSION
=
1
9
;
DEVELOPMENT_ASSET_PATHS
=
"\"Sailassist/Preview Content\""
;
DEVELOPMENT_TEAM
=
D2DC7QNNJ8
;
ENABLE_PREVIEWS
=
YES
;
...
...
@@ -1468,7 +1468,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME
=
AccentColor
;
CODE_SIGN_ENTITLEMENTS
=
Sailassist/Sailassist.entitlements
;
CODE_SIGN_STYLE
=
Automatic
;
CURRENT_PROJECT_VERSION
=
1
8
;
CURRENT_PROJECT_VERSION
=
1
9
;
DEVELOPMENT_ASSET_PATHS
=
"\"Sailassist/Preview Content\""
;
DEVELOPMENT_TEAM
=
D2DC7QNNJ8
;
ENABLE_PREVIEWS
=
YES
;
...
...
Seilassist/Sailassist/Login/LoginView.swift
View file @
6764045b
...
...
@@ -28,6 +28,7 @@ class LoginViewParam: ObservableObject{
@Published
var
password
:
String
=
""
@Published
var
deviceid
:
String
=
""
@Published
var
userName
:
String
=
""
@Published
var
qrCode
:
Bool
=
false
}
let
TimerInterval
=
60.0
...
...
@@ -130,7 +131,7 @@ struct LoginView: View {
)
case
.
Expired
:
return
Alert
(
title
:
Text
(
"Error"
),
message
:
Text
(
"
E
xpired."
),
message
:
Text
(
"
This account is e
xpired."
),
dismissButton
:
.
default
(
Text
(
"OK"
),
action
:
{
viewMode
=
.
SelectType
})
)
}
...
...
@@ -152,19 +153,23 @@ struct LoginView: View {
}
}
/**
* QRコードでのログイン
*/
func
LoginCheckQR
()
->
()
{
isProgressView
=
true
loginViewParam
.
shipId
=
Preferences
.
Id
loginViewParam
.
password
=
Preferences
.
Password
loginViewParam
.
deviceid
=
Preferences
.
DeviceId
// loginViewParam.userName = Preferences.UserNam
e
loginViewParam
.
qrCode
=
tru
e
viewMode
=
.
InputUserName
isProgressView
=
false
// let login = ReqLogin(Id: Preferences.Id, Password: Preferences.Password, DeviceId: Preferences.DeviceId, UserName: Preferences.UserName)
// sessionLogin.RequestLogin(login, completion: responseQrLogin)
}
/**
* Autoログイン
*/
func
LoginCheck
()
->
()
{
let
lastUnixTime
=
Preferences
.
lastLoginDate_Int64
??
0
let
lastDate
=
DateTextLib
.
UnixTime2Date
(
lastUnixTime
)
...
...
@@ -179,68 +184,6 @@ struct LoginView: View {
}
}
func
responseQrLogin
(
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
.
shipId
=
res
.
shipId
SharingData
.
my
.
shipName
=
res
.
shipName
SharingData
.
my
.
imo
=
res
.
imo
SharingData
.
my
.
mmsi
=
res
.
mmsi
SharingData
.
my
.
isFuelSwitchTask
=
res
.
enableFuelSwitchTask
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
=
.
QrFailure
default
:
alertType
=
.
QrFailure
}
isLogin
=
false
isAlert
=
true
break
}
isProgressView
=
false
}
func
responseLogin
(
result
:
Result
<
Data
,
APIError
>
)
{
print
(
debug
:
"calld"
)
switch
result
{
...
...
@@ -292,7 +235,17 @@ struct LoginView: View {
case
.
clientError
:
alertType
=
.
ClientError
case
.
serverError
:
alertType
=
.
loginFailure
let
dateFormatter
=
DateFormatter
()
dateFormatter
.
dateFormat
=
"yyyy-MM-dd'T'HH:mm:ssZ"
if
let
expiry
=
dateFormatter
.
date
(
from
:
Preferences
.
Expiry
)
{
if
Date
()
<
expiry
{
alertType
=
.
loginFailure
}
else
{
alertType
=
.
Expired
}
}
else
{
alertType
=
.
loginFailure
}
default
:
alertType
=
.
loginFailure
}
...
...
Seilassist/Sailassist/Login/View/InputIdPassWordView.swift
View file @
6764045b
...
...
@@ -64,6 +64,7 @@ struct InputIdPassWordView: View {
Button
(
action
:
{
if
param
.
shipId
.
isEmpty
||
param
.
password
.
isEmpty
{
param
.
qrCode
=
false
isIdPassWordEmpty
=
true
}
else
{
viewMode
=
.
InputUserName
...
...
Seilassist/Sailassist/Login/View/InputUserNameView.swift
View file @
6764045b
...
...
@@ -141,10 +141,28 @@ struct InputUserNameView: View {
case
.
failure
(
let
errorCode
):
print
(
debug
:
errorCode
)
switch
errorCode
{
case
.
clientError
:
alertType
=
.
ClientError
case
.
serverError
:
if
param
.
qrCode
{
alertType
=
.
QrFailure
let
dateFormatter
=
DateFormatter
()
dateFormatter
.
dateFormat
=
"yyyy-MM-dd'T'HH:mm:ssZ"
if
let
expiry
=
dateFormatter
.
date
(
from
:
Preferences
.
Expiry
)
{
if
Date
()
>
expiry
{
alertType
=
.
Expired
}
}
}
else
{
alertType
=
.
loginFailure
}
default
:
alertType
=
.
loginFailure
}
isProgressView
=
false
isLogin
=
false
isAlert
=
true
alertType
=
.
loginFailure
break
}
}
...
...
Seilassist/Sailassist/Login/ViewModel/ScannerViewModel.swift
View file @
6764045b
...
...
@@ -23,12 +23,14 @@ class ScannerViewModel: ObservableObject {
Preferences
.
Id
=
resjson
.
id
Preferences
.
Password
=
resjson
.
pass
Preferences
.
Expiry
=
resjson
.
exp
Preferences
.
lastLoginDate_Int64
=
DateTextLib
.
Date2UnixTime
(
date
:
Date
())
}
catch
{
print
(
debug
:
"decodeエラー"
)
Preferences
.
Id
=
""
Preferences
.
Password
=
""
Preferences
.
Expiry
=
""
}
isShowing
=
false
...
...
Seilassist/Sailassist/Preferences/Preferences.swift
View file @
6764045b
...
...
@@ -53,6 +53,7 @@ class Preferences{
@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:"", PreferencesKey.TypeString.UserName.rawValue)
static
var
Expiry
:
String
@AppStorage(wrappedValue:0, PreferencesKey.TypeInt.shipId.rawValue)
static
var
shipId
:
Int
@AppStorage(wrappedValue:0, PreferencesKey.TypeInt.LocationType.rawValue)
static
var
LocationType
:
Int
...
...
Seilassist/Sailassist/Preferences/PreferencesKey.swift
View file @
6764045b
...
...
@@ -16,6 +16,7 @@ class PreferencesKey{
case
Password
case
UserName
case
DeviceId
case
Expiry
//Manual類Version
case
ECDISBasic
...
...
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