TF-1289: [Presentation] Refactor name function
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
|
||||
class GetDeviceIdLoading extends UIState {}
|
||||
|
||||
class GetDeviceIdSuccess extends UIState {
|
||||
|
||||
final String deviceId;
|
||||
|
||||
GetDeviceIdSuccess(this.deviceId);
|
||||
|
||||
@override
|
||||
List<Object> get props => [deviceId];
|
||||
}
|
||||
|
||||
class GetDeviceIdFailure extends FeatureFailure {
|
||||
final dynamic exception;
|
||||
|
||||
GetDeviceIdFailure(this.exception);
|
||||
|
||||
@override
|
||||
List<Object> get props => [exception];
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
|
||||
class StoreDeviceIdLoading extends UIState {}
|
||||
|
||||
class StoreDeviceIdSuccess extends UIState {
|
||||
|
||||
StoreDeviceIdSuccess();
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class StoreDeviceIdFailure extends FeatureFailure {
|
||||
final dynamic exception;
|
||||
|
||||
StoreDeviceIdFailure(this.exception);
|
||||
|
||||
@override
|
||||
List<Object> get props => [exception];
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:tmail_ui_user/features/push_notification/domain/repository/fcm_repository.dart';
|
||||
import 'package:tmail_ui_user/features/push_notification/domain/state/get_device_id_state.dart';
|
||||
|
||||
class GetDeviceIdInteractor {
|
||||
final FCMRepository _fcmRepository;
|
||||
|
||||
GetDeviceIdInteractor(this._fcmRepository);
|
||||
|
||||
Stream<Either<Failure, Success>> execute() async* {
|
||||
try {
|
||||
yield Right<Failure, Success>(GetDeviceIdLoading());
|
||||
final deviceId = await _fcmRepository.getDeviceId();
|
||||
yield Right<Failure, Success>(GetDeviceIdSuccess(deviceId));
|
||||
} catch (e) {
|
||||
yield Left<Failure, Success>(GetDeviceIdFailure(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:tmail_ui_user/features/push_notification/domain/repository/fcm_repository.dart';
|
||||
import 'package:tmail_ui_user/features/push_notification/domain/state/store_device_id_state.dart';
|
||||
|
||||
class StoreDeviceIdInteractor {
|
||||
final FCMRepository _fcmRepository;
|
||||
|
||||
StoreDeviceIdInteractor(this._fcmRepository);
|
||||
|
||||
Stream<Either<Failure, Success>> execute(String deviceId) async* {
|
||||
try {
|
||||
yield Right<Failure, Success>(StoreDeviceIdLoading());
|
||||
await _fcmRepository.storeDeviceId(deviceId);
|
||||
yield Right<Failure, Success>(StoreDeviceIdSuccess());
|
||||
} catch (e) {
|
||||
yield Left<Failure, Success>(StoreDeviceIdFailure(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user