Skip to content

Commit

Permalink
#1149 | Show toast message when user clicks on sync button during aut…
Browse files Browse the repository at this point in the history
…omatic sync
  • Loading branch information
himeshr committed Oct 26, 2023
1 parent 4687641 commit 9c0ac36
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
11 changes: 7 additions & 4 deletions packages/openchs-android/src/views/SyncComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand All @@ -227,8 +231,7 @@ class SyncComponent extends AbstractComponent {
<View>
{this.renderSyncModal()}
<TouchableNativeFeedback
onPress={() => this.sync()}
disabled={this.state.backgroundSyncInProgress}>
onPress={() => this.sync()}>
<View style={{
flexDirection: 'column',
justifyContent: 'center',
Expand Down
3 changes: 2 additions & 1 deletion packages/openchs-android/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@
"confirmNewPassword" : "Confirm new password",
"enterNewPassword" : "Enter new password",
"enterNewPasswordFor" : "Enter new password for {{userName}}",
"enterOTP" : "Enter OTP"
"enterOTP" : "Enter OTP",
"backgroundSyncInProgress" : "Auto sync is in progress. Please try again after sometime."
}
}
3 changes: 2 additions & 1 deletion packages/openchs-android/translations/hi_IN.json
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@
"forgot_password_userId_placeholder" : "अपनी यूजर आईडी दर्ज करें",
"Send OTP" : "वन-टाइम पासवर्ड (OTP) भेजें",
"disableAutoSync": "ऑटो सिंक अक्षम करें",
"autoSync": "स्वतः सिंक"
"autoSync": "ऑटो सिंक",
"backgroundSyncInProgress": "ऑटो सिंक प्रगति पर है| कृपया कुछ देर बाद प्रयास करें।"
}
}

0 comments on commit 9c0ac36

Please sign in to comment.