-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into ui/exam_card
- Loading branch information
Showing
141 changed files
with
2,262 additions
and
2,260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.9.0-beta.24+287 | ||
1.10.0-beta.14+314 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/uni_app/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:app_links/app_links.dart'; | ||
import 'package:uni/utils/uri.dart'; | ||
|
||
final _authUri = Uri(scheme: 'pt.up.fe.ni.uni', host: 'auth'); | ||
|
||
class UniAppLinks { | ||
final login = _AuthenticationAppLink( | ||
redirectUri: _authUri.replace(path: '/login'), | ||
); | ||
|
||
final logout = _AuthenticationAppLink( | ||
redirectUri: _authUri.replace(path: '/logout'), | ||
); | ||
} | ||
|
||
class _AuthenticationAppLink { | ||
_AuthenticationAppLink({required this.redirectUri}); | ||
|
||
final AppLinks _appLinks = AppLinks(); | ||
final Uri redirectUri; | ||
|
||
Future<Uri> intercept( | ||
FutureOr<void> Function(Uri redirectUri) callback, | ||
) async { | ||
final interceptedUri = _appLinks.uriLinkStream | ||
.firstWhere((uri) => redirectUri == uri.stripQueryComponent()); | ||
|
||
await callback(redirectUri); | ||
final data = await interceptedUri; | ||
return data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 12 additions & 7 deletions
19
packages/uni_app/lib/controller/fetchers/faculties_fetcher.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 53 additions & 19 deletions
72
packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,60 @@ | ||
import 'package:uni/controller/fetchers/session_dependant_fetcher.dart'; | ||
import 'package:uni/controller/networking/network_router.dart'; | ||
import 'package:uni/controller/parsers/parser_library_occupation.dart'; | ||
import 'dart:convert'; | ||
|
||
import 'package:collection/collection.dart'; | ||
import 'package:http/http.dart' as http; | ||
import 'package:http/http.dart'; | ||
import 'package:tuple/tuple.dart'; | ||
import 'package:uni/model/entities/library_occupation.dart'; | ||
import 'package:uni/model/entities/session.dart'; | ||
|
||
/// Fetch the library occupation from Google Sheets | ||
class LibraryOccupationFetcherSheets implements SessionDependantFetcher { | ||
@override | ||
List<String> getEndpoints(Session session) { | ||
const baseUrl = 'https://docs.google.com/spreadsheets/d/'; | ||
const sheetId = '1gZRbEX4y8vNW7vrl15FCdAQ3pVNRJw_uRZtVL6ORP0g'; | ||
const url = | ||
'$baseUrl$sheetId/gviz/tq?tqx=out:json&sheet=MANUAL&range=C2:E7&tq=SELECT+C,E'; | ||
return [url]; | ||
class LibraryOccupationFetcher { | ||
String baseUrl = 'https://webapi.affluences.com/api/fillRate?'; | ||
|
||
static const List<Tuple2<String, int>> floorMaxSeats = [ | ||
Tuple2('BruV6IlujdwAe1', 72), | ||
Tuple2('cEhyzJZvC5nHSr', 114), | ||
Tuple2('iceVfgwZWaZRhV', 114), | ||
Tuple2('1yLPz9X0CNsg27', 114), | ||
Tuple2('keu1j5zERlQn90', 40), | ||
Tuple2('bY7K1v43HiAq55', 90), | ||
]; | ||
|
||
Future<LibraryOccupation> getLibraryOccupation() async { | ||
final libraryOccupation = LibraryOccupation(0, 0); | ||
|
||
await Future.wait( | ||
floorMaxSeats.mapIndexed((i, entry) async { | ||
final url = Uri.parse(baseUrl).replace( | ||
queryParameters: { | ||
'token': entry.item1, | ||
}, | ||
); | ||
|
||
final response = await http.get(url); | ||
|
||
final floorOccupation = | ||
processFloorOccupation(response, entry.item2, i); | ||
|
||
libraryOccupation.addFloor(floorOccupation); | ||
}), | ||
); | ||
|
||
return libraryOccupation; | ||
} | ||
|
||
Future<LibraryOccupation> getLibraryOccupationFromSheets( | ||
Session session, | ||
) async { | ||
final url = getEndpoints(session)[0]; | ||
final response = NetworkRouter.getWithCookies(url, {}, session); | ||
final occupation = await response.then(parseLibraryOccupationFromSheets); | ||
return occupation; | ||
FloorOccupation processFloorOccupation( | ||
Response response, | ||
int floorCapacity, | ||
int floor, | ||
) { | ||
final responseBody = jsonDecode(response.body) as Map<String, dynamic>; | ||
|
||
final floorOccupation = responseBody['progress'] as int? ?? 0; | ||
|
||
return FloorOccupation( | ||
floor + 1, | ||
(floorOccupation * floorCapacity / 100).round(), | ||
floorCapacity, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/uni_app/lib/controller/fetchers/reference_fetcher.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/uni_app/lib/controller/fetchers/restaurant_fetcher.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.