Skip to content

Commit

Permalink
chore: ColorOS Show Clipboard Toast
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed Jan 28, 2025
1 parent dad6d90 commit b0ad459
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@
import tw.nekomimi.nekogram.utils.EnvUtil;
import tw.nekomimi.nekogram.utils.FileUtil;
import tw.nekomimi.nekogram.utils.TelegramUtil;
import xyz.nextalone.nagram.helper.ColorOsHelper;

public class AndroidUtilities {
public final static int LIGHT_STATUS_BAR_OVERLAY = 0x0f000000, DARK_STATUS_BAR_OVERLAY = 0x33000000;
Expand Down Expand Up @@ -3442,7 +3443,11 @@ public static void shakeViewSpring(View view, float shiftDp, Runnable endCallbac
// }

public static boolean shouldShowClipboardToast() {
return (Build.VERSION.SDK_INT < Build.VERSION_CODES.S || !OneUIUtilities.hasBuiltInClipboardToasts()) && (Build.VERSION.SDK_INT < 32 || XiaomiUtilities.isMIUI());
boolean origin = (Build.VERSION.SDK_INT < Build.VERSION_CODES.S || !OneUIUtilities.hasBuiltInClipboardToasts()) && Build.VERSION.SDK_INT < 32;
if (origin) return true;
boolean isMIUI = XiaomiUtilities.isMIUI();
boolean isColorOS = ColorOsHelper.INSTANCE.isColorOS();
return isMIUI || isColorOS;
}

public static boolean addToClipboard(CharSequence str) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package xyz.nextalone.nagram.helper

import org.telegram.messenger.AndroidUtilities

object ColorOsHelper {
val isColorOS: Boolean =
AndroidUtilities.getSystemProperty("ro.build.version.oplusrom") != null
}
4 changes: 2 additions & 2 deletions bin/scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
git+https://github.com/KurimuzonAkuma/pyrogram
PyroTgCrypto==1.2.6a0
git+https://github.com/TeamPGM/pyrogram
PyroTgCrypto==1.2.7

0 comments on commit b0ad459

Please sign in to comment.