Skip to content

Commit f5d2ec8

Browse files
committed
Add alert when trying to turn contacts sync toggle on
1 parent 7735236 commit f5d2ec8

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

‎app/src/main/java/org/thunderdog/challegram/telegram/TdlibContactManager.java‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -530,12 +530,12 @@ public void disableSync () {
530530
}
531531

532532
public void enableSync (BaseActivity context) {
533+
if (getStatus() != STATUS_INACTIVE || state != STATE_NOT_STARTED) {
534+
return;
535+
}
533536
if (getHideOption() == HIDE_OPTION_NEVER) {
534537
setHideOption(HIDE_OPTION_DEFAULT);
535538
}
536-
if (getStatus() == STATUS_INACTIVE) {
537-
setStatus(STATUS_IN_FIRST_PROGRESS);
538-
}
539539
startSyncIfNeeded(context, true, null);
540540
}
541541

@@ -787,14 +787,16 @@ private void showAlert (final BaseActivity context, final int flags, final @Null
787787
b.setTitle(Lang.getString(title));
788788
b.setMessage(message);
789789
b.setCancelable(false);
790-
b.setNeutralButton(Lang.getString(R.string.SyncLearnMore), (dialog, which) -> {
790+
/*b.setNeutralButton(Lang.getString(R.string.SyncLearnMore), (dialog, which) -> {
791791
tdlib.ui().openUrl(delegate, Lang.getStringSecure(R.string.url_contactsPrivacy), null);
792-
});
793-
b.setOnDismissListener(dialog -> {
794-
if (showingAlert == dialog) {
795-
showingAlert = null;
796-
}
797-
});
792+
});*/
793+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
794+
b.setOnDismissListener(dialog -> {
795+
if (showingAlert == dialog) {
796+
showingAlert = null;
797+
}
798+
});
799+
}
798800
b.setPositiveButton(Lang.getString(!context.permissions().canReadContacts() ? (isRetry ? R.string.Settings : R.string.SyncBtn) : R.string.SyncBtn), (dialog, which) -> {
799801
if (isRetry) {
800802
Intents.openPermissionSettings();

0 commit comments

Comments
 (0)