Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
wheremyfiji committed Jul 21, 2024
1 parent 25a2863 commit 2743daa
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 18 deletions.
12 changes: 12 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,22 @@
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# https://dart.dev/tools/analysis#enabling-linter-rules

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

analyzer:
exclude:
- '.dart_tool/**'
- 'build/**'
- '**.g.dart'
- '**/*.g.dart'
- '**/*.config.dart'
- '**/*.gen.dart'
- '**/*.freezed.dart'

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,17 +288,19 @@ class _AnimeDetailsNewPageState extends ConsumerState<AnimeDetailsNewPage> {
],
),
),
const SliverToBoxAdapter(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 16.0),
child: Divider(),
if (title.topic != null) ...[
const SliverToBoxAdapter(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 16.0),
child: Divider(),
),
),
),
TitleComments(
id: title.topic.id,
count: title.topic.commentsCount,
name: title.russian ?? title.name,
),
TitleComments(
id: title.topic!.id,
count: title.topic!.commentsCount,
name: title.russian ?? title.name,
),
],
];
},
loading: () => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class GraphqlAnime {
final String name;
final String url;
final Poster poster;
final GraphqlTopic topic;
final GraphqlTopic? topic;
final String? russian;
final String? english;
final String? japanese;
Expand Down Expand Up @@ -331,7 +331,8 @@ class GraphqlAnime {
name: json["name"],
url: json["url"],
poster: Poster.fromJson(json["poster"]),
topic: GraphqlTopic.fromJson(json["topic"]),
topic:
json["topic"] == null ? null : GraphqlTopic.fromJson(json["topic"]),
russian: json["russian"],
english: json["english"],
japanese: json["japanese"],
Expand Down
11 changes: 7 additions & 4 deletions lib/src/services/anime_database/anime_database_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ import 'dart:developer';
import 'dart:convert' as c;
import 'dart:io' as io;

import 'package:flutter/foundation.dart';

import 'package:shared_preferences/shared_preferences.dart';
import 'package:path_provider/path_provider.dart' as path_prov;
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:collection/collection.dart';
import 'package:intl/intl.dart';
import 'package:isar/isar.dart';
import 'package:path_provider/path_provider.dart' as path_prov;
import 'package:path/path.dart' as p;
import 'package:shared_preferences/shared_preferences.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

import '../../constants/config.dart';
import '../../data/repositories/anime_database_repo.dart';
Expand All @@ -27,6 +29,7 @@ class LocalAnimeDatabaseImpl implements LocalAnimeDatabaseRepo {
[AnimeDatabaseSchema],
name: "animeDatabase",
directory: appDocDir.path,
inspector: kDebugMode,
//compactOnLaunch: const CompactCondition(minRatio: 2.0),
),
);
Expand Down
10 changes: 8 additions & 2 deletions lib/src/services/http/dio_service.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:developer';

import 'package:dio_http2_adapter/dio_http2_adapter.dart';
import 'package:native_dio_adapter/native_dio_adapter.dart';
import 'package:dio_smart_retry/dio_smart_retry.dart';
import 'package:network_logger/network_logger.dart';
Expand All @@ -22,15 +23,20 @@ class DioHttpService implements HttpService {
dio.httpClientAdapter = NativeAdapter(
createCronetEngine: () {
return CronetEngine.build(
// enableQuic: true,
enableHttp2: true,
enableBrotli: true,
cacheMode: CacheMode.memory,
cacheMaxSize: 4 * 1024 * 1024,
cacheMaxSize: 5 * 1024 * 1024,
userAgent: AppUtils.instance.userAgent,
);
},
);
} else {
dio.httpClientAdapter = Http2Adapter(
ConnectionManager(
idleTimeout: const Duration(seconds: 10),
),
);
}

dio.interceptors.add(RetryInterceptor(
Expand Down

0 comments on commit 2743daa

Please sign in to comment.