Skip to content

Commit

Permalink
Merge pull request #732 from rokwire/release/v2.11.5+1105
Browse files Browse the repository at this point in the history
Release/v2.11.5+1105
  • Loading branch information
yoonlees authored Oct 1, 2021
2 parents bcded1a + 9da1e49 commit 87a3bca
Show file tree
Hide file tree
Showing 16 changed files with 131 additions and 63 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [2.11.5] - 2021-10-01
### Fixed
- Fixed null pointer crash [#725](https://github.com/rokwire/safer-illinois-app/issues/725).

## [2.11.4] - 2021-10-01
### Changed
- Show when the vaccine will become effective in vaccination widget [#720](https://github.com/rokwire/safer-illinois-app/issues/720).
- Show upconing entries in history panel [#723](https://github.com/rokwire/safer-illinois-app/issues/723).

## [2.11.3] - 2021-09-29
### Deleted
- Removed vaccine taken event handling [#715](https://github.com/rokwire/safer-illinois-app/issues/715).
Expand Down
14 changes: 7 additions & 7 deletions assets/health.rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -557,14 +557,14 @@
"fail": "vaccinated-force"
},
"fail": "release.unvaccinated"
}
},
},

"release.unvaccinated": {
"code": "orange",
"priority": -1,
"next_step": "release.step",
"reason": "release.reason"
"release.unvaccinated": {
"code": "orange",
"priority": -1,
"next_step": "release.step",
"reason": "release.reason"
}
},

"tests" : {
Expand Down
3 changes: 3 additions & 0 deletions assets/strings.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@
"panel.covid19home.vaccination.none.description": "• COVID-19 vaccines are safe\n• COVID-19 vaccines are effective\n• COVID-19 vaccines allow you to safely do more\n• COVID-19 vaccines build safer protection",
"panel.covid19home.vaccination.vaccinated.title": "Vaccinated",
"panel.covid19home.vaccination.vaccinated.description": "Your vaccination is not effective yet.",
"panel.covid19home.vaccination.vaccinated.effective.0.description": "Your vaccine will be effective today.",
"panel.covid19home.vaccination.vaccinated.effective.1.description": "Your vaccine will be effective tomorrow.",
"panel.covid19home.vaccination.vaccinated.effective.n.description": "Your vaccine will be effective after %s days.",
"panel.covid19home.vaccination.button.appointment.title": "Make an appointment",
"panel.covid19home.vaccination.button.appointment.hint": "",

Expand Down
3 changes: 3 additions & 0 deletions assets/strings.es.json
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@
"panel.covid19home.vaccination.none.description": "• Las vacunas COVID-19 son seguras\n• Las vacunas COVID-19 son efectivas\n• Las vacunas COVID-19 le permiten hacer más de manera segura\n• Las vacunas COVID-19 crean una protección más segura",
"panel.covid19home.vaccination.vaccinated.title": "Vacunado",
"panel.covid19home.vaccination.vaccinated.description": "Su vacunación aún no es efectiva.",
"panel.covid19home.vaccination.vaccinated.effective.0.description": "Su vacuna será efectiva hoy.",
"panel.covid19home.vaccination.vaccinated.effective.1.description": "Su vacuna será efectiva mañana.",
"panel.covid19home.vaccination.vaccinated.effective.n.description": "Su vacuna será efectiva después de %s días.",
"panel.covid19home.vaccination.button.appointment.title": "Haga una cita",
"panel.covid19home.vaccination.button.appointment.hint": "",

Expand Down
3 changes: 3 additions & 0 deletions assets/strings.ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@
"panel.covid19home.vaccination.none.description": "• COVID-19 疫苗是安全的\n• COVID-19ワクチンは効果的です\n• COVID-19ワクチンはあなたが安全にもっと多くのことをすることを可能にします\n• COVID-19ワクチンはより安全な保護を構築します",
"panel.covid19home.vaccination.vaccinated.title": "ワクチン接種",
"panel.covid19home.vaccination.vaccinated.description": "あなたの予防接種はまだ効果的ではありません。",
"panel.covid19home.vaccination.vaccinated.effective.0.description": "あなたのワクチンは今日有効になります。",
"panel.covid19home.vaccination.vaccinated.effective.1.description": "あなたのワクチンは明日有効になります。",
"panel.covid19home.vaccination.vaccinated.effective.n.description": "あなたのワクチンは%s日後に有効になります。",
"panel.covid19home.vaccination.button.appointment.title": "予約する",
"panel.covid19home.vaccination.button.appointment.hint": "",

Expand Down
3 changes: 3 additions & 0 deletions assets/strings.zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@
"panel.covid19home.vaccination.none.description": "• COVID-19 疫苗是安全的\n• COVID-19 疫苗是有效的\n• COVID-19 疫苗可讓您安全地做更多事情\n• COVID-19 疫苗可建立更安全的保護",
"panel.covid19home.vaccination.vaccinated.title": "已接種",
"panel.covid19home.vaccination.vaccinated.description": "您的疫苗接種尚未生效。",
"panel.covid19home.vaccination.vaccinated.effective.0.description": "你的疫苗今天會有效。",
"panel.covid19home.vaccination.vaccinated.effective.1.description": "你的疫苗明天就會生效。",
"panel.covid19home.vaccination.vaccinated.effective.n.description": "您的疫苗將在 %s 天后生效。",
"panel.covid19home.vaccination.button.appointment.title": "預約",
"panel.covid19home.vaccination.button.appointment.hint": "",

Expand Down
Binary file added images/2.0x/icon-time2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2.0x/icon-time3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/3.0x/icon-time2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/3.0x/icon-time3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-time2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-time3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lib/service/Health.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1645,7 +1645,7 @@ class Health with Service implements NotificationsListener {

bool get isVaccinated {
HealthHistory vaccine = HealthHistory.mostRecentVaccine(Health().history);
return (vaccine.blob != null) && (vaccine?.blob?.isVaccineEffective ?? false) && (vaccine.dateUtc != null) && vaccine.dateUtc.isBefore(DateTime.now().toUtc());
return (vaccine != null) && (vaccine.blob != null) && vaccine.blob.isVaccineEffective && (vaccine.dateUtc != null) && vaccine.dateUtc.isBefore(DateTime.now().toUtc());
}

// Current Server Time
Expand Down
96 changes: 52 additions & 44 deletions lib/ui/health/HealthHistoryPanel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class _HealthHistoryPanelState extends State<HealthHistoryPanel> implements Noti
Health.notifyHistoryUpdated,
]);

_history = HealthHistory.pastList(Health().history);
_history = Health().history;
_refreshHistory();
}

Expand All @@ -75,7 +75,7 @@ class _HealthHistoryPanelState extends State<HealthHistoryPanel> implements Noti
else if (name == Health.notifyHistoryUpdated) {
if (mounted) {
setState(() {
_history = HealthHistory.pastList(Health().history);
_history = Health().history;
});
}
}
Expand All @@ -89,7 +89,7 @@ class _HealthHistoryPanelState extends State<HealthHistoryPanel> implements Noti
Health().refreshStatus().then((_) {
if (mounted) {
setState(() {
_history = HealthHistory.pastList(Health().history);
_history = Health().history;
_isRefreshing = false;
});
}
Expand Down Expand Up @@ -446,35 +446,19 @@ class _HealthHistoryEntryState extends State<_HealthHistoryEntry> with SingleTic
Widget build(BuildContext context) {

List<Widget> content = <Widget>[];
content.add(Container(height: 16,));
content.add(_buildCommonInfo(),);

if ((widget.historyEntry?.isTestVerified ?? false) || HealthEventExtra.listHasVisible(widget.historyEntry?.blob?.extras)) {
content.add(_buildMoreButton());

if (_expanded) {

Widget testResult = ((widget.historyEntry?.isTestVerified ?? false) && (widget.historyEntry?.blob?.testResult != null)) ? _buildTestResult() : null;
Widget additionalInfo = _buildAdditionalInfo();

if (testResult != null) {
content.add(testResult);
}

if ((testResult != null) && (additionalInfo != null)) {
content.add(_buildSplitter());
}

if (additionalInfo != null) {
content.add(additionalInfo);
}
Widget exandedConent = _expanded ? _buildExpandedContent() : null;
if (exandedConent != null) {
content.add(exandedConent);
}
}

content.add(Container(height: 16,));

return Container(
padding: EdgeInsets.symmetric(),
padding: EdgeInsets.symmetric(vertical: 16),
child: Column(children: content,),
);
}
Expand Down Expand Up @@ -570,13 +554,22 @@ class _HealthHistoryEntryState extends State<_HealthHistoryEntry> with SingleTic
}

return Semantics(sortKey: OrdinalSortKey(1), container: true, child:
Container(color: Styles().colors.white, padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), child:
Row(children: <Widget>[
Expanded(child:
Column(crossAxisAlignment: CrossAxisAlignment.start, children: contentList,)
Stack(children: [
Container(decoration: BoxDecoration(color: Styles().colors.white, border: Border.all(color: Styles().colors.surfaceAccent,)), padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), child:
Row(children: <Widget>[
Expanded(child:
Column(crossAxisAlignment: CrossAxisAlignment.start, children: contentList,)
),
]),
),
Visibility(visible: widget.historyEntry.dateUtc?.isAfter(DateTime.now().toUtc()) ?? false, child:
Align(alignment: Alignment.topRight, child:
Padding(padding: EdgeInsets.all(16), child:
Image.asset('images/icon-time3.png')
),
),
]),
),
),
],),
);
}

Expand Down Expand Up @@ -668,40 +661,55 @@ class _HealthHistoryEntryState extends State<_HealthHistoryEntry> with SingleTic
final Animatable<double> _halfTween = Tween<double>(begin: 0.0, end: 0.5);
final Animatable<double> _easeInTween = CurveTween(curve: Curves.easeIn);
Animation<double> _iconTurns = _controller.drive(_halfTween.chain(_easeInTween));
BorderSide borderSide = BorderSide(color: Styles().colors.surfaceAccent,);

return
Semantics(
sortKey: OrdinalSortKey(2),
container: true,
button: true,
child: InkWell(
onTap: (){
setState(() {
_expanded = !_expanded;
});
return Semantics(sortKey: OrdinalSortKey(2), container: true, button: true, child:
InkWell(onTap: () {
setState(() { _expanded = !_expanded; });
if (_expanded) {
_controller.forward();
} else {
_controller.reverse();
}
},
child: Container(
decoration: BoxDecoration(color: Styles().colors.background, border: Border.all(color: Styles().colors.surfaceAccent,)),
decoration: BoxDecoration(color: Styles().colors.background, border: Border(left: borderSide, right: borderSide, bottom: /* _expanded ? BorderSide.none : */ borderSide)),
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 14),
child: Row(children: <Widget>[
Text(Localization().getStringEx("panel.health.covid19.history.label.more_info.title","More Info"),
style: TextStyle(color: Styles().colors.fillColorPrimary,fontSize: 16, fontFamily: Styles().fontFamilies.bold,),
),
Expanded(child: Container(),),
Container(width: 4,),
RotationTransition(
turns: _iconTurns,
child: Image.asset("images/icon-down-orange.png", color: Styles().colors.fillColorSecondary, excludeFromSemantics: true,)),

RotationTransition(turns: _iconTurns, child:
Image.asset("images/icon-down-orange.png", color: Styles().colors.fillColorSecondary, excludeFromSemantics: true,)),
],)
)));
}

Widget _buildExpandedContent() {
List<Widget> expandedContent = <Widget>[];

Widget testResult = ((widget.historyEntry?.isTestVerified ?? false) && (widget.historyEntry?.blob?.testResult != null)) ? _buildTestResult() : null;
Widget additionalInfo = _buildAdditionalInfo();

if (testResult != null) {
expandedContent.add(testResult);
}

if ((testResult != null) && (additionalInfo != null)) {
expandedContent.add(_buildSplitter());
}

if (additionalInfo != null) {
expandedContent.add(additionalInfo);
}

return (0 < expandedContent.length) ? Container(
// decoration: BoxDecoration(color: Styles().colors.white, border: Border.all(color: Styles().colors.surfaceAccent,)),
child: Column(children: expandedContent,),) : null;
}

Widget _buildDetail(String title, String data, {GestureTapCallback onTapData, String onTapHint}) {

TextStyle dataTextStyle = (onTapData != null) ?
Expand Down
59 changes: 49 additions & 10 deletions lib/ui/health/HealthHomePanel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import 'package:illinois/ui/widgets/RoundedButton.dart';
import 'package:illinois/ui/widgets/SectionTitlePrimary.dart';
import 'package:illinois/ui/widgets/StatusInfoDialog.dart';
import 'package:illinois/utils/Utils.dart';
import 'package:sprintf/sprintf.dart';
import 'package:url_launcher/url_launcher.dart';

class HealthHomePanel extends StatefulWidget {
Expand Down Expand Up @@ -685,8 +686,9 @@ class _HealthHomePanelState extends State<HealthHomePanel> implements Notificati
String statusDescriptionText, statusDescriptionHtml;
String headingTitle = Localization().getStringEx('panel.covid19home.vaccination.heading.title', 'VACCINATION');

HealthHistory vaccine = HealthHistory.mostRecentVaccine(Health().history);
if (vaccine == null) {
HealthHistory recentVaccine = getRecentVaccine();

if (recentVaccine == null) {
// No vaccine at all - promote it.
statusTitleText = Localization().getStringEx('panel.covid19home.vaccination.none.title', 'Get a vaccine now');
statusDescriptionText = Localization().getStringEx('panel.covid19home.vaccination.none.description', """
Expand All @@ -695,15 +697,35 @@ class _HealthHomePanelState extends State<HealthHomePanel> implements Notificati
• COVID-19 vaccines allow you to safely do more
• COVID-19 vaccines build safer protection""");
}
else if ((vaccine.blob != null) && (vaccine.blob.isVaccineEffective) && (vaccine.dateUtc != null) && vaccine.dateUtc.isBefore(DateTime.now().toUtc())) {
// 5.2.4 When effective then hide the widget
return null;
}
else {
// Vaccinated, but not effective yet.
headingDate = AppDateTime.formatDateTime(vaccine.dateUtc?.toLocal(), format:"MMMM dd, yyyy", locale: Localization().currentLocale?.languageCode) ?? '';
headingDate = AppDateTime.formatDateTime(recentVaccine.dateUtc?.toLocal(), format:"MMMM dd, yyyy", locale: Localization().currentLocale?.languageCode);
statusTitleText = Localization().getStringEx('panel.covid19home.vaccination.vaccinated.title', 'Vaccinated');
statusDescriptionText = Localization().getStringEx('panel.covid19home.vaccination.vaccinated.description', 'Your vaccination is not effective yet.');

if ((recentVaccine.blob?.isVaccineEffective ?? false) && (recentVaccine.dateUtc != null)) {
DateTime now = DateTime.now();
if (recentVaccine.dateUtc.isBefore(now.toUtc())) {
// 5.2.4 When effective then hide the widget
return null;
}
else {
// Vaccinated, but not effective yet.
int delayInDays = AppDateTime.midnight(recentVaccine.dateUtc.toLocal()).difference(AppDateTime.midnight(now)).inDays;

if (delayInDays > 1) {
statusDescriptionText = sprintf(Localization().getStringEx('panel.covid19home.vaccination.vaccinated.effective.n.description', 'Your vaccine will be effective after %s days.'), [delayInDays]);
}
else if (delayInDays == 1) {
statusDescriptionText = Localization().getStringEx('panel.covid19home.vaccination.vaccinated.effective.1.description', 'Your vaccine will be effective tomorrow.');
}
else {
statusDescriptionText = Localization().getStringEx('panel.covid19home.vaccination.vaccinated.effective.0.description', 'Your vaccine will be effective today.');
}
}
}
else {
// Vaccinated, unknown status or date.
statusDescriptionText = Localization().getStringEx('panel.covid19home.vaccination.vaccinated.description', 'Your vaccination is not effective yet.');
}
}

List<Widget> contentWidgets = <Widget>[
Expand Down Expand Up @@ -770,7 +792,7 @@ class _HealthHomePanelState extends State<HealthHomePanel> implements Notificati
],),
];

if ((vaccine == null) && (Config().vaccinationAppointUrl != null)) {
if ((recentVaccine == null) && (Config().vaccinationAppointUrl != null)) {
contentList.addAll(<Widget>[
Container(margin: EdgeInsets.only(top: 14, bottom: 14), height: 1, color: Styles().colors.fillColorPrimaryTransparent015,),

Expand All @@ -794,6 +816,23 @@ class _HealthHomePanelState extends State<HealthHomePanel> implements Notificati
));
}

HealthHistory getRecentVaccine() {
HealthHistory mostRecentVaccine;
if (Health().history != null) {
for (HealthHistory historyEntry in Health().history) {
if (historyEntry.isVaccine) {
if (historyEntry.blob?.isVaccineEffective ?? false) {
return historyEntry;
}
else if (mostRecentVaccine == null) {
mostRecentVaccine = historyEntry;
}
}
}
}
return mostRecentVaccine;
}

Widget _buildTileButtons() {
List<Widget> contentList = [];

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.11.3+1103
version: 2.11.5+1105

environment:
sdk: ">=2.2.0 <3.0.0"
Expand Down

0 comments on commit 87a3bca

Please sign in to comment.