Skip to content

Commit

Permalink
Merge pull request #314 from mirea-ninja/release/v1.3.3
Browse files Browse the repository at this point in the history
Release v1.3.3
  • Loading branch information
0niel authored May 15, 2023
2 parents 3f57f02 + 37ccfa9 commit 1ff92fc
Show file tree
Hide file tree
Showing 29 changed files with 271 additions and 139 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: '3.7.0'
flutter-version: '3.10.0'
- 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: '3.7.0'
flutter-version: '3.10.0'
- 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: '3.7.0'
flutter-version: '3.10.0'
channel: 'stable' # or: 'beta', 'dev' or 'master'
- run: flutter pub get
- run: flutter test ./test/mirea_test.dart
Expand Down
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,18 @@

# Скриншоты
<p float="left">
<img src="https://user-images.githubusercontent.com/51058739/130845744-9cc1b085-cd9f-4e02-9a54-40c213b076a7.jpg" width="150" />
<img src="https://user-images.githubusercontent.com/51058739/130845737-15fe67ce-0893-4d42-86d7-f739aa981c14.jpg" width="150" />
<img src="https://user-images.githubusercontent.com/51058739/130845743-1d2fb68f-27d8-468d-ac1c-5249cc5bcbae.jpg" width="150" />
<img src="https://user-images.githubusercontent.com/51058739/130845914-5658f14a-e946-4f0e-ae05-fc10292643ca.jpg" width="150" />
<img src="https://github.com/mirea-ninja/rtu-mirea-mobile/assets/51058739/0306ec8f-c6cd-49c2-a3eb-043a3bf9e1ce" width="150" />
<img src="https://github.com/mirea-ninja/rtu-mirea-mobile/assets/51058739/e57e07fa-3e55-40fd-bac0-393b460f2925" width="150" />
<img src="https://github.com/mirea-ninja/rtu-mirea-mobile/assets/51058739/c1010e39-2eb5-4e9f-acba-81bd2368b174" width="150" />
<img src="https://github.com/mirea-ninja/rtu-mirea-mobile/assets/51058739/72f8fdf2-05b8-4cb0-8834-d3cef30fa899" width="150" />
<img src="https://github.com/mirea-ninja/rtu-mirea-mobile/assets/121052717/64ae1e7f-19e4-473c-a3f0-93ae64439551" width="150" />
</p>
<p float="left">
<img src="https://github.com/mirea-ninja/rtu-mirea-mobile/assets/51058739/2cb09f12-9185-47f5-9125-3f5afa1b52be" width="150" />
<img src="https://github.com/mirea-ninja/rtu-mirea-mobile/assets/51058739/f0df7fc8-f3f5-4706-84f8-6d16041f5337" width="150" />
<img src="https://github.com/mirea-ninja/rtu-mirea-mobile/assets/51058739/b8929457-b8b5-4a56-8e34-15afe6350de0" width="150" />
<img src="https://github.com/mirea-ninja/rtu-mirea-mobile/assets/51058739/a477c6c2-3082-49d3-ab65-dac371ab3b11" width="150" />
<img src="https://github.com/mirea-ninja/rtu-mirea-mobile/assets/121052717/73476d7c-eeda-47ef-8f81-80c4a95c0ca5" width="150" />
</p>

# Самостоятельная сборка проекта
Expand Down
Binary file not shown.
18 changes: 18 additions & 0 deletions android/app/src/main/res/drawable/monochrome_icon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="1024dp"
android:height="1024dp"
android:viewportWidth="1024"
android:viewportHeight="1024">

<path
android:fillColor="#000000"
android:pathData="M593.802 548.322C592.665 546.857 590.915 546 589.061 546H564C560.686 546 558 548.686 558 552V692C558 695.314 560.686 698 564 698H595C598.314 698 601 695.314 601 692V617.662L661.199 695.666C662.335 697.138 664.089 698 665.949 698H692C695.314 698 698 695.314 698 692V552C698 548.686 695.314 546 692 546H661C657.686 546 655 548.686 655 552V627.19L593.802 548.322Z" />
<path
android:fillColor="#000000"
android:fillType="evenOdd"
android:pathData="M319 398H669V483H319V398ZM459 440.5C459 455.136 447.136 467 432.5 467C417.864 467 406 455.136 406 440.5C406 425.864 417.864 414 432.5 414C447.136 414 459 425.864 459 440.5ZM553.5 467C568.136 467 580 455.136 580 440.5C580 425.864 568.136 414 553.5 414C538.864 414 527 425.864 527 440.5C527 455.136 538.864 467 553.5 467Z" />
<path
android:fillColor="#000000"
android:pathData="M671.661 518.077C685.108 519.964 697.696 510.575 697.961 496.998C698.633 462.566 690.618 428.377 674.479 397.656C654.512 359.65 623.116 328.872 584.72 309.663C546.325 290.455 502.868 283.785 460.479 290.596C418.091 297.407 378.91 317.354 348.464 347.623C318.019 377.892 297.845 416.957 290.788 459.305C283.732 501.653 290.149 545.148 309.134 583.655C328.119 622.161 358.715 653.735 396.605 673.922C427.231 690.24 461.373 698.453 495.808 697.981C509.386 697.795 518.848 685.262 517.039 671.803C515.23 658.345 502.812 649.106 489.236 648.778C465.073 648.194 441.258 641.993 419.728 630.522C390.928 615.177 367.672 591.177 353.241 561.908C338.809 532.639 333.932 499.577 339.296 467.388C344.659 435.198 359.994 405.505 383.136 382.497C406.278 359.488 436.06 344.326 468.28 339.15C500.501 333.973 533.533 339.042 562.718 353.643C591.903 368.244 615.767 391.639 630.945 420.528C642.291 442.123 648.354 465.975 648.798 490.141C649.047 503.718 658.213 516.189 671.661 518.077Z" />
</vector>
Binary file removed assets/icons/github.png
Binary file not shown.
Binary file removed assets/icons/telegram.png
Binary file not shown.
3 changes: 1 addition & 2 deletions lib/data/datasources/user_local.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'dart:core';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:oauth2_client/oauth2_helper.dart';
import 'package:rtu_mirea_app/common/errors/exceptions.dart';
import 'package:rtu_mirea_app/common/oauth.dart';
import 'package:shared_preferences/shared_preferences.dart';

abstract class UserLocalData {
Expand All @@ -28,7 +27,7 @@ class UserLocalDataImpl implements UserLocalData {

@override
Future<String> getTokenFromCache() async {
var token = await oauthHelper.getToken();
var token = await oauthHelper.getTokenFromStorage();
if (token == null) throw CacheException('Auth token are not set');
return Future.value(token.accessToken);
}
Expand Down
12 changes: 8 additions & 4 deletions lib/data/datasources/user_remote.dart
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,16 @@ class UserRemoteDataImpl implements UserRemoteData {
if (jsonResponse["ROWS"] != null) {
Map<String, dynamic>.from(jsonResponse["ROWS"]).forEach((date, row) {
if (row.containsKey("START")) {
attendance.add(
AttendanceModel.fromJson(row["START"]).copyWith(date: date));
if (row["START"] != null) {
attendance.add(
AttendanceModel.fromJson(row["START"]).copyWith(date: date));
}
}
if (row.containsKey("END")) {
attendance
.add(AttendanceModel.fromJson(row["END"]).copyWith(date: date));
if (row["END"] != null) {
attendance.add(
AttendanceModel.fromJson(row["END"]).copyWith(date: date));
}
}
});
}
Expand Down
4 changes: 4 additions & 0 deletions lib/domain/entities/user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import 'student.dart';

class User extends Equatable {
final int id;

/// Email in edu-mirea.ru domain
final String login;

/// Personal email
final String email;
final String name;
final String lastName;
Expand Down
4 changes: 1 addition & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:intl/intl.dart';

import 'package:rtu_mirea_app/common/oauth.dart';

import 'package:rtu_mirea_app/common/widget_data_init.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:rtu_mirea_app/presentation/bloc/about_app_bloc/about_app_bloc.dart';
Expand Down Expand Up @@ -104,8 +104,6 @@ Future<void> main() async {
// performance monitoring.
options.tracesSampleRate = 0.2;

options.enableAutoPerformanceTracking = true;

options.attachScreenshot = true;

options.addIntegration(LoggingIntegration());
Expand Down
12 changes: 10 additions & 2 deletions lib/presentation/pages/map/map_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,16 @@ class _MapPageState extends State<MapPage> {
rotationFocusPoint: _controller.rotationFocusPoint,
scale: defaultScale,
);
_controller.outputStateStream.listen((value) =>
context.read<MapCubit>().setMapScale(value.scale ?? maxScale));

_controller.outputStateStream.listen((value) {
double scale = value.scale ?? defaultScale;
if (scale > maxScale) {
_controller.scale = maxScale;
} else if (scale < minScale) {
_controller.scale = minScale;
}
context.read<MapCubit>().setMapScale(scale);
});
}

final _controller = PhotoViewController();
Expand Down
10 changes: 5 additions & 5 deletions lib/presentation/pages/news/news_details_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ class NewsDetailsPage extends StatelessWidget {
"body": Style(
fontStyle: AppTextStyle.bodyRegular.fontStyle),
},
customRenders: {
// iframeRenderer to display the YouTube video player
iframeMatcher(): iframeRender(),
},
extensions: const [
// to display the YouTube video player
IframeHtmlExtension(),
],
onLinkTap:
(String? url, context, attributes, element) {
(String? url, Map<String, String> attributes, _) {
if (url != null) {
launchUrlString(url);
}
Expand Down
10 changes: 4 additions & 6 deletions lib/presentation/pages/news/news_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,10 @@ class _NewsPageState extends State<NewsPage> {

void _setupScrollController(ScrollController controller) {
controller.addListener(() {
if (controller.position.atEdge) {
if (controller.position.pixels != 0) {
context
.read<NewsBloc>()
.add(NewsLoadEvent(isImportant: _tabValueNotifier.value == 1));
}
if (controller.position.pixels == controller.position.maxScrollExtent) {
context
.read<NewsBloc>()
.add(NewsLoadEvent(isImportant: _tabValueNotifier.value == 1));
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions lib/presentation/pages/news/widgets/news_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ class NewsItemWidget extends StatelessWidget {

case LoadState.failed:
return GestureDetector(
child: Stack(
child: const Stack(
fit: StackFit.expand,
children: const <Widget>[
children: <Widget>[
Positioned(
bottom: 0.0,
left: 0.0,
Expand Down
11 changes: 7 additions & 4 deletions lib/presentation/pages/profile/about_app_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:unicons/unicons.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand Down Expand Up @@ -177,8 +178,9 @@ class AboutAppPage extends StatelessWidget {
height: 40,
width: 90,
child: SocialIconButton(
assetImage:
const AssetImage('assets/icons/github.png'),
icon: Icon(UniconsLine.github,
color:
Theme.of(context).colorScheme.onBackground),
onClick: () {
launchUrlString(
'https://github.com/mirea-ninja/rtu-mirea-mobile',
Expand All @@ -203,8 +205,9 @@ class AboutAppPage extends StatelessWidget {
height: 40,
width: 90,
child: SocialIconButton(
assetImage:
const AssetImage('assets/icons/telegram.png'),
icon: Icon(UniconsLine.telegram,
color:
Theme.of(context).colorScheme.onBackground),
onClick: () {
launchUrlString(
'https://t.me/mirea_ninja_chat/1',
Expand Down
4 changes: 2 additions & 2 deletions lib/presentation/pages/profile/profile_announces_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ class ProfileAnnouncesPage extends StatelessWidget {
margin: Margins.all(0),
),
},
onLinkTap:
(String? url, context, attributes, element) {
onLinkTap: (String? url,
Map<String, String> attributes, _) {
if (url != null) {
launchUrlString(url);
}
Expand Down
116 changes: 90 additions & 26 deletions lib/presentation/pages/profile/profile_attendance_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:rtu_mirea_app/domain/entities/attendance.dart';
import 'package:rtu_mirea_app/presentation/bloc/attendance_bloc/attendance_bloc.dart';
import 'package:rtu_mirea_app/presentation/bloc/user_bloc/user_bloc.dart';
import 'package:rtu_mirea_app/presentation/pages/profile/widgets/attendance_card.dart';
Expand Down Expand Up @@ -34,6 +35,94 @@ class _ProfileAttendancePageState extends State<ProfileAttendancePage> {
return res;
}

List<List<Attendance>> _groupAttendanceByDate(List<Attendance> attendance) {
final Map<String, List<Attendance>> groupedAttendance = {};
for (var element in attendance) {
if (groupedAttendance.containsKey(element.date)) {
groupedAttendance[element.date]!.add(element);
} else {
groupedAttendance[element.date] = [element];
}
}

final List<List<Attendance>> result = [];

final dateFormat = DateFormat('dd.MM.yyyy HH:mm:ss');

groupedAttendance.forEach((key, value) {
value.sort((a, b) {
final aDateTime = dateFormat.parse('${a.date} ${a.time}');
final bDateTime = dateFormat.parse('${b.date} ${b.time}');

return aDateTime.compareTo(bDateTime);
});

final List<Attendance> entryExitAttendance = [];

Attendance? entryAttendance;
Attendance? exitAttendance;

for (final element in value) {
if (element.eventType == 'Вход' && entryAttendance == null) {
entryAttendance = element;
} else if (element.eventType == 'Выход') {
exitAttendance = element;
}
}

if (entryAttendance != null) {
entryExitAttendance.add(entryAttendance);
}
if (exitAttendance != null) {
entryExitAttendance.add(exitAttendance);
}
result.add(entryExitAttendance);
});

return result;
}

Widget _buildAttendanceList(List<Attendance> attendance) {
final List<List<Attendance>> groupedAttendance =
_groupAttendanceByDate(attendance);
return Expanded(
child: Column(
children: [
const SizedBox(height: 8),
Text('Дней посещено: ${groupedAttendance.length}',
style: AppTextStyle.body),
const SizedBox(height: 8),
Expanded(
child: ListView.builder(
itemCount: groupedAttendance.length,
itemBuilder: (context, index) {
return Padding(
padding:
const EdgeInsets.symmetric(vertical: 16, horizontal: 24),
child: Column(children: [
AttendanceCard(
type: groupedAttendance[index][0].eventType,
date: groupedAttendance[index][0].date,
time: groupedAttendance[index][0].time,
),
if (groupedAttendance[index].length > 1) ...[
const SizedBox(height: 8),
AttendanceCard(
type: groupedAttendance[index][1].eventType,
date: groupedAttendance[index][1].date,
time: groupedAttendance[index][1].time,
),
],
]),
);
},
),
),
],
),
);
}

@override
Widget build(BuildContext context) {
return Scaffold(
Expand Down Expand Up @@ -92,32 +181,7 @@ class _ProfileAttendancePageState extends State<ProfileAttendancePage> {
child: Center(child: CircularProgressIndicator()))
else if (state is AttendanceLoaded &&
state.attendance.isNotEmpty)
Expanded(
child: Column(
children: [
const SizedBox(height: 8),
Text('Дней посещено: ${state.visitsCount}',
style: AppTextStyle.body),
const SizedBox(height: 8),
Expanded(
child: ListView.builder(
itemCount: state.attendance.length,
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.symmetric(
vertical: 16, horizontal: 24),
child: AttendanceCard(
type: state.attendance[index].eventType,
date: state.attendance[index].date,
time: state.attendance[index].time,
),
);
},
),
),
],
),
),
_buildAttendanceList(state.attendance),
if (state is AttendanceLoaded && state.attendance.isEmpty)
Expanded(
child: Center(
Expand Down
Loading

0 comments on commit 1ff92fc

Please sign in to comment.