Skip to content

Commit

Permalink
Merge pull request #576 from rokwire/release/v2.9.21+921
Browse files Browse the repository at this point in the history
Release/v2.9.21+921
  • Loading branch information
sandeep-ps authored Mar 16, 2021
2 parents 17778b6 + d339eb6 commit b972dd8
Show file tree
Hide file tree
Showing 12 changed files with 105 additions and 40 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [2.9.21] - 2021-03-16
### Changed
- Check for start/stop exposure native service on revoking from background.
- Ask for Bluetooth and Location services permisions in iOS when the user selects to participate to Exposure Notification system. Exclude the relevant onboarding panels from onboarding flow in iOS [#573](https://github.com/rokwire/safer-illinois-app/issues/573).

### Fixed
- Fixed days interval calculation when daylight saving is changed [#572](https://github.com/rokwire/safer-illinois-app/issues/572).

## [2.9.20] - 2021-03-13
### Changed
- Updated version number to 2.9.20+920 for resubmission.
Expand Down
3 changes: 2 additions & 1 deletion assets/flexUI.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@
"settings.connected.phone.disconnect" : { "phoneLoggedIn": true }
},
"platform":{
"onboarding.bluetooth_auth" : { "os": "ios" }
"onboarding.location_auth" : { "os": "android" }
},
"enable" : {
"onboarding.bluetooth_auth" : false
}
}
}
21 changes: 3 additions & 18 deletions assets/health.rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -857,12 +857,7 @@
"symptoms.sore-throat": "Sore Throat",
"symptoms.congestion-or-runny-nose": "Congestion or runny nose",
"symptoms.nausea-or-vomiting": "Nausea or vomiting",
"symptoms.diarrhea":"Diarrhea",
"disclaimers.covid-19_pcr.positive.html": "",
"disclaimers.covid-19_pcr.negative.html": "",
"disclaimers.covid-19_pcr.invalid.html": "",
"disclaimers.covid-19_pcr.inconclusive.html": "",
"disclaimers.covid-19_pcr.rejected.html": ""
"symptoms.diarrhea":"Diarrhea"
},
"es": {
"default.step": "Realice una prueba de saliva SHIELD cuando regrese al campus.",
Expand Down Expand Up @@ -909,12 +904,7 @@
"symptoms.sore-throat": "Dolor de garganta",
"symptoms.congestion-or-runny-nose": "Congestión o secreción nasal",
"symptoms.nausea-or-vomiting": "Náuseas o vómitos",
"symptoms.diarrhea": "Diarrea",
"disclaimers.covid-19_pcr.positive.html": "",
"disclaimers.covid-19_pcr.negative.html": "",
"disclaimers.covid-19_pcr.invalid.html": "",
"disclaimers.covid-19_pcr.inconclusive.html": "",
"disclaimers.covid-19_pcr.rejected.html": ""
"symptoms.diarrhea": "Diarrea"
},
"zh": {
"default.step": "返回校園後,請參加SHIELD唾液測試。",
Expand Down Expand Up @@ -961,12 +951,7 @@
"symptoms.sore-throat": "咽喉痛",
"symptoms.congestion-or-runny-nose": "充血或流鼻涕",
"symptoms.nausea-or-vomiting": "噁心或嘔吐",
"symptoms.diarrhea":"腹瀉",
"disclaimers.covid-19_pcr.positive.html": "",
"disclaimers.covid-19_pcr.negative.html": "",
"disclaimers.covid-19_pcr.invalid.html": "",
"disclaimers.covid-19_pcr.inconclusive.html": "",
"disclaimers.covid-19_pcr.rejected.html": ""
"symptoms.diarrhea":"腹瀉"
}
}
}
12 changes: 9 additions & 3 deletions lib/model/Health.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2705,7 +2705,9 @@ class HealthRuleConditionalStatus extends _HealthRuleStatus {
static bool _evalRequireTestEntryFulfills(Covid19History entry, { DateTime originDateMidnightLocal, _HealthRuleInterval interval, HealthRulesSet rules, dynamic category }) {
if (entry.isTest && entry.canTestUpdateStatus) {
DateTime entryDateMidnightLocal = entry.dateMidnightLocal;
final difference = entryDateMidnightLocal.difference(originDateMidnightLocal).inDays;
//#572 Building access calculation issue
//int difference = entryDateMidnightLocal.difference(originDateMidnightLocal).inDays;
int difference = AppDateTime.midnightsDifferenceInDays(originDateMidnightLocal, entryDateMidnightLocal);
if (interval.match(difference, rules: rules)) {
if (category == null) {
return true; // any test matches
Expand Down Expand Up @@ -2771,7 +2773,9 @@ class HealthRuleConditionalStatus extends _HealthRuleStatus {
static bool _evalRequireSymptomsEntryFulfills(Covid19History entry, { DateTime originDateMidnightLocal, _HealthRuleInterval interval, HealthRulesSet rules }) {
if (entry.isSymptoms) {
DateTime entryDateMidnightLocal = entry.dateMidnightLocal;
final difference = entryDateMidnightLocal.difference(originDateMidnightLocal).inDays;
// #572 Building access calculation issue
//int difference = entryDateMidnightLocal.difference(originDateMidnightLocal).inDays;
int difference = AppDateTime.midnightsDifferenceInDays(originDateMidnightLocal, entryDateMidnightLocal);
if (interval.match(difference, rules: rules)) {
return true;
}
Expand All @@ -2798,7 +2802,9 @@ class HealthRuleConditionalStatus extends _HealthRuleStatus {

static bool _evalCurrentIntervalFulfills(_HealthRuleInterval currentInterval, { DateTime originDateMidnightLocal, HealthRulesSet rules } ) {
if (currentInterval != null) {
final difference = AppDateTime.todayMidnightLocal.difference(originDateMidnightLocal).inDays;
//#572 Building access calculation issue
//int difference = AppDateTime.todayMidnightLocal.difference(originDateMidnightLocal).inDays;
int difference = AppDateTime.midnightsDifferenceInDays(originDateMidnightLocal, AppDateTime.todayMidnightLocal);
if (currentInterval.match(difference, rules: rules)) {
return true;
}
Expand Down
8 changes: 5 additions & 3 deletions lib/service/Exposure.dart
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,11 @@ class Exposure with Service implements NotificationsListener {
else if (state == AppLifecycleState.resumed) {
Duration pausedDuration = (_pausedDateTime != null) ? DateTime.now().difference(_pausedDateTime) : null;
if ((pausedDuration != null) && (Config().refreshTimeout < pausedDuration.inSeconds)) {
checkReport();
checkExposures().then((_){
_startExposuresMonitor();
_updatePlugin().then((_) {
checkReport();
checkExposures().then((_){
_startExposuresMonitor();
});
});
}
else {
Expand Down
8 changes: 4 additions & 4 deletions lib/service/Health.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1449,13 +1449,13 @@ class Health with Service implements NotificationsListener {
}

if (exposureNotification == true) {
if (await LocationServices().status == LocationServicesStatus.PermissionNotDetermined) {
await LocationServices().requestPermission();
}

if (BluetoothServices().status == BluetoothStatus.PermissionNotDetermined) {
await BluetoothServices().requestStatus();
}

if (await LocationServices().status == LocationServicesStatus.PermissionNotDetermined) {
await LocationServices().requestPermission();
}
}

return user;
Expand Down
34 changes: 29 additions & 5 deletions lib/ui/health/onboarding/Covid19OnBoardingConsentPanel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@
* limitations under the License.
*/

import 'dart:io';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:illinois/service/Analytics.dart';
import 'package:illinois/service/Auth.dart';
import 'package:illinois/service/BluetoothServices.dart';
import 'package:illinois/service/Health.dart';
import 'package:illinois/service/Localization.dart';
import 'package:illinois/service/LocationServices.dart';
import 'package:illinois/service/Onboarding.dart';
import 'package:illinois/service/Styles.dart';
import 'package:illinois/ui/onboarding/OnboardingBackButton.dart';
Expand All @@ -47,14 +51,15 @@ class _Covid19OnBoardingConsentPanelState extends State<Covid19OnBoardingConsent
bool _exposureNotification = false;
bool _consent = true;
bool _canContinue = false;
bool _permissionsRequested = false;
ScrollController _scrollController;

@override
void initState() {
super.initState();
_scrollController = ScrollController();
_scrollController.addListener(_scrollListener);
//19.06 - 5.1 Covid setup flow consents should be off by default
// 19.06 - 5.1 Covid setup flow consents should be off by default
// Health().loadUser().then((HealthUser user) {
// setState(() {
// _exposureNotification = user?.consent ?? false;
Expand Down Expand Up @@ -267,10 +272,19 @@ class _Covid19OnBoardingConsentPanelState extends State<Covid19OnBoardingConsent

void _onParticipateTap(){
Analytics.instance.logSelect(target: "concent to participate");
setState(() {
_exposureNotification = !_exposureNotification;
});

if (Platform.isIOS && (_exposureNotification != true) && (_permissionsRequested != true)) {
_permissionsRequested = true;
_requestPermisions().then((_) {
setState(() {
_exposureNotification = !_exposureNotification;
});
});
}
else {
setState(() {
_exposureNotification = !_exposureNotification;
});
}
}

void _onAllowTap(){
Expand All @@ -288,6 +302,16 @@ class _Covid19OnBoardingConsentPanelState extends State<Covid19OnBoardingConsent
});
}
}

Future<void> _requestPermisions() async {
if (BluetoothServices().status == BluetoothStatus.PermissionNotDetermined) {
await BluetoothServices().requestStatus();
}

if (await LocationServices().status == LocationServicesStatus.PermissionNotDetermined) {
await LocationServices().requestPermission();
}
}
}

typedef void OnWidgetSizeChange(Size size);
Expand Down
7 changes: 4 additions & 3 deletions lib/ui/onboarding/OnboardingAuthBluetoothPanel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* limitations under the License.
*/

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:illinois/service/Analytics.dart';
Expand All @@ -39,7 +37,10 @@ class OnboardingAuthBluetoothPanel extends StatefulWidget with OnboardingPanel {

@override
bool get onboardingCanDisplay {
return Platform.isIOS && (BluetoothServices().status != BluetoothStatus.PermissionAllowed);
// Android does not support Bluetooth permisions.
// Bluetooth permisions in iOS should be prompted when "Consent to participate in the Exposure Notification system" is selected.
// return Platform.isIOS && (BluetoothServices().status != BluetoothStatus.PermissionAllowed);
return false;
}
}

Expand Down
5 changes: 4 additions & 1 deletion lib/ui/onboarding/OnboardingAuthLocationPanel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:illinois/service/Analytics.dart';
Expand All @@ -31,8 +33,9 @@ class OnboardingAuthLocationPanel extends StatelessWidget with OnboardingPanel {
OnboardingAuthLocationPanel({this.onboardingContext});

Future<bool> get onboardingCanDisplayAsync async {
// Location permisions in iOS should be prompted when "Consent to participate in the Exposure Notification system" is selected.
LocationServicesStatus status = await LocationServices.instance.status;
return (status != LocationServicesStatus.PermissionAllowed);
return Platform.isAndroid && (status != LocationServicesStatus.PermissionAllowed);
}

@override
Expand Down
25 changes: 24 additions & 1 deletion lib/ui/settings/SettingsHomePanel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';

import 'package:archive/archive.dart';
Expand All @@ -24,7 +25,9 @@ import 'package:flutter/foundation.dart';
import 'package:illinois/model/Health.dart';
import 'package:illinois/service/AppNavigation.dart';
import 'package:illinois/service/Auth.dart';
import 'package:illinois/service/BluetoothServices.dart';
import 'package:illinois/service/Connectivity.dart';
import 'package:illinois/service/LocationServices.dart';
import 'package:illinois/service/Organizations.dart';
import 'package:illinois/ui/onboarding/OnboardingLoginPhoneVerifyPanel.dart';
import 'package:illinois/ui/settings/SettingsFamilyMembersPanel.dart';
Expand Down Expand Up @@ -79,6 +82,8 @@ class _SettingsHomePanelState extends State<SettingsHomePanel> implements Notifi

bool _refreshingHealthUserKeys;

bool _permissionsRequested;

@override
void initState() {
NotificationService().subscribe(this, [
Expand Down Expand Up @@ -850,12 +855,30 @@ class _SettingsHomePanelState extends State<SettingsHomePanel> implements Notifi
if (Connectivity().isNotOffline) {
Analytics.instance.logSelect(target: "Exposure Notifications");
bool exposureNotification = _healthUser?.exposureNotification ?? false;
_updateHealthUser(exposureNotification: !exposureNotification);
if (Platform.isIOS && (exposureNotification != true) && (_permissionsRequested != true)) {
_permissionsRequested = true;
_requestPermisions().then((_) {
_updateHealthUser(exposureNotification: !exposureNotification);
});
}
else {
_updateHealthUser(exposureNotification: !exposureNotification);
}
} else {
AppAlert.showOfflineMessage(context);
}
}

Future<void> _requestPermisions() async {
if (BluetoothServices().status == BluetoothStatus.PermissionNotDetermined) {
await BluetoothServices().requestStatus();
}

if (await LocationServices().status == LocationServicesStatus.PermissionNotDetermined) {
await LocationServices().requestPermission();
}
}

void _onProviderTestResult() {
if (Connectivity().isNotOffline) {
Analytics.instance.logSelect(target: "Health Provider Test Results");
Expand Down
12 changes: 12 additions & 0 deletions lib/utils/AppDateTime.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@ class AppDateTime {
static DateTime get yesterdayMidnightLocal {
return midnight(DateTime.now()).add(Duration(days: -1));
}

static int midnightsDifferenceInDays(DateTime startMidnightTime, [DateTime endMidnightTime]) {
if (startMidnightTime != null) {
if (endMidnightTime == null) {
endMidnightTime = todayMidnightLocal;
}
return (endMidnightTime.difference(startMidnightTime).inMilliseconds / (24 * 3600 * 1000)).round();
}
else {
return null;
}
}
}

enum AppTimeOfDay {
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.9.20+920
version: 2.9.21+921

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

0 comments on commit b972dd8

Please sign in to comment.