Skip to content

Commit 7cd4ae8

Browse files
committed
Update
- Force en-us locale for MS Store API - Proper Memory Compression detection (but slow) - Fix notification status detection
1 parent a07409a commit 7cd4ae8

File tree

6 files changed

+89
-47
lines changed

6 files changed

+89
-47
lines changed

lib/screens/pages/performance_page.dart

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ class _PerformancePageState extends State<PerformancePage> {
1818
final PerformanceService _performanceService = PerformanceService();
1919
late final _sfBool =
2020
ValueNotifier<bool>(_performanceService.statusSuperfetch);
21-
late final _mcBool =
22-
ValueNotifier<bool>(_performanceService.statusMemoryCompression);
21+
late final _mcBool = ValueNotifier<bool>(false);
2322
late final _iTSXBool =
2423
ValueNotifier<bool>(_performanceService.statusIntelTSX);
2524
late final _foBool =
@@ -42,6 +41,19 @@ class _PerformancePageState extends State<PerformancePage> {
4241
late final _ntfsMUBool =
4342
ValueNotifier<bool>(_performanceService.statusMemoryUsageNTFS);
4443

44+
@override
45+
void initState() {
46+
WidgetsBinding.instance.addPostFrameCallback((_) async {
47+
_initMemoryCompresionStatus();
48+
49+
});
50+
super.initState();
51+
}
52+
53+
Future<void> _initMemoryCompresionStatus() async {
54+
_mcBool.value = await _performanceService.statusMemoryCompression;
55+
}
56+
4557
@override
4658
void dispose() {
4759
_sfBool.dispose();

lib/services/msstore_service.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ class MSStoreService {
7272
static var _packages = List<PackagesInfo>.empty(growable: true);
7373
List<PackagesInfo> get packages => List.unmodifiable(_packages);
7474

75-
Future<void> startProcess(String productId, String ring) async {
75+
Future<void> startProcess(String id, String ring) async {
7676
_packages = [];
77+
final productId = id.trim();
7778

7879
if (isUWP(productId)) {
7980
if (_cookie.isEmpty) {
@@ -148,8 +149,12 @@ class MSStoreService {
148149
}
149150

150151
Future<String> _getCategoryID(String id) async {
151-
final response = await _dio.get(
152-
"$_storeAPI/products/$id?market=${systemLanguage.substring(3).toUpperCase()}&locale=$systemLanguage&deviceFamily=Windows.Desktop",
152+
//TODO: Implement proper way to get compatible language codes for the store API parameters
153+
154+
// When Windows region is set to English (World), the language code isn't compatible with the store API
155+
//"$_storeAPI/products/$id?market=US&locale=en-us&deviceFamily=Windows.Desktop",
156+
final response = await _dio.get(
157+
"$_storeAPI/products/$id?market=US&locale=en-us&deviceFamily=Windows.Desktop",
153158
cancelToken: _cancelToken);
154159
final skus = response.data["Payload"]["Skus"];
155160
if (response.statusCode == 200) {

lib/services/performance_service.dart

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,32 +53,25 @@ class PerformanceService implements SetupService {
5353

5454
// TODO: Find a batter way to detect Memory Compression
5555
// isMemoryCompressionEnabled is added by ReviOS, due to complexity of detecting the value without PowerShell
56-
bool get statusMemoryCompression {
57-
return _registryUtilsService.readInt(
58-
RegistryHive.localMachine,
59-
r'SYSTEM\ControlSet001\Control\Session Manager\Memory Management\PrefetchParameters',
60-
'isMemoryCompressionEnabled') ==
61-
1;
56+
Future<bool> get statusMemoryCompression async {
57+
final value = await _shell.run(
58+
'PowerShell -NonInteractive -NoLogo -NoProfile -Command "(Get-MMAgent).MemoryCompression"', );
59+
return value.outText == 'True';
60+
// return _registryUtilsService.readInt(
61+
// RegistryHive.localMachine,
62+
// r'SYSTEM\ControlSet001\Control\Session Manager\Memory Management\PrefetchParameters',
63+
// 'isMemoryCompressionEnabled') ==
64+
// 1;
6265
}
6366

6467
Future<void> enableMemoryCompression() async {
6568
await _shell.run(
6669
'PowerShell -NonInteractive -NoLogo -NoProfile -Command "Enable-MMAgent -mc"');
67-
_registryUtilsService.writeDword(
68-
Registry.localMachine,
69-
r'SYSTEM\ControlSet001\Control\Session Manager\Memory Management\PrefetchParameters',
70-
'isMemoryCompressionEnabled',
71-
1);
7270
}
7371

7472
Future<void> disableMemoryCompression() async {
7573
await _shell.run(
7674
'PowerShell -NonInteractive -NoLogo -NoProfile -Command "Disable-MMAgent -mc"');
77-
_registryUtilsService.writeDword(
78-
Registry.localMachine,
79-
r'SYSTEM\ControlSet001\Control\Session Manager\Memory Management\PrefetchParameters',
80-
'isMemoryCompressionEnabled',
81-
0);
8275
}
8376

8477
bool get statusIntelTSX {

lib/services/usability_service.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class UsabilityService implements SetupService {
3030
return _registryUtilsService.readInt(
3131
RegistryHive.currentUser,
3232
r'Software\Microsoft\Windows\CurrentVersion\PushNotifications',
33-
'NoToastApplicationNotification') !=
34-
1;
33+
'ToastEnabled') !=
34+
0;
3535
}
3636

3737
Future<void> enableNotification() async {

pubspec.lock

Lines changed: 51 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ packages:
2626
source: hosted
2727
version: "2.0.2"
2828
args:
29-
dependency: transitive
29+
dependency: "direct main"
3030
description:
3131
name: args
3232
sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596
@@ -181,10 +181,10 @@ packages:
181181
dependency: "direct main"
182182
description:
183183
name: dio
184-
sha256: "797e1e341c3dd2f69f2dad42564a6feff3bfb87187d05abb93b9609e6f1645c3"
184+
sha256: "49af28382aefc53562459104f64d16b9dfd1e8ef68c862d5af436cc8356ce5a8"
185185
url: "https://pub.dev"
186186
source: hosted
187-
version: "5.4.0"
187+
version: "5.4.1"
188188
fake_async:
189189
dependency: transitive
190190
description:
@@ -221,18 +221,18 @@ packages:
221221
dependency: "direct main"
222222
description:
223223
name: fluent_ui
224-
sha256: d6ffe21ff6bc61e98044a0529c139277dac2bbe6e71f868f7791d7eabc53d718
224+
sha256: "432615c5b0cff4c3a162c94efc7f563ba783de447f6c6fbcaf7546dfab2fcb0a"
225225
url: "https://pub.dev"
226226
source: hosted
227-
version: "4.8.5"
227+
version: "4.8.6"
228228
fluentui_system_icons:
229229
dependency: "direct main"
230230
description:
231231
name: fluentui_system_icons
232-
sha256: "077cc7bd15ced57d768024508aefefff45431a2e82ae11e95c66815fd4d2880d"
232+
sha256: "5262a1e3b70822405e923ec06490e92ba66b6fd3910567b34f840af5d95c882b"
233233
url: "https://pub.dev"
234234
source: hosted
235-
version: "1.1.224"
235+
version: "1.1.227"
236236
flutter:
237237
dependency: "direct main"
238238
description: flutter
@@ -265,10 +265,10 @@ packages:
265265
dependency: "direct dev"
266266
description:
267267
name: freezed
268-
sha256: "6c5031daae12c7072b3a87eff98983076434b4889ef2a44384d0cae3f82372ba"
268+
sha256: "57247f692f35f068cae297549a46a9a097100685c6780fe67177503eea5ed4e5"
269269
url: "https://pub.dev"
270270
source: hosted
271-
version: "2.4.6"
271+
version: "2.4.7"
272272
freezed_annotation:
273273
dependency: "direct main"
274274
description:
@@ -365,6 +365,30 @@ packages:
365365
url: "https://pub.dev"
366366
source: hosted
367367
version: "6.7.1"
368+
leak_tracker:
369+
dependency: transitive
370+
description:
371+
name: leak_tracker
372+
sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa"
373+
url: "https://pub.dev"
374+
source: hosted
375+
version: "10.0.0"
376+
leak_tracker_flutter_testing:
377+
dependency: transitive
378+
description:
379+
name: leak_tracker_flutter_testing
380+
sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0
381+
url: "https://pub.dev"
382+
source: hosted
383+
version: "2.0.1"
384+
leak_tracker_testing:
385+
dependency: transitive
386+
description:
387+
name: leak_tracker_testing
388+
sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47
389+
url: "https://pub.dev"
390+
source: hosted
391+
version: "2.0.1"
368392
lints:
369393
dependency: transitive
370394
description:
@@ -385,18 +409,18 @@ packages:
385409
dependency: transitive
386410
description:
387411
name: matcher
388-
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
412+
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
389413
url: "https://pub.dev"
390414
source: hosted
391-
version: "0.12.16"
415+
version: "0.12.16+1"
392416
material_color_utilities:
393417
dependency: transitive
394418
description:
395419
name: material_color_utilities
396-
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
420+
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
397421
url: "https://pub.dev"
398422
source: hosted
399-
version: "0.5.0"
423+
version: "0.8.0"
400424
math_expressions:
401425
dependency: transitive
402426
description:
@@ -409,10 +433,10 @@ packages:
409433
dependency: transitive
410434
description:
411435
name: meta
412-
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
436+
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
413437
url: "https://pub.dev"
414438
source: hosted
415-
version: "1.10.0"
439+
version: "1.11.0"
416440
mime:
417441
dependency: transitive
418442
description:
@@ -465,10 +489,10 @@ packages:
465489
dependency: "direct main"
466490
description:
467491
name: path
468-
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
492+
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
469493
url: "https://pub.dev"
470494
source: hosted
471-
version: "1.8.3"
495+
version: "1.9.0"
472496
path_provider:
473497
dependency: "direct main"
474498
description:
@@ -553,10 +577,10 @@ packages:
553577
dependency: "direct main"
554578
description:
555579
name: process_run
556-
sha256: "3d5335d17003a7c2fd5148be2d313f5b84244ab2e625162fdd44b4aaa48bea66"
580+
sha256: "8d9c6198b98fbbfb511edd42e7364e24d85c163e47398919871b952dc86a423e"
557581
url: "https://pub.dev"
558582
source: hosted
559-
version: "0.13.3+1"
583+
version: "0.14.2"
560584
provider:
561585
dependency: "direct main"
562586
description:
@@ -746,6 +770,14 @@ packages:
746770
url: "https://pub.dev"
747771
source: hosted
748772
version: "2.1.4"
773+
vm_service:
774+
dependency: transitive
775+
description:
776+
name: vm_service
777+
sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
778+
url: "https://pub.dev"
779+
source: hosted
780+
version: "13.0.0"
749781
watcher:
750782
dependency: transitive
751783
description:

pubspec.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ dependencies:
1818
intl: '>=0.18.0 <= 1.0.0'
1919

2020
# UI
21-
fluent_ui: ^4.8.5
21+
fluent_ui: ^4.8.6
2222
system_theme: ^2.3.1
23-
fluentui_system_icons: ^1.1.224
23+
fluentui_system_icons: ^1.1.227
2424
window_plus:
2525
git:
2626
url: https://github.com/melo936/window_plus
@@ -33,10 +33,10 @@ dependencies:
3333
path: ^1.8.3
3434

3535
# Network
36-
dio: ^5.4.0
36+
dio: ^5.4.1
3737

3838
# Shell
39-
process_run: ^0.13.1
39+
process_run: ^0.14.2
4040

4141
# Used to get the version of the app
4242
package_info_plus: any
@@ -64,7 +64,7 @@ dev_dependencies:
6464
sdk: flutter
6565
flutter_lints: ^3.0.1
6666
build_runner: ^2.4.8
67-
freezed: ^2.4.6
67+
freezed: ^2.4.7
6868
json_serializable: ^6.7.1
6969

7070
flutter:

0 commit comments

Comments
 (0)