Skip to content

Commit ed70ee4

Browse files
authored
Merge pull request #135 from rokwire/release/v1.2.0
Release/v1.2.0
2 parents b6eb37a + ec00e94 commit ed70ee4

16 files changed

+572
-307
lines changed

CHANGELOG.md

+23
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## Unreleased
88

9+
## [1.2.0] - 2022-08-15
10+
### Fixed
11+
- Use simple getter for deep link redirect url [#2065](https://github.com/rokwire/illinois-app/issues/2065).
12+
- Properly convert colors that contain adjacent zeros [#122](https://github.com/rokwire/app-flutter-plugin/issues/122).
13+
### Changed
14+
- Allow referring string values from app config in FlexUI service [#118](https://github.com/rokwire/app-flutter-plugin/issues/118).
15+
- Added Auth2UserPres.setFavorite method; use Iterable inetead of List for muliple favorites paramter [#2065](https://github.com/rokwire/illinois-app/issues/2065).
16+
- FlexUI extended with content entry switch and multiple {content, rules} sets in single source [#121](https://github.com/rokwire/app-flutter-plugin/issues/121).
17+
- Acknowledged new paramters of 'report/abuse' API of Groups BB [#2083](https://github.com/rokwire/illinois-app/issues/2083).
18+
- Refresh Auth2 account object instead of profile and prefs separately [#132](https://github.com/rokwire/app-flutter-plugin/issues/132).
19+
- Updated format of settings APIs in Auth2UserPrefs [#2194](https://github.com/rokwire/illinois-app/issues/2194).
20+
- Do not load all groups on portions (paging) [#125](https://github.com/rokwire/app-flutter-plugin/issues/125).
21+
### Added
22+
- Differ multi events and events that last more than one day [#126](https://github.com/rokwire/app-flutter-plugin/issues/126).
23+
- Added Config().appStoreId getter [#2162](https://github.com/rokwire/illinois-app/issues/2162).
24+
- Added MapUtils.get2 helper [#2169](https://github.com/rokwire/illinois-app/issues/2169).
25+
- Check if event ends in the same year as it starts [#128](https://github.com/rokwire/app-flutter-plugin/issues/128).
26+
- Load groups and members on portions (e.g. paging) [#125](https://github.com/rokwire/app-flutter-plugin/issues/125).
27+
- Added system configs in Auth2Account [#132](https://github.com/rokwire/app-flutter-plugin/issues/132).
28+
- Added int settings getter in Auth2UserPrefs [#2207](https://github.com/rokwire/illinois-app/issues/2207).
29+
- Added config settings refs support for FlexUI enabled rules [#2210](https://github.com/rokwire/illinois-app/issues/2210).
30+
31+
932
## [1.1.0] - 2022-07-19
1033
### Changed
1134
- Added GeoFence location rules in FlexUI [#62](https://github.com/rokwire/app-flutter-plugin/issues/62).

SECURITY.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Patches for [ **illinois-app** ] will only be applied to the following versions:
66

77
| Version | Supported |
88
| ------- | ------------------ |
9+
| 1.2.0 | :white_check_mark: |
910
| 1.1.0 | :white_check_mark: |
1011
| 1.0.2 | :white_check_mark: |
1112
| 1.0.1 | :white_check_mark: |

example/pubspec.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ packages:
638638
path: ".."
639639
relative: true
640640
source: path
641-
version: "1.1.0"
641+
version: "1.2.0"
642642
shared_preferences:
643643
dependency: transitive
644644
description:

ios/rokwire_plugin.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
Pod::Spec.new do |s|
66
s.name = 'rokwire_plugin'
7-
s.version = '1.1.0'
7+
s.version = '1.2.0'
88
s.summary = 'Rokwire Flutter plugin'
99
s.description = <<-DESC
1010
Rokwire Flutter plugin

lib/model/auth2.dart

+79-37
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ class Auth2Account {
121121
final List<Auth2StringEntry>? roles;
122122
final List<Auth2StringEntry>? groups;
123123
final List<Auth2Type>? authTypes;
124+
final Map<String, dynamic>? systemConfigs;
124125

125-
126-
Auth2Account({this.id, this.profile, this.prefs, this.permissions, this.roles, this.groups, this.authTypes});
126+
Auth2Account({this.id, this.profile, this.prefs, this.permissions, this.roles, this.groups, this.authTypes, this.systemConfigs});
127127

128-
factory Auth2Account.fromOther(Auth2Account? other, {String? id, Auth2UserProfile? profile, Auth2UserPrefs? prefs, List<Auth2StringEntry>? permissions, List<Auth2StringEntry>? roles, List<Auth2StringEntry>? groups, List<Auth2Type>? authTypes}) {
128+
factory Auth2Account.fromOther(Auth2Account? other, {String? id, Auth2UserProfile? profile, Auth2UserPrefs? prefs, List<Auth2StringEntry>? permissions, List<Auth2StringEntry>? roles, List<Auth2StringEntry>? groups, List<Auth2Type>? authTypes, Map<String, dynamic>? systemConfigs}) {
129129
return Auth2Account(
130130
id: id ?? other?.id,
131131
profile: profile ?? other?.profile,
@@ -134,6 +134,7 @@ class Auth2Account {
134134
roles: roles ?? other?.roles,
135135
groups: groups ?? other?.groups,
136136
authTypes: authTypes ?? other?.authTypes,
137+
systemConfigs: systemConfigs ?? other?.systemConfigs,
137138
);
138139
}
139140

@@ -146,6 +147,7 @@ class Auth2Account {
146147
roles: Auth2StringEntry.listFromJson(JsonUtils.listValue(json['roles'])),
147148
groups: Auth2StringEntry.listFromJson(JsonUtils.listValue(json['groups'])),
148149
authTypes: Auth2Type.listFromJson(JsonUtils.listValue(json['auth_types'])),
150+
systemConfigs: JsonUtils.mapValue(json['system_configs']),
149151
) : null;
150152
}
151153

@@ -158,6 +160,7 @@ class Auth2Account {
158160
'roles': roles,
159161
'groups': groups,
160162
'auth_types': authTypes,
163+
'system_configs': systemConfigs,
161164
};
162165
}
163166

@@ -169,7 +172,8 @@ class Auth2Account {
169172
const DeepCollectionEquality().equals(other.permissions, permissions) &&
170173
const DeepCollectionEquality().equals(other.roles, roles) &&
171174
const DeepCollectionEquality().equals(other.groups, groups) &&
172-
const DeepCollectionEquality().equals(other.authTypes, authTypes);
175+
const DeepCollectionEquality().equals(other.authTypes, authTypes) &&
176+
const DeepCollectionEquality().equals(other.systemConfigs, systemConfigs);
173177

174178
@override
175179
int get hashCode =>
@@ -178,7 +182,8 @@ class Auth2Account {
178182
(const DeepCollectionEquality().hash(permissions)) ^
179183
(const DeepCollectionEquality().hash(roles)) ^
180184
(const DeepCollectionEquality().hash(groups)) ^
181-
(const DeepCollectionEquality().hash(authTypes));
185+
(const DeepCollectionEquality().hash(authTypes)) ^
186+
(const DeepCollectionEquality().hash(systemConfigs));
182187

183188
bool get isValid {
184189
return (id != null) && id!.isNotEmpty /* && (profile != null) && profile.isValid*/;
@@ -214,6 +219,7 @@ class Auth2Account {
214219
bool hasRole(String role) => (Auth2StringEntry.findInList(roles, name: role) != null);
215220
bool hasPermission(String premission) => (Auth2StringEntry.findInList(permissions, name: premission) != null);
216221
bool bellongsToGroup(String group) => (Auth2StringEntry.findInList(groups, name: group) != null);
222+
bool get isAnalyticsProcessed => (MapUtils.get(systemConfigs, 'analytics_processed_date') != null);
217223
}
218224

219225
////////////////////////////////
@@ -960,6 +966,8 @@ class Auth2UserPrefs {
960966

961967
// Favorites
962968

969+
Iterable<String>? get favoritesKeys => _favorites?.keys;
970+
963971
LinkedHashSet<String>? getFavorites(String favoriteKey) {
964972
return (_favorites != null) ? _favorites![favoriteKey] : null;
965973
}
@@ -1036,7 +1044,34 @@ class Auth2UserPrefs {
10361044
}
10371045
}
10381046

1039-
bool isListFavorite(List<Favorite>? favorites) {
1047+
void setFavorite(Favorite? favorite, bool value) {
1048+
if ((favorite != null) && (favorite.favoriteId != null)) {
1049+
LinkedHashSet<String>? favoriteIdsForKey = (_favorites != null) ? _favorites![favorite.favoriteKey] : null;
1050+
bool isFavorite = (favoriteIdsForKey != null) && favoriteIdsForKey.contains(favorite.favoriteId);
1051+
bool isModified = false;
1052+
if (value && !isFavorite) {
1053+
if (favoriteIdsForKey == null) {
1054+
_favorites ??= <String, LinkedHashSet<String>>{};
1055+
// ignore: prefer_collection_literals
1056+
_favorites![favorite.favoriteKey] = favoriteIdsForKey = LinkedHashSet<String>();
1057+
}
1058+
favoriteIdsForKey.add(favorite.favoriteId!);
1059+
isModified = true;
1060+
}
1061+
else if (!value && isFavorite) {
1062+
favoriteIdsForKey.remove(favorite.favoriteId);
1063+
isModified = true;
1064+
}
1065+
1066+
if (isModified) {
1067+
NotificationService().notify(notifyFavoriteChanged, favorite);
1068+
NotificationService().notify(notifyFavoritesChanged);
1069+
NotificationService().notify(notifyChanged, this);
1070+
}
1071+
}
1072+
}
1073+
1074+
bool isListFavorite(Iterable<Favorite>? favorites) {
10401075
if ((favorites != null) && (_favorites != null)) {
10411076
for (Favorite favorite in favorites) {
10421077
if (!isFavorite(favorite)) {
@@ -1048,34 +1083,40 @@ class Auth2UserPrefs {
10481083
return false;
10491084
}
10501085

1051-
void setListFavorite(List<Favorite>? favorites, bool shouldFavorite, {Favorite? sourceFavorite}) {
1086+
void setListFavorite(Iterable<Favorite>? favorites, bool shouldFavorite, {Favorite? sourceFavorite}) {
10521087
if (favorites != null) {
1053-
_favorites ??= <String, LinkedHashSet<String>>{};
10541088

1089+
bool isModified = false;
10551090
for (Favorite favorite in favorites) {
1056-
LinkedHashSet<String>? favoriteIdsForKey = _favorites![favorite.favoriteKey];
1057-
bool isFavorite = (favoriteIdsForKey != null) && favoriteIdsForKey.contains(favorite.favoriteId);
1058-
if (isFavorite && !shouldFavorite) {
1059-
favoriteIdsForKey.remove(favorite.favoriteId);
1060-
}
1061-
else if (!isFavorite && shouldFavorite) {
1062-
if (favoriteIdsForKey == null) {
1063-
// ignore: prefer_collection_literals
1064-
_favorites![favorite.favoriteKey] = favoriteIdsForKey = LinkedHashSet<String>();
1091+
if (favorite.favoriteId != null) {
1092+
LinkedHashSet<String>? favoriteIdsForKey = (_favorites != null) ? _favorites![favorite.favoriteKey] : null;
1093+
bool isFavorite = (favoriteIdsForKey != null) && favoriteIdsForKey.contains(favorite.favoriteId);
1094+
if (shouldFavorite && !isFavorite) {
1095+
if (favoriteIdsForKey == null) {
1096+
_favorites ??= <String, LinkedHashSet<String>>{};
1097+
// ignore: prefer_collection_literals
1098+
_favorites![favorite.favoriteKey] = favoriteIdsForKey = LinkedHashSet<String>();
1099+
}
1100+
favoriteIdsForKey.add(favorite.favoriteId!);
1101+
}
1102+
else if (!shouldFavorite && isFavorite) {
1103+
favoriteIdsForKey.remove(favorite.favoriteId);
10651104
}
1066-
SetUtils.add(favoriteIdsForKey, favorite.favoriteId);
1105+
NotificationService().notify(notifyFavoriteChanged, favorite);
1106+
isModified = true;
10671107
}
1068-
NotificationService().notify(notifyFavoriteChanged, favorite);
10691108
}
1070-
if (sourceFavorite != null) {
1071-
NotificationService().notify(notifyFavoriteChanged, sourceFavorite);
1109+
if (isModified) {
1110+
if (sourceFavorite != null) {
1111+
NotificationService().notify(notifyFavoriteChanged, sourceFavorite);
1112+
}
1113+
NotificationService().notify(notifyFavoritesChanged);
1114+
NotificationService().notify(notifyChanged, this);
10721115
}
1073-
NotificationService().notify(notifyFavoritesChanged);
1074-
NotificationService().notify(notifyChanged, this);
10751116
}
10761117
}
10771118

1078-
void toggleListFavorite(List<Favorite>? favorites, {Favorite? sourceFavorite}) {
1119+
void toggleListFavorite(Iterable<Favorite>? favorites, {Favorite? sourceFavorite}) {
10791120
setListFavorite(favorites, !isListFavorite(favorites), sourceFavorite: sourceFavorite);
10801121
}
10811122

@@ -1384,22 +1425,23 @@ class Auth2UserPrefs {
13841425
}
13851426
// Settings
13861427

1387-
bool? getBoolSetting({String? settingName, bool? defaultValue}){
1388-
return JsonUtils.boolValue(getSetting(settingName: settingName)) ?? defaultValue;
1389-
}
1428+
bool? getBoolSetting(String? settingName, { bool? defaultValue }) =>
1429+
JsonUtils.boolValue(getSetting(settingName)) ?? defaultValue;
13901430

1391-
dynamic getSetting({String? settingName}){
1392-
if(_settings?.isNotEmpty ?? false){
1393-
return _settings![settingName];
1394-
}
1431+
int? getIntSetting(String? settingName, { int? defaultValue }) =>
1432+
JsonUtils.intValue(getSetting(settingName)) ?? defaultValue;
13951433

1396-
return null;//consider default TBD
1397-
}
1398-
1399-
void applySetting(String settingName, dynamic settingValue){
1400-
_settings ??= <String, dynamic>{};
1401-
_settings![settingName] = settingValue;
1434+
dynamic getSetting(String? settingName) =>
1435+
(_settings != null) ? _settings![settingName] : null;
14021436

1437+
void applySetting(String settingName, dynamic settingValue) {
1438+
if (settingValue != null) {
1439+
_settings ??= <String, dynamic>{};
1440+
_settings![settingName] = settingValue;
1441+
}
1442+
else if (_settings != null) {
1443+
_settings!.remove(settingName);
1444+
}
14031445
NotificationService().notify(notifySettingsChanged);
14041446
NotificationService().notify(notifyChanged, this);
14051447
}

lib/model/event.dart

+15
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,21 @@ class Event with Explore, Favorite {
681681
return isRecurring || (isSuperEvent == true);
682682
}
683683

684+
bool get isMultiEvent {
685+
return isComposite || isMoreThanOneDay;
686+
}
687+
688+
bool get isMoreThanOneDay {
689+
int eventDays = (endDateGmt?.difference(startDateGmt!).inDays ?? 0).abs();
690+
return (eventDays >= 1);
691+
}
692+
693+
bool get isNotTheSameYear {
694+
int startYear = startDateGmt?.year ?? 0;
695+
int endYear = endDateGmt?.year ?? 0;
696+
return (startYear != endYear);
697+
}
698+
684699
static List<Map<String, dynamic>>? _constructSubEventsMap(List<dynamic>? subEventsJson) {
685700
if (subEventsJson == null || subEventsJson.isEmpty) {
686701
return null;

0 commit comments

Comments
 (0)