fix update

This commit is contained in:
vivabelarus 2022-12-19 17:40:59 +03:00
parent 2525460c38
commit 3fe1a59a35
No known key found for this signature in database
GPG key ID: D8D8542F5B70C314
3 changed files with 10 additions and 1 deletions

View file

@ -214,6 +214,7 @@ public class NotificationCenter {
public static final int chatSearchResultsAvailableAll = totalEvents++;
public static final int telegramDataReceived = totalEvents++;
public static final int telegramDataReceivingError = totalEvents++;
public static final int cacheClearedByPtg = totalEvents++;
//global

View file

@ -25,6 +25,7 @@ import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaDataController;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.MessagesStorage;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.UserConfig;
@ -165,6 +166,7 @@ public class Utils {
}
}
});
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.cacheClearedByPtg);
});
}

View file

@ -744,6 +744,7 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.shouldKillApp);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.shouldHideApp);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.savedChannelsButtonStateChanged);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.cacheClearedByPtg);
if (actionBarLayout.getFragmentStack().isEmpty()) {
if (!UserConfig.getInstance(currentAccount).isClientActivated()) {
actionBarLayout.addFragmentToStack(getClientNotActivatedFragment());
@ -5138,6 +5139,7 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.shouldKillApp);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.shouldHideApp);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.savedChannelsButtonStateChanged);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.cacheClearedByPtg);
}
public void presentFragment(INavigationLayout.NavigationParams params) {
@ -6118,10 +6120,14 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
System.exit(0);
} else if (id == NotificationCenter.shouldHideApp) {
moveTaskToBack(true);
} else if (id == NotificationCenter.savedChannelsButtonStateChanged) {
} else if (id == NotificationCenter.savedChannelsButtonStateChanged) {
if (sideMenu != null) {
sideMenu.getAdapter().notifyDataSetChanged();
}
} else if (id == NotificationCenter.cacheClearedByPtg) {
if (updateLayoutIcon != null && (updateLayoutIcon.getIcon() == MediaActionDrawable.ICON_CANCEL)) {
FileLoader.getInstance(currentAccount).cancelLoadFile(SharedConfig.pendingPtgAppUpdate.document);
}
}
}