Skip to content

Commit

Permalink
Add button to open settings in order to enable Bluetooth (#351)
Browse files Browse the repository at this point in the history
* Add button to open settings in order to enable Bluetooth

* Show back instead of cancel
  • Loading branch information
juancruzgs committed Sep 9, 2020
1 parent 2d6db2c commit 5be93e4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/Home/BluetoothActivationStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ActivationStatus } from "./ActivationStatus"
import { useTranslation } from "react-i18next"
import { useNavigation } from "@react-navigation/native"
import { HomeScreens } from "../navigation"
import { openAppSettings } from "../gaen/nativeModule"

export const BluetoothActivationStatus: FunctionComponent = () => {
const { t } = useTranslation()
Expand All @@ -25,7 +26,12 @@ export const BluetoothActivationStatus: FunctionComponent = () => {
t("home.bluetooth.bluetooth_disabled_error_message"),
[
{
text: t("common.okay"),
text: t("common.back"),
style: "cancel",
},
{
text: t("common.settings"),
onPress: () => openAppSettings(),
},
],
)
Expand Down
2 changes: 1 addition & 1 deletion src/Home/LocationActivationStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const LocationActivationStatus: FunctionComponent = () => {
t("home.bluetooth.location_disabled_error_message"),
[
{
text: t("common.cancel"),
text: t("common.back"),
style: "cancel",
},
{
Expand Down
5 changes: 4 additions & 1 deletion src/Home/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ describe("Home", () => {
expect(alertSpy).toHaveBeenCalledWith(
"Enable Bluetooth in Settings",
"Go to the Settings app and enable Bluetooth to fix this error",
[{ text: "Okay" }],
[
expect.objectContaining({ text: "Back" }),
expect.objectContaining({ text: "Open Settings" }),
],
)
})
})
Expand Down

0 comments on commit 5be93e4

Please sign in to comment.