Skip to content

Commit

Permalink
slidable developed & reorder only on hold action
Browse files Browse the repository at this point in the history
  • Loading branch information
matteo-convertino committed Jun 30, 2023
1 parent f3ef01d commit 8f4bd1f
Show file tree
Hide file tree
Showing 6 changed files with 172 additions and 174 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
8 changes: 4 additions & 4 deletions lib/bloc/home/home_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:otp/otp.dart';
import 'package:otp_manager/bloc/home/home_event.dart';
import 'package:otp_manager/bloc/home/home_state.dart';
import 'package:otp_manager/domain/nextcloud_service.dart';
import 'package:otp_manager/main.dart';
import 'package:otp_manager/models/account.dart';
import 'package:otp_manager/repository/local_repository.dart';
import 'package:otp_manager/routing/constants.dart';
Expand Down Expand Up @@ -128,19 +129,18 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
}

void _onDeleteAccount(DeleteAccount event, Emitter<HomeState> emit) {
if(localRepositoryImpl.setAccountAsDeleted(event.id)) {
if (localRepositoryImpl.setAccountAsDeleted(event.id)) {
Account? accountDeleted = localRepositoryImpl.getAccount(event.id);

add(const GetAccounts());
add(NextcloudSync());

emit(state.copyWith(
accountDeleted:
"${accountDeleted?.type == "totp" ? "TOTP" : "HOTP"} has been removed"));
"${accountDeleted?.type == "totp" ? "TOTP" : "HOTP"} has been removed"));
} else {
emit(state.copyWith(
accountDeleted:
"There was an error while deleting the account"));
accountDeleted: "There was an error while deleting the account"));
}

emit(state.copyWith(accountDeleted: ""));
Expand Down
13 changes: 1 addition & 12 deletions lib/bloc/home/home_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,4 @@ class IncrementCounter extends HomeEvent {

@override
List<Object> get props => [account];
}



/*class FilterChanged extends HomeEvent {
const FilterChanged({required this.filter});
final String filter;
@override
List<Object> get props => [filter];
}*/
}
6 changes: 0 additions & 6 deletions lib/bloc/home/home_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:otp_manager/models/user.dart';

class HomeState extends Equatable {
final Map<Account, String?> accounts;
//final String accountFilter;
final int refreshTime;
final int syncStatus; // 1 = SYNCING, 0 = OK, -1 = ERROR
final String syncError;
Expand All @@ -14,7 +13,6 @@ class HomeState extends Equatable {

const HomeState({
required this.accounts,
// required this.accountFilter,
required this.refreshTime,
required this.syncStatus,
required this.syncError,
Expand All @@ -25,7 +23,6 @@ class HomeState extends Equatable {

HomeState.initial(User user)
: accounts = {},
//accountFilter = "",
refreshTime = 30,
syncStatus = 1,
syncError = "",
Expand All @@ -35,15 +32,13 @@ class HomeState extends Equatable {

HomeState copyWith({
Map<Account, String?>? accounts,
//String? accountFilter,
int? refreshTime,
int? syncStatus,
String? syncError,
String? accountDeleted,
}) {
return HomeState(
accounts: accounts ?? this.accounts,
// accountFilter: accountFilter ?? this.accountFilter,
refreshTime: refreshTime ?? this.refreshTime,
syncStatus: syncStatus ?? this.syncStatus,
syncError: syncError ?? this.syncError,
Expand All @@ -56,7 +51,6 @@ class HomeState extends Equatable {
@override
List<Object?> get props => [
accounts,
//accountFilter,
refreshTime,
syncStatus,
syncError,
Expand Down
Loading

0 comments on commit 8f4bd1f

Please sign in to comment.