Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
Release 3.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
nzcovidtracer-dev committed Feb 23, 2021
1 parent e47c38b commit 73621c7
Show file tree
Hide file tree
Showing 18 changed files with 173 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"postinstall": "node scripts/add-certs.js",
"android": "react-native run-android --variant=envDevelopDebug",
"android": "react-native run-android --variant=envEnfDebug",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "yarn fix:test:realm && jest",
Expand Down
1 change: 1 addition & 0 deletions src/__snapshots__/config.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ Object {
"SafetynetKey": "",
"SupportPhoneLink": "tel:0800800606",
"WebAppBaseUrl": "",
"iOS12SupportLink": "https://www.health.govt.nz/our-work/diseases-and-conditions/covid-19-novel-coronavirus/covid-19-resources-and-tools/nz-covid-tracer-app/getting-started-nz-covid-tracer/bluetooth-tracing#ios-12-5",
}
`;
13 changes: 10 additions & 3 deletions src/components/molecules/FormV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { useHeaderHeight } from "@react-navigation/stack";
import React, {
createContext,
forwardRef,
ReactNode,
Ref,
useCallback,
useEffect,
Expand Down Expand Up @@ -109,6 +110,7 @@ export interface FormV2Props extends FormHeaderProps {
headingStyle?: TextStyle;
description?: string;
descriptionStyle?: TextStyle;
descriptionElement?: ReactNode;
buttonText?: string;
buttonTestID?: string;
buttonLoading?: boolean;
Expand Down Expand Up @@ -164,6 +166,7 @@ function _FormV2(props: FormV2Props, ref: Ref<FormV2Handle>) {
headingStyle,
description,
descriptionStyle,
descriptionElement,
buttonText,
buttonTestID,
buttonLoading,
Expand Down Expand Up @@ -393,9 +396,13 @@ function _FormV2(props: FormV2Props, ref: Ref<FormV2Handle>) {
}
<ContentContainer>
{!!heading && <Heading style={headingStyle}>{heading}</Heading>}
{!!description && (
<Description style={descriptionStyle}>{description}</Description>
)}
{descriptionElement
? descriptionElement
: !!description && (
<Description style={descriptionStyle}>
{description}
</Description>
)}
<FormV2Context.Provider
value={{ scrollTo, getHeight, getHeaderHeight, onInputFocus }}
>
Expand Down
5 changes: 5 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export interface AppConfigRaw {
ENFServerUrl?: string;
SafetynetKey?: string;
ENFCheckInterval?: string;
iOS12SupportLink?: string;
}

export interface AppConfig {
Expand Down Expand Up @@ -67,6 +68,7 @@ export interface AppConfig {
ENFServerUrl: string;
SafetynetKey: string;
ENFCheckInterval: number;
iOS12SupportLink: string;
}

export let disableAnimations = false;
Expand Down Expand Up @@ -182,6 +184,9 @@ const config: AppConfig = {
ENFServerUrl: raw.ENFServerUrl || "",
SafetynetKey: raw.SafetynetKey || "",
ENFCheckInterval: getENFCheckInterval(),
iOS12SupportLink:
raw.iOS12SupportLink ||
"https://www.health.govt.nz/our-work/diseases-and-conditions/covid-19-novel-coronavirus/covid-19-resources-and-tools/nz-covid-tracer-app/getting-started-nz-covid-tracer/bluetooth-tracing#ios-12-5",
};

export default config;
1 change: 1 addition & 0 deletions src/constants/__snapshots__/externalLinks.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Object {
"copyrightLink": "/help/copyright?src=app",
"feedbackLink": "mailto:help@covidtracer.min.health.nz?subject=NZ COVID Tracer App Feedback",
"helpLink": "https://www.health.govt.nz/our-work/diseases-and-conditions/covid-19-novel-coronavirus/covid-19-novel-coronavirus-resources-and-tools/nz-covid-tracer-app/questions-and-answers-nz-covid-tracer",
"iOS12SupportLink": "https://www.health.govt.nz/our-work/diseases-and-conditions/covid-19-novel-coronavirus/covid-19-resources-and-tools/nz-covid-tracer-app/getting-started-nz-covid-tracer/bluetooth-tracing#ios-12-5",
"loginLink": "/login?src=app",
"privacyLink": "/help/privacypolicy?src=app",
"resourcesLink": "/resources?src=app",
Expand Down
1 change: 1 addition & 0 deletions src/constants/externalLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ export const helpLink = config.HelpPageUrl;
export const contactLink = config.ContactUsPageUrl;
export const contactAlertslink = config.ContactAlertsUrl;
export const aboutBluetoothLink = config.AboutBluetoothLink;
export const iOS12SupportLink = config.iOS12SupportLink;
4 changes: 4 additions & 0 deletions src/features/enf/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export const strings = {
title: "Bluetooth tracing",
description:
"Anonymously log when you are near other app users by enabling your phone’s Exposure Notification System.",
descriptioniOS12:
"Your phone is partially supported. You can enable Bluetooth tracing now, and it will work fully in a future version of the app. ",
descriptionLinkiOS12:
"Read more about Bluetooth tracing on iOS 12.5 here.",
buttonEnabled: "Turn it off",
buttonEnabledAccessibility: "Turn bluetooth tracing off",
buttonDisabled: "Turn it on",
Expand Down
9 changes: 8 additions & 1 deletion src/features/enf/views/ENFSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { isIOS } from "@lib/helpers";
import { createLogger } from "@logger/createLogger";
import { useAccessibleTitle } from "@navigation/hooks/useAccessibleTitle";
import { iOS12EnfSupported } from "@utils/versions";
import React, { useCallback, useEffect, useRef } from "react";
import { useTranslation } from "react-i18next";
import { Alert, Linking } from "react-native";
Expand All @@ -20,6 +21,7 @@ import styled from "styled-components/native";

import { AnalyticsEvent, recordAnalyticEvent } from "../../../analytics";
import { Subtext } from "../components/Subtext";
import { ENFiOS12Support } from "./ENFiOS12Support";

const Subheading = styled(Text)`
font-family: ${fontFamilies["open-sans-bold"]};
Expand Down Expand Up @@ -150,6 +152,9 @@ export function ENFSettings() {
headerImage={require("../assets/images/information.png")}
heading={t("screens:enfSettings:title")}
description={t("screens:enfSettings:description")}
descriptionElement={
iOS12EnfSupported ? <ENFiOS12Support showLogParagraph /> : undefined
}
buttonText={buttonText}
onButtonPress={onButtonPress}
buttonAccessibilityLabel={buttonAccessibilityLabel}
Expand All @@ -174,7 +179,9 @@ export function ENFSettings() {
<Subheading>{t("screens:enfSettings:subheading")}</Subheading>
<Subtext>{t("screens:enfSettings:subtext")}</Subtext>
<Subtext>{t("screens:enfSettings:subtextP2")}</Subtext>
<Subtext>{t("screens:enfSettings:subtextP3")}</Subtext>
{!iOS12EnfSupported && (
<Subtext>{t("screens:enfSettings:subtextP3")}</Subtext>
)}
</FormV2>
);
}
54 changes: 54 additions & 0 deletions src/features/enf/views/ENFiOS12Support.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { VerticalSpacing } from "@components/atoms";
import { Text } from "@components/atoms/Text";
import { fontFamilies, fontSizes, grid2x, grid4x } from "@constants";
import React, { useCallback } from "react";
import { useTranslation } from "react-i18next";
import { Linking } from "react-native";
import styled from "styled-components/native";

import config from "../../../config";

const DescriptionBold = styled(Text)`
font-family: ${fontFamilies["open-sans-bold"]};
font-size: ${fontSizes.normal}px;
text-align: left;
`;

const Description = styled(Text)`
font-family: ${fontFamilies["open-sans"]};
font-size: ${fontSizes.normal}px;
margin-bottom: ${grid4x}px;
text-align: left;
`;

const DescriptionLink = styled(DescriptionBold)`
padding-top: 8px;
text-decoration-line: underline;
`;

export interface ENFiOS12SupportProps {
showLogParagraph?: boolean;
}

export function ENFiOS12Support({ showLogParagraph }: ENFiOS12SupportProps) {
const { t } = useTranslation();

const handleLink = useCallback(() => {
Linking.openURL(config.iOS12SupportLink);
}, []);

return (
<>
<DescriptionBold>
{t("screens:enfSettings:descriptioniOS12")}
</DescriptionBold>
<DescriptionLink onPress={handleLink}>
{t("screens:enfSettings:descriptionLinkiOS12")}
</DescriptionLink>
<VerticalSpacing height={grid2x} />
{showLogParagraph && (
<Description>{t("screens:enfSettings:description")}</Description>
)}
</>
);
}
10 changes: 10 additions & 0 deletions src/features/onboarding/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ const slice = createSlice({
state.loadingDidTimeout = true;
reduceIsLoading(state);
},
patchEnfCompleted(state) {
if (state.hasSeenDashboardEnf) {
state.screenCompleted[OnboardingScreen.EnableENF] = true;
}
},
},
extraReducers: (builder) => {
builder.addCase(
Expand Down Expand Up @@ -249,6 +254,11 @@ export const {
navigateNext,
setHasSeenEnf,
loadingDidTimeout,
/**
* This action patches the enf screen completed state,
* in case if it wasn't shown in the first time. (due to attestation failure)
*/
patchEnfCompleted,
} = actions;

export { reducer as _reducer };
Expand Down
8 changes: 6 additions & 2 deletions src/features/onboarding/saga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ExposureNotificationModule from "react-native-exposure-notification-servi
import { SagaIterator } from "redux-saga";
import { all, call, delay, put, race, select, take } from "redux-saga/effects";

import { setEnfSupported, setSessionType } from "./reducer";
import { patchEnfCompleted, setEnfSupported, setSessionType } from "./reducer";
import { selectSessionType } from "./selectors";
import { SessionType } from "./types";

Expand Down Expand Up @@ -60,5 +60,9 @@ function* onboarding(): SagaIterator {
}

export default function* sagaWatcher(): SagaIterator {
yield all([call(onboarding), call(loadEnfSupported)]);
yield all([
put(patchEnfCompleted()),
call(onboarding),
call(loadEnfSupported),
]);
}
2 changes: 2 additions & 0 deletions src/features/onboarding/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export const strings = {
title: "We’ve made a few changes for you",
infoEnf:
"Use Bluetooth to anonymously log when you are near other app users",
infoEnfiOS12:
"Your phone is now partially supported for Bluetooth tracing. You can enable it now, and it will work fully soon.",
infoPassword:
"You don't need to set a password or log in to use the app",
infoLook:
Expand Down
11 changes: 9 additions & 2 deletions src/features/onboarding/views/EnableENF.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import {
fontSizes,
grid2x,
} from "@constants";
import { ENFiOS12Support } from "@features/enf/views/ENFiOS12Support";
import { ENFEvent } from "@features/enfExposure/events";
import { isIOS } from "@lib/helpers";
import { createLogger } from "@logger/createLogger";
import { useAccessibleTitle } from "@navigation/hooks/useAccessibleTitle";
import { StackScreenProps } from "@react-navigation/stack";
import { iOS12EnfSupported } from "@utils/versions";
import React, { useCallback, useLayoutEffect, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { Linking } from "react-native";
Expand Down Expand Up @@ -163,15 +165,20 @@ export function EnableENF(props: Props) {
headingStyle={styles.headingBig}
renderButton={renderButton}
ref={formRef}
descriptionElement={iOS12EnfSupported ? <ENFiOS12Support /> : undefined}
>
<Paragraph>{t("screens:enableENF:description1")}</Paragraph>
<VerticalSpacing height={grid2x} />
<Paragraph>{t("screens:enableENF:description2")}</Paragraph>
<VerticalSpacing height={grid2x} />
<Paragraph>{t("screens:enableENF:description3")}</Paragraph>
<VerticalSpacing height={grid2x} />
<Paragraph>{t("screens:enableENF:description4")}</Paragraph>
<VerticalSpacing height={grid2x} />
{!iOS12EnfSupported && (
<>
<Paragraph>{t("screens:enableENF:description4")}</Paragraph>
<VerticalSpacing height={grid2x} />
</>
)}
<Link
onPress={handleLinkPressed}
accessibilityLabel={t("screens:enableENF:moreAccessibility")}
Expand Down
3 changes: 2 additions & 1 deletion src/features/scan/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export const strings = {
},
visitRecorded: {
addDetails: "Add details",
doneButton: "Finish",
doneButton: "Okay",
doneHint: "Navigates back to scan page",
detailsDescription:
"Describing who you were with and what you were doing can help the Contact Tracing team if you share your diary.",
},
Expand Down
1 change: 1 addition & 0 deletions src/features/scan/views/VisitRecordedScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export function VisitRecordedScreen(props: Props) {
headerImage={assets.tickSmall}
headerBackgroundColor={colors.green}
buttonText={t("screens:visitRecorded:doneButton")}
buttonAccessibilityHint={t("screens:visitRecorded:doneHint")}
buttonTestID="visitRecorded:done"
onButtonPress={handleDonePress}
keyboardAvoiding={true}
Expand Down
6 changes: 5 additions & 1 deletion src/translations/__snapshots__/strings.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ your community",
"buttonEnabled": "Turn it off",
"buttonEnabledAccessibility": "Turn bluetooth tracing off",
"description": "Anonymously log when you are near other app users by enabling your phone’s Exposure Notification System.",
"descriptionLinkiOS12": "Read more about Bluetooth tracing on iOS 12.5 here.",
"descriptioniOS12": "Your phone is partially supported. You can enable Bluetooth tracing now, and it will work fully in a future version of the app. ",
"disableModal": Object {
"cancel": "Cancel",
"description": "If you turn off this feature, you will stop logging when you are near other app users and won’t receive exposure notifications.
Expand Down Expand Up @@ -380,6 +382,7 @@ If there are any diary entries on this device that were linked to this email add
},
"existingUser": Object {
"infoEnf": "Use Bluetooth to anonymously log when you are near other app users",
"infoEnfiOS12": "Your phone is now partially supported for Bluetooth tracing. You can enable it now, and it will work fully soon.",
"infoLook": "We've simplified the dashboard to make it easier to get around",
"infoPassword": "You don't need to set a password or log in to use the app",
"okay": "Continue",
Expand Down Expand Up @@ -576,7 +579,8 @@ Together we can stop the spread of COVID-19.",
"visitRecorded": Object {
"addDetails": "Add details",
"detailsDescription": "Describing who you were with and what you were doing can help the Contact Tracing team if you share your diary.",
"doneButton": "Finish",
"doneButton": "Okay",
"doneHint": "Navigates back to scan page",
},
},
"validations": Object {
Expand Down
13 changes: 13 additions & 0 deletions src/utils/versions.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { parseVersion } from "./versions";

it.each([
["12.5", { major: 12, minor: 5 }],
["12.5.1", { major: 12, minor: 5 }],
["12.6", { major: 12, minor: 6 }],
["12.6,1", { major: 12, minor: 6 }],
["12", undefined],
["foo", undefined],
[8, { major: 8 }],
])("parses version %s to %s", (version, result) => {
expect(parseVersion(version)).toEqual(result);
});
40 changes: 40 additions & 0 deletions src/utils/versions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { Platform } from "react-native";

export interface Version {
major: number;
minor?: number;
}

export const parseVersion = (version: string | number): Version | undefined => {
if (typeof version === "number") {
return {
major: version,
};
}
const components = version.split(".");
if (components.length < 2) {
return undefined;
}

const major = parseInt(components[0]);
const minor = parseInt(components[1]);

if (isNaN(major) || isNaN(minor)) {
return undefined;
}

return {
major,
minor,
};
};

const platform = Platform.OS;
const version = parseVersion(Platform.Version || "");

export const iOS12EnfSupported =
platform === "ios" &&
version != null &&
version.major === 12 &&
version.minor != null &&
version.minor >= 5;

0 comments on commit 73621c7

Please sign in to comment.