Skip to content
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

Filter by information source #308

Open
wants to merge 79 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 72 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
4223e5f
Create UI prototype for selecting data sources
IoanaAlexandru Dec 20, 2020
73b469e
Create UI prototype for selecting data sources
IoanaAlexandru Dec 20, 2020
ddac723
Added source editing page, a field in user for filtering the informat…
AdrianMargineanu Feb 24, 2021
e060ea2
Edit the quarry from the firebase to filter the information.
AdrianMargineanu Feb 25, 2021
5f5ddfa
Merge remote-tracking branch 'origin/select_sources' into select_sources
AdrianMargineanu Feb 25, 2021
c4b1dc7
Create UI prototype for selecting data sources
IoanaAlexandru Dec 20, 2020
0bb872a
Added source editing page, a field in user for filtering the informat…
AdrianMargineanu Feb 24, 2021
6963757
Edit the quarry from the firebase to filter the information.
AdrianMargineanu Feb 25, 2021
f2f2852
Merge branch 'master' into select_sources
IoanaAlexandru Feb 26, 2021
27c63c7
Fix broken merge and update packages.
IoanaAlexandru Feb 26, 2021
a1258c6
Fix bug when user has no sources selected.
IoanaAlexandru Feb 26, 2021
ad6ae43
Merge remote-tracking branch 'origin/select_sources' into select_sources
AdrianMargineanu Feb 28, 2021
dd76c01
Disable the checkbox of the official info field
AdrianMargineanu Feb 28, 2021
e80f78e
Merge branch 'master' into select_sources
AdrianMargineanu Feb 28, 2021
98a287d
Remove the hardcoded text from tha page
AdrianMargineanu Mar 6, 2021
ed736d4
If the user is anonymous get all websites.
AdrianMargineanu Mar 6, 2021
1616310
Modify the condition of automation opening of source page
AdrianMargineanu Mar 6, 2021
fb13c4e
Correct deprecated methods
AdrianMargineanu Mar 6, 2021
8cbd334
Grammar fixes of the strings
AdrianMargineanu Mar 6, 2021
512e4fd
Move the source_page in settings
AdrianMargineanu Mar 6, 2021
03bd793
Correct the mock of the tests
AdrianMargineanu Mar 6, 2021
192c860
Make source selection page show only once per app launch.
IoanaAlexandru Mar 6, 2021
425a2a6
Merge branch 'master' into select_sources
IoanaAlexandru Mar 6, 2021
096494b
Fix broken merge conflict.
IoanaAlexandru Mar 6, 2021
596a48b
Add information sources page link to settings.
IoanaAlexandru Mar 6, 2021
e991417
Improve settings page.
IoanaAlexandru Mar 6, 2021
c945c7f
Migrate the database to the filter system
AdrianMargineanu Mar 7, 2021
07f7d20
Migrate faq to sources
AdrianMargineanu Mar 30, 2021
f515016
Merge branch 'master' into select_sources
AdrianMargineanu Mar 30, 2021
13b261d
Merged dev with select_sources
AdrianMargineanu Mar 30, 2021
e487c7a
Replace all material icons with their outlined counterpart.
IoanaAlexandru Apr 3, 2021
78312a0
Use feather icons.
IoanaAlexandru Apr 3, 2021
447350c
Improve padding.
IoanaAlexandru Apr 3, 2021
abad93a
Merge branch 'master' into IoanaAlexandru/improve_ui
IoanaAlexandru Apr 3, 2021
e6d292e
Fix failing test.
IoanaAlexandru Apr 3, 2021
931ecf4
Replace all FlatButtons with TextButtons.
IoanaAlexandru Apr 3, 2021
7086982
Fix unused package warning.
IoanaAlexandru Apr 3, 2021
ac8e6df
Improve settings page.
IoanaAlexandru Apr 3, 2021
2663d75
More settings page improvements.
IoanaAlexandru Apr 3, 2021
b66d254
Fix failing tests.
IoanaAlexandru Apr 3, 2021
b8a5e1f
Merge branch 'IoanaAlexandru/improve_ui' into select_sources
IoanaAlexandru Apr 3, 2021
7a311ac
Format files.
IoanaAlexandru Apr 3, 2021
7b1459f
Merge branch 'IoanaAlexandru/improve_ui' into select_sources
IoanaAlexandru Apr 3, 2021
e3e6438
Fix linter warning.
IoanaAlexandru Apr 3, 2021
c7620bd
Remove methods not useful in the prod
AdrianMargineanu Apr 10, 2021
d972734
Merge branch 'master' into select_sources
AdrianMargineanu Apr 10, 2021
8c54a20
Add a condition if the sources are null
AdrianMargineanu Apr 10, 2021
5fe4c1a
Merge branch 'master' into select_sources
AdrianMargineanu May 15, 2021
5aef7f2
Merge branch 'master' into select_sources
AdrianMargineanu Jul 17, 2021
f314f80
Fix the compilation errors after the merge
AdrianMargineanu Jul 18, 2021
7dd3b44
Remove the used imports.
AdrianMargineanu Jul 18, 2021
51c0292
Merge branch 'master' into select_sources
AdrianMargineanu Jul 18, 2021
4e161ce
Merge branch 'master' into select_sources
IoanaAlexandru Oct 3, 2021
d2ef2f2
Fix tests.
IoanaAlexandru Oct 3, 2021
14b9190
Merge branch 'master' into select_sources
AdrianMargineanu Oct 5, 2021
be60201
Solve conflicts
AdrianMargineanu Oct 5, 2021
13f0e41
Fix feedback tests
AdrianMargineanu Oct 5, 2021
63e8610
Code refactor. Build bump
AdrianMargineanu Oct 5, 2021
7e5e6b1
Change to form context to current
AdrianMargineanu Oct 5, 2021
2833d83
Merge branch 'master' into select_sources
stefanp0pa May 3, 2022
f713582
Applied most of RC, problem with whereIn condition in question_provider
stefanp0pa May 3, 2022
73454f4
Connect source selection page to the settings
stefanp0pa May 4, 2022
cfa3358
Removed unnecessary print
stefanp0pa May 4, 2022
e486f98
Solved last comments in pr
AdrianMargineanu May 4, 2022
5820e74
Add the error dialog if user has no student source in the events table
AdrianMargineanu May 4, 2022
fd97294
Solved failed intl string generation
stefanp0pa May 5, 2022
6d8d3aa
Add string in all files
stefanp0pa May 5, 2022
3320feb
Applied a part of the newest RCs by Ioana
stefanp0pa May 6, 2022
284ba99
Rename the old question provider into FaqQuestionProvider
stefanp0pa May 6, 2022
6162c65
Used ProxyProvider for the FaqQuestionProvider
stefanp0pa May 6, 2022
5ad6301
Applied ProxyProvider for WebsiteProvider, do not know how to test
stefanp0pa May 6, 2022
2c5ccf3
Replaced the warningEventsAreAddedByStudents string
stefanp0pa May 6, 2022
ff91044
When user did not select sources, default to all sources
stefanp0pa May 7, 2022
f245e83
Add filterBySource utility function in faq and website providers
stefanp0pa May 7, 2022
d3c32ea
Address DangerBot warning
stefanp0pa May 7, 2022
e917be5
Apply DangerBot suggestions
stefanp0pa May 8, 2022
c0e964e
Apply rewording RCs
stefanp0pa May 9, 2022
5821ebf
Apply getter for sources
stefanp0pa May 9, 2022
c17148d
Apply RC
stefanp0pa May 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions lib/authentication/model/user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class User {
@required this.firstName,
@required this.lastName,
this.classes,
this.sources,
int permissionLevel})
: permissionLevel = permissionLevel ?? 0;

Expand All @@ -15,6 +16,7 @@ class User {

String firstName;
String lastName;
List<String> sources;

/// Info about the user's assigned group (including degree, year of study, series etc)
List<String> classes;
Expand Down
33 changes: 28 additions & 5 deletions lib/authentication/service/auth_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ extension DatabaseUser on User {
firstName: data['name']['first'],
lastName: data['name']['last'],
classes: List.from(data['class'] ?? []),
permissionLevel: data['permissionLevel']);
permissionLevel: data['permissionLevel'],
sources: List.from(data['sources'] ?? []));
}

Map<String, dynamic> toData() {
return {
'name': {'first': firstName, 'last': lastName},
'class': classes,
'permissionLevel': permissionLevel
'permissionLevel': permissionLevel,
'sources': sources
};
}
}
Expand Down Expand Up @@ -173,10 +175,14 @@ class AuthProvider with ChangeNotifier {
User get currentUserFromCache => _currentUser;

Future<bool> signInAnonymously() async {
return FirebaseAuth.instance.signInAnonymously().catchError((dynamic e) {
bool result = false;
await FirebaseAuth.instance.signInAnonymously().then((_) {
result = true;
}).catchError((dynamic e) {
_errorHandler(e);
return false;
}).then((_) => true);
result = false;
});
return result;
}

Future<bool> changePassword(String password) async {
Expand Down Expand Up @@ -404,6 +410,23 @@ class AuthProvider with ChangeNotifier {
return true;
}

Future<bool> setSourcePreferences(List<String> sources,
{BuildContext context}) async {
try {
_currentUser.sources = sources;
await FirebaseFirestore.instance
.collection('users')
.doc(_currentUser.uid)
.update(_currentUser.toData());

notifyListeners();
return true;
} catch (e) {
_errorHandler(e);
return false;
}
}

/// Update the user information with the data in [info].
Future<bool> updateProfile(Map<String, dynamic> info) async {
try {
Expand Down
14 changes: 14 additions & 0 deletions lib/generated/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,11 @@ class MessageLookup extends MessageLookupByLibrary {
"hintLastName" : MessageLookupByLibrary.simpleMessage("Doe"),
"hintPassword" : MessageLookupByLibrary.simpleMessage("····················"),
"hintPoints" : MessageLookupByLibrary.simpleMessage("4.0"),
"hintSelectSources" : MessageLookupByLibrary.simpleMessage("Please select the sources that you want to see information from:"),
"hintWebsiteLabel" : MessageLookupByLibrary.simpleMessage("Google"),
"hintWebsiteLink" : MessageLookupByLibrary.simpleMessage("http://google.com"),
"infoAccepted" : MessageLookupByLibrary.simpleMessage("Accepted"),
"infoAdditionInformationSources" : MessageLookupByLibrary.simpleMessage("The Faculty of Automatic Control and Computers is not responsible for information originating from unofficial sources."),
"infoAdmin" : MessageLookupByLibrary.simpleMessage("Handle permission requests"),
"infoAppIsOpenSource" : m2,
"infoClasses" : MessageLookupByLibrary.simpleMessage("classes you are interested in"),
Expand Down Expand Up @@ -242,6 +244,7 @@ class MessageLookup extends MessageLookupByLibrary {
"messageRequestAlreadyExists" : MessageLookupByLibrary.simpleMessage("You have already submitted a request. If you want to add another one, please press \'Send\'."),
"messageRequestHasBeenSent" : MessageLookupByLibrary.simpleMessage("The request has been sent successfully."),
"messageResetPassword" : MessageLookupByLibrary.simpleMessage("Enter your e-mail in order to receive instructions on how to reset your password."),
"messageSelectSource" : MessageLookupByLibrary.simpleMessage("ACS UPB Mobile aims to be an information hub for students, therefore it aggregates data from various sources (official or unofficial)."),
"messageShortcutDeleted" : MessageLookupByLibrary.simpleMessage("Shortcut deleted successfully."),
"messageTalkToChatbot" : MessageLookupByLibrary.simpleMessage("Talk to Polly!"),
"messageTapForMoreInfo" : MessageLookupByLibrary.simpleMessage("Tap for more info"),
Expand Down Expand Up @@ -282,6 +285,7 @@ class MessageLookup extends MessageLookupByLibrary {
"sectionFeedbackNeeded" : MessageLookupByLibrary.simpleMessage("Feedback needed"),
"sectionFrequentlyAccessedWebsites" : MessageLookupByLibrary.simpleMessage("Favourite websites"),
"sectionGrading" : MessageLookupByLibrary.simpleMessage("Grading"),
"sectionInformationSources" : MessageLookupByLibrary.simpleMessage("Information sources"),
"sectionShortcuts" : MessageLookupByLibrary.simpleMessage("Shortcuts"),
"settingsAdminPermissions" : MessageLookupByLibrary.simpleMessage("Admin permissions"),
"settingsExportToGoogleCalendar" : MessageLookupByLibrary.simpleMessage("Export events to Google Calendar"),
Expand All @@ -298,6 +302,8 @@ class MessageLookup extends MessageLookupByLibrary {
"settingsPermissionsNone" : MessageLookupByLibrary.simpleMessage("No special permissions"),
"settingsPermissionsRequestSent" : MessageLookupByLibrary.simpleMessage("Permissions request already sent"),
"settingsRelevanceFilter" : MessageLookupByLibrary.simpleMessage("Relevance filter"),
"settingsSourceSelection" : MessageLookupByLibrary.simpleMessage("Select information sources"),
"settingsSourceSelectionSubtitle" : MessageLookupByLibrary.simpleMessage("Select the sources you want information from"),
"settingsTitleDataControl" : MessageLookupByLibrary.simpleMessage("Data control"),
"settingsTitleLocalization" : MessageLookupByLibrary.simpleMessage("Localization"),
"settingsTitlePersonalization" : MessageLookupByLibrary.simpleMessage("Personalization"),
Expand All @@ -306,6 +312,13 @@ class MessageLookup extends MessageLookupByLibrary {
"shortcutTypeMain" : MessageLookupByLibrary.simpleMessage("Main page"),
"shortcutTypeOther" : MessageLookupByLibrary.simpleMessage("Other"),
"shortcutTypeResource" : MessageLookupByLibrary.simpleMessage("Resource"),
"sourceOfficialWebPages" : MessageLookupByLibrary.simpleMessage("Official web pages"),
"sourceOfficialWebPagesInfo" : MessageLookupByLibrary.simpleMessage("acs.pub.ro, upb.ro, curs.upb.ro, studenti.pub.ro"),
"sourceStudentOrganizations" : MessageLookupByLibrary.simpleMessage("Student organizations"),
"sourceStudentOrganizationsInfo" : MessageLookupByLibrary.simpleMessage("LSAC, BEST, MLSA"),
"sourceStudentRepresentative" : MessageLookupByLibrary.simpleMessage("Representative students"),
"sourceStudentRepresentativesInfo" : MessageLookupByLibrary.simpleMessage("group/series representatives, student council members"),
"sourceUnknown" : MessageLookupByLibrary.simpleMessage("Unknown source"),
"stringAnd" : MessageLookupByLibrary.simpleMessage("and"),
"stringAnonymous" : MessageLookupByLibrary.simpleMessage("Anonymous"),
"stringAt" : MessageLookupByLibrary.simpleMessage("at"),
Expand All @@ -329,6 +342,7 @@ class MessageLookup extends MessageLookupByLibrary {
"warningAuthenticationNeeded" : MessageLookupByLibrary.simpleMessage("Please authenticate in order to access this feature."),
"warningEmailInUse" : m11,
"warningEventNotEditable" : MessageLookupByLibrary.simpleMessage("This event cannot be edited."),
"warningEventsAreAddedByStudents" : MessageLookupByLibrary.simpleMessage("Events in the calendar are added by other students. You can add the \"students\" information source to be able to view them."),
"warningFavouriteWebsitesInitializationFailed" : MessageLookupByLibrary.simpleMessage("Could not read favourite websites."),
"warningFeedbackAlreadySent" : MessageLookupByLibrary.simpleMessage("You have already submitted feedback for this class!"),
"warningFieldCannotBeEmpty" : MessageLookupByLibrary.simpleMessage("Field cannot be empty."),
Expand Down
14 changes: 14 additions & 0 deletions lib/generated/intl/messages_ro.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,11 @@ class MessageLookup extends MessageLookupByLibrary {
"hintLastName" : MessageLookupByLibrary.simpleMessage("Doe"),
"hintPassword" : MessageLookupByLibrary.simpleMessage("····················"),
"hintPoints" : MessageLookupByLibrary.simpleMessage("4.0"),
"hintSelectSources" : MessageLookupByLibrary.simpleMessage("Selectează sursele de informații pe care dorești să le folosești:"),
"hintWebsiteLabel" : MessageLookupByLibrary.simpleMessage("Google"),
"hintWebsiteLink" : MessageLookupByLibrary.simpleMessage("http://google.com"),
"infoAccepted" : MessageLookupByLibrary.simpleMessage("Acceptat"),
"infoAdditionInformationSources" : MessageLookupByLibrary.simpleMessage("Facultatea de Automatică și Calculatoare nu își asumă răspunderea pentru informațiile provenite din surse neoficiale."),
"infoAdmin" : MessageLookupByLibrary.simpleMessage("Trateaza cererile de permisiuni"),
"infoAppIsOpenSource" : m2,
"infoClasses" : MessageLookupByLibrary.simpleMessage("materiile care vă interesează"),
Expand Down Expand Up @@ -242,6 +244,7 @@ class MessageLookup extends MessageLookupByLibrary {
"messageRequestAlreadyExists" : MessageLookupByLibrary.simpleMessage("Ați trimis deja o cerere. Daca doriți să adăugați una nouă, vă rugăm sa apasați \'Salvare\'."),
"messageRequestHasBeenSent" : MessageLookupByLibrary.simpleMessage("Cererea a fost transmisă cu succes"),
"messageResetPassword" : MessageLookupByLibrary.simpleMessage("Introduceți mail-ul pentru a primi instrucțiuni de resetare a parolei."),
"messageSelectSource" : MessageLookupByLibrary.simpleMessage("Aplicația ACS UPB Mobile își propune să fie un hub de informații despre facultate, așadar culege date din diverse surse (oficiale sau neoficiale)."),
"messageShortcutDeleted" : MessageLookupByLibrary.simpleMessage("Scurtătura a fost ștearsă cu succes."),
"messageTalkToChatbot" : MessageLookupByLibrary.simpleMessage("Vorbește cu Polly!"),
"messageTapForMoreInfo" : MessageLookupByLibrary.simpleMessage("Apasă pentru mai multe informații"),
Expand Down Expand Up @@ -282,6 +285,7 @@ class MessageLookup extends MessageLookupByLibrary {
"sectionFeedbackNeeded" : MessageLookupByLibrary.simpleMessage("Feedback necesar"),
"sectionFrequentlyAccessedWebsites" : MessageLookupByLibrary.simpleMessage("Website-uri favorite"),
"sectionGrading" : MessageLookupByLibrary.simpleMessage("Punctaj"),
"sectionInformationSources" : MessageLookupByLibrary.simpleMessage("Surse de informații"),
"sectionShortcuts" : MessageLookupByLibrary.simpleMessage("Scurtături"),
"settingsAdminPermissions" : MessageLookupByLibrary.simpleMessage("Permisiuni de administrator"),
"settingsExportToGoogleCalendar" : MessageLookupByLibrary.simpleMessage("Exportă evenimentele în Google Calendar"),
Expand All @@ -298,6 +302,8 @@ class MessageLookup extends MessageLookupByLibrary {
"settingsPermissionsNone" : MessageLookupByLibrary.simpleMessage("Fără permisiuni speciale"),
"settingsPermissionsRequestSent" : MessageLookupByLibrary.simpleMessage("Cerere pentru permisiuni trimisă"),
"settingsRelevanceFilter" : MessageLookupByLibrary.simpleMessage("Filtru de relevanță"),
"settingsSourceSelection" : MessageLookupByLibrary.simpleMessage("Selectează sursele de informații"),
"settingsSourceSelectionSubtitle" : MessageLookupByLibrary.simpleMessage("Selectează sursele din care vrei informații"),
"settingsTitleDataControl" : MessageLookupByLibrary.simpleMessage("Control date"),
"settingsTitleLocalization" : MessageLookupByLibrary.simpleMessage("Localizare"),
"settingsTitlePersonalization" : MessageLookupByLibrary.simpleMessage("Personalizare"),
Expand All @@ -306,6 +312,13 @@ class MessageLookup extends MessageLookupByLibrary {
"shortcutTypeMain" : MessageLookupByLibrary.simpleMessage("Pagina principală"),
"shortcutTypeOther" : MessageLookupByLibrary.simpleMessage("Alta"),
"shortcutTypeResource" : MessageLookupByLibrary.simpleMessage("Resursă"),
"sourceOfficialWebPages" : MessageLookupByLibrary.simpleMessage("Site-uri oficiale"),
"sourceOfficialWebPagesInfo" : MessageLookupByLibrary.simpleMessage("acs.pub.ro, upb.ro, curs.upb.ro, studenti.pub.ro"),
"sourceStudentOrganizations" : MessageLookupByLibrary.simpleMessage("Organizații studențești"),
"sourceStudentOrganizationsInfo" : MessageLookupByLibrary.simpleMessage("LSAC, BEST, MLSA"),
"sourceStudentRepresentative" : MessageLookupByLibrary.simpleMessage("Studenți reprezentanți"),
"sourceStudentRepresentativesInfo" : MessageLookupByLibrary.simpleMessage("șefi de grupă, serie și studenții consilieri"),
"sourceUnknown" : MessageLookupByLibrary.simpleMessage("Sursă necunoscută"),
"stringAnd" : MessageLookupByLibrary.simpleMessage("și"),
"stringAnonymous" : MessageLookupByLibrary.simpleMessage("Anonim"),
"stringAt" : MessageLookupByLibrary.simpleMessage("la"),
Expand All @@ -329,6 +342,7 @@ class MessageLookup extends MessageLookupByLibrary {
"warningAuthenticationNeeded" : MessageLookupByLibrary.simpleMessage("Autentificați-vă pentru a accesa această funcționalitate."),
"warningEmailInUse" : m11,
"warningEventNotEditable" : MessageLookupByLibrary.simpleMessage("Acest eveniment nu poate fi modificat."),
"warningEventsAreAddedByStudents" : MessageLookupByLibrary.simpleMessage("Evenimentele din calendar sunt adăugate de studenți. Puteți să selectați sursa de informație \"stundenți\" pentru a le vedea."),
"warningFavouriteWebsitesInitializationFailed" : MessageLookupByLibrary.simpleMessage("Nu se pot citi date despre site-urile favorite."),
"warningFeedbackAlreadySent" : MessageLookupByLibrary.simpleMessage("Ați trimis deja feedback pentru această materie!"),
"warningFieldCannotBeEmpty" : MessageLookupByLibrary.simpleMessage("Câmpul nu poate fi gol."),
Expand Down
141 changes: 140 additions & 1 deletion lib/generated/l10n.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading