Skip to content

Commit

Permalink
Deleted unused params token
Browse files Browse the repository at this point in the history
  • Loading branch information
Eldar2021 committed Jul 12, 2024
1 parent 1ae4cf9 commit 8db656e
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ final class HatimReadRepositoryImpl implements HatimRepository {
final HatimRemoteDataSource dataSource;

@override
Future<HatimReadEntity> getHatim(String token) async {
final res = await dataSource.getHatim(token);
Future<HatimReadEntity> getHatim() async {
final res = await dataSource.getHatim();
return res.toEntity;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class HatimRemoteDataSource {
late final WebSocketChannel channel;
bool isInitilized = false;

Future<HatimReadModel> getHatim(String token) async {
Future<HatimReadModel> getHatim() async {
try {
final res = await remoteClient.postType(
apiConst.joinToHatim,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:my_quran/modules/modules.dart';

abstract class HatimRepository {
Future<HatimReadEntity> getHatim(String token);
Future<HatimReadEntity> getHatim();

void connectToSocket(String token);

Expand Down
2 changes: 1 addition & 1 deletion app/lib/modules/hatim/presentation/bloc/hatim_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class HatimBloc extends Bloc<HatimEvent, HatimState> {
try {
if (state.dashBoardState is HatimDashBoardLoading) return;
emit(state.copyWith(dashBoardState: const HatimDashBoardLoading()));
final data = await repo.getHatim(token);
final data = await repo.getHatim();
emit(state.copyWith(dashBoardState: HatimDashBoardFetched(data)));

emit(state.copyWith(eventState: const HatimStateLoading()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ final class HomeRepositoryImpl implements HomeRepository {
final HomeRemoteDataSource remoteDataSource;

@override
Future<HomeEntity> getData(String token) async {
Future<HomeEntity> getData() async {
try {
final remoteData = await remoteDataSource.getRemoteData(token);
final remoteData = await remoteDataSource.getRemoteData();
await localDataSource.saveLocalData(remoteData);
return _convertData(remoteData);
} catch (e, s) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ final class HomeRemoteDataSource {

final MqDio remoteClient;

Future<HomeModelResponse> getRemoteData(String token) async {
Future<HomeModelResponse> getRemoteData() async {
final remoteValue = await remoteClient.getType<HomeModelResponse>(
apiConst.hatimDashBoard,
fromJson: HomeModelResponse.fromJson,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:my_quran/modules/modules.dart';

abstract class HomeRepository {
Future<HomeEntity> getData(String token);
Future<HomeEntity> getData();
}
4 changes: 2 additions & 2 deletions app/lib/modules/home/domain/usecase/get_data_usecase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ final class GetHomeDataUseCase {

final HomeRepository repository;

Future<HomeEntity> execute(String token) {
return repository.getData(token);
Future<HomeEntity> execute() {
return repository.getData();
}
}
4 changes: 2 additions & 2 deletions app/lib/modules/home/presentation/cubit/home_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class HomeCubit extends Cubit<HomeState> {

final GetHomeDataUseCase getHomeDataUseCase;

Future<void> getData(String token) async {
Future<void> getData() async {
try {
final homeModel = await getHomeDataUseCase.execute(token);
final homeModel = await getHomeDataUseCase.execute();
emit(HomeState(status: FetchStatus.success, homeModel: homeModel));
} catch (e, s) {
MqCrashlytics.report(e, s);
Expand Down
7 changes: 2 additions & 5 deletions app/lib/modules/home/presentation/view/home_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class _HomeViewState extends State<HomeView> {
if (homeCubit.state.status != FetchStatus.success && user != null) {
MqCrashlytics.setUserIdentifier(validName ?? user.accessToken);
MqAnalytic.setUserProperty(validName ?? user.accessToken);
homeCubit.getData(user.accessToken);
homeCubit.getData();
}
super.initState();
}
Expand All @@ -42,10 +42,7 @@ class _HomeViewState extends State<HomeView> {
body: RefreshIndicator(
onRefresh: () async {
MqAnalytic.track(AnalyticKey.refreshHomePage);
final user = context.read<AuthCubit>().state.user;
if (user != null) {
await context.read<HomeCubit>().getData(user.accessToken);
}
await context.read<HomeCubit>().getData();
},
child: SafeArea(
child: ListView(
Expand Down
2 changes: 1 addition & 1 deletion app/test/mocks/app_mocks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class MockPackageInfo extends Mock implements PackageInfo {

final class MockHomeRepositoryImpl implements HomeRepository {
@override
Future<HomeEntity> getData(String token) async {
Future<HomeEntity> getData() async {
return const HomeEntity(allDoneHatims: 8, allDonePages: 5325, donePages: 634);
}
}
Expand Down

0 comments on commit 8db656e

Please sign in to comment.