Skip to content

Commit

Permalink
feat: deep link for send logs
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed May 16, 2024
1 parent 8fe7fc3 commit cb6491b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2311,7 +2311,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 @@ -2794,7 +2794,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
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 cb6491b

Please sign in to comment.