Skip to content

Commit

Permalink
chore: monitor clipboard only when search is active
Browse files Browse the repository at this point in the history
  • Loading branch information
MSOB7YY committed Jan 15, 2024
1 parent 961e8af commit 1c2bb17
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import 'package:path_provider/path_provider.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:picture_in_picture/picture_in_picture.dart';

import 'package:namida/controller/clipboard_controller.dart';
import 'package:namida/controller/connectivity.dart';
import 'package:namida/controller/current_color.dart';
import 'package:namida/controller/folders_controller.dart';
Expand Down Expand Up @@ -117,7 +116,7 @@ void main() async {
Language.initialize(),
]);
ConnectivityController.inst.initialize();
ClipboardController.inst.setClipboardMonitoringStatus(settings.enableClipboardMonitoring.value);
LifeCycleController.inst.setCanEnterPip(settings.enablePip.value);

/// updates values on startup
Indexer.inst.updateImageSizeInStorage();
Expand Down
2 changes: 2 additions & 0 deletions lib/ui/pages/main_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,10 @@ class NamidaSearchBar extends StatelessWidget {
ClipboardController.inst.updateTextInControllerEmpty(true);
if (isOpen) {
SearchSortController.inst.prepareResources();
ClipboardController.inst.setClipboardMonitoringStatus(settings.enableClipboardMonitoring.value);
} else {
SearchSortController.inst.disposeResources();
ClipboardController.inst.setClipboardMonitoringStatus(false);
}
},
onFieldSubmitted: _onSubmitted,
Expand Down
2 changes: 0 additions & 2 deletions lib/ui/widgets/settings/extra_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'package:flutter/material.dart';

import 'package:get/get.dart';

import 'package:namida/controller/clipboard_controller.dart';
import 'package:namida/controller/current_color.dart';
import 'package:namida/controller/folders_controller.dart';
import 'package:namida/controller/indexer_controller.dart';
Expand Down Expand Up @@ -339,7 +338,6 @@ class ExtrasSettings extends SettingSubpageProvider {
value: settings.enableClipboardMonitoring.value,
onChanged: (isTrue) {
settings.save(enableClipboardMonitoring: !isTrue);
ClipboardController.inst.setClipboardMonitoringStatus(!isTrue);
},
),
),
Expand Down

0 comments on commit 1c2bb17

Please sign in to comment.