Skip to content

Commit

Permalink
Merge pull request from Release v1.2.2 (#242)
Browse files Browse the repository at this point in the history
Release v1.2.2
  • Loading branch information
0niel authored Aug 29, 2022
2 parents 6458074 + bc5ef8b commit c6a3f1f
Show file tree
Hide file tree
Showing 52 changed files with 829 additions and 517 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '2.8.1'
flutter-version: '3.0.5'
- run: flutter pub get
- name: Run Tests
run: flutter test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '2.8.1'
flutter-version: '3.0.5'
- run: flutter pub get
- name: Run Tests
run: flutter test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
java-version: '12.x'
- uses: subosito/flutter-action@v1
with:
flutter-version: '2.8.1'
flutter-version: '3.0.5'
channel: 'stable' # or: 'beta', 'dev' or 'master'
- run: flutter pub get
- run: flutter test ./test/mirea_test.dart
Expand Down
5 changes: 3 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Binary file added assets/images/Saly-39.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions lib/common/utils/calendar_utils.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:math';

import 'package:clock/clock.dart';
import 'package:intl/intl.dart';

Expand Down Expand Up @@ -68,10 +66,11 @@ abstract class CalendarUtils {
static DateTime getSemesterLastDay(
{DateTime? mCurrentDate, final Clock clock = const Clock()}) {
return getDaysInWeek(
kMaxWeekInSemester,
_CurrentSemesterStart.getCurrentSemesterStart(
mCurrentDate: mCurrentDate, clock: clock))
.last;
kMaxWeekInSemester,
_CurrentSemesterStart.getCurrentSemesterStart(
mCurrentDate: mCurrentDate,
clock: clock,
)).last;
}

/// Calculates number of weeks for a given year as per https://en.wikipedia.org/wiki/ISO_week_date#Weeks_per_year
Expand Down Expand Up @@ -119,7 +118,8 @@ abstract class _CurrentSemesterStart {
/// For the first semester it is September 1
/// For the second semester it is February 9th
static DateTime _getExpectedSemesterStart(DateTime currentDate) {
if (currentDate.month >= DateTime.september) {
if (currentDate.month >= DateTime.september ||
(currentDate.month == DateTime.august && currentDate.day >= 25)) {
return DateTime(currentDate.year, DateTime.september, 1);
} else {
return DateTime(currentDate.year, DateTime.february, 9);
Expand Down
3 changes: 1 addition & 2 deletions lib/data/datasources/forum_remote.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ class ForumRemoteDataImpl implements ForumRemoteData {

@override
Future<List<ForumMemberModel>> getPatrons() async {
final response = await httpClient.get(_apiUrl +
'groups/patrons/members.json?offset=0&order=&asc=true&filter=');
final response = await httpClient.get('${_apiUrl}groups/patrons/members.json?offset=0&order=&asc=true&filter=');
if (response.statusCode == 200) {
Map responseBody = response.data;
List<ForumMemberModel> patrons = [];
Expand Down
6 changes: 2 additions & 4 deletions lib/data/datasources/news_remote.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ class NewsRemoteDataImpl extends NewsRemoteData {
[String? tag]) async {
final String tagsFilter =
tag != null ? "&filters[tags][name][\$eq]=$tag" : "";
final String requestUrl = _apiUrl +
'/announcements?populate=*&pagination[limit]=$limit&pagination[start]=$offset&sort=date:DESC&filters[isImportant][\$eq]=${isImportant.toString()}' +
tagsFilter;
final String requestUrl = '$_apiUrl/announcements?populate=*&pagination[limit]=$limit&pagination[start]=$offset&sort=date:DESC&filters[isImportant][\$eq]=${isImportant.toString()}$tagsFilter';

final response = await httpClient.get(requestUrl);

Expand All @@ -39,7 +37,7 @@ class NewsRemoteDataImpl extends NewsRemoteData {

@override
Future<List<String>> getTags() async {
final response = await httpClient.get(_apiUrl + '/tags');
final response = await httpClient.get('$_apiUrl/tags');

if (response.statusCode == 200) {
Map responseBody = response.data;
Expand Down
4 changes: 2 additions & 2 deletions lib/data/datasources/schedule_remote.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ScheduleRemoteDataImpl implements ScheduleRemoteData {
@override
Future<List<String>> getGroups() async {
try {
final response = await httpClient.get(_apiUrl + 'schedule/groups');
final response = await httpClient.get('${_apiUrl}schedule/groups');
if (response.statusCode == 200) {
Map responseBody = response.data;
List<String> groups = [];
Expand All @@ -35,7 +35,7 @@ class ScheduleRemoteDataImpl implements ScheduleRemoteData {
Future<ScheduleModel> getScheduleByGroup(String group) async {
try {
final response =
await httpClient.get(_apiUrl + 'schedule/$group/full_schedule');
await httpClient.get('${_apiUrl}schedule/$group/full_schedule');
if (response.statusCode == 200) {
final data = response.data as Map<String, dynamic>;
data["remote"] = true;
Expand Down
5 changes: 2 additions & 3 deletions lib/data/datasources/strapi_remote.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ class StrapiRemoteDataImpl implements StrapiRemoteData {

@override
Future<List<StoryModel>> getStories() async {
final response = await httpClient.get(_apiUrl +
'/stories?populate[0]=pages.actions&populate[1]=pages.media&populate[2]=author&populate[3]=author.logo&populate[4]=preview');
final response = await httpClient.get('$_apiUrl/stories?populate[0]=pages.actions&populate[1]=pages.media&populate[2]=author&populate[3]=author.logo&populate[4]=preview');
if (response.statusCode == 200) {
final responseBody = response.data;
List<StoryModel> stories = [];
Expand All @@ -33,7 +32,7 @@ class StrapiRemoteDataImpl implements StrapiRemoteData {
@override
Future<List<UpdateInfoModel>> getLastUpdateInfo() async {
final response =
await httpClient.get(_apiUrl + '/updates?sort=buildNumber:DESC');
await httpClient.get('$_apiUrl/updates?sort=buildNumber:DESC');
if (response.statusCode == 200) {
try {
final responseBody = response.data;
Expand Down
17 changes: 8 additions & 9 deletions lib/data/datasources/user_remote.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'dart:convert';

import 'dart:developer';
import 'package:dio/dio.dart';
import 'package:rtu_mirea_app/common/errors/exceptions.dart';
import 'package:rtu_mirea_app/data/models/announce_model.dart';
Expand Down Expand Up @@ -31,6 +31,7 @@ class UserRemoteDataImpl implements UserRemoteData {
final response = await httpClient.get(_apiUrl, queryParameters: data);
if (response.statusCode == 200) {
var jsonResponse = json.decode(response.data);
log('Response: $jsonResponse');
if (jsonResponse.containsKey('errors')) {
throw ServerException(jsonResponse['errors'][0]);
}
Expand All @@ -43,12 +44,13 @@ class UserRemoteDataImpl implements UserRemoteData {
@override
Future<UserModel> getProfileData(String token) async {
final response = await httpClient.get(
_apiUrl + '?action=getData&url=https://lk.mirea.ru/profile/',
'$_apiUrl?action=getData&url=https://lk.mirea.ru/profile/',
options: Options(
headers: {'Authorization': token},
),
);
var jsonResponse = json.decode(response.data);
log('Response: $jsonResponse');
if (jsonResponse.containsKey('errors')) {
throw ServerException(jsonResponse['errors'][0]);
}
Expand All @@ -62,7 +64,7 @@ class UserRemoteDataImpl implements UserRemoteData {
@override
Future<List<AnnounceModel>> getAnnounces(String token) async {
final response = await httpClient.get(
_apiUrl + '?action=getData&url=https://lk.mirea.ru/livestream/',
'$_apiUrl?action=getData&url=https://lk.mirea.ru/livestream/',
options: Options(
headers: {'Authorization': token},
),
Expand All @@ -87,9 +89,7 @@ class UserRemoteDataImpl implements UserRemoteData {
@override
Future<List<EmployeeModel>> getEmployees(String token, String name) async {
final response = await httpClient.get(
_apiUrl +
'?action=getData&url=https://lk.mirea.ru/lectors/&page=undefined&findname=' +
name,
'$_apiUrl?action=getData&url=https://lk.mirea.ru/lectors/&page=undefined&findname=$name',
options: Options(
headers: {'Authorization': token},
),
Expand All @@ -116,7 +116,7 @@ class UserRemoteDataImpl implements UserRemoteData {
@override
Future<Map<String, List<ScoreModel>>> getScores(String token) async {
final response = await httpClient.get(
_apiUrl + '?action=getData&url=https://lk.mirea.ru/learning/scores/',
'$_apiUrl?action=getData&url=https://lk.mirea.ru/learning/scores/',
options: Options(
headers: {'Authorization': token},
),
Expand Down Expand Up @@ -149,8 +149,7 @@ class UserRemoteDataImpl implements UserRemoteData {
Future<List<AttendanceModel>> getAttendance(
String token, String dateStart, String dateEnd) async {
final response = await httpClient.get(
_apiUrl +
'?action=getData&url=https://lk.mirea.ru/schedule/attendance/&startDate=$dateStart&endDate=$dateEnd',
'$_apiUrl?action=getData&url=https://lk.mirea.ru/schedule/attendance/&startDate=$dateStart&endDate=$dateEnd',
options: Options(
headers: {'Authorization': token},
),
Expand Down
74 changes: 25 additions & 49 deletions lib/data/models/update_info_model/update_info_model.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,12 @@ part of 'update_info_model.dart';
T _$identity<T>(T value) => value;

final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');

UpdateInfoModel _$UpdateInfoModelFromJson(Map<String, dynamic> json) {
return _UpdateInfoModel.fromJson(json);
}

/// @nodoc
class _$UpdateInfoModelTearOff {
const _$UpdateInfoModelTearOff();

_UpdateInfoModel call(
{@JsonKey(name: 'title') required String title,
@JsonKey(name: 'description') required String? description,
@JsonKey(name: 'text') required String text,
@JsonKey(name: 'appVersion') required String appVersion,
@JsonKey(name: 'buildNumber') required int buildNumber}) {
return _UpdateInfoModel(
title: title,
description: description,
text: text,
appVersion: appVersion,
buildNumber: buildNumber,
);
}

UpdateInfoModel fromJson(Map<String, Object?> json) {
return UpdateInfoModel.fromJson(json);
}
}

/// @nodoc
const $UpdateInfoModel = _$UpdateInfoModelTearOff();

/// @nodoc
mixin _$UpdateInfoModel {
@JsonKey(name: 'title')
Expand Down Expand Up @@ -120,11 +93,11 @@ class _$UpdateInfoModelCopyWithImpl<$Res>
}

/// @nodoc
abstract class _$UpdateInfoModelCopyWith<$Res>
abstract class _$$_UpdateInfoModelCopyWith<$Res>
implements $UpdateInfoModelCopyWith<$Res> {
factory _$UpdateInfoModelCopyWith(
_UpdateInfoModel value, $Res Function(_UpdateInfoModel) then) =
__$UpdateInfoModelCopyWithImpl<$Res>;
factory _$$_UpdateInfoModelCopyWith(
_$_UpdateInfoModel value, $Res Function(_$_UpdateInfoModel) then) =
__$$_UpdateInfoModelCopyWithImpl<$Res>;
@override
$Res call(
{@JsonKey(name: 'title') String title,
Expand All @@ -135,15 +108,15 @@ abstract class _$UpdateInfoModelCopyWith<$Res>
}

/// @nodoc
class __$UpdateInfoModelCopyWithImpl<$Res>
class __$$_UpdateInfoModelCopyWithImpl<$Res>
extends _$UpdateInfoModelCopyWithImpl<$Res>
implements _$UpdateInfoModelCopyWith<$Res> {
__$UpdateInfoModelCopyWithImpl(
_UpdateInfoModel _value, $Res Function(_UpdateInfoModel) _then)
: super(_value, (v) => _then(v as _UpdateInfoModel));
implements _$$_UpdateInfoModelCopyWith<$Res> {
__$$_UpdateInfoModelCopyWithImpl(
_$_UpdateInfoModel _value, $Res Function(_$_UpdateInfoModel) _then)
: super(_value, (v) => _then(v as _$_UpdateInfoModel));

@override
_UpdateInfoModel get _value => super._value as _UpdateInfoModel;
_$_UpdateInfoModel get _value => super._value as _$_UpdateInfoModel;

@override
$Res call({
Expand All @@ -153,7 +126,7 @@ class __$UpdateInfoModelCopyWithImpl<$Res>
Object? appVersion = freezed,
Object? buildNumber = freezed,
}) {
return _then(_UpdateInfoModel(
return _then(_$_UpdateInfoModel(
title: title == freezed
? _value.title
: title // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -216,7 +189,7 @@ class _$_UpdateInfoModel implements _UpdateInfoModel {
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _UpdateInfoModel &&
other is _$_UpdateInfoModel &&
const DeepCollectionEquality().equals(other.title, title) &&
const DeepCollectionEquality()
.equals(other.description, description) &&
Expand All @@ -227,6 +200,7 @@ class _$_UpdateInfoModel implements _UpdateInfoModel {
.equals(other.buildNumber, buildNumber));
}

@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType,
Expand All @@ -238,22 +212,24 @@ class _$_UpdateInfoModel implements _UpdateInfoModel {

@JsonKey(ignore: true)
@override
_$UpdateInfoModelCopyWith<_UpdateInfoModel> get copyWith =>
__$UpdateInfoModelCopyWithImpl<_UpdateInfoModel>(this, _$identity);
_$$_UpdateInfoModelCopyWith<_$_UpdateInfoModel> get copyWith =>
__$$_UpdateInfoModelCopyWithImpl<_$_UpdateInfoModel>(this, _$identity);

@override
Map<String, dynamic> toJson() {
return _$$_UpdateInfoModelToJson(this);
return _$$_UpdateInfoModelToJson(
this,
);
}
}

abstract class _UpdateInfoModel implements UpdateInfoModel {
const factory _UpdateInfoModel(
{@JsonKey(name: 'title') required String title,
@JsonKey(name: 'description') required String? description,
@JsonKey(name: 'text') required String text,
@JsonKey(name: 'appVersion') required String appVersion,
@JsonKey(name: 'buildNumber') required int buildNumber}) =
{@JsonKey(name: 'title') required final String title,
@JsonKey(name: 'description') required final String? description,
@JsonKey(name: 'text') required final String text,
@JsonKey(name: 'appVersion') required final String appVersion,
@JsonKey(name: 'buildNumber') required final int buildNumber}) =
_$_UpdateInfoModel;

factory _UpdateInfoModel.fromJson(Map<String, dynamic> json) =
Expand All @@ -276,6 +252,6 @@ abstract class _UpdateInfoModel implements UpdateInfoModel {
int get buildNumber;
@override
@JsonKey(ignore: true)
_$UpdateInfoModelCopyWith<_UpdateInfoModel> get copyWith =>
_$$_UpdateInfoModelCopyWith<_$_UpdateInfoModel> get copyWith =>
throw _privateConstructorUsedError;
}
2 changes: 1 addition & 1 deletion lib/data/repositories/forum_repository_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
}
Expand Down
Loading

0 comments on commit c6a3f1f

Please sign in to comment.