-
Notifications
You must be signed in to change notification settings - Fork 18
feat: personal info #1799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
muralhaplays
wants to merge
24
commits into
develop
Choose a base branch
from
feat/personal_info
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: personal info #1799
Changes from 13 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
94d7863
Add personal information to settings page. Add new atributes to the p…
muralhaplays 97ba368
Add new attributes to profile. Fetch the attributes that were added.
muralhaplays 6540a69
Format the files
muralhaplays 334be34
Change profile to store the type of the address as well. Create the p…
muralhaplays 9e63020
Rebuild everything because the sigarra page can have more entries tha…
muralhaplays 79b9c31
Format a few things and remove unused imports
muralhaplays df9e586
Restore the duration of profile cache
muralhaplays 6c9f56f
Change the didChangeDependencies() from the courses page to the home …
muralhaplays d21890a
Change the profile button
muralhaplays 2349b62
Merge branch 'develop' into feat/personal_info
muralhaplays c269147
formatted
muralhaplays 2335518
Add shimmer and no content widgets to the personal info page.
muralhaplays 7068f1f
Format files
muralhaplays bae44e3
Remove a folder that was mistakenly created
muralhaplays 78e69e2
Merge branch 'develop' into feat/personal_info
muralhaplays b5db565
Change the way we save the profile info
muralhaplays 2fea347
Put the ProfileInfo into the database
muralhaplays 1ea25ae
Fix copilot suggestions. Save profile info into the database
muralhaplays 3232ce3
Change profile info cache duration to 30 days
muralhaplays 6c95cb8
Merge branch 'develop' into feat/personal_info
pedroafmonteiro ac00ee0
Merge branch 'develop' into feat/personal_info
muralhaplays 5d74d9c
Change the personal info button to above the settings heading
muralhaplays 4258db6
Merge remote-tracking branch 'refs/remotes/origin/feat/personal_info'…
muralhaplays abbfa47
Fix the request changes
muralhaplays File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,62 @@ | ||
| // DO NOT EDIT. This is code generated via package:intl/generate_localized.dart | ||
| // This is a library that looks up messages for specific locales by | ||
| // delegating to the appropriate library. | ||
|
|
||
| // Ignore issues from commonly used lints in this file. | ||
| // ignore_for_file:implementation_imports, file_names, unnecessary_new | ||
| // ignore_for_file:unnecessary_brace_in_string_interps, directives_ordering | ||
| // ignore_for_file:argument_type_not_assignable, invalid_assignment | ||
| // ignore_for_file:prefer_single_quotes, prefer_generic_function_type_aliases | ||
| // ignore_for_file:comment_references | ||
|
|
||
| import 'dart:async'; | ||
|
|
||
| import 'package:intl/intl.dart'; | ||
| import 'package:intl/message_lookup_by_library.dart'; | ||
| import 'package:intl/src/intl_helpers.dart'; | ||
|
|
||
| import 'messages_en.dart' as messages_en; | ||
|
|
||
| typedef Future<dynamic> LibraryLoader(); | ||
| Map<String, LibraryLoader> _deferredLibraries = { | ||
| 'en': () => new Future.value(null), | ||
| }; | ||
|
|
||
| MessageLookupByLibrary? _findExact(String localeName) { | ||
| switch (localeName) { | ||
| case 'en': | ||
| return messages_en.messages; | ||
| default: | ||
| return null; | ||
| } | ||
| } | ||
|
|
||
| /// User programs should call this before using [localeName] for messages. | ||
| Future<bool> initializeMessages(String localeName) async { | ||
| var availableLocale = Intl.verifiedLocale( | ||
| localeName, (locale) => _deferredLibraries[locale] != null, | ||
| onFailure: (_) => null); | ||
| if (availableLocale == null) { | ||
| return new Future.value(false); | ||
| } | ||
| var lib = _deferredLibraries[availableLocale]; | ||
| await (lib == null ? new Future.value(false) : lib()); | ||
| initializeInternalMessageLookup(() => new CompositeMessageLookup()); | ||
| messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor); | ||
| return new Future.value(true); | ||
| } | ||
|
|
||
| bool _messagesExistFor(String locale) { | ||
| try { | ||
| return _findExact(locale) != null; | ||
| } catch (e) { | ||
| return false; | ||
| } | ||
| } | ||
|
|
||
| MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) { | ||
| var actualLocale = | ||
| Intl.verifiedLocale(locale, _messagesExistFor, onFailure: (_) => null); | ||
| if (actualLocale == null) return null; | ||
| return _findExact(actualLocale); | ||
| } |
This file contains hidden or 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,24 @@ | ||
| // DO NOT EDIT. This is code generated via package:intl/generate_localized.dart | ||
| // This is a library that provides messages for a en locale. All the | ||
| // messages from the main program should be duplicated here with the same | ||
| // function name. | ||
|
|
||
| // Ignore issues from commonly used lints in this file. | ||
| // ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new | ||
| // ignore_for_file:prefer_single_quotes,comment_references, directives_ordering | ||
| // ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases | ||
| // ignore_for_file:unused_import, file_names | ||
|
|
||
| import 'package:intl/intl.dart'; | ||
| import 'package:intl/message_lookup_by_library.dart'; | ||
|
|
||
| final messages = new MessageLookup(); | ||
|
|
||
| typedef String MessageIfAbsent(String messageStr, List<dynamic> args); | ||
|
|
||
| class MessageLookup extends MessageLookupByLibrary { | ||
| String get localeName => 'en'; | ||
|
|
||
| final messages = _notInlinedMessages(_notInlinedMessages); | ||
| static _notInlinedMessages(_) => <String, Function>{}; | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 @@ | ||
| {} | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
36 changes: 36 additions & 0 deletions
36
packages/uni_app/lib/controller/fetchers/profile_info_fetcher.dart
This file contains hidden or 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,36 @@ | ||
| import 'package:uni/controller/fetchers/session_dependant_fetcher.dart'; | ||
| import 'package:uni/controller/networking/network_router.dart'; | ||
| import 'package:uni/controller/parsers/parser_profile_info.dart'; | ||
| import 'package:uni/model/entities/profile_info.dart'; | ||
| import 'package:uni/session/flows/base/session.dart'; | ||
|
|
||
| class ProfileInfoFetcher implements SessionDependantFetcher { | ||
| @override | ||
| List<String> getEndpoints(Session session) { | ||
| final url = NetworkRouter.getBaseUrlsFromSession( | ||
| session, | ||
| )[0]; // user profile is the same on all faculties | ||
| return [url]; | ||
| } | ||
|
|
||
| /// Returns the user's [ProfileInfo]. | ||
| static Future<ProfileInfo?> fetchProfileInfo(Session session) async { | ||
| final now = DateTime.now(); | ||
| final dummy = | ||
| '${now.year}-${now.month}-${now.day}T${now.hour}:${now.minute}:${now.second}.${now.millisecond}Z'; | ||
| final urlProfileInfo = | ||
| '${NetworkRouter.getBaseUrlsFromSession(session, languageSensitive: true)[0]}' | ||
| 'fest_geral.info_pessoal_view?'; | ||
| final responseProfileInfo = await NetworkRouter.getWithCookies( | ||
| urlProfileInfo, | ||
| {'pv_num_unico': session.username, 'pv_dummy': dummy}, | ||
| session, | ||
| ); | ||
|
|
||
|
muralhaplays marked this conversation as resolved.
|
||
| final data = parseProfileDetails(responseProfileInfo); | ||
|
|
||
| final profileInfo = ProfileInfo.fromList(data); | ||
|
|
||
| return profileInfo; | ||
| } | ||
| } | ||
24 changes: 24 additions & 0 deletions
24
packages/uni_app/lib/controller/parsers/parser_profile_info.dart
This file contains hidden or 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,24 @@ | ||
| import 'package:html/parser.dart' show parse; | ||
| import 'package:http/http.dart' as http; | ||
|
|
||
| List<List<List<String>>> parseProfileDetails(http.Response response) { | ||
| final document = parse(response.body); | ||
| final tables = document.querySelectorAll('table'); | ||
| final List<List<List<String>>> eachTable = []; | ||
|
|
||
| for (final tableRaw in tables) { | ||
| final table = tableRaw | ||
| .querySelectorAll('td') | ||
| .map((cell) => cell.text.trim().replaceAll(':', '')) | ||
| .where((cell) => cell.isNotEmpty) | ||
| .toList(); | ||
| final List<List<String>> tableWithPairs = []; | ||
| for (var i = 0; i < table.length; i += 2) { | ||
|
muralhaplays marked this conversation as resolved.
|
||
| tableWithPairs.add(table.sublist(i, i + 2)); | ||
|
muralhaplays marked this conversation as resolved.
Outdated
|
||
| } | ||
|
|
||
| eachTable.add(tableWithPairs); | ||
| } | ||
|
|
||
| return eachTable; | ||
| } | ||
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.