From 9c0ac36aca8b8720313d903d260853da8765774c Mon Sep 17 00:00:00 2001 From: himeshr Date: Thu, 26 Oct 2023 12:38:43 +0530 Subject: [PATCH] #1149 | Show toast message when user clicks on sync button during automatic sync --- packages/openchs-android/src/views/SyncComponent.js | 11 +++++++---- packages/openchs-android/translations/en.json | 3 ++- packages/openchs-android/translations/hi_IN.json | 3 ++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/openchs-android/src/views/SyncComponent.js b/packages/openchs-android/src/views/SyncComponent.js index 44ccb282b..fad3aaa65 100644 --- a/packages/openchs-android/src/views/SyncComponent.js +++ b/packages/openchs-android/src/views/SyncComponent.js @@ -13,7 +13,7 @@ import bugsnag from "../utility/bugsnag"; import AuthenticationError from "../service/AuthenticationError"; import CHSNavigator from "../utility/CHSNavigator"; import ServerError from "../service/ServerError"; -import {Alert, Text, TouchableNativeFeedback, View} from "react-native"; +import {Alert, Text, ToastAndroid, TouchableNativeFeedback, View} from "react-native"; import NetInfo from "@react-native-community/netinfo"; import _ from "lodash"; import SyncService from "../service/SyncService"; @@ -143,6 +143,10 @@ class SyncComponent extends AbstractComponent { } sync() { + if(this.state.backgroundSyncInProgress) { + ToastAndroid.show(this.I18n.t('backgroundSyncInProgress'), ToastAndroid.SHORT); + return; + } this.setState(({syncStarted}) => { if (!syncStarted) { this.startSync(); @@ -208,7 +212,7 @@ class SyncComponent extends AbstractComponent { alignSelf: 'center', fontSize: 30 }); - const syncDisabledIcon = this.props.icon("sync-circle", { + const syncDisabledIcon = this.props.icon("sync-off", { color: Colors.DisabledButtonColor, alignSelf: 'center', fontSize: 30 @@ -227,8 +231,7 @@ class SyncComponent extends AbstractComponent { {this.renderSyncModal()} this.sync()} - disabled={this.state.backgroundSyncInProgress}> + onPress={() => this.sync()}>