Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
LiuYi0526 committed May 16, 2024
2 parents 5cec31b + cb6491b commit 27c6914
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2320,7 +2320,7 @@ private boolean handleIntent(Intent intent, boolean isNew, boolean restore, bool
} else if (path.startsWith("addemoji/")) {
emoji = path.replace("addemoji/", "");
} else if (path.startsWith("nasettings/")) {
SettingsHelper.processDeepLink(data, fragment -> {
SettingsHelper.processDeepLink(this, data, fragment -> {
AndroidUtilities.runOnUIThread(() -> presentFragment(fragment, false, false));
if (AndroidUtilities.isTablet()) {
actionBarLayout.showLastFragment();
Expand Down Expand Up @@ -2803,7 +2803,7 @@ private boolean handleIntent(Intent intent, boolean isNew, boolean restore, bool
} else if (url.startsWith("tg:neko") || url.startsWith("tg://neko")) {
url = url.replace("tg:neko", "tg://t.me/nasettings").replace("tg://neko", "tg://t.me/nasettings");
data = Uri.parse(url);
SettingsHelper.processDeepLink(data, fragment -> {
SettingsHelper.processDeepLink(this, data, fragment -> {
AndroidUtilities.runOnUIThread(() -> presentFragment(fragment, false, false));
if (AndroidUtilities.isTablet()) {
actionBarLayout.showLastFragment();
Expand Down
53 changes: 27 additions & 26 deletions TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -13218,32 +13218,33 @@ private void onTextDetailCellImageClicked(View view) {
args.putLong("user_id", userId);
presentFragment(new QrActivity(args));
} else if (parent.getTag() != null && ((int) parent.getTag()) == birthdayRow) {
if (userId == getUserConfig().getClientUserId()) {
presentFragment(new PremiumPreviewFragment("my_profile_gift"));
return;
}
TLRPC.User user = getMessagesController().getUser(userId);
if (user == null || userInfo == null) return;
ArrayList<TLRPC.TL_premiumGiftOption> options = new ArrayList<>(userInfo.premium_gifts);
if (options.isEmpty()) {
if (getVisibleDialog() != null) return;
final AlertDialog progressDialog = new AlertDialog(getContext(), AlertDialog.ALERT_TYPE_SPINNER);
final int reqId = BoostRepository.loadGiftOptions(null, loadedOptions -> {
progressDialog.dismiss();
if (getVisibleDialog() != null) return;
loadedOptions = BoostRepository.filterGiftOptions(loadedOptions, 1);
loadedOptions = BoostRepository.filterGiftOptionsByBilling(loadedOptions);
ArrayList<TLRPC.User> users = new ArrayList<>();
users.add(user);
PremiumPreviewGiftToUsersBottomSheet.show(users, loadedOptions);
});
progressDialog.setOnCancelListener(di -> {
getConnectionsManager().cancelRequest(reqId, true);
});
progressDialog.showDelayed(500);
} else {
showDialog(new GiftPremiumBottomSheet(this, user));
}
// if (userId == getUserConfig().getClientUserId()) {
// presentFragment(new PremiumPreviewFragment("my_profile_gift"));
// return;
// }
// TLRPC.User user = getMessagesController().getUser(userId);
// if (user == null || userInfo == null) return;
// ArrayList<TLRPC.TL_premiumGiftOption> options = new ArrayList<>(userInfo.premium_gifts);
// if (options.isEmpty()) {
// if (getVisibleDialog() != null) return;
// final AlertDialog progressDialog = new AlertDialog(getContext(), AlertDialog.ALERT_TYPE_SPINNER);
// final int reqId = BoostRepository.loadGiftOptions(null, loadedOptions -> {
// progressDialog.dismiss();
// if (getVisibleDialog() != null) return;
// loadedOptions = BoostRepository.filterGiftOptions(loadedOptions, 1);
// loadedOptions = BoostRepository.filterGiftOptionsByBilling(loadedOptions);
// ArrayList<TLRPC.User> users = new ArrayList<>();
// users.add(user);
// PremiumPreviewGiftToUsersBottomSheet.show(users, loadedOptions);
// });
// progressDialog.setOnCancelListener(di -> {
// getConnectionsManager().cancelRequest(reqId, true);
// });
// progressDialog.showDelayed(500);
// } else {
// showDialog(new GiftPremiumBottomSheet(this, user));
// }
showDialog(new PremiumNotAvailableBottomSheet(this));
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package tw.nekomimi.nekogram.helpers;

import static org.telegram.ui.ProfileActivity.sendLogs;

import android.app.Activity;
import android.net.Uri;
import android.text.TextUtils;

Expand All @@ -23,7 +26,7 @@

public class SettingsHelper {

public static void processDeepLink(Uri uri, Callback callback, Runnable unknown) {
public static void processDeepLink(Activity activity, Uri uri, Callback callback, Runnable unknown) {
if (uri == null) {
unknown.run();
return;
Expand Down Expand Up @@ -65,6 +68,9 @@ public static void processDeepLink(Uri uri, Callback callback, Runnable unknown)
case "g":
fragment = nekox_fragment = new NekoGeneralSettingsActivity();
break;
case "send_logs":
sendLogs(activity, false);
return;
default:
unknown.run();
return;
Expand Down

0 comments on commit 27c6914

Please sign in to comment.