Remove obsolete code

This commit is contained in:
Ming Ming 2023-08-27 19:20:37 +08:00
parent 0f129f839d
commit 0d2d9feac4
4 changed files with 7 additions and 50 deletions

View file

@ -4,7 +4,6 @@ import 'package:event_bus/event_bus.dart';
import 'package:kiwi/kiwi.dart'; import 'package:kiwi/kiwi.dart';
import 'package:logging/logging.dart'; import 'package:logging/logging.dart';
import 'package:nc_photos/account.dart'; import 'package:nc_photos/account.dart';
import 'package:nc_photos/entity/album.dart';
import 'package:nc_photos/entity/file.dart'; import 'package:nc_photos/entity/file.dart';
import 'package:nc_photos/entity/file_descriptor.dart'; import 'package:nc_photos/entity/file_descriptor.dart';
import 'package:nc_photos/entity/local_file.dart'; import 'package:nc_photos/entity/local_file.dart';
@ -46,20 +45,6 @@ class AccountPrefUpdatedEvent {
final dynamic value; final dynamic value;
} }
class AlbumCreatedEvent {
AlbumCreatedEvent(this.account, this.album);
final Account account;
final Album album;
}
class AlbumUpdatedEvent {
AlbumUpdatedEvent(this.account, this.album);
final Account account;
final Album album;
}
class FilePropertyUpdatedEvent { class FilePropertyUpdatedEvent {
FilePropertyUpdatedEvent(this.account, this.file, this.properties); FilePropertyUpdatedEvent(this.account, this.file, this.properties);
@ -97,13 +82,6 @@ class FileMovedEvent {
final String destination; final String destination;
} }
class ShareCreatedEvent {
const ShareCreatedEvent(this.account, this.share);
final Account account;
final Share share;
}
class ShareRemovedEvent { class ShareRemovedEvent {
const ShareRemovedEvent(this.account, this.share); const ShareRemovedEvent(this.account, this.share);

View file

@ -1,19 +1,11 @@
import 'package:event_bus/event_bus.dart';
import 'package:kiwi/kiwi.dart';
import 'package:nc_photos/account.dart'; import 'package:nc_photos/account.dart';
import 'package:nc_photos/entity/album.dart'; import 'package:nc_photos/entity/album.dart';
import 'package:nc_photos/event/event.dart';
class CreateAlbum { class CreateAlbum {
CreateAlbum(this.albumRepo); const CreateAlbum(this.albumRepo);
Future<Album> call(Account account, Album album) async { Future<Album> call(Account account, Album album) async =>
final newAlbum = await albumRepo.create(account, album); albumRepo.create(account, album);
KiwiContainer()
.resolve<EventBus>()
.fire(AlbumCreatedEvent(account, newAlbum));
return newAlbum;
}
final AlbumRepo albumRepo; final AlbumRepo albumRepo;
} }

View file

@ -1,18 +1,12 @@
import 'package:event_bus/event_bus.dart';
import 'package:kiwi/kiwi.dart';
import 'package:nc_photos/account.dart'; import 'package:nc_photos/account.dart';
import 'package:nc_photos/entity/file.dart'; import 'package:nc_photos/entity/file.dart';
import 'package:nc_photos/entity/share.dart'; import 'package:nc_photos/entity/share.dart';
import 'package:nc_photos/event/event.dart';
class CreateUserShare { class CreateUserShare {
const CreateUserShare(this.shareRepo); const CreateUserShare(this.shareRepo);
Future<Share> call(Account account, File file, String shareWith) async { Future<Share> call(Account account, File file, String shareWith) =>
final share = await shareRepo.create(account, file, shareWith); shareRepo.create(account, file, shareWith);
KiwiContainer().resolve<EventBus>().fire(ShareCreatedEvent(account, share));
return share;
}
final ShareRepo shareRepo; final ShareRepo shareRepo;
} }
@ -24,11 +18,8 @@ class CreateLinkShare {
Account account, Account account,
File file, { File file, {
String? password, String? password,
}) async { }) =>
final share = await shareRepo.createLink(account, file, password: password); shareRepo.createLink(account, file, password: password);
KiwiContainer().resolve<EventBus>().fire(ShareCreatedEvent(account, share));
return share;
}
final ShareRepo shareRepo; final ShareRepo shareRepo;
} }

View file

@ -1,10 +1,7 @@
import 'package:event_bus/event_bus.dart';
import 'package:kiwi/kiwi.dart';
import 'package:nc_photos/account.dart'; import 'package:nc_photos/account.dart';
import 'package:nc_photos/entity/album.dart'; import 'package:nc_photos/entity/album.dart';
import 'package:nc_photos/entity/album/item.dart'; import 'package:nc_photos/entity/album/item.dart';
import 'package:nc_photos/entity/album/provider.dart'; import 'package:nc_photos/entity/album/provider.dart';
import 'package:nc_photos/event/event.dart';
import 'package:nc_photos/exception.dart'; import 'package:nc_photos/exception.dart';
class UpdateAlbum { class UpdateAlbum {
@ -29,7 +26,6 @@ class UpdateAlbum {
} else { } else {
await albumRepo.update(account, album); await albumRepo.update(account, album);
} }
KiwiContainer().resolve<EventBus>().fire(AlbumUpdatedEvent(account, album));
} }
List<AlbumItem> _minimizeItems(List<AlbumItem> items) { List<AlbumItem> _minimizeItems(List<AlbumItem> items) {