diff --git a/lib/pages/portal/model/website.dart b/lib/pages/portal/model/website.dart index 8b9bceebf..47b3145ca 100644 --- a/lib/pages/portal/model/website.dart +++ b/lib/pages/portal/model/website.dart @@ -32,6 +32,8 @@ class Website { /// Whether the website is public or part of user data final bool isPrivate; + final List editedBy; + final WebsiteCategory category; final String iconPath; final String label; @@ -42,12 +44,14 @@ class Website { {this.ownerUid, @required this.id, @required this.isPrivate, + List editedBy, @required this.category, this.iconPath, String label, @required String link, this.infoByLocale}) - : this.label = toString(label).isEmpty ? labelFromLink(link) : label, + : this.editedBy = editedBy ?? [], + this.label = toString(label).isEmpty ? labelFromLink(link) : label, this.link = link; static String labelFromLink(String link) => link.split('://').last; diff --git a/lib/pages/portal/service/website_provider.dart b/lib/pages/portal/service/website_provider.dart index c8d55a8df..d2fb2fe9a 100644 --- a/lib/pages/portal/service/website_provider.dart +++ b/lib/pages/portal/service/website_provider.dart @@ -32,6 +32,7 @@ extension WebsiteExtension on Website { ownerUid: ownerUid ?? snap.data['addedBy'], id: snap.documentID, isPrivate: ownerUid != null, + editedBy: List.from(snap.data['editedBy'] ?? []), category: WebsiteCategoryExtension.fromString(snap.data['category']), iconPath: snap.data['icon'] ?? 'icons/websites/globe.png', label: snap.data['label'] ?? 'Website', @@ -50,6 +51,7 @@ extension WebsiteExtension on Website { if (!isPrivate) { if (ownerUid != null) data['addedBy'] = ownerUid; + data['editedBy'] = editedBy; data['relevance'] = null; // TODO: Make relevance customizable } diff --git a/lib/pages/portal/view/website_view.dart b/lib/pages/portal/view/website_view.dart index 1ad1fe466..382c04a3d 100644 --- a/lib/pages/portal/view/website_view.dart +++ b/lib/pages/portal/view/website_view.dart @@ -115,6 +115,7 @@ class _WebsiteViewState extends State { ownerUid: widget.website != null ? widget.website.ownerUid : _user?.uid, isPrivate: _onlyMeController.isSelected ?? true, + editedBy: (widget.website?.editedBy ?? []) + [_user?.uid], label: _labelController.text, link: _linkController.text, category: _selectedCategory, diff --git a/pubspec.yaml b/pubspec.yaml index 51caa3000..6758c1e41 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ description: A mobile application for students at ACS UPB. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 0.4.2+3 +version: 0.4.3+1 environment: sdk: ">=2.6.0 <3.0.0"