mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-04-12 14:56:53 +02:00
105 lines
4.3 KiB
Diff
105 lines
4.3 KiB
Diff
From 369131e50242091de00163d0b1fc16de33336928 Mon Sep 17 00:00:00 2001
|
|
From: "lauren n. liberda" <lauren@selfisekai.rocks>
|
|
Date: Tue, 30 May 2023 03:06:58 +0200
|
|
Subject: [PATCH 1/2] fix window/layout on pmos
|
|
|
|
---
|
|
.../intiface_configuration_cubit.dart | 19 ++++++++++++++---
|
|
lib/intiface_central_app.dart | 21 +++++++++++--------
|
|
lib/util/intiface_util.dart | 8 +++++++
|
|
3 files changed, 36 insertions(+), 12 deletions(-)
|
|
|
|
diff --git a/lib/bloc/configuration/intiface_configuration_cubit.dart b/lib/bloc/configuration/intiface_configuration_cubit.dart
|
|
index 6d761bf..0f23aa4 100644
|
|
--- a/lib/bloc/configuration/intiface_configuration_cubit.dart
|
|
+++ b/lib/bloc/configuration/intiface_configuration_cubit.dart
|
|
@@ -83,6 +83,11 @@
|
|
WebsocketServerPortState(this.value);
|
|
}
|
|
|
|
+class Pmos extends IntifaceConfigurationState {
|
|
+ final bool value;
|
|
+ Pmos(this.value);
|
|
+}
|
|
+
|
|
class UseCompactDisplayState extends IntifaceConfigurationState {
|
|
final bool value;
|
|
UseCompactDisplayState(this.value);
|
|
@@ -186,9 +191,11 @@
|
|
// Our initializer runs through all of our known configuration values, either setting them to what they already are,
|
|
// or providing them with default values.
|
|
|
|
- // Window settings for desktop. Will be ignored on mobile. Default to expanded.
|
|
- useCompactDisplay = _prefs.getBool("useCompactDisplay") ?? false;
|
|
+ pmos = await isPostmarket();
|
|
|
|
+ // Window settings for desktop. Will be ignored on mobile. Default to expanded except pmos.
|
|
+ useCompactDisplay = _prefs.getBool("useCompactDisplay") ?? pmos;
|
|
+
|
|
// Crash reporting setting is now CrashReporting2, because it was originally slammed to true but never actually
|
|
// used anywhere. With the addition of Sentry, it's now defaulted to off so we're not sending data without the
|
|
// user's approval.
|
|
@@ -207,7 +214,7 @@
|
|
showExtendedUI = _prefs.getBool("showExtendedUI") ?? false;
|
|
allowRawMessages = _prefs.getBool("allowRawMessages") ?? false;
|
|
unreadNews = _prefs.getBool("unreadNews") ?? false;
|
|
- useSideNavigationBar = _prefs.getBool("useSideNavigationBar") ?? isDesktop();
|
|
+ useSideNavigationBar = _prefs.getBool("useSideNavigationBar") ?? isDesktop() && !pmos;
|
|
useLightTheme = _prefs.getBool("useLightTheme") ?? true;
|
|
restoreWindowLocation = _prefs.getBool("restoreWindowLocation") ?? true;
|
|
|
|
@@ -264,6 +271,12 @@
|
|
set currentDeviceConfigEtag(String value) {
|
|
_prefs.setString("currentDeviceConfigEtag", value);
|
|
emit(CurrentDeviceConfigEtagState(value));
|
|
+ }
|
|
+
|
|
+ bool get pmos => _prefs.getBool("pmos")!;
|
|
+ set pmos(bool value) {
|
|
+ _prefs.setBool("pmos", value);
|
|
+ emit(Pmos(value));
|
|
}
|
|
|
|
// Slam to false until we figure out how to window resizing.
|
|
diff --git a/lib/intiface_central_app.dart b/lib/intiface_central_app.dart
|
|
index 1fac674..d547773 100644
|
|
--- a/lib/intiface_central_app.dart
|
|
+++ b/lib/intiface_central_app.dart
|
|
@@ -153,6 +153,7 @@
|
|
logInfo("Window location not restored due to configuration settings");
|
|
}
|
|
|
|
+ if (configCubit.pmos) {
|
|
windowDisplayModeResize(configCubit.useCompactDisplay, guiSettingsCubit);
|
|
await windowManager.waitUntilReadyToShow(windowOptions, () async {
|
|
await windowManager.show();
|
|
@@ -165,6 +166,7 @@
|
|
}
|
|
windowDisplayModeResize(event.value, guiSettingsCubit);
|
|
});
|
|
+ }
|
|
|
|
// Only add app update checks on desktop, mobile apps will use stores.
|
|
updateRepo.addProvider(IntifaceCentralDesktopUpdater());
|
|
diff --git a/lib/util/intiface_util.dart b/lib/util/intiface_util.dart
|
|
index 2f2ccb6..fb3031e 100644
|
|
--- a/lib/util/intiface_util.dart
|
|
+++ b/lib/util/intiface_util.dart
|
|
@@ -1,3 +1,4 @@
|
|
+import 'package:device_info_plus/device_info_plus.dart';
|
|
import 'package:path_provider/path_provider.dart';
|
|
import 'package:path/path.dart' as p;
|
|
import 'dart:io';
|
|
@@ -82,3 +83,10 @@
|
|
bool isDesktop() => Platform.isLinux || Platform.isMacOS || Platform.isWindows;
|
|
bool isMobile() => Platform.isAndroid || Platform.isIOS;
|
|
bool canShowUpdate() => !(const bool.fromEnvironment('NO_VISIBLE_UPDATES'));
|
|
+Future<bool> isPostmarket() async {
|
|
+ if (!Platform.isLinux) return false;
|
|
+
|
|
+ DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
|
+ LinuxDeviceInfo linuxInfo = await deviceInfo.linuxInfo;
|
|
+ return linuxInfo.id == "postmarketos";
|
|
+}
|
|
--
|
|
2.40.1
|