Fix beacon scan not working on button tap
This commit is contained in:
parent
f43d23fe44
commit
8bb5511d37
@ -15,6 +15,7 @@ class VisitAppContext with ChangeNotifier{
|
|||||||
List<SectionRead> readSections = [];
|
List<SectionRead> readSections = [];
|
||||||
bool isContentCurrentlyShown = false;
|
bool isContentCurrentlyShown = false;
|
||||||
bool isScanningBeacons = false;
|
bool isScanningBeacons = false;
|
||||||
|
bool isScanBeaconAlreadyAllowed = false;
|
||||||
|
|
||||||
VisitAppContext({this.language, this.id, this.configuration, this.instanceId});
|
VisitAppContext({this.language, this.id, this.configuration, this.instanceId});
|
||||||
|
|
||||||
|
|||||||
@ -76,7 +76,7 @@ class _ConfigurationsListState extends State<ConfigurationsList> {
|
|||||||
|
|
||||||
Navigator.of(context).pushReplacement(MaterialPageRoute(
|
Navigator.of(context).pushReplacement(MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
VisitPage(configurationId: configurations[index].id!),
|
VisitPage(configurationId: configurations[index].id!, isAlreadyAllowed: visitAppContext.isScanBeaconAlreadyAllowed),
|
||||||
));
|
));
|
||||||
/*Navigator.push(
|
/*Navigator.push(
|
||||||
context,
|
context,
|
||||||
@ -110,7 +110,7 @@ class _ConfigurationsListState extends State<ConfigurationsList> {
|
|||||||
|
|
||||||
Navigator.of(context).pushReplacement(MaterialPageRoute(
|
Navigator.of(context).pushReplacement(MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
VisitPage(configurationId: configurations[index].id!),
|
VisitPage(configurationId: configurations[index].id!, isAlreadyAllowed: visitAppContext.isScanBeaconAlreadyAllowed),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,9 +23,10 @@ import 'package:provider/provider.dart';
|
|||||||
import 'components/body.dart';
|
import 'components/body.dart';
|
||||||
|
|
||||||
class VisitPage extends StatefulWidget {
|
class VisitPage extends StatefulWidget {
|
||||||
const VisitPage({Key? key, required this.configurationId}) : super(key: key);
|
const VisitPage({Key? key, required this.configurationId, required this.isAlreadyAllowed}) : super(key: key);
|
||||||
|
|
||||||
final String configurationId;
|
final String configurationId;
|
||||||
|
final bool isAlreadyAllowed;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<VisitPage> createState() => _VisitPageState();
|
State<VisitPage> createState() => _VisitPageState();
|
||||||
@ -69,7 +70,7 @@ class _VisitPageState extends State<VisitPage> with WidgetsBindingObserver {
|
|||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
if(controller.authorizationStatusOk) {
|
if(widget.isAlreadyAllowed) {
|
||||||
listeningState();
|
listeningState();
|
||||||
}
|
}
|
||||||
//listeningState();
|
//listeningState();
|
||||||
@ -466,6 +467,13 @@ class _VisitPageState extends State<VisitPage> with WidgetsBindingObserver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!isCancel) {
|
if(!isCancel) {
|
||||||
|
if(!controller.bluetoothEnabled) {
|
||||||
|
await handleOpenBluetooth();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!controller.locationServiceEnabled) {
|
||||||
|
await handleOpenLocationSettings();
|
||||||
|
}
|
||||||
if(!visitAppContext.isScanningBeacons) {
|
if(!visitAppContext.isScanningBeacons) {
|
||||||
print("Start Scan");
|
print("Start Scan");
|
||||||
print(_streamRanging);
|
print(_streamRanging);
|
||||||
@ -477,6 +485,7 @@ class _VisitPageState extends State<VisitPage> with WidgetsBindingObserver {
|
|||||||
|
|
||||||
controller.startScanning();
|
controller.startScanning();
|
||||||
visitAppContext.isScanningBeacons = true;
|
visitAppContext.isScanningBeacons = true;
|
||||||
|
visitAppContext.isScanBeaconAlreadyAllowed = true;
|
||||||
appContext.setContext(visitAppContext);
|
appContext.setContext(visitAppContext);
|
||||||
} else {
|
} else {
|
||||||
print("Pause Scan");
|
print("Pause Scan");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user