From 22aacee40d0f4ccf2481425bf4a4de977862d874 Mon Sep 17 00:00:00 2001 From: Sergey Dmitriev <51058739+0niel@users.noreply.github.com> Date: Sat, 28 May 2022 00:35:24 +0300 Subject: [PATCH] refactor: Upgrade Flutter SDK and Kotlin version (#234) --- android/app/build.gradle | 5 +++-- .../mireaapp/widget_channel/HomeWidgetPlugin.kt | 2 +- android/build.gradle | 4 ++-- android/gradle/wrapper/gradle-wrapper.properties | 2 +- lib/common/utils/calendar_utils.dart | 1 - lib/data/repositories/forum_repository_impl.dart | 2 +- .../repositories/github_repository_impl.dart | 4 ++-- lib/data/repositories/news_repository_impl.dart | 8 ++++---- .../repositories/schedule_repository_impl.dart | 7 +++---- .../repositories/app_settings_repository.dart | 2 -- lib/main.dart | 1 - lib/presentation/bloc/news_bloc/news_bloc.dart | 1 - lib/presentation/colors.dart | 1 - lib/presentation/core/routes/routes.dart | 2 ++ lib/presentation/pages/news/news_page.dart | 1 - .../pages/news/widgets/story_item.dart | 1 - pubspec.yaml | 16 ++++++++-------- test/mirea_test.dart | 2 -- 18 files changed, 27 insertions(+), 35 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 2b6f3127..5405dcf1 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -22,13 +22,14 @@ if (flutterVersionName == null) { } apply plugin: 'com.android.application' -apply plugin: 'com.google.gms.google-services' apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply plugin: 'kotlinx-serialization' +apply plugin: 'com.google.gms.google-services' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { compileSdkVersion flutter.compileSdkVersion + ndkVersion flutter.ndkVersion compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 diff --git a/android/app/src/main/kotlin/ninja/mirea/mireaapp/widget_channel/HomeWidgetPlugin.kt b/android/app/src/main/kotlin/ninja/mirea/mireaapp/widget_channel/HomeWidgetPlugin.kt index a0c724b5..ad86ecb1 100644 --- a/android/app/src/main/kotlin/ninja/mirea/mireaapp/widget_channel/HomeWidgetPlugin.kt +++ b/android/app/src/main/kotlin/ninja/mirea/mireaapp/widget_channel/HomeWidgetPlugin.kt @@ -216,7 +216,7 @@ class HomeWidgetPlugin : FlutterPlugin, MethodCallHandler, ActivityAware, } } - override fun onNewIntent(intent: Intent?): Boolean { + override fun onNewIntent(intent: Intent): Boolean { receiver?.onReceive(context, intent) return receiver != null } diff --git a/android/build.gradle b/android/build.gradle index 4136fca8..fd425c1d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.5.31' + ext.kotlin_version = '1.6.10' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.0.2' + classpath 'com.android.tools.build:gradle:7.1.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" classpath 'com.google.gms:google-services:4.3.8' diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 595fb867..302da314 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip \ No newline at end of file diff --git a/lib/common/utils/calendar_utils.dart b/lib/common/utils/calendar_utils.dart index 3a513b29..b74dfaf7 100644 --- a/lib/common/utils/calendar_utils.dart +++ b/lib/common/utils/calendar_utils.dart @@ -1,4 +1,3 @@ -import 'dart:math'; import 'package:clock/clock.dart'; import 'package:intl/intl.dart'; diff --git a/lib/data/repositories/forum_repository_impl.dart b/lib/data/repositories/forum_repository_impl.dart index ef657c89..09a80250 100644 --- a/lib/data/repositories/forum_repository_impl.dart +++ b/lib/data/repositories/forum_repository_impl.dart @@ -33,7 +33,7 @@ class ForumRepositoryImpl implements ForumRepository { final patrons = await localDataSource.getPatronsFromCache(); return Right(patrons); } on CacheException { - return Left(CacheFailure()); + return const Left(CacheFailure()); } } } diff --git a/lib/data/repositories/github_repository_impl.dart b/lib/data/repositories/github_repository_impl.dart index a29a6e7a..48c24b14 100644 --- a/lib/data/repositories/github_repository_impl.dart +++ b/lib/data/repositories/github_repository_impl.dart @@ -26,14 +26,14 @@ class GithubRepositoryImpl implements GithubRepository { localDataSource.setContributorsToCache(contributors); return Right(contributors); } on ServerException { - return Left(ServerFailure()); + return const Left(ServerFailure()); } } else { try { final contributors = await localDataSource.getContributorsFromCache(); return Right(contributors); } on CacheException { - return Left(CacheFailure()); + return const Left(CacheFailure()); } } } diff --git a/lib/data/repositories/news_repository_impl.dart b/lib/data/repositories/news_repository_impl.dart index efcbfda2..119e8f75 100644 --- a/lib/data/repositories/news_repository_impl.dart +++ b/lib/data/repositories/news_repository_impl.dart @@ -25,10 +25,10 @@ class NewsRepositoryImpl implements NewsRepository { await remoteDataSource.getNews(offset, limit, isImportant, tag); return Right(newsList); } on ServerException { - return const Left(const ServerFailure()); + return const Left(ServerFailure()); } } else { - return const Left(const ServerFailure()); + return const Left(ServerFailure()); } } @@ -39,10 +39,10 @@ class NewsRepositoryImpl implements NewsRepository { final tagsList = await remoteDataSource.getTags(); return Right(tagsList); } on ServerException { - return const Left(const ServerFailure()); + return const Left(ServerFailure()); } } else { - return const Left(const ServerFailure()); + return const Left(ServerFailure()); } } } diff --git a/lib/data/repositories/schedule_repository_impl.dart b/lib/data/repositories/schedule_repository_impl.dart index de0a485c..b53c9248 100644 --- a/lib/data/repositories/schedule_repository_impl.dart +++ b/lib/data/repositories/schedule_repository_impl.dart @@ -23,7 +23,6 @@ class ScheduleRepositoryImpl implements ScheduleRepository { @override Future>> getAllGroups() async { - connectionChecker.checkInterval = const Duration(seconds: 2); if (await connectionChecker.hasConnection) { try { final groupsList = await remoteDataSource.getGroups(); @@ -86,7 +85,7 @@ class ScheduleRepositoryImpl implements ScheduleRepository { // we can try to get the schedule from the local storage final localSchedule = await _tryGetLocalSchedule(group); if (localSchedule.isRight()) return localSchedule; - return Left(ServerFailure()); + return const Left(ServerFailure()); } } else { return await _tryGetLocalSchedule(group); @@ -108,7 +107,7 @@ class ScheduleRepositoryImpl implements ScheduleRepository { try { return Right(await localDataSource.getActiveGroupFromCache()); } on CacheException { - return Left(CacheFailure()); + return const Left(CacheFailure()); } } @@ -123,7 +122,7 @@ class ScheduleRepositoryImpl implements ScheduleRepository { final localSchedule = await localDataSource.getScheduleFromCache(); return Right(localSchedule); } on CacheException { - return Left(CacheFailure()); + return const Left(CacheFailure()); } } diff --git a/lib/domain/repositories/app_settings_repository.dart b/lib/domain/repositories/app_settings_repository.dart index 7922480c..046579d0 100644 --- a/lib/domain/repositories/app_settings_repository.dart +++ b/lib/domain/repositories/app_settings_repository.dart @@ -1,5 +1,3 @@ -import 'package:dartz/dartz.dart'; -import 'package:rtu_mirea_app/common/errors/failures.dart'; import 'package:rtu_mirea_app/domain/entities/app_settings.dart'; abstract class AppSettingsRepository { diff --git a/lib/main.dart b/lib/main.dart index 1b644f0a..3e37799c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -25,7 +25,6 @@ import 'package:rtu_mirea_app/presentation/core/routes/routes.gr.dart'; import 'package:rtu_mirea_app/presentation/theme.dart'; import 'package:intl/intl_standalone.dart'; import 'package:rtu_mirea_app/service_locator.dart' as dependency_injection; -import 'package:shared_preferences/shared_preferences.dart'; import 'package:url_strategy/url_strategy.dart'; import 'service_locator.dart'; import 'package:firebase_core/firebase_core.dart'; diff --git a/lib/presentation/bloc/news_bloc/news_bloc.dart b/lib/presentation/bloc/news_bloc/news_bloc.dart index 55b9dd05..e418daf8 100644 --- a/lib/presentation/bloc/news_bloc/news_bloc.dart +++ b/lib/presentation/bloc/news_bloc/news_bloc.dart @@ -1,4 +1,3 @@ -import 'dart:async'; import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; diff --git a/lib/presentation/colors.dart b/lib/presentation/colors.dart index dc039802..2f4754be 100644 --- a/lib/presentation/colors.dart +++ b/lib/presentation/colors.dart @@ -1,4 +1,3 @@ -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter/painting.dart'; diff --git a/lib/presentation/core/routes/routes.dart b/lib/presentation/core/routes/routes.dart index a91d76f7..1e93a679 100644 --- a/lib/presentation/core/routes/routes.dart +++ b/lib/presentation/core/routes/routes.dart @@ -106,6 +106,8 @@ Route transparentRoute( BuildContext context, Widget child, CustomPage page) { return TransparentRoute( settings: page, + transitionDuration: const Duration(milliseconds: 250), + reverseTransitionDuration: const Duration(milliseconds: 250), builder: (context) => child, backgroundColor: Colors.black.withOpacity(0.45), ); diff --git a/lib/presentation/pages/news/news_page.dart b/lib/presentation/pages/news/news_page.dart index 30aef87d..6ea30343 100644 --- a/lib/presentation/pages/news/news_page.dart +++ b/lib/presentation/pages/news/news_page.dart @@ -1,4 +1,3 @@ -import 'dart:async'; import 'package:auto_route/auto_route.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; diff --git a/lib/presentation/pages/news/widgets/story_item.dart b/lib/presentation/pages/news/widgets/story_item.dart index 0b8e5d8c..8e78438b 100644 --- a/lib/presentation/pages/news/widgets/story_item.dart +++ b/lib/presentation/pages/news/widgets/story_item.dart @@ -1,5 +1,4 @@ import 'package:auto_route/auto_route.dart'; -import 'package:firebase_analytics/firebase_analytics.dart'; import 'package:flutter/material.dart'; import 'package:rtu_mirea_app/domain/entities/story.dart'; import 'package:rtu_mirea_app/presentation/colors.dart'; diff --git a/pubspec.yaml b/pubspec.yaml index 286f9956..9de3f7aa 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,6 @@ name: rtu_mirea_app description: Mobile application for students of RTU MIREA +publish_to: 'none' # The following defines the version and build number for your application. # A version number is three numbers separated by dots, like 1.2.43 @@ -80,7 +81,7 @@ dependencies: # dates or a range of dates. It has four built-in views that allow quick # navigation to the desired date. # See https://pub.dev/packages/syncfusion_flutter_datepicker - syncfusion_flutter_datepicker: ^19.3.54 + syncfusion_flutter_datepicker: ^20.1.57 # A Flutter widget rendering static HTML and CSS as Flutter widgets. # See https://pub.dev/packages/flutter_html @@ -128,12 +129,11 @@ dependencies: # ListView that implicitly animates between the changes of two lists # See https://pub.dev/packages/implicitly_animated_reorderable_list implicitly_animated_reorderable_list: ^0.4.2 - - syncfusion_flutter_core: ^19.4.38 - syncfusion_flutter_datagrid: - syncfusion_flutter_sliders: ^19.4.38 - syncfusion_flutter_charts: ^19.4.38 - syncfusion_flutter_gauges: ^19.4.38 + syncfusion_flutter_datagrid: ^20.1.57 + syncfusion_flutter_core: ^20.1.57 + syncfusion_flutter_sliders: ^20.1.57 + syncfusion_flutter_charts: ^20.1.57 + syncfusion_flutter_gauges: ^20.1.57 auto_route: ^3.2.2 @@ -168,7 +168,7 @@ dependencies: get_storage: # https://pub.dev/packages/home_widget - home_widget: ^0.1.5 + home_widget: ^0.1.6 freezed_annotation: ^1.1.0 firebase_core: ^1.12.0 diff --git a/test/mirea_test.dart b/test/mirea_test.dart index 56798a0d..ccd344ba 100644 --- a/test/mirea_test.dart +++ b/test/mirea_test.dart @@ -1,6 +1,4 @@ import 'package:flutter_test/flutter_test.dart'; -import 'package:rtu_mirea_app/service_locator.dart' as service_locator; -import 'package:shared_preferences/shared_preferences.dart'; import 'utils/calendar_test.dart' as cal_utils;