diff --git a/lib/core/constants/my_api.dart b/lib/core/constants/my_api.dart index e22ef53..bafa090 100644 --- a/lib/core/constants/my_api.dart +++ b/lib/core/constants/my_api.dart @@ -7,15 +7,12 @@ class MyApi { static const String contentType = 'application/json'; static const String defaultError = 'An unexpected error has occurred.'; - static const String baseUrl = 'https://shiamind.newhorizonco.uk'; + static const String baseUrl = 'https://shiamind.newhorizonco.uk/backend/api'; - /// Backend - static const String backend = '/backend/api'; + /// Player Auth + static const String guestToken = '/player/guest-token/'; + static const String centrifugoToken = '/player/centrifugo-connect/'; - /// Topics - static const String topics = '$backend/topics/'; - - /// Tokens - static const String guestToken = '$backend/player/guest-token/'; - static const String centrifugoToken = '$backend/player/centrifugo-connect/'; + /// Quiz + static const String topics = '/quiz/topics/'; } diff --git a/lib/core/error_handler/error_handler.dart b/lib/core/error_handler/error_handler.dart index db8de6e..559c9eb 100644 --- a/lib/core/error_handler/error_handler.dart +++ b/lib/core/error_handler/error_handler.dart @@ -1,6 +1,8 @@ import 'package:dio/dio.dart'; +import 'package:get/get.dart'; import 'package:shia_game_flutter/core/constants/my_api.dart'; import 'package:shia_game_flutter/core/error_handler/my_exception.dart'; +import 'package:shia_game_flutter/core/utils/my_localization.dart'; class ErrorHandler { static const ErrorHandler _i = ErrorHandler._internal(); @@ -8,22 +10,23 @@ class ErrorHandler { factory ErrorHandler() => _i; static void handleError(DioException e) { - if (e.response == null) { + if (e.type == DioExceptionType.connectionTimeout || + e.type == DioExceptionType.connectionError || + e.type == DioExceptionType.receiveTimeout || + e.type == DioExceptionType.sendTimeout) { throw MyException( - errorMessage: e.message ?? MyApi.defaultError, - statusCode: e.response?.statusCode, + errorMessage: Get.context!.translate.check_internet_connection, + statusCode: 0, ); } else { - if (e.response?.data['message'] == null) { + if (e.response?.data?['message'] == null) { throw MyException( - errorMessage: - e.response?.statusMessage ?? e.message ?? MyApi.defaultError, + errorMessage: e.response?.statusMessage ?? e.message ?? MyApi.defaultError, statusCode: e.response?.statusCode, ); } else { throw MyException( - errorMessage: - e.response?.data['message'] ?? e.message ?? MyApi.defaultError, + errorMessage: e.response?.data?['message'] ?? e.message ?? MyApi.defaultError, statusCode: e.response?.statusCode, ); } diff --git a/lib/core/network/http_request_impl.dart b/lib/core/network/http_request_impl.dart index 74cbbb2..c272f67 100644 --- a/lib/core/network/http_request_impl.dart +++ b/lib/core/network/http_request_impl.dart @@ -17,6 +17,7 @@ class HttpRequestImpl implements IHttpRequest { ), )..interceptors.addAll([ LoggingInterceptor.prettyDioLogger, + LoggingInterceptor.curlDioLogger, TokenInterceptor(), ]); diff --git a/lib/core/network/interceptors/logging_interceptor.dart b/lib/core/network/interceptors/logging_interceptor.dart index 5311e0d..81a6d8d 100644 --- a/lib/core/network/interceptors/logging_interceptor.dart +++ b/lib/core/network/interceptors/logging_interceptor.dart @@ -1,5 +1,6 @@ import 'package:flutter/foundation.dart'; import 'package:pretty_dio_logger/pretty_dio_logger.dart'; +import 'package:curl_logger_dio_interceptor/curl_logger_dio_interceptor.dart'; class LoggingInterceptor { static const LoggingInterceptor _i = LoggingInterceptor._internal(); @@ -16,4 +17,7 @@ class LoggingInterceptor { maxWidth: 90, enabled: kDebugMode, ); + + static final CurlLoggerDioInterceptor curlDioLogger = + CurlLoggerDioInterceptor(); } diff --git a/lib/core/params/battle_league_params.dart b/lib/core/params/battle_league_params.dart new file mode 100644 index 0000000..bd495e0 --- /dev/null +++ b/lib/core/params/battle_league_params.dart @@ -0,0 +1,5 @@ +class BattleLeagueParams { + int? id; + + BattleLeagueParams({this.id}); +} diff --git a/lib/core/params/topic_params.dart b/lib/core/params/topic_params.dart deleted file mode 100644 index bf52519..0000000 --- a/lib/core/params/topic_params.dart +++ /dev/null @@ -1,5 +0,0 @@ -class TopicParams { - int? id; - - TopicParams({this.id}); -} diff --git a/lib/core/status/base_status.dart b/lib/core/status/base_status.dart index 2055fa4..5f2b749 100644 --- a/lib/core/status/base_status.dart +++ b/lib/core/status/base_status.dart @@ -23,5 +23,6 @@ class BaseComplete extends BaseStatus { } class BaseError extends BaseStatus { - const BaseError(); + final String errorMessage; + const BaseError({required this.errorMessage}); } diff --git a/lib/core/widgets/loading/my_loading.dart b/lib/core/widgets/loading/my_loading.dart index 501e66f..57a12ad 100644 --- a/lib/core/widgets/loading/my_loading.dart +++ b/lib/core/widgets/loading/my_loading.dart @@ -6,6 +6,8 @@ class MyLoading extends StatelessWidget { @override Widget build(BuildContext context) { - return const CupertinoActivityIndicator(color: MyColors.white); + return const Center( + child: CupertinoActivityIndicator(color: MyColors.white), + ); } } diff --git a/lib/features/battle_league/first_part/data/datasource/battle_league_datasource.dart b/lib/features/battle_league/first_part/data/datasource/battle_league_datasource.dart index 3e47fc6..719a20e 100644 --- a/lib/features/battle_league/first_part/data/datasource/battle_league_datasource.dart +++ b/lib/features/battle_league/first_part/data/datasource/battle_league_datasource.dart @@ -1,12 +1,12 @@ import 'package:shia_game_flutter/core/constants/my_api.dart'; import 'package:shia_game_flutter/core/network/http_request.dart'; -import 'package:shia_game_flutter/core/params/sample_params.dart'; +import 'package:shia_game_flutter/core/params/battle_league_params.dart'; import 'package:shia_game_flutter/core/response/base_response.dart'; -import 'package:shia_game_flutter/features/battle_league/first_part/data/model/battle_league_model.dart'; -import 'package:shia_game_flutter/features/battle_league/first_part/domain/entity/battle_league_entity.dart'; +import 'package:shia_game_flutter/features/battle_league/first_part/data/model/topics_model.dart'; +import 'package:shia_game_flutter/features/battle_league/first_part/domain/entity/topics_entity.dart'; abstract class IBattleLeagueDatasource { - Future getData({required SampleParams params}); + Future> getTopics({required BattleLeagueParams params}); } class BattleLeagueDatasourceImpl implements IBattleLeagueDatasource { @@ -15,15 +15,14 @@ class BattleLeagueDatasourceImpl implements IBattleLeagueDatasource { const BattleLeagueDatasourceImpl(this.httpRequest); @override - Future getData({required SampleParams params}) async { - final response = await httpRequest.get( - path: MyApi.baseUrl, - ); + Future> getTopics({ + required BattleLeagueParams params, + }) async { + final response = await httpRequest.get(path: MyApi.topics); - return BaseResponse.getData( - response?['data'], - (json) => BattleLeagueModel.fromJson(json), + return BaseResponse.getDataList( + response?['results'], + (json) => TopicsModel.fromJson(json), ); } } - diff --git a/lib/features/battle_league/first_part/data/model/topics_model.dart b/lib/features/battle_league/first_part/data/model/topics_model.dart new file mode 100644 index 0000000..08c604c --- /dev/null +++ b/lib/features/battle_league/first_part/data/model/topics_model.dart @@ -0,0 +1,41 @@ +import 'package:shia_game_flutter/features/battle_league/first_part/domain/entity/topics_entity.dart'; + +class TopicsModel extends TopicsEntity { + const TopicsModel({ + super.id, + super.slug, + super.title, + super.description, + super.icon, + super.iconUrl, + super.order, + super.isActive, + super.difficultyLevel, + super.difficultyDisplay, + super.questionsCount, + super.createdAt, + super.updatedAt, + }); + + factory TopicsModel.fromJson(Map json) { + return TopicsModel( + id: json['id'], + slug: json['slug'], + title: json['title'], + description: json['description'], + icon: json['icon'], + iconUrl: json['icon_url'], + order: json['order'], + isActive: json['is_active'], + difficultyLevel: json['difficulty_level'], + difficultyDisplay: json['difficulty_display'], + questionsCount: json['questions_count'], + createdAt: json['created_at'] == null + ? null + : DateTime.parse(json['created_at']), + updatedAt: json['updated_at'] == null + ? null + : DateTime.parse(json['updated_at']), + ); + } +} diff --git a/lib/features/battle_league/first_part/data/repository_impl/battle_league_repository_impl.dart b/lib/features/battle_league/first_part/data/repository_impl/battle_league_repository_impl.dart index 36d681f..5eea715 100644 --- a/lib/features/battle_league/first_part/data/repository_impl/battle_league_repository_impl.dart +++ b/lib/features/battle_league/first_part/data/repository_impl/battle_league_repository_impl.dart @@ -1,9 +1,9 @@ import 'package:flutter/foundation.dart'; import 'package:shia_game_flutter/core/error_handler/my_exception.dart'; -import 'package:shia_game_flutter/core/params/sample_params.dart'; +import 'package:shia_game_flutter/core/params/battle_league_params.dart'; import 'package:shia_game_flutter/core/utils/data_state.dart'; import 'package:shia_game_flutter/features/battle_league/first_part/data/datasource/battle_league_datasource.dart'; -import 'package:shia_game_flutter/features/battle_league/first_part/domain/entity/battle_league_entity.dart'; +import 'package:shia_game_flutter/features/battle_league/first_part/domain/entity/topics_entity.dart'; import 'package:shia_game_flutter/features/battle_league/first_part/domain/repository/battle_league_repository.dart'; class BattleLeagueRepositoryImpl implements IBattleLeagueRepository { @@ -12,9 +12,13 @@ class BattleLeagueRepositoryImpl implements IBattleLeagueRepository { const BattleLeagueRepositoryImpl(this.datasource); @override - Future> getData({required SampleParams params}) async { + Future, MyException>> getTopics({ + required BattleLeagueParams params, + }) async { try { - final BattleLeagueEntity response = await datasource.getData(params: params); + final List response = await datasource.getTopics( + params: params, + ); return DataState.success(response); } on MyException catch (e) { return DataState.error(e); @@ -27,4 +31,3 @@ class BattleLeagueRepositoryImpl implements IBattleLeagueRepository { } } } - diff --git a/lib/features/battle_league/first_part/domain/entity/topics_entity.dart b/lib/features/battle_league/first_part/domain/entity/topics_entity.dart new file mode 100644 index 0000000..b65c328 --- /dev/null +++ b/lib/features/battle_league/first_part/domain/entity/topics_entity.dart @@ -0,0 +1,50 @@ +import 'package:equatable/equatable.dart'; + +class TopicsEntity extends Equatable { + final int? id; + final String? slug; + final String? title; + final String? description; + final String? icon; + final String? iconUrl; + final int? order; + final bool? isActive; + final String? difficultyLevel; + final String? difficultyDisplay; + final int? questionsCount; + final DateTime? createdAt; + final DateTime? updatedAt; + + const TopicsEntity({ + this.id, + this.slug, + this.title, + this.description, + this.icon, + this.iconUrl, + this.order, + this.isActive, + this.difficultyLevel, + this.difficultyDisplay, + this.questionsCount, + this.createdAt, + this.updatedAt, + }); + + @override + List get props => [ + id, + slug, + title, + description, + icon, + iconUrl, + order, + isActive, + difficultyLevel, + difficultyDisplay, + questionsCount, + createdAt, + updatedAt, + ]; +} diff --git a/lib/features/battle_league/first_part/domain/repository/battle_league_repository.dart b/lib/features/battle_league/first_part/domain/repository/battle_league_repository.dart index 6fde6dd..1b3a80d 100644 --- a/lib/features/battle_league/first_part/domain/repository/battle_league_repository.dart +++ b/lib/features/battle_league/first_part/domain/repository/battle_league_repository.dart @@ -1,9 +1,10 @@ import 'package:shia_game_flutter/core/error_handler/my_exception.dart'; -import 'package:shia_game_flutter/core/params/sample_params.dart'; +import 'package:shia_game_flutter/core/params/battle_league_params.dart'; import 'package:shia_game_flutter/core/utils/data_state.dart'; -import 'package:shia_game_flutter/features/battle_league/first_part/domain/entity/battle_league_entity.dart'; +import 'package:shia_game_flutter/features/battle_league/first_part/domain/entity/topics_entity.dart'; abstract class IBattleLeagueRepository { - Future> getData({required SampleParams params}); + Future, MyException>> getTopics({ + required BattleLeagueParams params, + }); } - diff --git a/lib/features/battle_league/first_part/domain/usecases/get_battle_league_usecase.dart b/lib/features/battle_league/first_part/domain/usecases/get_topics_usecase.dart similarity index 53% rename from lib/features/battle_league/first_part/domain/usecases/get_battle_league_usecase.dart rename to lib/features/battle_league/first_part/domain/usecases/get_topics_usecase.dart index 0c201a7..bb1c4d4 100644 --- a/lib/features/battle_league/first_part/domain/usecases/get_battle_league_usecase.dart +++ b/lib/features/battle_league/first_part/domain/usecases/get_topics_usecase.dart @@ -1,18 +1,18 @@ import 'package:shia_game_flutter/core/error_handler/my_exception.dart'; -import 'package:shia_game_flutter/core/params/sample_params.dart'; +import 'package:shia_game_flutter/core/params/battle_league_params.dart'; import 'package:shia_game_flutter/core/usecase/usecase.dart'; import 'package:shia_game_flutter/core/utils/data_state.dart'; -import 'package:shia_game_flutter/features/battle_league/first_part/domain/entity/battle_league_entity.dart'; +import 'package:shia_game_flutter/features/battle_league/first_part/domain/entity/topics_entity.dart'; import 'package:shia_game_flutter/features/battle_league/first_part/domain/repository/battle_league_repository.dart'; -class GetBattleLeagueUseCase implements UseCase { +class GetTopicsUseCase + implements UseCase, BattleLeagueParams> { final IBattleLeagueRepository repository; - const GetBattleLeagueUseCase(this.repository); + const GetTopicsUseCase(this.repository); @override - Future> call(SampleParams params) { - return repository.getData(params: params); + Future, MyException>> call(BattleLeagueParams params,) { + return repository.getTopics(params: params); } } - diff --git a/lib/features/battle_league/first_part/presentation/controller/battle_league_controller.dart b/lib/features/battle_league/first_part/presentation/controller/battle_league_controller.dart index 20a645b..b949ff1 100644 --- a/lib/features/battle_league/first_part/presentation/controller/battle_league_controller.dart +++ b/lib/features/battle_league/first_part/presentation/controller/battle_league_controller.dart @@ -1,20 +1,19 @@ import 'package:flutter/material.dart'; -import 'package:shia_game_flutter/core/params/sample_params.dart'; +import 'package:get/get.dart'; +import 'package:shia_game_flutter/core/params/battle_league_params.dart'; import 'package:shia_game_flutter/core/routers/my_routes.dart'; import 'package:shia_game_flutter/core/status/base_status.dart'; -import 'package:get/get.dart'; -import 'package:shia_game_flutter/features/battle_league/first_part/domain/entity/battle_league_entity.dart'; -import 'package:shia_game_flutter/features/battle_league/first_part/domain/usecases/get_battle_league_usecase.dart'; +import 'package:shia_game_flutter/features/battle_league/first_part/domain/entity/topics_entity.dart'; +import 'package:shia_game_flutter/features/battle_league/first_part/domain/usecases/get_topics_usecase.dart'; class BattleLeagueController extends GetxController with StateMixin, GetSingleTickerProviderStateMixin { /// ----- Constructor ----- - BattleLeagueController(this.getBattleLeagueUseCase); + BattleLeagueController(this._getTopicsUseCase); @override void onInit() { super.onInit(); - change('', status: RxStatus.success()); tabController = TabController(length: 2, vsync: this); } @@ -25,11 +24,11 @@ class BattleLeagueController extends GetxController } /// ----- UseCases ----- - final GetBattleLeagueUseCase getBattleLeagueUseCase; + final GetTopicsUseCase _getTopicsUseCase; /// ----- Variables ----- - final Rx battleLeagueParams = Rx(SampleParams()); - final Rx battleLeagueEntity = Rx(const BattleLeagueEntity()); + final BattleLeagueParams battleLeagueParams = BattleLeagueParams(); + final RxList topicList = RxList.empty(); /// ------ Controllers ------ final TextEditingController textEditingController = TextEditingController(); @@ -37,33 +36,35 @@ class BattleLeagueController extends GetxController /// ------ Statuses ------ final Rx getBattleLeagueStatus = Rx(const BaseInit()); + final Rx getTopicsStatus = Rx(const BaseInit()); /// ------ Functions ------ - void goToTopicPage(){ + void goToTopicPage() { + getTopics(); Get.toNamed(Routes.battleLeagueTopicPage); } - void goToFindingPage(){ + void goToFindingPage() { Get.toNamed(Routes.battleLeagueFindingPage); } - void goToFoundedPage(){ + + void goToFoundedPage() { Get.toNamed(Routes.battleLeagueFoundedPage); } /// ------ Api Calls ------ - Future getBattleLeague() async { - change('', status: RxStatus.loading()); - await getBattleLeagueUseCase(battleLeagueParams.value).then( + Future getTopics() async { + getTopicsStatus.value = const BaseLoading(); + await _getTopicsUseCase(battleLeagueParams).then( (value) => value.fold( (data) { - battleLeagueEntity.value = data; - change('', status: RxStatus.success()); + topicList.value = data; + getTopicsStatus.value = const BaseComplete(); }, (error) { - change('', status: RxStatus.error(error.errorMessage)); + getTopicsStatus.value = BaseError(errorMessage: error.errorMessage); }, ), ); } } - diff --git a/lib/features/battle_league/first_part/presentation/ui/battle_league_topic_page.dart b/lib/features/battle_league/first_part/presentation/ui/battle_league_topic_page.dart index acbb722..f4d208b 100644 --- a/lib/features/battle_league/first_part/presentation/ui/battle_league_topic_page.dart +++ b/lib/features/battle_league/first_part/presentation/ui/battle_league_topic_page.dart @@ -3,11 +3,13 @@ import 'package:get/get.dart'; import 'package:shia_game_flutter/common_ui/resources/my_assets.dart'; import 'package:shia_game_flutter/common_ui/resources/my_colors.dart'; import 'package:shia_game_flutter/common_ui/resources/my_text_style.dart'; +import 'package:shia_game_flutter/core/status/base_status.dart'; import 'package:shia_game_flutter/core/utils/gap.dart'; import 'package:shia_game_flutter/core/utils/my_localization.dart'; import 'package:shia_game_flutter/core/utils/screen_size.dart'; import 'package:shia_game_flutter/core/widgets/app_bar/enums/app_bar_type.dart'; import 'package:shia_game_flutter/core/widgets/app_bar/my_app_bar.dart'; +import 'package:shia_game_flutter/core/widgets/loading/my_loading.dart'; import 'package:shia_game_flutter/features/battle_league/first_part/presentation/controller/battle_league_controller.dart'; import 'package:shia_game_flutter/features/battle_league/first_part/presentation/ui/widgets/button/battle_golden_button.dart'; import 'package:shia_game_flutter/features/battle_league/first_part/presentation/ui/widgets/button/battle_grey_button.dart'; @@ -26,18 +28,32 @@ class BattleLeagueTopicPage extends GetView { title: context.translate.choose_3_topics, ), body: SafeArea( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - 20.h.gapHeight, - _title(context), - 27.h.gapHeight, - _topicList(context), - 20.h.gapHeight, - _randomButton(context), - const Spacer(), - _startButton(context), - ], + child: Obx( + () { + if(controller.getTopicsStatus.value is BaseComplete){ + return Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + 20.h.gapHeight, + _title(context), + 27.h.gapHeight, + _topicList(context), + 20.h.gapHeight, + _randomButton(context), + const Spacer(), + _startButton(context), + ], + ); + } + if(controller.getTopicsStatus.value is BaseLoading){ + return const MyLoading(); + } + if(controller.getTopicsStatus.value is BaseError){ + return Text( + (controller.getTopicsStatus.value as BaseError).errorMessage); + } + return const SizedBox.shrink(); + } ), ), ); @@ -73,17 +89,18 @@ class BattleLeagueTopicPage extends GetView { SizedBox _topicList(BuildContext context) { return SizedBox( width: context.widthScreen, - child: Wrap( - spacing: 20, - runSpacing: 14, - direction: Axis.horizontal, - alignment: WrapAlignment.center, - children: List.generate( - 10, - (index) => TopicWidget( - label: context.translate.art, - image: MyAssets.iconArt, - onTap: () {}, + child: Obx( + () => Wrap( + spacing: 20, + runSpacing: 14, + direction: Axis.horizontal, + alignment: WrapAlignment.center, + children: List.generate( + controller.topicList.length, + (index) => TopicWidget( + topic: controller.topicList[index], + onTap: () {}, + ), ), ), ), diff --git a/lib/features/battle_league/first_part/presentation/ui/widgets/topic_page/topic_widget.dart b/lib/features/battle_league/first_part/presentation/ui/widgets/topic_page/topic_widget.dart index 5147c91..80e50d5 100644 --- a/lib/features/battle_league/first_part/presentation/ui/widgets/topic_page/topic_widget.dart +++ b/lib/features/battle_league/first_part/presentation/ui/widgets/topic_page/topic_widget.dart @@ -3,18 +3,17 @@ import 'package:shia_game_flutter/common_ui/resources/my_text_style.dart'; import 'package:shia_game_flutter/core/utils/screen_size.dart'; import 'package:shia_game_flutter/core/widgets/container/my_container.dart'; import 'package:shia_game_flutter/core/widgets/image/my_image.dart'; +import 'package:shia_game_flutter/features/battle_league/first_part/domain/entity/topics_entity.dart'; class TopicWidget extends StatelessWidget { const TopicWidget({ super.key, this.onTap, - this.label, - this.image, + required this.topic, }); final VoidCallback? onTap; - final String? label; - final String? image; + final TopicsEntity topic; @override Widget build(BuildContext context) { @@ -51,10 +50,10 @@ class TopicWidget extends StatelessWidget { spacing: 4, children: [ MyImage( - asset: image ?? '', + asset: topic.iconUrl ?? '', ), Text( - label ?? '', + topic.title ?? '', style: Lexend.medium.copyWith(fontSize: 12), ), ], diff --git a/lib/features/home/presentation/controller/home_controller.dart b/lib/features/home/presentation/controller/home_controller.dart index b7ed054..f68a883 100644 --- a/lib/features/home/presentation/controller/home_controller.dart +++ b/lib/features/home/presentation/controller/home_controller.dart @@ -66,7 +66,8 @@ class HomeController extends GetxController { loginGuestStatus.value = const BaseComplete(); }, (error) { - loginGuestStatus.value = const BaseError(); + loginGuestStatus.value = + BaseError(errorMessage: error.errorMessage); }, ), ); diff --git a/lib/init_bindings.dart b/lib/init_bindings.dart index 113ff8b..e39fdd8 100644 --- a/lib/init_bindings.dart +++ b/lib/init_bindings.dart @@ -8,7 +8,7 @@ import 'package:shia_game_flutter/features/awards/domain/usecases/get_awards_use import 'package:shia_game_flutter/features/battle_league/first_part/data/datasource/battle_league_datasource.dart'; import 'package:shia_game_flutter/features/battle_league/first_part/data/repository_impl/battle_league_repository_impl.dart'; import 'package:shia_game_flutter/features/battle_league/first_part/domain/repository/battle_league_repository.dart'; -import 'package:shia_game_flutter/features/battle_league/first_part/domain/usecases/get_battle_league_usecase.dart'; +import 'package:shia_game_flutter/features/battle_league/first_part/domain/usecases/get_topics_usecase.dart'; import 'package:shia_game_flutter/features/battle_league/question_part/bl_question/data/datasource/bl_question_datasource.dart'; import 'package:shia_game_flutter/features/battle_league/question_part/bl_question/data/repository_impl/bl_question_repository_impl.dart'; import 'package:shia_game_flutter/features/battle_league/question_part/bl_question/domain/repository/bl_question_repository.dart'; @@ -80,7 +80,7 @@ void initBindings() { /// ----- BattleLeague Feature ----- Get.lazyPut(() => BattleLeagueDatasourceImpl(Get.find()), fenix: true); Get.lazyPut(() => BattleLeagueRepositoryImpl(Get.find()), fenix: true); - Get.lazyPut(() => GetBattleLeagueUseCase(Get.find()), fenix: true); + Get.lazyPut(() => GetTopicsUseCase(Get.find()), fenix: true); /// ----- BattleLeagueQuestion Feature ----- Get.lazyPut(() => BLQuestionDatasourceImpl(Get.find()), fenix: true); diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index b6c63ff..11ed740 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -1,5 +1,6 @@ { "@@locale": "en", + "check_internet_connection": "Please Check your internet connection.", "loading": "Loading...", "home": "Home", "shop": "Shop", diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 7699c75..3b9e953 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -94,6 +94,12 @@ abstract class AppLocalizations { /// A list of this localizations delegate's supported locales. static const List supportedLocales = [Locale('en')]; + /// No description provided for @check_internet_connection. + /// + /// In en, this message translates to: + /// **'Please Check your internet connection.'** + String get check_internet_connection; + /// No description provided for @loading. /// /// In en, this message translates to: diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 1bf3bc6..3e60839 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -8,6 +8,10 @@ import 'app_localizations.dart'; class AppLocalizationsEn extends AppLocalizations { AppLocalizationsEn([String locale = 'en']) : super(locale); + @override + String get check_internet_connection => + 'Please Check your internet connection.'; + @override String get loading => 'Loading...'; diff --git a/pubspec.lock b/pubspec.lock index 80755c0..627b2cd 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -73,6 +73,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.7" + curl_logger_dio_interceptor: + dependency: "direct main" + description: + name: curl_logger_dio_interceptor + sha256: "0702d32b8ff1b451ba1d9882d57b885061872ebc38384c18243b18b2a0db2a5b" + url: "https://pub.dev" + source: hosted + version: "1.0.1" dio: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index f9a1300..2ebc492 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -19,6 +19,7 @@ dependencies: get: ^4.7.2 intl: ^0.20.2 pretty_dio_logger: ^1.4.0 + curl_logger_dio_interceptor: ^1.0.1 shared_preferences: ^2.5.3 vector_graphics: ^1.1.19