From cae29fa2795bc8aca691118e3bb11cad1a7aa834 Mon Sep 17 00:00:00 2001 From: CrisTofani Date: Tue, 25 Aug 2020 17:12:51 +0200 Subject: [PATCH 1/3] [#174160259] Switch label to change text on switch value change --- ts/screens/services/ServiceDetailsScreen.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ts/screens/services/ServiceDetailsScreen.tsx b/ts/screens/services/ServiceDetailsScreen.tsx index c76f762f95a..f51b90d23fd 100644 --- a/ts/screens/services/ServiceDetailsScreen.tsx +++ b/ts/screens/services/ServiceDetailsScreen.tsx @@ -476,7 +476,7 @@ class ServiceDetailsScreen extends React.Component { bold={true} style={isSwitchedOn ? styles.enabledColor : styles.disabledColor} > - {this.profileEnabledChannels.inbox + {isSwitchedOn ? I18n.t("services.serviceIsEnabled") : I18n.t("services.serviceNotEnabled")} From 579493946a2707afab2af7743b107805eb3aaa83 Mon Sep 17 00:00:00 2001 From: CrisTofani Date: Wed, 26 Aug 2020 18:02:07 +0200 Subject: [PATCH 2/3] Restore the check on profileEnabledChannels --- ts/screens/services/ServiceDetailsScreen.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ts/screens/services/ServiceDetailsScreen.tsx b/ts/screens/services/ServiceDetailsScreen.tsx index f51b90d23fd..2b029b291d4 100644 --- a/ts/screens/services/ServiceDetailsScreen.tsx +++ b/ts/screens/services/ServiceDetailsScreen.tsx @@ -455,7 +455,9 @@ class ServiceDetailsScreen extends React.Component { // inbox is globally disabled or this.props.isInboxEnabled && // inbox is disabled for the given service - this.state.uiEnabledChannels.inbox; + this.state.uiEnabledChannels.inbox && + // inbox is disbaled for the profile + this.profileEnabledChannels.inbox; const onValueChange = (value: boolean) => { if (!value && !this.props.wasServiceAlertDisplayedOnce) { From 31a63e150ef09e6b81f71760b5dbae1ec4d118bc Mon Sep 17 00:00:00 2001 From: Matteo Boschi Date: Mon, 31 Aug 2020 18:25:17 +0200 Subject: [PATCH 3/3] [#174574704] fix some comments typos fix a bug that computes profile status only when the screen is mounted --- ts/screens/services/ServiceDetailsScreen.tsx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/ts/screens/services/ServiceDetailsScreen.tsx b/ts/screens/services/ServiceDetailsScreen.tsx index 2b029b291d4..be186274175 100644 --- a/ts/screens/services/ServiceDetailsScreen.tsx +++ b/ts/screens/services/ServiceDetailsScreen.tsx @@ -269,10 +269,8 @@ class ServiceDetailsScreen extends React.Component { private service = this.props.navigation.getParam("service"); // finds out which channels are enabled in the user profile - private profileEnabledChannels = getEnabledChannelsForService( - this.props.profile, - this.serviceId - ); + private profileEnabledChannels = () => + getEnabledChannelsForService(this.props.profile, this.serviceId); // whether last attempt to save the preferences failed private profileVersion = pot @@ -446,18 +444,18 @@ class ServiceDetailsScreen extends React.Component { private getInboxSwitchRow = () => { const isDisabled = // the preference can be updated if - // natifications are globally disabled or + // notifications are globally disabled or !this.props.isInboxEnabled || // profile is updating pot.isUpdating(this.props.profile); const isSwitchedOn = - // inbox is globally disabled or + // inbox is globally enabled and this.props.isInboxEnabled && - // inbox is disabled for the given service + // inbox is enabled for the given service this.state.uiEnabledChannels.inbox && - // inbox is disbaled for the profile - this.profileEnabledChannels.inbox; + // inbox is enabled for the profile + this.profileEnabledChannels().inbox; const onValueChange = (value: boolean) => { if (!value && !this.props.wasServiceAlertDisplayedOnce) {