Merge pull request #479 from ente-io/debug_options

This commit is contained in:
Vishnu Mohandas 2022-09-13 16:46:51 +05:30 committed by GitHub
commit 9b93564da4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 3 deletions

View file

@ -74,6 +74,11 @@ class IgnoredFilesService {
}
}
Future<void> reset() async {
await _db.clearTable();
_ignoredIDs = null;
}
Future<Set<String>> _loadExistingIDs() async {
_logger.fine('loading existing IDs');
final result = await _db.getAll();

View file

@ -13,7 +13,6 @@ import 'package:photos/core/event_bus.dart';
import 'package:photos/db/device_files_db.dart';
import 'package:photos/db/file_updation_db.dart';
import 'package:photos/db/files_db.dart';
import 'package:photos/db/ignored_files_db.dart';
import 'package:photos/events/backup_folders_updated_event.dart';
import 'package:photos/events/local_photos_updated_event.dart';
import 'package:photos/events/sync_status_update_event.dart';
@ -308,7 +307,6 @@ class LocalSyncService {
Future<void> resetLocalSync() async {
assert(kDebugMode, "only available in debug mode");
await FilesDB.instance.deleteDB();
await IgnoredFilesDB.instance.clearTable();
for (var element in [
kHasCompletedFirstImportKey,
hasImportedDeviceCollections,

View file

@ -5,7 +5,9 @@ import 'package:flutter/material.dart';
import 'package:flutter_sodium/flutter_sodium.dart';
import 'package:photos/core/configuration.dart';
import 'package:photos/core/network.dart';
import 'package:photos/services/ignored_files_service.dart';
import 'package:photos/services/local_sync_service.dart';
import 'package:photos/services/sync_service.dart';
import 'package:photos/ui/settings/common_settings.dart';
import 'package:photos/ui/settings/settings_section_title.dart';
import 'package:photos/ui/settings/settings_text_item.dart';
@ -57,6 +59,18 @@ class DebugSectionWidget extends StatelessWidget {
icon: Icons.navigate_next,
),
),
GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () async {
await IgnoredFilesService.instance.reset();
SyncService.instance.sync();
showToast(context, "Done");
},
child: const SettingsTextItem(
text: "Allow auto-upload for ignored files",
icon: Icons.navigate_next,
),
),
],
);
}

View file

@ -5,6 +5,7 @@ import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:photos/core/configuration.dart';
import 'package:photos/services/feature_flag_service.dart';
import 'package:photos/ui/settings/account_section_widget.dart';
import 'package:photos/ui/settings/app_version_widget.dart';
import 'package:photos/ui/settings/backup_section_widget.dart';
@ -104,7 +105,8 @@ class SettingsPage extends StatelessWidget {
]);
}
if (kDebugMode && hasLoggedIn) {
if (FeatureFlagService.instance.isInternalUserOrDebugBuild() &&
hasLoggedIn) {
contents.addAll([sectionDivider, const DebugSectionWidget()]);
}
contents.add(const AppVersionWidget());