Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote client package #241

Merged
merged 7 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading