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
54
Merge Requests
54
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
gr-ssv
Sailassist
Commits
abc71913
Commit
abc71913
authored
Jan 13, 2024
by
shigemi miura
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Camera使用許可
parent
3d687d77
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
2 deletions
+38
-2
HttpRequestType.swift
Seilassist/Sailassist/Http/HttpRequestType.swift
+1
-1
LoginTypeSelectView.swift
Seilassist/Sailassist/Login/View/LoginTypeSelectView.swift
+37
-1
No files found.
Seilassist/Sailassist/Http/HttpRequestType.swift
View file @
abc71913
...
...
@@ -48,7 +48,7 @@ enum HttpRequestType : String {
case
GetMessage
=
"https://ssv-qc-web.azurewebsites.net/api/chatdata/getmessages?shipId=XXXXX"
case
SignalR
=
"https://ssv-qc-web.azurewebsites.net/signalr/shore"
case
PushHistory
=
"https://ssv-qc-web.azurewebsites.net/api/sailassist/pushhistory/XXXXX"
case
UploadImage
=
"https://ssv-qc-web.azur
ewebsites
.net/api/chatdata/uploadimage"
case
UploadImage
=
"https://ssv-qc-web.azur.net/api/chatdata/uploadimage"
case
ConnectionString
=
"Endpoint=sb://ssv-qc-notification.servicebus.windows.net/;SharedAccessKeyName=DefaultListenSharedAccessSignature;SharedAccessKey=qjI5K38IyGfh2arFherVgp5tNUBE2U4eVClgTEQip54="
case
HubName
=
"ssv-qc-sailassist-notification"
case
storage
=
"https://tacmiquaritycheckstorage.z31.web.core.windows.net/"
...
...
Seilassist/Sailassist/Login/View/LoginTypeSelectView.swift
View file @
abc71913
...
...
@@ -6,15 +6,17 @@
//
import
SwiftUI
import
AVFoundation
struct
LoginTypeSelectView
:
View
{
@Binding
var
isQrRead
:
Bool
@Binding
var
viewMode
:
LoginViewMode
@State
var
isCameraAlert
=
false
var
body
:
some
View
{
VStack
(
spacing
:
20
)
{
Button
(
action
:
{
isQrRead
=
true
checkCamera
()
},
label
:
{
Text
(
"Read the QR code"
)
.
font
(
FontStyle
.
TitleS
.
font
)
...
...
@@ -33,11 +35,45 @@ struct LoginTypeSelectView: View{
.
font
(
FontStyle
.
SupplementText
.
font
)
.
foregroundColor
(
ColorSet
.
Body
.
color
)
})
.
alert
(
"Error"
,
isPresented
:
$
isCameraAlert
)
{
Button
(
"Cancel"
)
{}
Button
(
"Setting"
)
{
guard
let
settingsURL
=
URL
(
string
:
UIApplication
.
openSettingsURLString
)
else
{
return
}
UIApplication
.
shared
.
open
(
settingsURL
,
options
:
[:],
completionHandler
:
nil
)
}
}
message
:
{
Text
(
"Please allow access to the camera in iOS settings."
)
}
}
.
padding
(
.
horizontal
,
50
)
}
/**
* カメラ許可確認
*/
func
checkCamera
()
{
isQrRead
=
true
let
status
=
AVCaptureDevice
.
authorizationStatus
(
for
:
AVMediaType
.
video
)
if
status
==
AVAuthorizationStatus
.
authorized
{
print
(
debug
:
"Camera permission"
)
}
else
if
status
==
AVAuthorizationStatus
.
notDetermined
{
print
(
debug
:
"Haven't asked for camera access permission yet"
)
}
else
if
status
==
AVAuthorizationStatus
.
denied
{
print
(
debug
:
"Camera not allowed"
)
AVCaptureDevice
.
requestAccess
(
for
:
.
video
,
completionHandler
:
{
granted
in
if
(
granted
==
false
)
{
isCameraAlert
=
true
isQrRead
=
false
}
})
}
}
}
#Preview {
LoginTypeSelectView
(
isQrRead
:
.
constant
(
false
),
viewMode
:
.
constant
(
.
SelectType
))
}
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