From 943e2301c9c99bd07cbd7ee1dbd000e2b7ffa7ab Mon Sep 17 00:00:00 2001 From: Mladen Dryankov Date: Tue, 23 Mar 2021 18:44:30 +0200 Subject: [PATCH 01/21] Changelog 2.9 --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0b6ca8b..6acbd4ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased -### Changed + +## [2.9.22] - 2021-03-22 +### Fixed - Undo changing permission request buttons to "Continue" [#560](https://github.com/rokwire/safer-illinois-app/issues/560). - Unload web page when the app is in background [#580](https://github.com/rokwire/safer-illinois-app/issues/580). - Cleaned up Covid19TestLocationsPanel. From 4efbbf533969c7bd170e73ef5f6a3cdf7bceb4b4 Mon Sep 17 00:00:00 2001 From: Mladen Dryankov Date: Thu, 1 Apr 2021 11:24:36 +0300 Subject: [PATCH 02/21] Many students and employees using phone verification [#584] --- CHANGELOG.md | 2 ++ lib/ui/onboarding/OnboardingLoginPhoneConfirmPanel.dart | 1 + 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6acbd4ea..e0b88408 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased +### Fixed +- Many students and employees using phone verification [#584](https://github.com/rokwire/safer-illinois-app/issues/560). ## [2.9.22] - 2021-03-22 ### Fixed diff --git a/lib/ui/onboarding/OnboardingLoginPhoneConfirmPanel.dart b/lib/ui/onboarding/OnboardingLoginPhoneConfirmPanel.dart index 3475163f..600d5d29 100644 --- a/lib/ui/onboarding/OnboardingLoginPhoneConfirmPanel.dart +++ b/lib/ui/onboarding/OnboardingLoginPhoneConfirmPanel.dart @@ -215,6 +215,7 @@ class _OnboardingLoginPhoneConfirmPanelState extends State Date: Thu, 1 Apr 2021 11:32:29 +0300 Subject: [PATCH 03/21] Wrong ticket number [#584] --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0b88408..e2d2bf1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ### Fixed -- Many students and employees using phone verification [#584](https://github.com/rokwire/safer-illinois-app/issues/560). +- Many students and employees using phone verification [#584](https://github.com/rokwire/safer-illinois-app/issues/584). ## [2.9.22] - 2021-03-22 ### Fixed From e5cef70dba64065bf45e1ba362abefdfa7f31dac Mon Sep 17 00:00:00 2001 From: Mladen Dryankov Date: Thu, 22 Apr 2021 16:48:14 +0300 Subject: [PATCH 04/21] Remove Retry button [#602] --- CHANGELOG.md | 1 + lib/ui/settings/SettingsHomePanel.dart | 23 ++--------------------- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9224c0c5..b06e8bf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased +- On Setting screen, Disable Covid-19 section for the user who didn't verify the identity [#602](https://github.com/rokwire/safer-illinois-app/issues/602). ## [2.10.18] - 2021-04-19 ### Changed diff --git a/lib/ui/settings/SettingsHomePanel.dart b/lib/ui/settings/SettingsHomePanel.dart index 9ac77e61..2c3eeb46 100644 --- a/lib/ui/settings/SettingsHomePanel.dart +++ b/lib/ui/settings/SettingsHomePanel.dart @@ -661,19 +661,9 @@ class _SettingsHomePanelState extends State implements Notifi child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container(height: 10,), Text(Localization().getStringEx('panel.settings.home.covid19.text.user.fail', 'Unable to retrieve user COVID-19 settings.') , style: TextStyle(color: Styles().colors.textBackground, fontFamily: Styles().fontFamilies.regular, fontSize: 16)), - Container(height: 4,), -// Row(children: [ - ScalableRoundedButton( - label: Localization().getStringEx('panel.settings.home.covid19.button.retry.title', 'Retry'), - backgroundColor: Styles().colors.background, - fontSize: 16.0, - padding: EdgeInsets.symmetric(horizontal: 24), - textColor: Styles().colors.fillColorPrimary, - borderColor: Styles().colors.fillColorPrimary, - onTap: _onTapCovid19Login - ), -// ],) + Container(height: 10,), ],) )); } @@ -900,15 +890,6 @@ class _SettingsHomePanelState extends State implements Notifi } } - void _onTapCovid19Login() { - if (Connectivity().isNotOffline) { - Analytics.instance.logSelect(target: "Retry"); - _refreshHealthUser(); - } else { - AppAlert.showOfflineMessage(context); - } - } - void _onTapCovid19ResetKeys() { if (Connectivity().isNotOffline) { Analytics.instance.logSelect(target: "Reset"); From 54f24bdb0844584f84f6c4819ee2341aca768a2b Mon Sep 17 00:00:00 2001 From: Mladen Dryankov Date: Thu, 22 Apr 2021 17:26:53 +0300 Subject: [PATCH 05/21] Refix appropriately #602 --- lib/ui/settings/SettingsHomePanel.dart | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lib/ui/settings/SettingsHomePanel.dart b/lib/ui/settings/SettingsHomePanel.dart index 2c3eeb46..c7626dde 100644 --- a/lib/ui/settings/SettingsHomePanel.dart +++ b/lib/ui/settings/SettingsHomePanel.dart @@ -664,6 +664,23 @@ class _SettingsHomePanelState extends State implements Notifi Container(height: 10,), Text(Localization().getStringEx('panel.settings.home.covid19.text.user.fail', 'Unable to retrieve user COVID-19 settings.') , style: TextStyle(color: Styles().colors.textBackground, fontFamily: Styles().fontFamilies.regular, fontSize: 16)), Container(height: 10,), + Visibility( + visible: Auth().isLoggedIn, + child: Column( + children: [ + ScalableRoundedButton( + label: Localization().getStringEx('panel.settings.home.covid19.button.retry.title', 'Retry'), + backgroundColor: Styles().colors.background, + fontSize: 16.0, + padding: EdgeInsets.symmetric(horizontal: 24), + textColor: Styles().colors.fillColorPrimary, + borderColor: Styles().colors.fillColorPrimary, + onTap: _onTapCovid19Login + ), + Container(height: 10,), + ], + ), + ), ],) )); } @@ -890,6 +907,15 @@ class _SettingsHomePanelState extends State implements Notifi } } + void _onTapCovid19Login() { + if (Connectivity().isNotOffline) { + Analytics.instance.logSelect(target: "Retry"); + _refreshHealthUser(); + } else { + AppAlert.showOfflineMessage(context); + } + } + void _onTapCovid19ResetKeys() { if (Connectivity().isNotOffline) { Analytics.instance.logSelect(target: "Reset"); From 7657ab345613686787586c6b78404eae06ed61aa Mon Sep 17 00:00:00 2001 From: Mihail Varbanov Date: Fri, 23 Apr 2021 12:15:48 +0300 Subject: [PATCH 06/21] Fixed mailto and tel URLs in Wellness Center Panel (#601). --- lib/ui/health/HealthWellnessCenterPanel.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ui/health/HealthWellnessCenterPanel.dart b/lib/ui/health/HealthWellnessCenterPanel.dart index 9366cb81..cdb94cd1 100644 --- a/lib/ui/health/HealthWellnessCenterPanel.dart +++ b/lib/ui/health/HealthWellnessCenterPanel.dart @@ -90,10 +90,10 @@ class HealthWellnessCenterPanel extends StatelessWidget{ } void onEmailTapped(){ - launch('mailto: covidwellness@illinois.edu'); + launch('mailto:covidwellness@illinois.edu'); } void onCallTapped(){ - launch('tel://+12173331900'); + launch('tel:+12173331900'); } } \ No newline at end of file From 0de3837da7880912508e274ed4cf4ab86e082d01 Mon Sep 17 00:00:00 2001 From: Mihail Varbanov Date: Fri, 23 Apr 2021 12:16:50 +0300 Subject: [PATCH 07/21] Updated CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b06e8bf0..5c57dcc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased +- Fixed mailto and tel URLs in Wellness Center Panel [#601](https://github.com/rokwire/safer-illinois-app/issues/601). - On Setting screen, Disable Covid-19 section for the user who didn't verify the identity [#602](https://github.com/rokwire/safer-illinois-app/issues/602). ## [2.10.18] - 2021-04-19 From 95bcb8b69ab9924b9cc42602840310b1df34d2dd Mon Sep 17 00:00:00 2001 From: Mihail Varbanov Date: Fri, 23 Apr 2021 12:59:25 +0300 Subject: [PATCH 08/21] Hide COVID-19 section from Settings panel if the user is not logged in (#602). --- assets/flexUI.json | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/flexUI.json b/assets/flexUI.json index a8742e6c..10c51361 100644 --- a/assets/flexUI.json +++ b/assets/flexUI.json @@ -42,6 +42,7 @@ "settings.connect" : { "loggedIn": false }, "settings.connected" : { "loggedIn": true }, "settings.account" : { "loggedIn": true }, + "settings.covid19" : { "loggedIn": true }, "settings.connected.netid" : { "shibbolethLoggedIn": true }, "settings.connected.phone" : { "phoneLoggedIn": true }, "settings.connected.netid.info" : { "shibbolethLoggedIn": true }, From 1b491d364dd362d134fd60aef1f63ee781dcebc7 Mon Sep 17 00:00:00 2001 From: Mihail Varbanov Date: Fri, 23 Apr 2021 13:00:48 +0300 Subject: [PATCH 09/21] Display progress indicator in COVID-19 section from Settings Panel while Health service is refreshing the user. Do not display any content in COVID-19 section if the user is not authenticated. (#602) --- lib/service/Health.dart | 4 + lib/ui/settings/SettingsHomePanel.dart | 109 +++++++++++++------------ 2 files changed, 60 insertions(+), 53 deletions(-) diff --git a/lib/service/Health.dart b/lib/service/Health.dart index b4ffdf54..2abbf516 100644 --- a/lib/service/Health.dart +++ b/lib/service/Health.dart @@ -222,6 +222,10 @@ class Health with Service implements NotificationsListener { return (_refreshFuture != null); } + bool get refreshingUser { + return (_refreshFuture != null) && (_refreshOptions?.user == true); + } + Future refreshStatus() async { return _refresh(_RefreshOptions.fromList([_RefreshOption.userInterval, _RefreshOption.history, _RefreshOption.rules, _RefreshOption.buildingAccessRules])); } diff --git a/lib/ui/settings/SettingsHomePanel.dart b/lib/ui/settings/SettingsHomePanel.dart index c7626dde..27fd35f5 100644 --- a/lib/ui/settings/SettingsHomePanel.dart +++ b/lib/ui/settings/SettingsHomePanel.dart @@ -90,6 +90,7 @@ class _SettingsHomePanelState extends State implements Notifi Auth.notifyUserPiiDataChanged, UserProfile.notifyProfileUpdated, Health.notifyUserUpdated, + Health.notifyRefreshing, FirebaseMessaging.notifySettingUpdated, FlexUI.notifyChanged, ]); @@ -116,6 +117,8 @@ class _SettingsHomePanelState extends State implements Notifi _updateState(); } else if (name == Health.notifyUserUpdated) { _verifyHealthUserKeys(); + } else if (name == Health.notifyRefreshing) { + _updateState(); } else if (name == FirebaseMessaging.notifySettingUpdated) { _updateState(); } else if (name == FlexUI.notifyChanged) { @@ -645,29 +648,27 @@ class _SettingsHomePanelState extends State implements Notifi Widget _buildCovid19Settings() { - List contentList = new List(); + List contentList = List(); - if (_refreshingHealthUser == true) { - contentList.add(Container( - padding: EdgeInsets.all(16), - child: Center(child: - CircularProgressIndicator(valueColor: AlwaysStoppedAnimation(Styles().colors.fillColorSecondary), strokeWidth: 2,) - ,), - )); - } - else if (Health().user == null) { - contentList.add(Container( - padding: EdgeInsets.only(left: 8), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container(height: 10,), - Text(Localization().getStringEx('panel.settings.home.covid19.text.user.fail', 'Unable to retrieve user COVID-19 settings.') , style: TextStyle(color: Styles().colors.textBackground, fontFamily: Styles().fontFamilies.regular, fontSize: 16)), - Container(height: 10,), - Visibility( - visible: Auth().isLoggedIn, - child: Column( - children: [ + if (Auth().isLoggedIn) { + if ((_refreshingHealthUser == true) || Health().refreshingUser) { + contentList.add(Container( + padding: EdgeInsets.all(16), + child: Center(child: + CircularProgressIndicator(valueColor: AlwaysStoppedAnimation(Styles().colors.fillColorSecondary), strokeWidth: 2,) + ,), + )); + } + else if (Health().user == null) { + contentList.add(Container( + padding: EdgeInsets.only(left: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container(height: 10,), + Text(Localization().getStringEx('panel.settings.home.covid19.text.user.fail', 'Unable to retrieve user COVID-19 settings.') , style: TextStyle(color: Styles().colors.textBackground, fontFamily: Styles().fontFamilies.regular, fontSize: 16)), + Container(height: 10,), + Column(children: [ ScalableRoundedButton( label: Localization().getStringEx('panel.settings.home.covid19.button.retry.title', 'Retry'), backgroundColor: Styles().colors.background, @@ -680,42 +681,44 @@ class _SettingsHomePanelState extends State implements Notifi Container(height: 10,), ], ), - ), - ],) - )); - } - else { - List codes = FlexUI()['settings.covid19'] ?? []; - for (int index = 0; index < codes.length; index++) { - String code = codes[index]; - BorderRadius borderRadius = _borderRadiusFromIndex(index, codes.length); - if (code == 'exposure_notifications') { - contentList.add(ToggleRibbonButton( - height: null, - borderRadius: borderRadius, - label: Localization().getStringEx("panel.settings.home.covid19.exposure_notifications", "Exposure Notifications"), - toggled: (Health().user?.exposureNotification == true), - context: context, - onTap: _onExposureNotifications)); - } - else if (code == 'provider_test_result') { - contentList.add(ToggleRibbonButton( - height: null, - borderRadius: borderRadius, - label: Localization().getStringEx("panel.settings.home.covid19.provider_test_result", "Health Provider Test Results"), - toggled: (Health().user?.consent == true), - context: context, - onTap: _onProviderTestResult)); - } - else if (code == 'qr_code') { - contentList.add(Padding(padding: EdgeInsets.only(left: 8, top: 16), child: _buildCovid19KeysSection(),)); + ],) + )); + } + else { + List codes = FlexUI()['settings.covid19'] ?? []; + for (int index = 0; index < codes.length; index++) { + String code = codes[index]; + BorderRadius borderRadius = _borderRadiusFromIndex(index, codes.length); + if (code == 'exposure_notifications') { + contentList.add(ToggleRibbonButton( + height: null, + borderRadius: borderRadius, + label: Localization().getStringEx("panel.settings.home.covid19.exposure_notifications", "Exposure Notifications"), + toggled: (Health().user?.exposureNotification == true), + context: context, + onTap: _onExposureNotifications)); + } + else if (code == 'provider_test_result') { + contentList.add(ToggleRibbonButton( + height: null, + borderRadius: borderRadius, + label: Localization().getStringEx("panel.settings.home.covid19.provider_test_result", "Health Provider Test Results"), + toggled: (Health().user?.consent == true), + context: context, + onTap: _onProviderTestResult)); + } + else if (code == 'qr_code') { + contentList.add(Padding(padding: EdgeInsets.only(left: 8, top: 16), child: _buildCovid19KeysSection(),)); + } } } } - return _OptionsSection( + return (0 < contentList.length) ? + _OptionsSection( title: Localization().getStringEx("panel.settings.home.covid19.title", "COVID-19"), - widgets: contentList); + widgets: contentList) : + Container(); } Widget _buildCovid19KeysSection() { From 19be3eb3feee5dd0a87b2f075da3265bdb5ac8ef Mon Sep 17 00:00:00 2001 From: Mihail Varbanov Date: Fri, 23 Apr 2021 13:00:56 +0300 Subject: [PATCH 10/21] Updated CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c57dcc3..96c12d88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased - Fixed mailto and tel URLs in Wellness Center Panel [#601](https://github.com/rokwire/safer-illinois-app/issues/601). -- On Setting screen, Disable Covid-19 section for the user who didn't verify the identity [#602](https://github.com/rokwire/safer-illinois-app/issues/602). +- Remove Covid-19 section from Settings panel if the user is not logged in, improved control of progress indicator inside [#602](https://github.com/rokwire/safer-illinois-app/issues/602). ## [2.10.18] - 2021-04-19 ### Changed From c0726bf29783a7672c41c2165c5b34eb4730d84a Mon Sep 17 00:00:00 2001 From: Mladen Dryankov Date: Fri, 23 Apr 2021 13:44:04 +0300 Subject: [PATCH 11/21] Show current date time under Building Access status panel [#604] --- CHANGELOG.md | 1 + lib/ui/health/HealthStatusPanel.dart | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96c12d88..8e6812f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased +- Show current date time under Building Access Status [#604](https://github.com/rokwire/safer-illinois-app/issues/604). - Fixed mailto and tel URLs in Wellness Center Panel [#601](https://github.com/rokwire/safer-illinois-app/issues/601). - Remove Covid-19 section from Settings panel if the user is not logged in, improved control of progress indicator inside [#602](https://github.com/rokwire/safer-illinois-app/issues/602). diff --git a/lib/ui/health/HealthStatusPanel.dart b/lib/ui/health/HealthStatusPanel.dart index 52d90785..694fcd7c 100644 --- a/lib/ui/health/HealthStatusPanel.dart +++ b/lib/ui/health/HealthStatusPanel.dart @@ -15,6 +15,7 @@ */ import 'dart:typed_data'; +import 'package:intl/intl.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; @@ -211,6 +212,7 @@ class _HealthStatusPanelState extends State implements Notifi Widget _buildAccesLayout() { String imageAsset = (Health().buildingAccessGranted == true) ? 'images/group-20.png' : 'images/group-28.png'; + String currentDateTime = DateFormat("MMM d, yyyy HH:mm a").format(DateTime.now()); String accessText; switch (Health().buildingAccessGranted) { case true: accessText = Localization().getStringEx("panel.covid19_passport.label.access.granted", "GRANTED"); break; @@ -221,9 +223,10 @@ class _HealthStatusPanelState extends State implements Notifi Column(children: [ Container(height: 15,), Image.asset(imageAsset, excludeFromSemantics: true,), - Container(height: 7,), + Container(height: 5,), Text(Localization().getStringEx("panel.covid19_passport.label.access.heading", "Building Access"), style: TextStyle(fontFamily: Styles().fontFamilies.medium, fontSize: 16, color: Styles().colors.fillColorPrimary),), - Container(height: 6,), + Text(currentDateTime, style: TextStyle(fontFamily: Styles().fontFamilies.bold, fontSize: 16, color: Styles().colors.fillColorPrimary),), + Container(height: 15,), Text(accessText ?? '', style: TextStyle(fontFamily: Styles().fontFamilies.medium, fontSize: 28, color: Styles().colors.fillColorPrimary),), ],), )), From 79a9f7850ddf7b05bdc2d584c57412e36d4d2ee4 Mon Sep 17 00:00:00 2001 From: Mihail Varbanov Date: Fri, 23 Apr 2021 16:53:22 +0300 Subject: [PATCH 12/21] Indicate that location text is clickable in TestLocations panel (#597). --- CHANGELOG.md | 1 + assets/strings.en.json | 5 +- assets/strings.es.json | 5 +- assets/strings.zh.json | 5 +- lib/ui/health/HealthTestLocationsPanel.dart | 59 ++++++++++++++------- 5 files changed, 50 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e6812f0..3d7b250c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Show current date time under Building Access Status [#604](https://github.com/rokwire/safer-illinois-app/issues/604). - Fixed mailto and tel URLs in Wellness Center Panel [#601](https://github.com/rokwire/safer-illinois-app/issues/601). - Remove Covid-19 section from Settings panel if the user is not logged in, improved control of progress indicator inside [#602](https://github.com/rokwire/safer-illinois-app/issues/602). +- Indicate that location text is clickable in TestLocations panel [#597](https://github.com/rokwire/safer-illinois-app/issues/597). ## [2.10.18] - 2021-04-19 ### Changed diff --git a/assets/strings.en.json b/assets/strings.en.json index 0b56834f..9055ef92 100644 --- a/assets/strings.en.json +++ b/assets/strings.en.json @@ -338,8 +338,9 @@ "panel.covid19_test_locations.header.title": "Test Locations", "panel.covid19_test_locations.label.contact.title": "Contact", - "panel.covid19_test_locations.distance.text": "mi away get directions", - "panel.covid19_test_locations.distance.unknown": "unknown distance", + "panel.covid19_test_locations.distance.text": "mi away", + "panel.covid19_test_locations.distance.directions.text": "get directions", + "panel.covid19_test_locations.location.unknown": "unknown location", "panel.covid19_test_locations.work_time.unknown": "Unknown working time", "panel.covid19_test_locations.work_time.open_until": "Open until", "panel.covid19_test_locations.work_time.closed_until": "Closed until", diff --git a/assets/strings.es.json b/assets/strings.es.json index f113819e..507d53ed 100644 --- a/assets/strings.es.json +++ b/assets/strings.es.json @@ -338,8 +338,9 @@ "panel.covid19_test_locations.header.title": "Lugares de prueba", "panel.covid19_test_locations.label.contact.title": "Contacto", - "panel.covid19_test_locations.distance.text": "mi distancia y obtener direcciones", - "panel.covid19_test_locations.distance.unknown": "distancia desconocida", + "panel.covid19_test_locations.distance.text": "mi distancia", + "panel.covid19_test_locations.distance.directions.text": "obtener las direcciones", + "panel.covid19_test_locations.location.unknown": "ubicación desconocida", "panel.covid19_test_locations.work_time.unknown": "Tiempo de trabajo desconocido", "panel.covid19_test_locations.work_time.open_until": "Abierto hasta", "panel.covid19_test_locations.work_time.closed_until": "Cerrado hasta", diff --git a/assets/strings.zh.json b/assets/strings.zh.json index 4336ff54..47f8b79d 100644 --- a/assets/strings.zh.json +++ b/assets/strings.zh.json @@ -338,8 +338,9 @@ "panel.covid19_test_locations.header.title": "测试位置", "panel.covid19_test_locations.label.contact.title": "联系人", - "panel.covid19_test_locations.distance.text": "寻路", - "panel.covid19_test_locations.distance.unknown": "未知距离", + "panel.covid19_test_locations.distance.text": "英里遠", + "panel.covid19_test_locations.distance.directions.text": "獲取路線", + "panel.covid19_test_locations.location.unknown": "未知的位置", "panel.covid19_test_locations.work_time.unknown": "未知工作时间", "panel.covid19_test_locations.work_time.open_until": "打开到", "panel.covid19_test_locations.work_time.closed_until": "关闭到", diff --git a/lib/ui/health/HealthTestLocationsPanel.dart b/lib/ui/health/HealthTestLocationsPanel.dart index 2cefa7ff..9f05b06b 100644 --- a/lib/ui/health/HealthTestLocationsPanel.dart +++ b/lib/ui/health/HealthTestLocationsPanel.dart @@ -387,13 +387,43 @@ class _TestLocation extends StatelessWidget { final HealthServiceLocation testLocation; final double distance; - _TestLocation({this.testLocation, this.distance = 0}); + _TestLocation({this.testLocation, this.distance}); @override Widget build(BuildContext context) { - - String distanceSufix = Localization().getStringEx("panel.covid19_test_locations.distance.text","mi away get directions"); - String distanceText = distance?.toStringAsFixed(2); + + bool canLocation = (testLocation?.latitude != null) && (testLocation?.longitude != null); + TextStyle textStyle = TextStyle(fontFamily: Styles().fontFamilies.regular, fontSize: 16, color: Styles().colors.textSurface,); + TextStyle linkStyle = TextStyle(fontFamily: Styles().fontFamilies.regular, fontSize: 16, color: Styles().colors.accentColor3, decoration: TextDecoration.underline); + + List locationContent = [ + Image.asset('images/icon-location.png',excludeFromSemantics: true), + Container(width: 8), + ]; + + if ((distance != null) && (distance > 0)) { + String distanceText = distance.toStringAsFixed(2) + Localization().getStringEx("panel.covid19_test_locations.distance.text", "mi away"); + locationContent.add(Text(distanceText, style: textStyle,)); + if (canLocation) { + String directionsText = Localization().getStringEx("panel.covid19_test_locations.distance.directions.text", "get directions"); + locationContent.addAll([ + Text(" (", style: textStyle,), + Text(directionsText, style: linkStyle,), + Text(")", style: textStyle,), + ]); + } + } + else if (testLocation?.fullAddress != null) { + locationContent.add( + Text(testLocation.fullAddress, style: canLocation ? linkStyle : textStyle, + )); + } + else { + String unknownLocationText = Localization().getStringEx("panel.covid19_test_locations.location.unknown", "unknown location"); + locationContent.add( + Text(unknownLocationText, style: canLocation ? linkStyle : textStyle, + )); + } return Semantics(button: false, container: true, child: @@ -413,21 +443,12 @@ class _TestLocation extends StatelessWidget { Semantics(button: true, child: GestureDetector( onTap: _onTapAddress, - child: Container( - padding: EdgeInsets.only(top: 8, bottom: 4), - child: Row( - children: [ - Image.asset('images/icon-location.png',excludeFromSemantics: true), - Container(width: 8,), - Expanded(child: - Text( - distance > 0 ? '$distanceText' + distanceSufix: - (testLocation?.fullAddress?? Localization().getStringEx("panel.covid19_test_locations.distance.unknown","unknown distance")), - style: TextStyle(fontFamily: Styles().fontFamilies.regular, fontSize: 16, color: Styles().colors.textSurface, ), - ) - ) - ], - )), + child: Padding( + padding: EdgeInsets.only(top: 8, bottom: 4), + child: Row( + children: locationContent, + ) + ), )), /*Semantics(label: Localization().getStringEx("panel.covid19_test_locations.call.hint","Call"), button: true, child: GestureDetector( From 4ec3708fb21edd481727d0da2319953daa07a0ef Mon Sep 17 00:00:00 2001 From: Mihail Varbanov Date: Fri, 23 Apr 2021 17:51:03 +0300 Subject: [PATCH 13/21] Update current date time in Health Status panel (#604). --- lib/ui/health/HealthStatusPanel.dart | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/lib/ui/health/HealthStatusPanel.dart b/lib/ui/health/HealthStatusPanel.dart index 694fcd7c..2886c7f0 100644 --- a/lib/ui/health/HealthStatusPanel.dart +++ b/lib/ui/health/HealthStatusPanel.dart @@ -14,6 +14,7 @@ * limitations under the License. */ +import 'dart:async'; import 'dart:typed_data'; import 'package:intl/intl.dart'; @@ -48,6 +49,8 @@ class _HealthStatusPanelState extends State implements Notifi List _counties; Color _colorOfTheDay; + String _currentDateTime; + Timer _currentDateTimeTimer; MemoryImage _photoImage; bool _netIdStatusChecked; bool _loading; @@ -57,9 +60,14 @@ class _HealthStatusPanelState extends State implements Notifi @override void initState() { super.initState(); + NotificationService().subscribe(this, [ Health.notifyStatusUpdated, ]); + + _currentDateTime = _getCurrentDateTime(); + _currentDateTimeTimer = Timer.periodic(const Duration(seconds: 1), _updateCurrentDateTime); + _initData(); } @@ -67,6 +75,11 @@ class _HealthStatusPanelState extends State implements Notifi void dispose() { super.dispose(); NotificationService().unsubscribe(this); + + if (_currentDateTimeTimer != null) { + _currentDateTimeTimer.cancel(); + _currentDateTimeTimer = null; + } } @override @@ -460,6 +473,22 @@ class _HealthStatusPanelState extends State implements Notifi Color get _backgroundColor { return Styles().colors.background; } + + static String _getCurrentDateTime() { + return DateFormat("MMM d, yyyy HH:mm a").format(DateTime.now()); + } + + void _updateCurrentDateTime(_) { + if (mounted && (_loading != true)) { + String currentDateTime = _getCurrentDateTime(); + if (currentDateTime != _currentDateTime) { + setState(() { + _currentDateTime = currentDateTime; + }); + } + } + } + } class _RotatingBorder extends StatefulWidget{ From 9979386d81f97ccedc5a12feff0cd1584541a653 Mon Sep 17 00:00:00 2001 From: Mihail Varbanov Date: Fri, 23 Apr 2021 17:58:53 +0300 Subject: [PATCH 14/21] version: 2.10.20+1020 --- CHANGELOG.md | 5 +++++ pubspec.yaml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d7b250c..7eb4c201 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased + +## [2.10.20] - 2021-04-23 - Show current date time under Building Access Status [#604](https://github.com/rokwire/safer-illinois-app/issues/604). - Fixed mailto and tel URLs in Wellness Center Panel [#601](https://github.com/rokwire/safer-illinois-app/issues/601). - Remove Covid-19 section from Settings panel if the user is not logged in, improved control of progress indicator inside [#602](https://github.com/rokwire/safer-illinois-app/issues/602). - Indicate that location text is clickable in TestLocations panel [#597](https://github.com/rokwire/safer-illinois-app/issues/597). +## [2.10.19] - 2021-04-21 +Build number 1019 was taken by 2.9.22 release + ## [2.10.18] - 2021-04-19 ### Changed - Update FlexUI content from app assets [#595](https://github.com/rokwire/safer-illinois-app/issues/595). diff --git a/pubspec.yaml b/pubspec.yaml index b70cbdc1..b38f04c4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ description: Illinois client application. # 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: 2.10.18+1018 +version: 2.10.20+1020 environment: sdk: ">=2.2.0 <3.0.0" From baa288d5e6ac14995b1e1da4c922ea3a88042f7b Mon Sep 17 00:00:00 2001 From: Mihail Varbanov Date: Mon, 26 Apr 2021 11:45:38 +0300 Subject: [PATCH 15/21] Removed talentChooserUrl and locationsUrl from Config service (unused). --- lib/service/Config.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/service/Config.dart b/lib/service/Config.dart index ff3980a1..2d4b0be4 100644 --- a/lib/service/Config.dart +++ b/lib/service/Config.dart @@ -359,9 +359,7 @@ class Config with Service implements NotificationsListener { String get rokmetroAuthUrl { return platformBuildingBlocks['rokmetro_auth_url']; } // "https://api-dev.rokwire.illinois.edu/authbb/77779" String get sportsServiceUrl { return platformBuildingBlocks['sports_service_url']; } // "https://api-dev.rokwire.illinois.edu/sports-service"; String get healthUrl { return platformBuildingBlocks['health_url']; } // "https://api-dev.rokwire.illinois.edu/health" - String get talentChooserUrl { return platformBuildingBlocks['talent_chooser_url']; } // "https://api-dev.rokwire.illinois.edu/talent-chooser/api/ui-content" String get transportationUrl { return platformBuildingBlocks["transportation_url"]; } // "https://api-dev.rokwire.illinois.edu/transportation" - String get locationsUrl { return platformBuildingBlocks["locations_url"]; } // "https://api-dev.rokwire.illinois.edu/location/api"; String get imagesServiceUrl { return platformBuildingBlocks['images_service_url']; } // "https://api-dev.rokwire.illinois.edu/images-service"; String get osfBaseUrl { return thirdPartyServices['osf_base_url']; } // "https://ssproxy.osfhealthcare.org/fhir-proxy" From d848908930a3948b3eb2734f6119c6a261eee3a5 Mon Sep 17 00:00:00 2001 From: Mihail Varbanov Date: Mon, 26 Apr 2021 13:10:55 +0300 Subject: [PATCH 16/21] Check server time before displaying StatusCardPanel (#611). --- CHANGELOG.md | 1 + assets/strings.en.json | 1 + assets/strings.es.json | 1 + assets/strings.zh.json | 1 + lib/service/Health.dart | 14 +++++++++ lib/ui/health/HealthStatusPanel.dart | 44 ++++++++++++++++++++++------ 6 files changed, 53 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7eb4c201..46bed37e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased +- Check server time before displaying StatusCardPanel [#611](https://github.com/rokwire/safer-illinois-app/issues/611). ## [2.10.20] - 2021-04-23 - Show current date time under Building Access Status [#604](https://github.com/rokwire/safer-illinois-app/issues/604). diff --git a/assets/strings.en.json b/assets/strings.en.json index 9055ef92..c009e615 100644 --- a/assets/strings.en.json +++ b/assets/strings.en.json @@ -274,6 +274,7 @@ "panel.covid19_passport.label.access.granted": "GRANTED", "panel.covid19_passport.label.access.denied": "DENIED", "panel.covid19_passport.message.missing_id_info": "No Illini ID information found. You may have an expired i-card. Please contact the ID Center.", + "panel.covid19_passport.message.incorrect_time": "Your Date & Time is incorrect.", "panel.covid19_passport.button.show_page_1.title": "Show page 1 of 2", "panel.covid19_passport.button.show_page_1.hint": "", "panel.covid19_passport.button.show_page_2.title": "Show page 2 of 2", diff --git a/assets/strings.es.json b/assets/strings.es.json index 507d53ed..77782403 100644 --- a/assets/strings.es.json +++ b/assets/strings.es.json @@ -274,6 +274,7 @@ "panel.covid19_passport.label.access.granted": "CONCEDIDO", "panel.covid19_passport.label.access.denied": "NEGADO", "panel.covid19_passport.message.missing_id_info": "No se encontró información de identificación de Illini. Es posible que tenga una i-card vencida. Comuníquese con el Centro de identificación.", + "panel.covid19_passport.message.incorrect_time": "Tu fecha y hora son incorrectas.", "panel.covid19_passport.button.show_page_1.title": "Mostrar página 1 de 2", "panel.covid19_passport.button.show_page_1.hint": "", "panel.covid19_passport.button.show_page_2.title": "Mostrar página 2 de 2", diff --git a/assets/strings.zh.json b/assets/strings.zh.json index 47f8b79d..e2ca3b98 100644 --- a/assets/strings.zh.json +++ b/assets/strings.zh.json @@ -274,6 +274,7 @@ "panel.covid19_passport.label.access.granted": "授予", "panel.covid19_passport.label.access.denied": "否认", "panel.covid19_passport.message.missing_id_info": "找不到Illini ID信息. 您的I-Card可能已过期。请与ID中心联系.", + "panel.covid19_passport.message.incorrect_time": "您的日期和時間不正確。", "panel.covid19_passport.button.show_page_1.title": "Show page 1 of 2", "panel.covid19_passport.button.show_page_1.hint": "", "panel.covid19_passport.button.show_page_2.title": "Show page 2 of 2", diff --git a/lib/service/Health.dart b/lib/service/Health.dart index 2abbf516..ce49a406 100644 --- a/lib/service/Health.dart +++ b/lib/service/Health.dart @@ -1648,6 +1648,20 @@ class Health with Service implements NotificationsListener { return (HealthHistory.mostRecentVaccine(_history, vaccine: HealthHistoryBlob.VaccineEffective) != null); } + // Current Server Time + + Future getServerTimeUtc() async { + //TMP: return DateTime.now().toUtc(); + String url = (Config().healthUrl != null) ? "${Config().healthUrl}/covid19/time" : null; + Response response = (url != null) ? await Network().get(url, auth: Network.AppAuth) : null; + String responseBody = (response?.statusCode == 200) ? response.body : null; + Map responseJson = (responseBody != null) ? AppJson.decodeMap(responseBody) : null; + String timeString = (responseJson != null) ? AppJson.stringValue(responseJson['time']) : null; + try { return (timeString != null) ? DateTime.parse(timeString) : null; } + catch (e) { print(e?.toString()); } + return null; + } + // Health Family Members List get familyMembers { diff --git a/lib/ui/health/HealthStatusPanel.dart b/lib/ui/health/HealthStatusPanel.dart index 2886c7f0..86f4e054 100644 --- a/lib/ui/health/HealthStatusPanel.dart +++ b/lib/ui/health/HealthStatusPanel.dart @@ -16,6 +16,7 @@ import 'dart:async'; import 'dart:typed_data'; +import 'package:illinois/service/Config.dart'; import 'package:intl/intl.dart'; import 'package:flutter/cupertino.dart'; @@ -49,10 +50,10 @@ class _HealthStatusPanelState extends State implements Notifi List _counties; Color _colorOfTheDay; + DateTime _serverTimeUtc; String _currentDateTime; Timer _currentDateTimeTimer; MemoryImage _photoImage; - bool _netIdStatusChecked; bool _loading; final SwiperController _swiperController = SwiperController(); @@ -97,16 +98,28 @@ class _HealthStatusPanelState extends State implements Notifi Health().refreshStatusAndUser(), Health().loadCounties(), _loadColorOfTheDay(), + _loadServerTimeUtc(), _loadPhotoBytes(), ]).then((List results) { if (mounted) { setState(() { _counties = ((results != null) && (1 < results.length)) ? results[1] : null; _colorOfTheDay = ((results != null) && (2 < results.length)) ? results[2] : null; - _photoImage = ((results != null) && (3 < results.length)) ? results[3] : null; + _serverTimeUtc = ((results != null) && (3 < results.length)) ? results[3] : null; + _photoImage = ((results != null) && (4 < results.length)) ? results[4] : null; _loading = false; }); - _checkNetIdStatus(); + + _checkServerTime().then((bool timeValid) { + if (mounted) { + if (timeValid) { + _checkNetIdStatus(); + } + else { + Navigator.of(context).pop(); + } + } + }); } }); } @@ -115,18 +128,31 @@ class _HealthStatusPanelState extends State implements Notifi return await TransportationService().loadBussColor(deviceId: await NativeCommunicator().getDeviceId(), userId: UserProfile().uuid); } + static Future _loadServerTimeUtc() async { + return await Health().getServerTimeUtc(); + } + static Future _loadPhotoBytes() async { Uint8List photoBytes = await Auth().photoImageBytes; return AppCollection.isCollectionNotEmpty(photoBytes) ? await compute(AppImage.memoryImageWithBytes, photoBytes) : null; } - void _checkNetIdStatus() { - if ((_loading != true) && (_netIdStatusChecked != true)) { - _netIdStatusChecked = true; - if (Auth().isShibbolethLoggedIn && (Auth().authCard?.photoBase64?.length ?? 0) == 0) { - AppAlert.showDialogResult(context, Localization().getStringEx('panel.covid19_passport.message.missing_id_info', 'No Illini ID information found. You may have an expired i-card. Please contact the ID Center.')); - } + Future _checkNetIdStatus() async { + if (Auth().isShibbolethLoggedIn && (Auth().authCard?.photoBase64?.length ?? 0) == 0) { + await AppAlert.showDialogResult(context, Localization().getStringEx('panel.covid19_passport.message.missing_id_info', 'No Illini ID information found. You may have an expired i-card. Please contact the ID Center.')); + return false; + } + return true; + } + + Future _checkServerTime() async { + int offsetInSecs = _serverTimeUtc?.difference(DateTime.now().toUtc())?.inSeconds?.abs(); + int maximumOffsetInSecs = (Config().settings['covid19MaximumServerTimeOffset'] ?? 300); + if ((offsetInSecs == null) || (maximumOffsetInSecs < offsetInSecs)) { + await AppAlert.showDialogResult(context, Localization().getStringEx('panel.covid19_passport.message.incorrect_time', 'Your Date & Time is incorrect.')); + return false; } + return true; } @override From a32e52fbe57a1d05aa63b7e5402433a23e33e0e1 Mon Sep 17 00:00:00 2001 From: Mihail Varbanov Date: Mon, 26 Apr 2021 13:20:14 +0300 Subject: [PATCH 17/21] version: 2.10.21+1021 --- CHANGELOG.md | 8 +++++++- pubspec.yaml | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46bed37e..4f6f89e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,14 +5,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased + +## [2.10.21] - 2021-04-26 +### Added - Check server time before displaying StatusCardPanel [#611](https://github.com/rokwire/safer-illinois-app/issues/611). ## [2.10.20] - 2021-04-23 +### Changed - Show current date time under Building Access Status [#604](https://github.com/rokwire/safer-illinois-app/issues/604). -- Fixed mailto and tel URLs in Wellness Center Panel [#601](https://github.com/rokwire/safer-illinois-app/issues/601). - Remove Covid-19 section from Settings panel if the user is not logged in, improved control of progress indicator inside [#602](https://github.com/rokwire/safer-illinois-app/issues/602). - Indicate that location text is clickable in TestLocations panel [#597](https://github.com/rokwire/safer-illinois-app/issues/597). +### Fixed +- Fixed mailto and tel URLs in Wellness Center Panel [#601](https://github.com/rokwire/safer-illinois-app/issues/601). + ## [2.10.19] - 2021-04-21 Build number 1019 was taken by 2.9.22 release diff --git a/pubspec.yaml b/pubspec.yaml index b38f04c4..dca34da1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ description: Illinois client application. # 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: 2.10.20+1020 +version: 2.10.21+1021 environment: sdk: ">=2.2.0 <3.0.0" From eeab282500e8a21f98700eb909edbf5f75bc5362 Mon Sep 17 00:00:00 2001 From: Mihail Varbanov Date: Tue, 27 Apr 2021 16:21:53 +0300 Subject: [PATCH 18/21] Make sure to put all network calls in try/catch statement, handle HandshakeException: Handshake error in client (OS Error: CERTIFICATE_VERIFY_FAILED: certificate is not yet valid (handshake.cc:354)). --- lib/service/Network.dart | 89 +++++++++++++++++++++++++++------------- 1 file changed, 60 insertions(+), 29 deletions(-) diff --git a/lib/service/Network.dart b/lib/service/Network.dart index 270e5ddb..b9b4f09d 100644 --- a/lib/service/Network.dart +++ b/lib/service/Network.dart @@ -111,7 +111,7 @@ class Network { return (responseStream != null) ? Http.Response.fromStream(responseStream) : null; } } catch (e) { - Log.e(e.toString()); + Log.d(e?.toString()); FirebaseCrashlytics().recordError(e, null); } return null; @@ -142,7 +142,7 @@ class Network { return response; } } catch (e) { - Log.e(e.toString()); + Log.d(e?.toString()); FirebaseCrashlytics().recordError(e, null); } } @@ -150,12 +150,18 @@ class Network { } Future get(url, { String body, Encoding encoding, Map headers, int auth, Http.Client client, int timeout = 60, bool sendAnalytics = true, String analyticsUrl, bool analyticsAnonymous }) async { - Http.Response response = await _get(url, headers: headers, body: body, encoding: encoding, auth: auth, client: client, timeout: timeout); - - if (_requiresTokenRefresh(response, auth)) { - if (await _refreshToken(auth) != null) { - response = await _get(url, headers: headers, body: body, encoding: encoding, auth: auth, client: client, timeout: timeout); + Http.Response response; + try { + response = await _get(url, headers: headers, body: body, encoding: encoding, auth: auth, client: client, timeout: timeout); + + if (_requiresTokenRefresh(response, auth)) { + if (await _refreshToken(auth) != null) { + response = await _get(url, headers: headers, body: body, encoding: encoding, auth: auth, client: client, timeout: timeout); + } } + } catch (e) { + Log.d(e?.toString()); + FirebaseCrashlytics().recordError(e, null); } if (sendAnalytics) { @@ -173,7 +179,7 @@ class Network { Future response = (url != null) ? Http.post(url, headers: _prepareHeaders(headers, auth, url), body: body, encoding: encoding) : null; return ((response != null) && (timeout != null)) ? response.timeout(Duration(seconds: timeout), onTimeout: _responseTimeoutHandler) : response; } catch (e) { - Log.e(e.toString()); + Log.d(e?.toString()); FirebaseCrashlytics().recordError(e, null); } } @@ -181,14 +187,21 @@ class Network { } Future post(url, { body, Encoding encoding, Map headers, int auth, int timeout = 60, bool sendAnalytics = true, String analyticsUrl, bool analyticsAnonymous }) async{ - Http.Response response = await _post(url, body: body, encoding: encoding, headers: headers, auth: auth, timeout: timeout); + Http.Response response; + try { + response = await _post(url, body: body, encoding: encoding, headers: headers, auth: auth, timeout: timeout); - if (_requiresTokenRefresh(response, auth)) { - if (await _refreshToken(auth) != null) { - response = await _post(url, body: body, encoding: encoding, headers: headers, auth: auth, timeout: timeout); + if (_requiresTokenRefresh(response, auth)) { + if (await _refreshToken(auth) != null) { + response = await _post(url, body: body, encoding: encoding, headers: headers, auth: auth, timeout: timeout); + } } + } catch (e) { + Log.d(e?.toString()); + FirebaseCrashlytics().recordError(e, null); } + if (sendAnalytics) { Analytics().logHttpResponse(response, requestMethod:'POST', requestUrl: analyticsUrl ?? url, anonymous: analyticsAnonymous); } @@ -210,7 +223,7 @@ class Network { return ((response != null) && (timeout != null)) ? response.timeout(Duration(seconds: timeout), onTimeout: _responseTimeoutHandler) : response; } catch (e) { - Log.e(e.toString()); + Log.d(e?.toString()); FirebaseCrashlytics().recordError(e, null); } } @@ -218,12 +231,18 @@ class Network { } Future put(url, { body, Encoding encoding, Map headers, int auth, int timeout = 60, Http.Client client, bool sendAnalytics = true, String analyticsUrl, bool analyticsAnonymous }) async { - Http.Response response = await _put(url, body: body, encoding: encoding, headers: headers, auth: auth, timeout: timeout, client: client); + Http.Response response; + try { + response = await _put(url, body: body, encoding: encoding, headers: headers, auth: auth, timeout: timeout, client: client); - if (_requiresTokenRefresh(response, auth)) { - if (await _refreshToken(auth) != null) { - response = await _put(url, body: body, encoding: encoding, headers: headers, auth: auth, timeout: timeout, client: client); + if (_requiresTokenRefresh(response, auth)) { + if (await _refreshToken(auth) != null) { + response = await _put(url, body: body, encoding: encoding, headers: headers, auth: auth, timeout: timeout, client: client); + } } + } catch (e) { + Log.d(e?.toString()); + FirebaseCrashlytics().recordError(e, null); } if (sendAnalytics) { @@ -241,7 +260,7 @@ class Network { Future response = (url != null) ? Http.patch(url, headers: _prepareHeaders(headers, auth, url), body: body, encoding: encoding) : null; return ((response != null) && (timeout != null)) ? response.timeout(Duration(seconds: timeout), onTimeout: _responseTimeoutHandler) : response; } catch (e) { - Log.e(e.toString()); + Log.d(e?.toString()); FirebaseCrashlytics().recordError(e, null); } } @@ -249,12 +268,18 @@ class Network { } Future patch(url, { body, Encoding encoding, Map headers, int auth, int timeout = 60, bool sendAnalytics = true, String analyticsUrl, bool analyticsAnonymous }) async { - Http.Response response = await _patch(url, body: body, encoding: encoding, headers: headers, auth: auth, timeout: timeout); + Http.Response response; + try { + response = await _patch(url, body: body, encoding: encoding, headers: headers, auth: auth, timeout: timeout); - if (_requiresTokenRefresh(response, auth)) { - if (await _refreshToken(auth) != null) { - response = await _patch(url, body: body, encoding: encoding, headers: headers, auth: auth, timeout: timeout); + if (_requiresTokenRefresh(response, auth)) { + if (await _refreshToken(auth) != null) { + response = await _patch(url, body: body, encoding: encoding, headers: headers, auth: auth, timeout: timeout); + } } + } catch (e) { + Log.d(e?.toString()); + FirebaseCrashlytics().recordError(e, null); } if (sendAnalytics) { @@ -272,7 +297,7 @@ class Network { Future response = (url != null) ? Http.delete(url, headers: _prepareHeaders(headers, auth, url)) : null; return ((response != null) && (timeout != null)) ? response.timeout(Duration(seconds: timeout), onTimeout: _responseTimeoutHandler) : response; } catch (e) { - Log.e(e.toString()); + Log.d(e?.toString()); FirebaseCrashlytics().recordError(e, null); } } @@ -280,12 +305,18 @@ class Network { } Future delete(url, { Map headers, int auth, int timeout = 60, bool sendAnalytics = true, String analyticsUrl, bool analyticsAnonymous }) async { - Http.Response response = await _delete(url, headers: headers, auth: auth, timeout: timeout); + Http.Response response; + try { + response = await _delete(url, headers: headers, auth: auth, timeout: timeout); - if (_requiresTokenRefresh(response, auth)) { - if (await _refreshToken(auth) != null) { - response = await _delete(url, headers: headers, auth: auth, timeout: timeout); + if (_requiresTokenRefresh(response, auth)) { + if (await _refreshToken(auth) != null) { + response = await _delete(url, headers: headers, auth: auth, timeout: timeout); + } } + } catch (e) { + Log.d(e?.toString()); + FirebaseCrashlytics().recordError(e, null); } if (sendAnalytics) { @@ -303,7 +334,7 @@ class Network { Future response = (url != null) ? Http.read(url, headers: _prepareHeaders(headers, auth, url)) : null; return ((response != null) && (timeout != null)) ? response.timeout(Duration(seconds: timeout)) : response; } catch (e) { - Log.e(e.toString()); + Log.d(e?.toString()); FirebaseCrashlytics().recordError(e, null); } } @@ -320,7 +351,7 @@ class Network { Future response = (url != null) ? Http.readBytes(url, headers: _prepareHeaders(headers, auth, url)) : null; return ((response != null) && (timeout != null)) ? response.timeout(Duration(seconds: timeout), onTimeout: _responseBytesHandler) : response; } catch (e) { - Log.e(e.toString()); + Log.d(e?.toString()); FirebaseCrashlytics().recordError(e, null); } } From c027266adcf31c306e08e2b6466d7caa304409e3 Mon Sep 17 00:00:00 2001 From: Mihail Varbanov Date: Tue, 27 Apr 2021 16:23:08 +0300 Subject: [PATCH 19/21] Simplified check for successful response. --- lib/service/Health.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/service/Health.dart b/lib/service/Health.dart index ce49a406..b7897014 100644 --- a/lib/service/Health.dart +++ b/lib/service/Health.dart @@ -400,7 +400,7 @@ class Health with Service implements NotificationsListener { String url = "${Config().healthUrl}/covid19/login"; String post = AppJson.encode(user?.toJson()); Response response = await Network().post(url, body: post, auth: Network.RokmetroUserAuth); - if ((response != null) && (response.statusCode == 200)) { + if (response?.statusCode == 200) { return true; } } From 463cbeacbc45c3d9722717a6747724c91db9061a Mon Sep 17 00:00:00 2001 From: Mihail Varbanov Date: Tue, 27 Apr 2021 16:24:45 +0300 Subject: [PATCH 20/21] Updated CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f6f89e9..b073c892 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased +### Fixed +- Fixed app misbehavior when system date time is much behind the current date time [#615](https://github.com/rokwire/safer-illinois-app/issues/615). ## [2.10.21] - 2021-04-26 ### Added From 96af1f9250232d2a3ae7f04b6fcf2daf58070ab0 Mon Sep 17 00:00:00 2001 From: Mihail Varbanov Date: Tue, 27 Apr 2021 16:30:37 +0300 Subject: [PATCH 21/21] version: 2.10.22+1022 --- CHANGELOG.md | 2 ++ pubspec.yaml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b073c892..6ebeda77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased + +## [2.10.22] - 2021-04-27 ### Fixed - Fixed app misbehavior when system date time is much behind the current date time [#615](https://github.com/rokwire/safer-illinois-app/issues/615). diff --git a/pubspec.yaml b/pubspec.yaml index dca34da1..7c5254c0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ description: Illinois client application. # 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: 2.10.21+1021 +version: 2.10.22+1022 environment: sdk: ">=2.2.0 <3.0.0"