screensaver: init fix
This commit is contained in:
parent
102e3974e7
commit
edab909fb0
2 changed files with 11 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
import 'package:aves/services/common/services.dart';
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:floating/floating.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:local_auth/local_auth.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
|
||||
|
@ -57,7 +58,12 @@ class Device {
|
|||
_canAuthenticateUser = await auth.canCheckBiometrics || await auth.isDeviceSupported();
|
||||
|
||||
final floating = Floating();
|
||||
try {
|
||||
_supportPictureInPicture = await floating.isPipAvailable;
|
||||
} on PlatformException catch (_) {
|
||||
// as of floating v2.0.0, plugin assumes activity and fails when bound via service
|
||||
_supportPictureInPicture = false;
|
||||
}
|
||||
floating.dispose();
|
||||
|
||||
final capabilities = await deviceService.getCapabilities();
|
||||
|
|
|
@ -3,6 +3,7 @@ import 'dart:math';
|
|||
import 'package:aves/app_mode.dart';
|
||||
import 'package:aves/model/actions/entry_actions.dart';
|
||||
import 'package:aves/model/actions/move_type.dart';
|
||||
import 'package:aves/model/device.dart';
|
||||
import 'package:aves/model/entry.dart';
|
||||
import 'package:aves/model/filters/filters.dart';
|
||||
import 'package:aves/model/filters/trash.dart';
|
||||
|
@ -241,7 +242,9 @@ class _EntryViewerStackState extends State<EntryViewerStack> with EntryViewContr
|
|||
onViewDisposed: (mainEntry, pageEntry) => viewStateConductor.reset(pageEntry ?? mainEntry),
|
||||
);
|
||||
return StreamBuilder<PiPStatus>(
|
||||
stream: _floating.pipStatus$,
|
||||
// as of floating v2.0.0, plugin assumes activity and fails when bound via service
|
||||
// so we do not access status stream directly, but check for support first
|
||||
stream: device.supportPictureInPicture ? _floating.pipStatus$ : Stream.value(PiPStatus.disabled),
|
||||
builder: (context, snapshot) {
|
||||
var pipEnabled = snapshot.data == PiPStatus.enabled;
|
||||
return Stack(
|
||||
|
|
Loading…
Reference in a new issue