Skip to content

Commit

Permalink
Merge branch 'release/2.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
deandreamatias committed Jan 6, 2024
2 parents e63d976 + bb0878d commit 42294d7
Show file tree
Hide file tree
Showing 25 changed files with 99 additions and 128 deletions.
2 changes: 1 addition & 1 deletion .fvm/fvm_config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"flutterSdkVersion": "3.7.7",
"flutterSdkVersion": "3.16.5",
"flavors": {}
}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [2.1.0](https://github.com/deandreamatias/tv-randshow/compare/v2.0.0...v2.1.0) (2024-01-06)

* Update dependencies
* Build with Flutter 3.16.5

## [2.0.0](https://github.com/deandreamatias/tv-randshow/compare/v1.10.2...v2.0.0) (2023-03-18)

* Improve architecture (clean)
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
[![Tests](https://api.codemagic.io/apps/5ea04fef2173e4001d6d6c75/6210143b0b28f63215deee7d/status_badge.svg)](https://codemagic.io/apps/5ea04fef2173e4001d6d6c75/6210143b0b28f63215deee7d/latest_build)
[![Releases](https://img.shields.io/github/v/release/deandreamatias/tv-randshow)](https://github.com/deandreamatias/tv-randshow/releases)
[![Google Play](https://img.shields.io/badge/google--play-Google--Play-green?label=App)](https://play.google.com/store/apps/details?id=deandrea.matias.tv_randshow)
[![IzzyOnDroid](https://img.shields.io/endpoint?url=https://apt.izzysoft.de/fdroid/api/v1/shield/deandrea.matias.tv_randshow/)](https://apt.izzysoft.de/fdroid/index/apk/deandrea.matias.tv_randshow/)
[![Website](https://img.shields.io/website?up_message=online&url=https%3A%2F%2Ftvrandshow.com%2F)](https://tvrandshow.com/)
[![Paypal donate](https://img.shields.io/badge/paypal-donate-blue)](https://www.paypal.com/donate/?hosted_button_id=QWL5BXSRLCUJJ)
[![Trello](https://img.shields.io/badge/trello-roadmap-blue)](https://trello.com/b/ib0jdUzK)

### About the project

Expand Down Expand Up @@ -72,7 +74,7 @@ Run `just run dev DEVICE_ID TMDB_API_KEY STREAMING_API_KEY` command or copy the

### Build

- Android APK: Run `just run prod TMDB_API_KEY STREAMING_API_KEY` command or copy the command from `./justfile
- Android APK: Run `just build-apk prod TMDB_API_KEY STREAMING_API_KEY` command or copy the command from `./justfile

> Replace screaming snake case with your values
## Author
Expand Down
49 changes: 0 additions & 49 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,59 +31,10 @@ linter:
- use_string_buffers
- use_super_parameters
analyzer:
plugins:
- dart_code_metrics
exclude:
- fvm/
- lib/**/*.config.dart
- lib/**/*.g.dart
- lib/config/env.dart
- lib/generated_plugin_registrant.dart
- test/**/**.mock.dart

dart_code_metrics:
extends:
- package:dart_code_metrics_presets/all.yaml
rules:
- arguments-ordering: false
- avoid-late-keyword: false
- avoid-nested-conditional-expressions:
acceptable-level: 2
- no-equal-arguments:
ignored-parameters:
- height
- width
- spacing
- padding
- mainAxisSpacing
- no-magic-number:
allow-only-once: true
- prefer-correct-identifier-length:
exceptions: [ 'id' ]
max-identifier-length: 30
min-identifier-length: 3
- prefer-extracting-callbacks:
ignored-named-arguments:
- onPressed
- onTap
allowed-line-count: 3
- prefer-match-file-name:
exclude:
- lib/**/**_state.dart
- prefer-moving-to-variable:
allowed-duplicated-chains: 3
- prefer-static-class: false
- prefer-single-widget-per-file:
ignore-private-widgets: true

metrics-exclude:
- lib/**/*.config.dart
- lib/**/*.freezed.dart
- lib/**/*.g.dart
- lib/**/*.gform.dart
- lib/generated_plugin_registrant.dart
- test/**
metrics:
cyclomatic-complexity: 20
maximum-nesting-level: 5
lines-of-code: 100
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 33
compileSdkVersion 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -54,7 +54,7 @@ android {
defaultConfig {
applicationId "deandrea.matias.tv_randshow"
minSdkVersion 19
targetSdkVersion 33
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.7.10'
ext.kotlin_version = '1.9.0'
repositories {
google()
mavenCentral()
Expand All @@ -24,6 +24,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
5 changes: 5 additions & 0 deletions assets/markdown/whats_news_en.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.1.0 - 2024/01/06

* Update dependencies
* Build with Flutter 3.16

## 2.0.0 - 2023/03/18

### Features
Expand Down
5 changes: 5 additions & 0 deletions assets/markdown/whats_news_es.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.1.0 - 2024/01/06

* Actualizadas dependencias
* Construido con Flutter 3.16

## 2.0.0 - 2023/03/18

### Features
Expand Down
5 changes: 5 additions & 0 deletions assets/markdown/whats_news_pt.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.1.0 - 2024/01/06

* Atualizadas dependencias
* Construído com Flutter 3.16

## 2.0.0 - 2023/03/18

### Features
Expand Down
4 changes: 2 additions & 2 deletions integration_test/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ Future<void> main() async {

expect(find.text('Favorites'), findsOneWidget);
expect(find.text('Search'), findsOneWidget);
expect(find.text('Info'), findsOneWidget);
expect(find.text('Settings'), findsOneWidget);

// Navigate to info tab.
// Navigate to settings tab.
await tester.tap(find.byKey(const Key('app.info.tab')));
await tester.pumpAndSettle();

Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ run flavor apiKey streamingApiKey device:

# Build Android apk with {{flavor}}, {{apikey}} and {{streamingApiKey}}
build-apk flavor apiKey streamingApiKey:
fvm flutter build apk--flavor {{flavor}} -t lib/main_{{flavor}}.dart --obfuscate --split-debug-info=./android/split-debug/ --dart-define API_KEY={{apiKey}} --dart-define STREAMING_API_KEY={{streamingApiKey}}
fvm flutter build apk --flavor {{flavor}} -t lib/main_{{flavor}}.dart --obfuscate --split-debug-info=./android/split-debug/ --dart-define API_KEY={{apiKey}} --dart-define STREAMING_API_KEY={{streamingApiKey}}

# Build Android appbundle with {{flavor}}, {{apikey}} and {{streamingApiKey}}
build-appbundle flavor apiKey streamingApiKey:
Expand Down
8 changes: 4 additions & 4 deletions lib/common/services/dio_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ class DioService {

/// Optional [catchErrors] to get DioError. This is usuful when need
/// transform a DioError to custom error.
final void Function(DioError)? catchErrors;
final void Function(DioException)? catchErrors;
late final Dio _dio = Dio(
BaseOptions(
baseUrl: baseUrl,
connectTimeout: 5000,
receiveTimeout: 3000,
connectTimeout: const Duration(seconds: 5),
receiveTimeout: const Duration(seconds: 3),
headers: headers,
queryParameters: queryParams,
),
Expand Down Expand Up @@ -45,7 +45,7 @@ class DioService {
}

return {};
} on DioError catch (e) {
} on DioException catch (e) {
log('${e.message.toString()} - ${e.response.toString()}');
if (catchErrors == null) {
rethrow;
Expand Down
20 changes: 10 additions & 10 deletions lib/common/services/local_preferences_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ class LocalPreferencesService implements ILocalPreferencesService {
Future<T?> read<T>({required String key}) async {
if (!_sharedPreferences.containsKey(key)) return null;
switch (T) {
case String:
case const (String):
return (_sharedPreferences.getString(key) ?? '') as T;
case int:
case const (int):
return _sharedPreferences.getInt(key) as T?;
case bool:
case const (bool):
return _sharedPreferences.getBool(key) as T?;
case double:
case const (double):
return _sharedPreferences.getDouble(key) as T?;
case List:
case List _:
return _sharedPreferences.getStringList(key) as T?;
default:
return _sharedPreferences.get(key) as T?;
Expand All @@ -31,19 +31,19 @@ class LocalPreferencesService implements ILocalPreferencesService {
@override
Future<bool> write<T>({required String key, required T value}) async {
switch (T) {
case String:
case const (String):
value as String;
return _sharedPreferences.setString(key, value);
case int:
case const (int):
value as int;
return _sharedPreferences.setInt(key, value);
case bool:
case const (bool):
value as bool;
return _sharedPreferences.setBool(key, value);
case double:
case const (double):
value as double;
return _sharedPreferences.setDouble(key, value);
case List:
case List _:
value as List<String>;
return _sharedPreferences.setStringList(key, value);
default:
Expand Down
2 changes: 1 addition & 1 deletion lib/core/app/data/transformers/tmdb_error_transformer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:dio/dio.dart';
import 'package:tv_randshow/core/app/domain/exceptions/api_error.dart';

class TmdbErrorTransformer {
static void transformDioErros(DioError error) {
static void transformDioErros(DioException error) {
final String apiErrorMessage = _getMessage(error.response);

switch (error.response?.statusCode) {
Expand Down
13 changes: 7 additions & 6 deletions lib/core/io/data/services/save_file_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import 'package:tv_randshow/core/io/domain/interfaces/i_manage_files_service.dar
class SaveFileService implements IManageFilesService {
@override
Future<String> saveFile(String fileName, String json) async {
return FileSaver.instance.saveAs(
fileName,
Uint8List.fromList(json.codeUnits),
'json',
MimeType.JSON,
);
return (await FileSaver.instance.saveAs(
name: fileName,
bytes: Uint8List.fromList(json.codeUnits),
ext: 'json',
mimeType: MimeType.json,
)) ??
'';
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'dart:ui' as ui;
import 'dart:ui';

import 'package:injectable/injectable.dart';
import 'package:tv_randshow/core/migration/domain/models/migration_status.dart';
Expand Down Expand Up @@ -32,7 +32,7 @@ class AddStreamingsMigrationUseCase {
List<StreamingDetail> streamings = [];
final search = StreamingSearch(
tmdbId: tvshow.id.toString(),
country: ui.window.locale.countryCode ?? '',
country: PlatformDispatcher.instance.locale.countryCode ?? '',
);
final tvshowStremings =
await _streamingsRepository.searchTvShow(search);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:dio/dio.dart';
import 'package:tv_randshow/core/app/domain/exceptions/api_error.dart';

class StreamingErrorTransformer {
static void transformDioErros(DioError error) {
static void transformDioErros(DioException error) {
final String apiErrorMessage = _getMessage(error.response);

switch (error.response?.statusCode) {
Expand Down
2 changes: 1 addition & 1 deletion lib/core/tvshow/domain/models/episode.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ part 'episode.g.dart';
@DateTimeTransformer()
class Episode {
DateTime? airDate;
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
List<Crew> crew;
int episodeNumber;
List<GuestStar> guestStars;
Expand Down
2 changes: 1 addition & 1 deletion lib/core/tvshow/domain/models/tvshow_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class TvshowDetails extends HiveObject {
@HiveField(8)
String posterPath;

@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
List<StreamingDetail> streamings;
TvshowDetails({
this.rowId,
Expand Down
4 changes: 2 additions & 2 deletions lib/core/tvshow/domain/use_cases/add_fav_tvshow_use_case.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'dart:ui' as ui;
import 'package:flutter/foundation.dart';
import 'package:injectable/injectable.dart';
import 'package:tv_randshow/core/streaming/domain/models/streaming_search.dart';
import 'package:tv_randshow/core/streaming/domain/use_cases/get_tvshow_streamings_use_case.dart';
Expand Down Expand Up @@ -28,7 +28,7 @@ class AddFavTvshowUseCase {
final streamings = await _getTvshowStreamingsUseCase(
StreamingSearch(
tmdbId: idTv.toString(),
country: ui.window.locale.countryCode ?? '',
country: PlatformDispatcher.instance.locale.countryCode ?? '',
),
);
tvshowDetails = tvshowDetails.copyWith(streamings: streamings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ class TvshowEpisodeInfoResult extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: result.streamings
.map(
(streaming) => StreamingButton(
streamingDetail: streaming,
(streaming) => Row(
children: [
StreamingButton(streamingDetail: streaming),
const SizedBox(width: Styles.small),
],
),
)
.toList(),
Expand Down
4 changes: 0 additions & 4 deletions lib/ui/shared/custom_icons.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// ignore_for_file: member-ordering
/// Flutter icons Unicons
/// Copyright (C) 2020 by original authors @ fluttericon.com, fontello.com
/// This font was generated by FlutterIcon.com, which is derived from Fontello.
import 'package:flutter/widgets.dart';

class CustomIcons {
Expand Down
6 changes: 3 additions & 3 deletions lib/ui/widgets/error_message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ class ErrorMessage extends StatelessWidget {
return (error as Error).getMessage();
}
switch (error.runtimeType) {
case ApiError:
case ApiError _:
return (error as ApiError).code.getMessage();
case DatabaseError:
case DatabaseError _:
return (error as DatabaseError).code.getMessage();
case AppError:
case AppError _:
return (error as AppError).code.getMessage();
default:
return '';
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tv-randshow",
"version": "2.0.1",
"version": "2.1.0",
"description": "app to pick a random tv show episode",
"main": "build/web/main.dart.js",
"directories": {
Expand Down

0 comments on commit 42294d7

Please sign in to comment.