Skip to content

Commit

Permalink
Merge pull request #241 from Eldar2021/ai/mq-remote-client-package
Browse files Browse the repository at this point in the history
Remote client package
  • Loading branch information
Eldar2021 authored Aug 11, 2024
2 parents efd8cbf + 256b545 commit f726c9f
Show file tree
Hide file tree
Showing 26 changed files with 569 additions and 336 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:meta/meta.dart';
import 'package:mq_either/mq_either.dart';
import 'package:mq_remote_client/mq_remote_client.dart';
import 'package:mq_storage/mq_storage.dart';
import 'package:my_quran/app/app.dart';
import 'package:my_quran/config/config.dart';
Expand All @@ -15,7 +16,7 @@ final class AuthRemoteDataSourceImpl implements AuthRemoteDataSource {
required this.isIntegrationTest,
});

final MqDio client;
final MqRemoteClient client;
final PreferencesStorage storage;
final SoccialAuth soccialAuth;
final bool isIntegrationTest;
Expand Down Expand Up @@ -156,7 +157,7 @@ final class AuthRemoteDataSourceImpl implements AuthRemoteDataSource {
required Gender gender,
}) async {
try {
final token = await client.post(
final token = await client.postType(
'apiConst.fetchSmsCode',
fromJson: TokenResponse.fromJson,
body: {'code': code},
Expand Down Expand Up @@ -186,7 +187,7 @@ final class AuthRemoteDataSourceImpl implements AuthRemoteDataSource {
@override
Future<void> loginWithEmail(String email) async {
try {
await client.post(
await client.postType(
'apiConst.loginWithEmail',
fromJson: TokenResponse.fromJson,
body: {'email': email},
Expand Down
7 changes: 5 additions & 2 deletions app/lib/app/presentation/view/app_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter/scheduler.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:just_audio/just_audio.dart';
import 'package:loader_overlay/loader_overlay.dart';
import 'package:mq_remote_client/mq_remote_client.dart';
import 'package:mq_storage/mq_storage.dart';

import 'package:my_quran/app/app.dart';
Expand Down Expand Up @@ -51,7 +52,7 @@ class MyApp extends StatelessWidget {
remoteDataSource: isMockData
? const AuthRemoteDataSourceMock()
: AuthRemoteDataSourceImpl(
client: context.read<MqDio>(),
client: context.read<MqRemoteClient>(),
storage: context.read<PreferencesStorage>(),
soccialAuth: context.read<SoccialAuth>(),
isIntegrationTest: context.read<AppConfig>().isIntegrationTest,
Expand All @@ -77,7 +78,9 @@ class MyApp extends StatelessWidget {
isMockData
? const HomeLocalDataSourceMock()
: HomeLocalDataSourceImpl(context.read<PreferencesStorage>()),
isMockData ? const HomeRemoteDataSourceMock() : HomeRemoteDataSourceImpl(context.read<MqDio>()),
isMockData
? const HomeRemoteDataSourceMock()
: HomeRemoteDataSourceImpl(context.read<MqRemoteClient>()),
),
),
),
Expand Down
152 changes: 0 additions & 152 deletions app/lib/core/client/mq_dio.dart

This file was deleted.

149 changes: 0 additions & 149 deletions app/lib/core/client/mq_dio_base_extension.dart

This file was deleted.

3 changes: 0 additions & 3 deletions app/lib/core/core.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
export 'auth/soccial_auth.dart';
export 'client/network_client.dart';
export 'client/http_exception.dart';
export 'client/mq_dio.dart';
export 'crashlytics/mq_crashlytics.dart';
export 'exceptions/network_exception.dart';
export 'exceptions/server_exception.dart';
Expand Down
1 change: 0 additions & 1 deletion app/lib/core/crashlytics/mq_crashlytics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ final class MqCrashlytics {
}

static Future<void> setCrashlyticsCollectionEnabled({required bool enabled}) async {
if (kDebugMode) return;
return crashlytics.setCrashlyticsCollectionEnabled(enabled);
}

Expand Down
Loading

0 comments on commit f726c9f

Please sign in to comment.