Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
mobile_scanner
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Navaron Bracke
2023-11-27 16:28:05 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
dac29bdd3d85e242929e715a0c061ef4f3f7602a
dac29bdd
1 parent
c4a2f2cd
fix bug with Android not using undetermined state
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
lib/src/mobile_scanner_controller.dart
lib/src/mobile_scanner_controller.dart
View file @
dac29bd
...
...
@@ -206,32 +206,33 @@ class MobileScannerController {
}
switch
(
state
)
{
// Android does not have an undetermined permission state.
// So if the permission state is denied, just request it now.
case
MobileScannerState
.
undetermined
:
bool
result
=
false
;
case
MobileScannerState
.
denied
:
try
{
result
=
final
bool
granted
=
await
_methodChannel
.
invokeMethod
(
'request'
)
as
bool
?
??
false
;
}
catch
(
error
)
{
if
(!
granted
)
{
isStarting
=
false
;
throw
const
MobileScannerException
(
errorCode:
MobileScannerErrorCode
.
genericError
,
errorCode:
MobileScannerErrorCode
.
permissionDenied
,
);
}
if
(!
result
)
{
}
on
PlatformException
catch
(
error
)
{
isStarting
=
false
;
throw
const
MobileScannerException
(
errorCode:
MobileScannerErrorCode
.
permissionDenied
,
throw
MobileScannerException
(
errorCode:
MobileScannerErrorCode
.
genericError
,
errorDetails:
MobileScannerErrorDetails
(
code:
error
.
code
,
details:
error
.
details
as
Object
?,
message:
error
.
message
,
),
);
}
break
;
case
MobileScannerState
.
denied
:
isStarting
=
false
;
throw
const
MobileScannerException
(
errorCode:
MobileScannerErrorCode
.
permissionDenied
,
);
case
MobileScannerState
.
authorized
:
break
;
}
...
...
Please
register
or
login
to post a comment