From ace1e998c0938bfd138de2fd7a14e4cf8e7d6260 Mon Sep 17 00:00:00 2001 From: Nam Anh Date: Fri, 11 Oct 2024 04:18:13 +0700 Subject: [PATCH] feat: add party size support & misc --- .../java/com/my/kizzy/preference/Prefs.kt | 2 + .../src/main/res/values-de/strings.xml | 2 +- .../src/main/res/values-es/strings.xml | 4 +- .../src/main/res/values-fa/strings.xml | 2 +- .../src/main/res/values-fil/strings.xml | 2 +- .../src/main/res/values-fr/strings.xml | 2 +- .../src/main/res/values-hr/strings.xml | 2 +- .../src/main/res/values-in/strings.xml | 2 +- .../src/main/res/values-it/strings.xml | 2 +- .../src/main/res/values-ja/strings.xml | 2 +- .../src/main/res/values-kr/strings.xml | 2 +- .../src/main/res/values-mm/strings.xml | 2 +- .../src/main/res/values-nl/strings.xml | 2 +- .../src/main/res/values-pl/strings.xml | 2 +- .../src/main/res/values-pt/strings.xml | 2 +- .../src/main/res/values-ru/strings.xml | 2 +- .../src/main/res/values-th/strings.xml | 2 +- .../src/main/res/values-tr/strings.xml | 2 +- .../src/main/res/values-vi/strings.xml | 65 +++++++++++++++-- .../src/main/res/values-zh/strings.xml | 2 +- .../resources/src/main/res/values/strings.xml | 61 ++++++++++++++-- .../media/GetCurrentlyPlayingMedia.kt | 14 +++- .../java/com/my/kizzy/data/rpc/CommonRpc.kt | 4 +- .../java/com/my/kizzy/data/rpc/KizzyRPC.kt | 22 ++++++ .../java/com/my/kizzy/data/rpc/Timestamps.kt | 18 +++++ .../my/kizzy/domain/model/rpc/RpcConfig.kt | 6 +- .../com/my/kizzy/domain/model/user/User.kt | 8 +- .../com/my/kizzy/feature_about/about/About.kt | 2 +- .../com/my/kizzy/feature_apps_rpc/AppsRpc.kt | 2 +- .../kizzy/feature_console_rpc/GamesScreen.kt | 8 +- .../my/kizzy/feature_custom_rpc/CustomRpc.kt | 73 ++++++++++++++++++- .../CustomScreenViewModel.kt | 5 ++ .../my/kizzy/feature_custom_rpc/UiEvent.kt | 1 + .../my/kizzy/feature_custom_rpc/UiState.kt | 1 + .../sheet/RequestStoragePermission.kt | 2 +- .../java/com/my/kizzy/feature_home/Home.kt | 6 +- .../feature_home/feature/FeaturesProvider.kt | 23 +++--- .../com/my/kizzy/feature_logs/LogScreen.kt | 48 +++++++++--- .../my/kizzy/feature_logs/LogsViewModel.kt | 1 + .../my/kizzy/feature_media_rpc/MediaRpc.kt | 19 ++++- .../ui/component/ActivityRow.kt | 22 ++++-- .../ui/component/LogoutButton.kt | 4 +- .../ui/component/ProfileCard.kt | 16 ++-- .../ui/component/ProfileNetworkError.kt | 6 +- .../feature_profile/ui/user/UserScreen.kt | 7 +- .../services/CustomRpcService.kt | 1 + .../services/ExperimentalRpc.kt | 3 + .../services/MediaRpcService.kt | 10 ++- .../com/my/kizzy/feature_settings/Settings.kt | 8 +- .../rpc_settings/RpcSettings.kt | 18 ++--- .../com/my/kizzy/feature_startup/StartUp.kt | 16 ++-- .../gateway/entities/presence/Activity.kt | 2 + .../kizzy/gateway/entities/presence/Party.kt | 29 ++++++++ 53 files changed, 455 insertions(+), 116 deletions(-) create mode 100644 data/src/main/java/com/my/kizzy/data/rpc/Timestamps.kt create mode 100644 gateway/src/main/java/kizzy/gateway/entities/presence/Party.kt diff --git a/common/preference/src/main/java/com/my/kizzy/preference/Prefs.kt b/common/preference/src/main/java/com/my/kizzy/preference/Prefs.kt index 4a5b9589..78b1d3c7 100644 --- a/common/preference/src/main/java/com/my/kizzy/preference/Prefs.kt +++ b/common/preference/src/main/java/com/my/kizzy/preference/Prefs.kt @@ -115,6 +115,7 @@ object Prefs { const val MEDIA_RPC_ALBUM_NAME = "media_rpc_album_name" const val MEDIA_RPC_APP_ICON = "media_rpc_app_icon" const val MEDIA_RPC_ENABLE_TIMESTAMPS = "enable_timestamps" + const val MEDIA_RPC_HIDE_ON_PAUSE = "hide_on_pause" //Rpc Setting Preferences const val USE_RPC_BUTTONS = "use_saved_rpc_buttons" @@ -135,6 +136,7 @@ object Prefs { const val IS_FIRST_LAUNCHED = "is_first_launched" const val CUSTOM_ACTIVITY_TYPE = "custom_activity_type" const val SHOW_LOGS_IN_COMPACT_MODE = "logs_compact_mode" + const val LOGS_AUTO_SCROLL = "logs_auto_scroll" const val PALETTE_STYLE = "palette_style" diff --git a/common/resources/src/main/res/values-de/strings.xml b/common/resources/src/main/res/values-de/strings.xml index e17ed39b..a1cf45da 100644 --- a/common/resources/src/main/res/values-de/strings.xml +++ b/common/resources/src/main/res/values-de/strings.xml @@ -35,7 +35,7 @@ App-Symbol anzeigen Zeitstempel aktivieren Der Speicherzugriff ist wichtig für diese Anwendung, um Konfigurationen in öffentlichen Verzeichnissen zu speichern. Bitte erteile die Erlaubnis. - Speichererlaubnis erforderlich, damit die Konfigurationsfunktionen funktionieren. Bitte erteile die Erlaubnis + Speichererlaubnis erforderlich, damit die Konfigurationsfunktionen funktionieren. Bitte erteile die Erlaubnis Erlaubnis erteilen Bilder mit niedriger Auflösung verwenden Verwende ein App-Symbol mit geringerer Auflösung für die Anzeige in der Rpc (schalte dies ein, wenn die Rpc abstürzt). Diese Einstellung wird auch auf Apps Rpc angewendet. diff --git a/common/resources/src/main/res/values-es/strings.xml b/common/resources/src/main/res/values-es/strings.xml index cacaed64..038014eb 100644 --- a/common/resources/src/main/res/values-es/strings.xml +++ b/common/resources/src/main/res/values-es/strings.xml @@ -47,8 +47,8 @@ Otros RPC RPC de medios Un RPC de detección de música/video - RPC personalizado - Detalles de RPC + RPC personalizado + Detalles de RPC Cambiar idioma Buscar actualizaciones Forzar actualización diff --git a/common/resources/src/main/res/values-fa/strings.xml b/common/resources/src/main/res/values-fa/strings.xml index 531ac3cd..168c8550 100644 --- a/common/resources/src/main/res/values-fa/strings.xml +++ b/common/resources/src/main/res/values-fa/strings.xml @@ -35,7 +35,7 @@ نمایش نماد برنامه فعال کردن رویداد ها دسترسی به فضای ذخیره سازی برای این برنامه برای ذخیره تنظیمات در پوشه های عمومی مهم است. لطفا اجازه بدهید - مجوز ذخیره سازی برای عملکرد ویژگی های پیکربندی مورد نیاز است. لطفا اجازه بدهید + مجوز ذخیره سازی برای عملکرد ویژگی های پیکربندی مورد نیاز است. لطفا اجازه بدهید اعطای مجوز از تصاویر با وضوح پایین استفاده کنید برای نمایش در rpc از یک نماد برنامه با وضوح پایین تر استفاده کنید (اگر rpc کار نمی کند، این را روشن کنید). این تنظیم برای برنامه های Rpc نیز اعمال خواهد شد. diff --git a/common/resources/src/main/res/values-fil/strings.xml b/common/resources/src/main/res/values-fil/strings.xml index a16dea75..fa9d2e23 100644 --- a/common/resources/src/main/res/values-fil/strings.xml +++ b/common/resources/src/main/res/values-fil/strings.xml @@ -34,7 +34,7 @@ Ipakita ang Icon ng App Paganahin ang mga Timestamp Mahalaga ang access sa storage para sa app na ito upang mag-imbak ng mga config sa mga pampublikong direktoryo. Mangyaring bigyan ang pahintulot. - Mahalaga ang access sa storage para sa app na ito upang mag-imbak ng mga config sa mga pampublikong direktoryo. Mangyaring bigyan ang pahintulot. + Mahalaga ang access sa storage para sa app na ito upang mag-imbak ng mga config sa mga pampublikong direktoryo. Mangyaring bigyan ang pahintulot. Pinayagang pahintulot Gumamit ng Low Resolution Images Gumamit ng icon ng app na may mas mababang resolution para sa pagpapakita sa rpc (i-on ito kung nag-crash ang rpc). Ilalapat din ang setting na ito sa Apps Rpc. diff --git a/common/resources/src/main/res/values-fr/strings.xml b/common/resources/src/main/res/values-fr/strings.xml index 2dd12184..105ce42f 100644 --- a/common/resources/src/main/res/values-fr/strings.xml +++ b/common/resources/src/main/res/values-fr/strings.xml @@ -34,7 +34,7 @@ Afficher l\'icône de l\'application Activer le Timestamps L\'accès au stockage est important pour cette application afin de stocker les configurations dans des répertoires publics. Veuillez accorder cette permission. - L\'autorisation de stockage est nécessaire pour que les fonctions de configuration fonctionnent. Veuillez accorder cette autorisation + L\'autorisation de stockage est nécessaire pour que les fonctions de configuration fonctionnent. Veuillez accorder cette autorisation Accorder l\'autorisation Utiliser des images de basse résolution Utilisez une icône d\'application de plus faible résolution pour l\'affichage sur le RPC (activez cette option si le RPC se bloque). Ce paramètre sera également appliqué aux applications Rpc. diff --git a/common/resources/src/main/res/values-hr/strings.xml b/common/resources/src/main/res/values-hr/strings.xml index bb0bc76f..fcfc884d 100644 --- a/common/resources/src/main/res/values-hr/strings.xml +++ b/common/resources/src/main/res/values-hr/strings.xml @@ -34,7 +34,7 @@ Prikaži ikonu aplikacije Omogući vremenske oznake Pristup pohrani je važan za ovu aplikaciju kako bi se postavke pohranile u javne direktorije. Molimo odobrite pristup. - Potrebna je dozvola za pohranu za rad postavki. Molimo odobrite pristup. + Potrebna je dozvola za pohranu za rad postavki. Molimo odobrite pristup. Odobri dozvolu Koristi sliku niske rezolucije Koristite sliku aplikacije niske rezolucije za prikaz na RPC-u (uključite ovo ako se RPC ruši). Ova postavka će se primijeniti i na Apps RPC. diff --git a/common/resources/src/main/res/values-in/strings.xml b/common/resources/src/main/res/values-in/strings.xml index 58a75b66..6755e2d4 100644 --- a/common/resources/src/main/res/values-in/strings.xml +++ b/common/resources/src/main/res/values-in/strings.xml @@ -34,7 +34,7 @@ Tampilkan Ikon Aplikasi Nyalakan Stempel Waktu Akses penyimpanan penting bagi aplikasi ini untuk menyimpan konfigurasi di folder publik. - Izin penyimpanan diperlukan agar fitur konfigurasi berfungsi. + Izin penyimpanan diperlukan agar fitur konfigurasi berfungsi. Izinkan Gunakan Gambar Resolusi rendah Gunakan gambar resolusi rendah untuk menampilkan rpc (nyalakan ini jika rpc kamu crash). Settingan ini juga berlaku untuk Apps RPC diff --git a/common/resources/src/main/res/values-it/strings.xml b/common/resources/src/main/res/values-it/strings.xml index 117ad8b9..3d9a0a60 100644 --- a/common/resources/src/main/res/values-it/strings.xml +++ b/common/resources/src/main/res/values-it/strings.xml @@ -34,7 +34,7 @@ Mostra Icona App Abilita Tempo Trascorso Accesso ai dati di archiviazione necessario per salvare le configurazioni nelle cartelle pubbliche. Si prega di concedere il permesso. - Autorizzazione ai dati di archiviazione è necessario per le funzionalità di configurazione. Si prega di concedere il permesso. + Autorizzazione ai dati di archiviazione è necessario per le funzionalità di configurazione. Si prega di concedere il permesso. Concedi Permesso Usa Immagini a Bassa Risoluzione Usa icone app a risoluzione inferiore da mostrare su RPC (attivala se il RPC si arresta in modo anomalo). Questa impostazione verrà applicata anche al RPC App. diff --git a/common/resources/src/main/res/values-ja/strings.xml b/common/resources/src/main/res/values-ja/strings.xml index 885f1e7e..0d48f449 100644 --- a/common/resources/src/main/res/values-ja/strings.xml +++ b/common/resources/src/main/res/values-ja/strings.xml @@ -34,7 +34,7 @@ アプリアイコンを表示 経過日時を表示 このアプリでは、構成ファイルを保存、読み込み、削除するためにストレージへのアクセスが必要です。権限を付与してください。 - 構成ファイルを保存、読み込み、削除するためにストレージへのアクセスが必要です。権限を付与してください。 + 構成ファイルを保存、読み込み、削除するためにストレージへのアクセスが必要です。権限を付与してください。 権限を付与 低解像度の画像を使用 低解像度の画像を使用してアクティビティに表示します。(アプリがクラッシュする際にお試しください) この設定は、アプリアクティビティにも適用されます。 diff --git a/common/resources/src/main/res/values-kr/strings.xml b/common/resources/src/main/res/values-kr/strings.xml index cd69a105..ca434502 100644 --- a/common/resources/src/main/res/values-kr/strings.xml +++ b/common/resources/src/main/res/values-kr/strings.xml @@ -35,7 +35,7 @@ 앱 아이콘 표시 타임스탬프 활성화 이 앱이 설정을 저장하려면 저장소 액세스가 필요합니다. 권한을 부여해주세요. - 설정 기능이 작동하려면 저장소 권한이 필요합니다. 권한을 부여해주세요. + 설정 기능이 작동하려면 저장소 권한이 필요합니다. 권한을 부여해주세요. 권한 부여 저해상도 이미지 사용 저해상도 앱 아이콘을 사용하여 RPC에 표시합니다 (RPC가 충돌할 경우 켜주세요). 이 설정은 앱의 RPC에도 적용됩니다. diff --git a/common/resources/src/main/res/values-mm/strings.xml b/common/resources/src/main/res/values-mm/strings.xml index 27630f6e..0d3d8c25 100644 --- a/common/resources/src/main/res/values-mm/strings.xml +++ b/common/resources/src/main/res/values-mm/strings.xml @@ -34,7 +34,7 @@ အက်ပ်အိုင်ကွန် ပြပါ အချိန်ပြစာကို သုံးပါ Storage access is important for this app to store configs in public directories. Please grant the permission. - သိုလှောင်ခွင့်သည် ဤအက်ပ်အတွက်ု အချက်အလက်များသိမ်းဆည်းရန် လိုအပ်ပါသည်။ ကျေးဇူးပြု၍ ခွင့်ပြုချက်ပေးပါ + သိုလှောင်ခွင့်သည် ဤအက်ပ်အတွက်ု အချက်အလက်များသိမ်းဆည်းရန် လိုအပ်ပါသည်။ ကျေးဇူးပြု၍ ခွင့်ပြုချက်ပေးပါ ခွင့်ပြုချက်ပေးသည် Low Resolution ပုံများကို သုံးပါ Rpc တွင်ပြသရန် Low Resolution ပုံများကို သုံးပါ (Rpc ပျက်နေပါက ဤခလုတ်ကိုဖွင့်ပါ)။ ဤဆက်တင်ကို Apps Rpc တွင်လည်း အသုံးပြုမည်ဖြစ်သည်။ diff --git a/common/resources/src/main/res/values-nl/strings.xml b/common/resources/src/main/res/values-nl/strings.xml index 5f657eeb..87928683 100644 --- a/common/resources/src/main/res/values-nl/strings.xml +++ b/common/resources/src/main/res/values-nl/strings.xml @@ -34,7 +34,7 @@ Laat app icoon zien Laat verstreken tijd zien Geef de app permissie om de opslag te gebruiken, het is erg belangrijk en word gebruikt om de configuraties op te slaan. - Opslag permissies is erg belangrijk voor configuratie opties, geef alstublieft opslag permissies. + Opslag permissies is erg belangrijk voor configuratie opties, geef alstublieft opslag permissies. Geef Permissie Use Low Resolution Images Gebruik een lagere resolutie voor de app icoon/logo op rpc (schakel dit in als de rpc crasht). Deze instelling wordt ook toegepast op Apps Rpc. diff --git a/common/resources/src/main/res/values-pl/strings.xml b/common/resources/src/main/res/values-pl/strings.xml index 46cd2ee0..d9fb8b34 100644 --- a/common/resources/src/main/res/values-pl/strings.xml +++ b/common/resources/src/main/res/values-pl/strings.xml @@ -35,7 +35,7 @@ Pokaż Ikonę Aplikacji Włącz Znaczniki Czasu Dostęp do pamięci jest ważny dla tej aplikacji do przechowywania konfiguracji w katalogach publicznych. Proszę o pozwolenie na dostęp - Aby funkcje konfiguracyjne mogły działać, wymagane jest zezwolenie na przechowywanie. Proszę o pozwolenie na dostęp + Aby funkcje konfiguracyjne mogły działać, wymagane jest zezwolenie na przechowywanie. Proszę o pozwolenie na dostęp Przydziel Uprawnienia Użyj Grafik Niskiej Rozdzielczości Użyj niskiej rozdzielczości ikony aplikacji wyświetlanej w rpc (włącz to jeśli rpc ulega awarii). To ustawienie zostanie zastosowane również dla RPC Aplikacji diff --git a/common/resources/src/main/res/values-pt/strings.xml b/common/resources/src/main/res/values-pt/strings.xml index 6b6bc92b..9b8875b7 100644 --- a/common/resources/src/main/res/values-pt/strings.xml +++ b/common/resources/src/main/res/values-pt/strings.xml @@ -34,7 +34,7 @@ Mostrar Ícone do Aplicativo Ativar Tempo de Atividade O acesso à memória é importante para este aplicativo armazenar configurações em diretórios públicos. Por favor, conceda permissão. - A Permissão de armazenamento é necessária para que os recursos de configuração funcionem. Por favor, conceda a permissão. + A Permissão de armazenamento é necessária para que os recursos de configuração funcionem. Por favor, conceda a permissão. Conceder Permissão Usar imagens com resolução baixa Use um ícone de aplicativo de resolução mais baixa para exibir no rpc (ative-o se o rpc estiver crashando). Essa configuração também será aplicada aos Apps Rpc. diff --git a/common/resources/src/main/res/values-ru/strings.xml b/common/resources/src/main/res/values-ru/strings.xml index 4567ea6b..dda7958b 100644 --- a/common/resources/src/main/res/values-ru/strings.xml +++ b/common/resources/src/main/res/values-ru/strings.xml @@ -34,7 +34,7 @@ Показывать иконку приложения Включить временные метки Доступ к хранилищу важен для этого приложения, чтобы хранить конфигурации в общедоступных каталогах. Пожалуйста, дайте разрешение. - Разрешение на хранение требуется для работы функций конфигурации. Пожалуйста, дайте разрешение. + Разрешение на хранение требуется для работы функций конфигурации. Пожалуйста, дайте разрешение. Дать разрешение Использовать низкокачественные изображения Использовать значок приложения с более низким разрешением для отображения в активности. Этот параметр также будет применяться к Активности приложений. diff --git a/common/resources/src/main/res/values-th/strings.xml b/common/resources/src/main/res/values-th/strings.xml index 77172a87..f5917146 100644 --- a/common/resources/src/main/res/values-th/strings.xml +++ b/common/resources/src/main/res/values-th/strings.xml @@ -34,7 +34,7 @@ แสดงไอคอนของแอพสุดเฟี้ยว เปิดใช้งานการประทับเวลา เฮ้! การเข้าถึงพื้นที่จัดเก็บข้อมูลในโทรศัพท์ของคุณเป็นความสำคัญต่อแอพในการเก็บพวกเหล่าการตั้งค่าต่างๆของคุณให้มี ที่ซุกหัวนอนภายในพื้นที่โทรศัพท์อ่ะนะ ขอมาขนาดนี้ให้สิทธิ์การเข้าถึงพื้นที่จัดเก็บมือถือด้วยล่ะ มันง่ายกว่าไปรักเขาข้างเดียวอีก! - นี้พวกคือ.. เปิดใช้งานการเข้าถึงพื้นที่จัดเก็บข้อมูลเถอะ เพื่อเป็นการให้เหล่า ตั้งค่าฟีเจอร์ต่างๆ ได้ออกมาเฉิดฉายอย่างสง่างามไง! อย่าลืมเปิดด้วยล่ะ + นี้พวกคือ.. เปิดใช้งานการเข้าถึงพื้นที่จัดเก็บข้อมูลเถอะ เพื่อเป็นการให้เหล่า ตั้งค่าฟีเจอร์ต่างๆ ได้ออกมาเฉิดฉายอย่างสง่างามไง! อย่าลืมเปิดด้วยล่ะ อนุญาตการเข้าถึง ลดคุณภาพของภาพลง การลดคุณภาพของภาพลงของเหล่าไอคอนแอพที่กำลังจะได้เฉิดฉายบน RPC (ถ้าเกิด RPC มันค้างก็เปิดใช้งานอันนี้ดูนะ!) การตั้งค่านี้จะนำไปใช้กับ Apps Rpc ด้วยนะ! diff --git a/common/resources/src/main/res/values-tr/strings.xml b/common/resources/src/main/res/values-tr/strings.xml index 8f3ea72e..badb497f 100644 --- a/common/resources/src/main/res/values-tr/strings.xml +++ b/common/resources/src/main/res/values-tr/strings.xml @@ -34,7 +34,7 @@ Uygulama Simgesini Göster Zaman Bilgisini Etkinleştir Depolama erişimi bu uygulama için herkese açık dizinlerde yapılandırma kaydetmek için önemlidir. Lütfen izin verin. - Depolama izni yapılandırma özelliğinin çalışması için gereklidir. Lütfen izin verin. + Depolama izni yapılandırma özelliğinin çalışması için gereklidir. Lütfen izin verin. İzin Ver Düşük Çözünürlüklü Resim Kullan RPC\'de gözükecek uygulama simgesini düşük çözünürlüklü kullan (bunu RPC çöküyorsa açın). Bu ayar Uygulama RPC\'sine de uygulanır. diff --git a/common/resources/src/main/res/values-vi/strings.xml b/common/resources/src/main/res/values-vi/strings.xml index d07a24f2..bccb7e6e 100644 --- a/common/resources/src/main/res/values-vi/strings.xml +++ b/common/resources/src/main/res/values-vi/strings.xml @@ -7,7 +7,7 @@ Trạng thái hoạt động Thời gian bắt đầu hoạt động Thời gian kết thúc hoạt động - Trạng thái hoạt động (Trực tuyến, Rảnh rỗi, Không muốn bị làm phiền) + Trạng thái hoạt động (\"online\", \"idle\", \"dnd\") Văn bản nút hoạt động 1 Văn bản nút hoạt động 2 Liên kết nút 1 @@ -33,8 +33,8 @@ Hiện tên album Hiển thị biểu tượng ứng dụng Hiện thời gian - Ứng dụng cần được cấp quyền truy cập bộ nhớ để lưu trữ cấu hình ứng dụng. - Ứng dụng cần được cấp quyền truy cập vào bộ nhớ để sử dụng các tính năng phụ thuộc vào cấu hình được lưu. + Ứng dụng cần được cấp quyền Truy cập bộ nhớ để lưu trữ cấu hình ứng dụng. + Ứng dụng cần được cấp quyền Truy cập vào bộ nhớ để sử dụng các tính năng phụ thuộc vào cấu hình được lưu. Cấp quyền Sử dụng hình ảnh có độ phân giải thấp Hiển thị hình ảnh có độ phân giải thấp hơn (bật tùy chọn này nếu ứng dụng gặp sự cố). @@ -52,7 +52,7 @@ Ngôn ngữ Ghi nhận các thư viện được sử dụng Bật nhận diện ứng dụng - Yêu cầu quyền Theo dõi truy cập ứng dụng + Quyền Theo dõi truy cập ứng dụng Ứng dụng cần được cấp quyền Theo dõi truy cập ứng dụng để lấy thông tin về ứng dụng đang chạy Bật trạng thái trình phát Yêu cầu quyền @@ -60,13 +60,13 @@ Chủ đề tối Chính sách bảo mật Xem Chính sách bảo mật - Bật trạng thái máy trò chơi điện tử + Bật trạng thái trò chơi Cấu hình nút hoạt động cho Trạng thái phương tiện và nhận diện ứng dụng Sử dụng nút tùy chỉnh - Sử dụng các nút đã cấu hùnh trước để hiển thị hoạt động trên Trạng thái trình phát và nhận diện ứng dụng + Sử dụng các nút đã cấu hình trước để hiển thị hoạt động trên Trạng thái trình phát và nhận diện ứng dụng Mặc định hệ thống Cài đặt nâng cao - Chủ đề Amoled + Chủ đề AMOLED Màu sắc động Áp dụng màu sắc từ hình nền Hủy bỏ @@ -100,4 +100,55 @@ Tìm kiếm Xóa Tìm kiếm... + Ẩn hoạt động khi dừng + Đang ngưng... + Nhận diện Ứng dụng + Kizzy cho phép bạn chia sẻ ứng dụng bạn đang sử dụng bằng hoạt động Discord. + RPC Trình Phát + Kizzy cho phép bạn chia sẻ hoạt động đa phương tiện của bạn, như bài hát bạn đang nghe hay video đang xem, lên Discord + RPC Tùy Chỉnh + RPC Trò Chơi + Kizzy cho phép bạn sử dụng một vài cấu hình đã định sẵn để thêm vào hoạt động Discord. + RPC Thử Nghiệm + RPC Thử Nghiệm là tính năng tự động chuyền đổi giữa Nhận diện ứng dụng và RPC trình phát. + Kizzy cho phép bạn tạo một hoạt động tùy chỉnh cho Discord. + Sắp Ra Mắt + Thoát + Log + TRỢ GIÚP + Câu hỏi thường gặp + Đi tới Hồ sơ + Phiên bản + Thử lại + Ứng dụng cần được cấp quyền Đọc thông báo để nhận thông tin về trình phát đa phương tiện. + Đang kiểm tra cập nhật... + Không có bản cập nhật + Thu gọn + Bạn có chắc không? + + Không thể hiện hồ sơ người dùng: + Không thể kết nối Internet. Thử lại sau. + ĐANG SỬ DỤNG HOẠT ĐỘNG KIZZY + GIỚI THIỆU VỀ TÔI + Nút đặc biệt + Hồ sơ Người dùng + Đăng xuất + Thư mục chứa cấu hình RPC tùy chỉnh + Chọn thư mục + Điền thông tin + Trực tuyến + Chờ + Vui Lòng Không Làm Phiền + Vô hình và hiện như ngoại tuyến + Ngoại tuyến + Quyền Đọc thông báo + Thông báo + Cấp quyền thông báo + Quyền Truy cập bộ nhớ + Khởi tạo Ứng dụng + Bỏ qua + Độ lớn tổ người chơi hiện tại + Độ lớn tối đa tổ người chơi + (%1$d / %2$d) + Tự động cuộn diff --git a/common/resources/src/main/res/values-zh/strings.xml b/common/resources/src/main/res/values-zh/strings.xml index eecc6456..fc7cdf0c 100644 --- a/common/resources/src/main/res/values-zh/strings.xml +++ b/common/resources/src/main/res/values-zh/strings.xml @@ -34,7 +34,7 @@ 顯示程式名字 啟用時間 你必須授權儲存權限以儲存配置 - 你必須授權儲存權限以啟用配置功能 + 你必須授權儲存權限以啟用配置功能 授權權限 使用低畫質圖示 顯示低畫質圖示在 rpc 上(如果rpc停止運作請啟用這個)。 這項功能也會應用到程式rpc上 diff --git a/common/resources/src/main/res/values/strings.xml b/common/resources/src/main/res/values/strings.xml index 38bfb348..5c1fcd17 100644 --- a/common/resources/src/main/res/values/strings.xml +++ b/common/resources/src/main/res/values/strings.xml @@ -8,11 +8,11 @@ Activity State Start Timestamps Stop Timestamps - Activity status(online,idle,dnd) + Activity status (\"online\", \"idle\", \"dnd\") Activity button1 text Activity button2 text - Button 1 Url - Button 2 Url + Button 1 URL + Button 2 URL Activity Large Image Activity Small Image Activity Type @@ -35,7 +35,7 @@ Show App Icon Enable Timestamps Storage access is important for this app to store configs in public directories. Please grant the permission. - Storage permission required for config features to work. Please grant the permission. + Storage permission required for config features to work. Please grant the permission. Grant Permission Use Low Resolution Images Use a lower resolution app icon for displaying on RPC (turn this on if the RPC is crashing). This setting will also be applied to Apps . @@ -67,7 +67,7 @@ Use Predefined buttons to show on Media and AppDetection RPC Follow System Advanced Settings - Amoled Theme + AMOLED Theme Dynamic color Apply colors from wallpapers Cancel @@ -101,4 +101,55 @@ Search Clear Search... + Hide RPC on Pause + Idling... + App Detection + Kizzy allows you to share your current activity on Discord by detecting what app you\'re using on your device. + Media RPC + Kizzy allows you to share your current media activity on Discord, such as the song or video you\'re currently listening to or watching. + Custom RPC + Console RPC + Kizzy allows you to use some predefined presets to set your presence on Discord. + Experimental RPC + Experimental RPC is a feature in Kizzy that constantly switches between Apps RPC and Media RPC. + Kizzy allows you to create your own fully customisable rich presence for Discord. + Coming Soon + Exit + Logs + HELP + FAQ + Go to Profile + Version + Retry + Notification Access is needed for app to extract media information. + Checking for update... + No updates available + Compact Mode + Are you sure? + Yes + Could not Update User Profile: + No Internet connection. Try again later. + USING KIZZY RICH PRESENCE + ABOUT ME + Special Button + User Profile + Logout + Directory to store Custom RPC configs + Select directory + Enter details + Online + Idle + Do Not Disturb + Invisible and shown as offline + Offline + Notification Access Permission + Post Notification + Grant Permission to Show Notification + Storage Access + Start App Now + Skip + Party Current Size + Party Max Size + (%1$d of %2$d) + Auto scroll diff --git a/data/src/main/java/com/my/kizzy/data/get_current_data/media/GetCurrentlyPlayingMedia.kt b/data/src/main/java/com/my/kizzy/data/get_current_data/media/GetCurrentlyPlayingMedia.kt index f56f75d1..a10e2f30 100644 --- a/data/src/main/java/com/my/kizzy/data/get_current_data/media/GetCurrentlyPlayingMedia.kt +++ b/data/src/main/java/com/my/kizzy/data/get_current_data/media/GetCurrentlyPlayingMedia.kt @@ -17,13 +17,13 @@ import android.content.ComponentName import android.content.Context import android.media.MediaMetadata import android.media.session.MediaSessionManager -import android.media.session.PlaybackState.STATE_PLAYING +import android.media.session.PlaybackState import com.blankj.utilcode.util.AppUtils import com.my.kizzy.data.rpc.CommonRpc +import com.my.kizzy.data.rpc.Timestamps import com.my.kizzy.data.rpc.RpcImage import com.my.kizzy.preference.Prefs import dagger.hilt.android.qualifiers.ApplicationContext -import kizzy.gateway.entities.presence.Timestamps import javax.inject.Inject class GetCurrentPlayingMedia @Inject constructor( @@ -40,6 +40,14 @@ class GetCurrentPlayingMedia @Inject constructor( val sessions = mediaSessionManager.getActiveSessions(componentName) if (sessions.size > 0) { val mediaController = sessions[0] + if ( + Prefs[Prefs.MEDIA_RPC_HIDE_ON_PAUSE, false] && + ( + mediaController.playbackState?.state == PlaybackState.STATE_PAUSED || + mediaController.playbackState?.state == PlaybackState.STATE_STOPPED + ) + ) return CommonRpc() + val metadata = mediaController.metadata val title = metadata?.getString(MediaMetadata.METADATA_KEY_TITLE) val appName = AppUtils.getAppName(mediaController.packageName) @@ -54,7 +62,7 @@ class GetCurrentPlayingMedia @Inject constructor( val bitmap = metadata?.let { metadataResolver.getCoverArt(it) } val duration = metadata?.getLong(MediaMetadata.METADATA_KEY_DURATION) duration?.let { - if (it != 0L && mediaController.playbackState?.state == STATE_PLAYING) timestamps = Timestamps( + if (it != 0L && mediaController.playbackState?.state == PlaybackState.STATE_PLAYING) timestamps = Timestamps( end = System.currentTimeMillis() + duration - (mediaController.playbackState?.position ?: 0L), start = System.currentTimeMillis() - (mediaController.playbackState?.position ?: 0L) ) diff --git a/data/src/main/java/com/my/kizzy/data/rpc/CommonRpc.kt b/data/src/main/java/com/my/kizzy/data/rpc/CommonRpc.kt index e1ed9dd0..c2e4b4e8 100644 --- a/data/src/main/java/com/my/kizzy/data/rpc/CommonRpc.kt +++ b/data/src/main/java/com/my/kizzy/data/rpc/CommonRpc.kt @@ -12,12 +12,12 @@ package com.my.kizzy.data.rpc -import kizzy.gateway.entities.presence.Timestamps - data class CommonRpc( val name: String = "", val details: String? = "", val state: String? = "", + val party1: Int? = null, + val party2: Int? = null, val largeImage: RpcImage? = null, val smallImage: RpcImage? = null, var largeText: String? = "", diff --git a/data/src/main/java/com/my/kizzy/data/rpc/KizzyRPC.kt b/data/src/main/java/com/my/kizzy/data/rpc/KizzyRPC.kt index d3cb3ba8..fcd8a3e9 100644 --- a/data/src/main/java/com/my/kizzy/data/rpc/KizzyRPC.kt +++ b/data/src/main/java/com/my/kizzy/data/rpc/KizzyRPC.kt @@ -20,6 +20,7 @@ import kizzy.gateway.DiscordWebSocket import kizzy.gateway.entities.presence.Activity import kizzy.gateway.entities.presence.Assets import kizzy.gateway.entities.presence.Metadata +import kizzy.gateway.entities.presence.Party import kizzy.gateway.entities.presence.Presence import kizzy.gateway.entities.presence.Timestamps import kotlinx.coroutines.isActive @@ -34,6 +35,7 @@ class KizzyRPC( private var activityName: String? = null private var details: String? = null private var state: String? = null + private var party: Party? = null private var largeImage: RpcImage? = null private var smallImage: RpcImage? = null private var largeText: String? = null @@ -102,6 +104,22 @@ class KizzyRPC( return this } + /** + * Party of Rpc + * + * @param party + * @return + */ + fun setPartySize(current: Int?, max: Int?): KizzyRPC { + if (current != null && max != null) { + this.party = Party( + id = "kizzy", + size = arrayOf(current, max) + ) + } + return this + } + /** * Large image on rpc * How to get Image ? @@ -235,6 +253,7 @@ class KizzyRPC( name = activityName, state = state, details = details, + party = party.takeIf { party != null }, type = type, timestamps = Timestamps( start = startTimestamps, @@ -273,6 +292,8 @@ class KizzyRPC( var time = Timestamps(start = startTimestamps) if (commonRpc.time != null) Timestamps(end = commonRpc.time.end, start = commonRpc.time.start).also { time = it } + if (commonRpc.party1 != null && commonRpc.party2 != null) + Party(id = "kizzy", size = arrayOf(commonRpc.party1, commonRpc.party2)).also { party = it } discordWebSocket.sendActivity( Presence( activities = listOf( @@ -288,6 +309,7 @@ class KizzyRPC( largeText = commonRpc.largeText, smallText = commonRpc.smallText, ).takeIf { commonRpc.largeImage != null || commonRpc.smallImage != null }, + party = party.takeIf { party != null }, buttons = buttons.takeIf { buttons.size > 0 }, metadata = Metadata(buttonUrls = buttonUrl).takeIf { buttonUrl.size > 0 }, applicationId = Constants.APPLICATION_ID.takeIf { buttons.size > 0 } diff --git a/data/src/main/java/com/my/kizzy/data/rpc/Timestamps.kt b/data/src/main/java/com/my/kizzy/data/rpc/Timestamps.kt new file mode 100644 index 00000000..931aaa0d --- /dev/null +++ b/data/src/main/java/com/my/kizzy/data/rpc/Timestamps.kt @@ -0,0 +1,18 @@ +/* + * + * ****************************************************************** + * * * Copyright (C) 2022 + * * * Timestamps.kt is part of Kizzy + * * * and can not be copied and/or distributed without the express + * * * permission of yzziK(Vaibhav) + * * ***************************************************************** + * + * + */ + +package com.my.kizzy.data.rpc + +data class Timestamps( + val start: Long? = null, + val end: Long? = null +) diff --git a/domain/src/main/java/com/my/kizzy/domain/model/rpc/RpcConfig.kt b/domain/src/main/java/com/my/kizzy/domain/model/rpc/RpcConfig.kt index c888ac6c..597a59d4 100644 --- a/domain/src/main/java/com/my/kizzy/domain/model/rpc/RpcConfig.kt +++ b/domain/src/main/java/com/my/kizzy/domain/model/rpc/RpcConfig.kt @@ -49,5 +49,9 @@ data class RpcConfig( @SerialName("small_text") val smallText: String = "", @SerialName("url") - val url: String = "" + val url: String = "", + @SerialName("party1") + val party1: String = "", + @SerialName("party2") + val party2: String = "", ) \ No newline at end of file diff --git a/domain/src/main/java/com/my/kizzy/domain/model/user/User.kt b/domain/src/main/java/com/my/kizzy/domain/model/user/User.kt index b4d76e26..e48af63f 100644 --- a/domain/src/main/java/com/my/kizzy/domain/model/user/User.kt +++ b/domain/src/main/java/com/my/kizzy/domain/model/user/User.kt @@ -50,16 +50,16 @@ val globalName: String? = null ) { fun getAvatarImage(): String { return if (avatar?.startsWith("a_") == true) - "${DISCORD_CDN}/avatars/${id}/${avatar}.gif" + "${DISCORD_CDN}/avatars/${id}/${avatar}.gif?size=4096" else - "${DISCORD_CDN}/avatars/${id}/${avatar}.png" + "${DISCORD_CDN}/avatars/${id}/${avatar}.png?size=4096" } fun getBannerImage(): String? { if (banner.isNullOrEmpty()) return null return if (banner.startsWith("a_")) - "$DISCORD_CDN/banners/${id}/${banner}.gif" + "$DISCORD_CDN/banners/${id}/${banner}.gif?size=4096" else - "$DISCORD_CDN/banners/${id}/${banner}.png" + "$DISCORD_CDN/banners/${id}/${banner}.png?size=4096" } } diff --git a/feature_about/src/main/java/com/my/kizzy/feature_about/about/About.kt b/feature_about/src/main/java/com/my/kizzy/feature_about/about/About.kt index 1d6041fa..345fc9c1 100644 --- a/feature_about/src/main/java/com/my/kizzy/feature_about/about/About.kt +++ b/feature_about/src/main/java/com/my/kizzy/feature_about/about/About.kt @@ -110,7 +110,7 @@ fun About( } item { SettingItem( - title = "Version", + title = stringResource(id = R.string.version), description = BuildConfig.VERSION_NAME, icon = Icons.Outlined.Info ) { diff --git a/feature_apps_rpc/src/main/java/com/my/kizzy/feature_apps_rpc/AppsRpc.kt b/feature_apps_rpc/src/main/java/com/my/kizzy/feature_apps_rpc/AppsRpc.kt index 032772ca..42619776 100644 --- a/feature_apps_rpc/src/main/java/com/my/kizzy/feature_apps_rpc/AppsRpc.kt +++ b/feature_apps_rpc/src/main/java/com/my/kizzy/feature_apps_rpc/AppsRpc.kt @@ -71,7 +71,7 @@ fun AppsRPC( title = { Column { Text( - text = "Apps", + text = stringResource(id = R.string.main_appDetection), style = MaterialTheme.typography.headlineLarge, ) } diff --git a/feature_console_rpc/src/main/java/com/my/kizzy/feature_console_rpc/GamesScreen.kt b/feature_console_rpc/src/main/java/com/my/kizzy/feature_console_rpc/GamesScreen.kt index b937794b..be839235 100644 --- a/feature_console_rpc/src/main/java/com/my/kizzy/feature_console_rpc/GamesScreen.kt +++ b/feature_console_rpc/src/main/java/com/my/kizzy/feature_console_rpc/GamesScreen.kt @@ -83,7 +83,7 @@ fun GamesScreen( onEvent(UiEvent.Search(it)) }, text = searchText, - placeholder = "Search", + placeholder = stringResource(id = R.string.search_placeholder), onClose = { onEvent(UiEvent.CloseSearchBar) } @@ -91,7 +91,7 @@ fun GamesScreen( } else { Text( - text = "Console RPC", + text = stringResource(id = R.string.main_consoleRpc), style = MaterialTheme.typography.headlineLarge, ) } @@ -99,7 +99,7 @@ fun GamesScreen( actions = { if(!isSearchBarVisible) { IconButton(onClick = { onEvent(UiEvent.OpenSearchBar) }) { - Icon(Icons.Default.Search, "search") + Icon(Icons.Default.Search, stringResource(id = R.string.search)) } } }, @@ -124,7 +124,7 @@ fun GamesScreen( .padding(horizontal = 20.dp) ) Button(onClick = { onEvent(UiEvent.TryAgain) }) { - Text(text = "Try Again") + Text(text = stringResource(id = R.string.try_again)) } } } diff --git a/feature_custom_rpc/src/main/java/com/my/kizzy/feature_custom_rpc/CustomRpc.kt b/feature_custom_rpc/src/main/java/com/my/kizzy/feature_custom_rpc/CustomRpc.kt index b535be44..a6517fdb 100644 --- a/feature_custom_rpc/src/main/java/com/my/kizzy/feature_custom_rpc/CustomRpc.kt +++ b/feature_custom_rpc/src/main/java/com/my/kizzy/feature_custom_rpc/CustomRpc.kt @@ -153,7 +153,7 @@ fun CustomRpcScreen( topBar = { LargeTopAppBar(title = { Text( - text = "Custom RPC", + text = stringResource(id = R.string.main_customRpc), style = MaterialTheme.typography.headlineLarge, ) }, @@ -239,6 +239,30 @@ private fun RpcTextFieldsColumn( } } + item { + Row { + RpcField( + value = party1, + label = R.string.party_current, + keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number) + ) { + onEvent(UiEvent.SetFieldsFromConfig(uiState.rpcConfig.copy(party1 = it))) + } + } + } + + item { + AnimatedVisibility(visible = party1.isNotBlank()) { + RpcField( + value = party2, + label = R.string.party_max, + keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number) + ) { + onEvent(UiEvent.SetFieldsFromConfig(uiState.rpcConfig.copy(party2 = it))) + } + } + } + item { RpcField(value = timestampsStart, label = R.string.activity_start_timestamps, @@ -301,13 +325,58 @@ private fun RpcTextFieldsColumn( } } + val iconStatus = if (uiState.activityTypeIsExpanded) + Icons.Default.KeyboardArrowUp + else + Icons.Default.KeyboardArrowDown + item { RpcField( value = status, - label = R.string.activity_status_online_idle_dnd + label = R.string.activity_status_online_idle_dnd, + trailingIcon = { + Icon(imageVector = iconStatus, + contentDescription = null, + modifier = Modifier.clickable { + onEvent(UiEvent.TriggerStatusDropDownMenu) + }) + } ) { onEvent(UiEvent.SetFieldsFromConfig(uiState.rpcConfig.copy(status = it))) } + + DropdownMenu( + expanded = uiState.statusIsExpanded, onDismissRequest = { + onEvent(UiEvent.TriggerStatusDropDownMenu) + }, + modifier = Modifier.fillMaxWidth() + ) { + val statuses = listOf( + Pair( + stringResource(id = R.string.status_online), + "online" + ), + Pair( + stringResource(id = R.string.status_idle), + "idle" + ), + Pair( + stringResource(id = R.string.status_dnd), + "dnd" + ), + ) + statuses.forEach { + DropdownMenuItem( + text = { + Text(text = it.first) + }, + onClick = { + onEvent(UiEvent.SetFieldsFromConfig(uiState.rpcConfig.copy(status = it.second))) + onEvent(UiEvent.TriggerStatusDropDownMenu) + }, + ) + } + } } item { diff --git a/feature_custom_rpc/src/main/java/com/my/kizzy/feature_custom_rpc/CustomScreenViewModel.kt b/feature_custom_rpc/src/main/java/com/my/kizzy/feature_custom_rpc/CustomScreenViewModel.kt index 8d2a3340..4d04bd47 100644 --- a/feature_custom_rpc/src/main/java/com/my/kizzy/feature_custom_rpc/CustomScreenViewModel.kt +++ b/feature_custom_rpc/src/main/java/com/my/kizzy/feature_custom_rpc/CustomScreenViewModel.kt @@ -83,6 +83,11 @@ class CustomScreenViewModel @Inject constructor( _uiState.value.copy(activityTypeIsExpanded = !_uiState.value.activityTypeIsExpanded) } + UiEvent.TriggerStatusDropDownMenu -> { + _uiState.value = + _uiState.value.copy(statusIsExpanded = !_uiState.value.statusIsExpanded) + } + UiEvent.TriggerStartTimeStampsDialog -> { _uiState.value = _uiState.value.copy(showStartTimeStampsPickerDialog = !_uiState.value.showStartTimeStampsPickerDialog) diff --git a/feature_custom_rpc/src/main/java/com/my/kizzy/feature_custom_rpc/UiEvent.kt b/feature_custom_rpc/src/main/java/com/my/kizzy/feature_custom_rpc/UiEvent.kt index 25437f96..3d555841 100644 --- a/feature_custom_rpc/src/main/java/com/my/kizzy/feature_custom_rpc/UiEvent.kt +++ b/feature_custom_rpc/src/main/java/com/my/kizzy/feature_custom_rpc/UiEvent.kt @@ -18,6 +18,7 @@ import java.io.File sealed interface UiEvent { object TriggerBottomSheet: UiEvent object TriggerActivityTypeDropDownMenu: UiEvent + object TriggerStatusDropDownMenu: UiEvent class SetFieldsFromConfig(val config: RpcConfig): UiEvent object TriggerStartTimeStampsDialog: UiEvent object TriggerStopTimeStampsDialog: UiEvent diff --git a/feature_custom_rpc/src/main/java/com/my/kizzy/feature_custom_rpc/UiState.kt b/feature_custom_rpc/src/main/java/com/my/kizzy/feature_custom_rpc/UiState.kt index 52d94746..ca509c6b 100644 --- a/feature_custom_rpc/src/main/java/com/my/kizzy/feature_custom_rpc/UiState.kt +++ b/feature_custom_rpc/src/main/java/com/my/kizzy/feature_custom_rpc/UiState.kt @@ -25,5 +25,6 @@ data class UiState( val showStoragePermissionRequestDialog: Boolean = false, val showStartTimeStampsPickerDialog: Boolean = false, val showStopTimeStampsPickerDialog: Boolean = false, + val statusIsExpanded: Boolean = false, val rpcConfig: RpcConfig = RpcConfig() ) \ No newline at end of file diff --git a/feature_custom_rpc/src/main/java/com/my/kizzy/feature_custom_rpc/components/sheet/RequestStoragePermission.kt b/feature_custom_rpc/src/main/java/com/my/kizzy/feature_custom_rpc/components/sheet/RequestStoragePermission.kt index a723901d..f23935af 100644 --- a/feature_custom_rpc/src/main/java/com/my/kizzy/feature_custom_rpc/components/sheet/RequestStoragePermission.kt +++ b/feature_custom_rpc/src/main/java/com/my/kizzy/feature_custom_rpc/components/sheet/RequestStoragePermission.kt @@ -41,7 +41,7 @@ internal fun RequestStoragePermissionDialog( if ((storagePermissionState.status as PermissionStatus.Denied).shouldShowRationale) { stringResource(id = R.string.text_after_permission_denied) } else { - stringResource(id = R.string.request_for_permission) + stringResource(id = R.string.request_for_storage_access) } AlertDialog( onDismissRequest = onDismiss, diff --git a/feature_home/src/main/java/com/my/kizzy/feature_home/Home.kt b/feature_home/src/main/java/com/my/kizzy/feature_home/Home.kt index a6684d05..0ec3635d 100644 --- a/feature_home/src/main/java/com/my/kizzy/feature_home/Home.kt +++ b/feature_home/src/main/java/com/my/kizzy/feature_home/Home.kt @@ -162,7 +162,7 @@ fun Home( modifier = Modifier.clickable { Toast.makeText( ctx, - "Checking for updates...", + ctx.getString(R.string.update_check_for_update), Toast.LENGTH_SHORT ).show() checkForUpdates() @@ -177,7 +177,7 @@ fun Home( modifier = Modifier.clickable { Toast.makeText( ctx, - "Checking for updates...", + ctx.getString(R.string.update_check_for_update), Toast.LENGTH_SHORT ).show() checkForUpdates() @@ -257,7 +257,7 @@ fun Home( ) } } else { - Toast.makeText(ctx, "No updates available", Toast.LENGTH_SHORT).show() + Toast.makeText(ctx, ctx.getString(R.string.update_no_updates_available), Toast.LENGTH_SHORT).show() showUpdateDialog = false } } diff --git a/feature_home/src/main/java/com/my/kizzy/feature_home/feature/FeaturesProvider.kt b/feature_home/src/main/java/com/my/kizzy/feature_home/feature/FeaturesProvider.kt index 2a693166..10ab0829 100644 --- a/feature_home/src/main/java/com/my/kizzy/feature_home/feature/FeaturesProvider.kt +++ b/feature_home/src/main/java/com/my/kizzy/feature_home/feature/FeaturesProvider.kt @@ -17,6 +17,7 @@ import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.runtime.Composable import androidx.compose.runtime.MutableState import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.my.kizzy.feature_rpc_base.AppUtils import com.my.kizzy.feature_rpc_base.services.AppDetectionService @@ -38,7 +39,7 @@ fun homeFeaturesProvider( val ctx = LocalContext.current return listOf( HomeFeature( - title = "App Detection", + title = stringResource(id = R.string.main_appDetection), icon = R.drawable.ic_apps, route = Routes.APPS_DETECTION, isChecked = AppUtils.appDetectionRunning(), @@ -57,10 +58,10 @@ fun homeFeaturesProvider( ctx.stopService(Intent(ctx, AppDetectionService::class.java)) }, shape = RoundedCornerShape(20.dp, 44.dp, 20.dp, 44.dp), - tooltipText = ToolTipContent.APP_DETECTION_DOCS, + tooltipText = stringResource(id = R.string.main_appDetection_details), featureDocsLink = ToolTipContent.APP_DETECTION_DOCS_LINK ), HomeFeature( - title = "Media RPC", + title = stringResource(id = R.string.main_mediaRpc), icon = R.drawable.ic_media_rpc, route = Routes.MEDIA_RPC, isChecked = AppUtils.mediaRpcRunning(), @@ -79,10 +80,10 @@ fun homeFeaturesProvider( ctx.stopService(Intent(ctx, MediaRpcService::class.java)) }, shape = RoundedCornerShape(44.dp, 20.dp, 44.dp, 20.dp), - tooltipText = ToolTipContent.MEDIA_RPC_DOCS, + tooltipText = stringResource(id = R.string.main_mediaRpc_details), featureDocsLink = ToolTipContent.MEDIA_RPC_DOCS_LINK ), HomeFeature( - title = "Custom RPC", + title = stringResource(id = R.string.main_customRpc), icon = R.drawable.ic_rpc_placeholder, route = Routes.CUSTOM_RPC, isChecked = AppUtils.customRpcRunning(), @@ -106,10 +107,10 @@ fun homeFeaturesProvider( }, shape = RoundedCornerShape(44.dp, 20.dp, 44.dp, 20.dp), showSwitch = Prefs[Prefs.LAST_RUN_CUSTOM_RPC, ""].isNotEmpty(), - tooltipText = ToolTipContent.CUSTOM_RPC_DOCS, + tooltipText = stringResource(id = R.string.main_customRpc_details), featureDocsLink = ToolTipContent.CUSTOM_RPC_DOCS_LINK ), HomeFeature( - title = "Console RPC", + title = stringResource(id = R.string.main_consoleRpc), icon = R.drawable.ic_console_games, route = Routes.CONSOLE_RPC, isChecked = AppUtils.customRpcRunning(), @@ -133,11 +134,11 @@ fun homeFeaturesProvider( }, shape = RoundedCornerShape(20.dp, 44.dp, 20.dp, 44.dp), showSwitch = Prefs[Prefs.LAST_RUN_CONSOLE_RPC, ""].isNotEmpty(), - tooltipText = ToolTipContent.CONSOLE_RPC_DOCS, + tooltipText = stringResource(id = R.string.main_consoleRpc_details), featureDocsLink = ToolTipContent.CONSOLE_RPC_DOCS_LINK ), HomeFeature( - title = "Experimental RPC", + title = stringResource(id = R.string.main_experimentalRpc), icon = R.drawable.ic_dev_rpc, isChecked = AppUtils.experimentalRpcRunning(), onCheckedChange = { @@ -152,7 +153,7 @@ fun homeFeaturesProvider( }, shape = RoundedCornerShape(20.dp, 44.dp, 20.dp, 44.dp), showSwitch = hasUsageAccess.value && hasNotificationAccess.value && userVerified, - tooltipText = ToolTipContent.EXPERIMENTAL_RPC_DOCS, + tooltipText = stringResource(id = R.string.main_experimentalRpc_details), featureDocsLink = ToolTipContent.EXPERIMENTAL_RPC_DOCS_LINK ), HomeFeature( @@ -173,7 +174,7 @@ fun homeFeaturesProvider( showSwitch = hasUsageAccess.value && userVerified && Prefs[Prefs.SAMSUNG_RPC_ENABLED, false], ), HomeFeature( - title = "Coming Soon", + title = stringResource(id = R.string.main_comingSoon), icon = R.drawable.ic_info, shape = RoundedCornerShape(20.dp, 44.dp, 20.dp, 44.dp), showSwitch = false diff --git a/feature_logs/src/main/java/com/my/kizzy/feature_logs/LogScreen.kt b/feature_logs/src/main/java/com/my/kizzy/feature_logs/LogScreen.kt index 67f4b17b..99c7ff26 100644 --- a/feature_logs/src/main/java/com/my/kizzy/feature_logs/LogScreen.kt +++ b/feature_logs/src/main/java/com/my/kizzy/feature_logs/LogScreen.kt @@ -30,6 +30,7 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.drawWithCache import androidx.compose.ui.geometry.Offset import androidx.compose.ui.geometry.Size +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.font.FontWeight @@ -40,6 +41,7 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.my.kizzy.domain.model.logs.LogEvent import com.my.kizzy.preference.Prefs +import com.my.kizzy.resources.R import com.my.kizzy.ui.components.KSwitch import com.my.kizzy.ui.components.SearchBar import com.my.kizzy.ui.theme.LogColors.color @@ -58,8 +60,8 @@ fun LogScreen(viewModel: LogsViewModel) { modifier = Modifier.fillMaxSize(), topBar = { ToolBar(viewModel) } ) { paddingValues -> - LaunchedEffect(viewModel.logs.size) { - if (viewModel.logs.size > 0) + LaunchedEffect(viewModel.logs.size) { + if (viewModel.logs.size > 0 && viewModel.autoScroll.value) lazyListState.animateScrollToItem(viewModel.logs.size - 1) } LazyColumn( @@ -101,7 +103,7 @@ fun ToolBar(viewModel: LogsViewModel) { if(viewModel.isSearchBarVisible.value) { SearchBar( text = viewModel.filterStrings.value, - placeholder = "Search...", + placeholder = stringResource(id = R.string.search_placeholder), onClose = { viewModel.isSearchBarVisible.value = false } ) { viewModel.filterStrings.value = it @@ -115,7 +117,7 @@ fun ToolBar(viewModel: LogsViewModel) { actions = { if(!viewModel.isSearchBarVisible.value){ IconButton(onClick = { viewModel.isSearchBarVisible.value = true }) { - Icon(Icons.Default.Search, "search") + Icon(Icons.Default.Search, stringResource(id = R.string.search)) } } IconButton(onClick = { menuClicked = !menuClicked }) { @@ -124,7 +126,29 @@ fun ToolBar(viewModel: LogsViewModel) { ) DropdownMenu(expanded = menuClicked, onDismissRequest = { menuClicked = !menuClicked }) { - DropdownMenuItem(onClick = {}, + DropdownMenuItem( + onClick = {}, + text = { + Row( + Modifier + .fillMaxSize() + .clickable { + viewModel.autoScroll.value = !viewModel.autoScroll.value + Prefs[Prefs.LOGS_AUTO_SCROLL] = viewModel.autoScroll.value + }, horizontalArrangement = Arrangement.SpaceBetween + ) { + Text( + text = stringResource(id = R.string.auto_scroll), + style = MaterialTheme.typography.bodyLarge + ) + KSwitch( + checked = viewModel.autoScroll.value, + modifier = Modifier.padding(start = 10.dp) + ) + } + }) + DropdownMenuItem( + onClick = {}, text = { Row( Modifier @@ -132,14 +156,20 @@ fun ToolBar(viewModel: LogsViewModel) { .clickable { viewModel.showCompat.value = !viewModel.showCompat.value Prefs[Prefs.SHOW_LOGS_IN_COMPACT_MODE] = viewModel.showCompat.value - }, horizontalArrangement = Arrangement.SpaceAround + }, horizontalArrangement = Arrangement.SpaceBetween ) { - Text("Compact Mode") - KSwitch(checked = viewModel.showCompat.value) + Text( + text = stringResource(id = R.string.compact_mode), + style = MaterialTheme.typography.bodyLarge + ) + KSwitch( + checked = viewModel.showCompat.value, + modifier = Modifier.padding(start = 10.dp) + ) } }) DropdownMenuItem( - text = { Text("Clear") }, + text = { Text(text = stringResource(R.string.clear), style = MaterialTheme.typography.bodyLarge) }, onClick = { viewModel.clearLogs() menuClicked = false diff --git a/feature_logs/src/main/java/com/my/kizzy/feature_logs/LogsViewModel.kt b/feature_logs/src/main/java/com/my/kizzy/feature_logs/LogsViewModel.kt index 326b1bcd..557b51fa 100644 --- a/feature_logs/src/main/java/com/my/kizzy/feature_logs/LogsViewModel.kt +++ b/feature_logs/src/main/java/com/my/kizzy/feature_logs/LogsViewModel.kt @@ -23,6 +23,7 @@ class LogsViewModel: ViewModel() { val filterStrings = mutableStateOf("") var logs = logger.getLogs() var showCompat = mutableStateOf(Prefs[Prefs.SHOW_LOGS_IN_COMPACT_MODE,false]) + var autoScroll = mutableStateOf(Prefs[Prefs.LOGS_AUTO_SCROLL,true]) val isSearchBarVisible = mutableStateOf(false) diff --git a/feature_media_rpc/src/main/java/com/my/kizzy/feature_media_rpc/MediaRpc.kt b/feature_media_rpc/src/main/java/com/my/kizzy/feature_media_rpc/MediaRpc.kt index 74aa007a..3d284035 100644 --- a/feature_media_rpc/src/main/java/com/my/kizzy/feature_media_rpc/MediaRpc.kt +++ b/feature_media_rpc/src/main/java/com/my/kizzy/feature_media_rpc/MediaRpc.kt @@ -23,6 +23,7 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Apps import androidx.compose.material.icons.filled.Audiotrack import androidx.compose.material.icons.filled.Album +import androidx.compose.material.icons.filled.PauseCircle import androidx.compose.material.icons.filled.Timer import androidx.compose.material.icons.filled.Warning import androidx.compose.material3.* @@ -40,6 +41,7 @@ import com.my.kizzy.preference.Prefs.MEDIA_RPC_APP_ICON import com.my.kizzy.preference.Prefs.MEDIA_RPC_ARTIST_NAME import com.my.kizzy.preference.Prefs.MEDIA_RPC_ALBUM_NAME import com.my.kizzy.preference.Prefs.MEDIA_RPC_ENABLE_TIMESTAMPS +import com.my.kizzy.preference.Prefs.MEDIA_RPC_HIDE_ON_PAUSE import com.my.kizzy.resources.R import com.my.kizzy.ui.components.BackButton import com.my.kizzy.ui.components.SwitchBar @@ -55,6 +57,7 @@ fun MediaRPC(onBackPressed: () -> Unit) { var isAlbumEnabled by remember { mutableStateOf(Prefs[MEDIA_RPC_ALBUM_NAME, false]) } var isAppIconEnabled by remember { mutableStateOf(Prefs[MEDIA_RPC_APP_ICON, false]) } var isTimestampsEnabled by remember { mutableStateOf(Prefs[MEDIA_RPC_ENABLE_TIMESTAMPS, false]) } + var hideOnPause by remember { mutableStateOf(Prefs[MEDIA_RPC_HIDE_ON_PAUSE, false]) } var hasNotificationAccess by remember { mutableStateOf(context.hasNotificationAccess()) } Scaffold( modifier = Modifier @@ -63,7 +66,7 @@ fun MediaRPC(onBackPressed: () -> Unit) { LargeTopAppBar( title = { Text( - text = "Media RPC", + text = stringResource(id = R.string.main_mediaRpc), style = MaterialTheme.typography.headlineLarge, ) }, @@ -76,8 +79,8 @@ fun MediaRPC(onBackPressed: () -> Unit) { AnimatedVisibility(visible = !hasNotificationAccess ) { PreferencesHint( - title = "Permission Required", - description = "Notification Access is needed for app to extract media information", + title = stringResource(id = R.string.permission_required), + description = stringResource(id = R.string.request_for_notification_access), icon = Icons.Default.Warning, ) { when (context.hasNotificationAccess()) { @@ -143,6 +146,16 @@ fun MediaRPC(onBackPressed: () -> Unit) { Prefs[MEDIA_RPC_ENABLE_TIMESTAMPS] = isTimestampsEnabled } } + item { + PreferenceSwitch( + title = stringResource(id = R.string.hide_on_pause), + icon = Icons.Default.PauseCircle, + isChecked = hideOnPause, + ) { + hideOnPause = !hideOnPause + Prefs[MEDIA_RPC_HIDE_ON_PAUSE] = hideOnPause + } + } } } } diff --git a/feature_profile/src/main/java/com/my/kizzy/feature_profile/ui/component/ActivityRow.kt b/feature_profile/src/main/java/com/my/kizzy/feature_profile/ui/component/ActivityRow.kt index 60e3bc08..91a71689 100644 --- a/feature_profile/src/main/java/com/my/kizzy/feature_profile/ui/component/ActivityRow.kt +++ b/feature_profile/src/main/java/com/my/kizzy/feature_profile/ui/component/ActivityRow.kt @@ -28,6 +28,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp @@ -93,12 +94,12 @@ fun ActivityRow( } Column { ProfileText( - text = rpcConfig?.name.takeIf { !it.isNullOrEmpty() }?:"User Profile", + text = rpcConfig?.name.takeIf { !it.isNullOrEmpty() }?: stringResource(id = R.string.user_profile), style = MaterialTheme.typography.titleSmall .copy( fontFamily = FontFamily.Monospace, - fontSize = 16.sp - ) + fontSize = 16.sp, + ), ) ProfileText( text = rpcConfig?.details, @@ -109,7 +110,18 @@ fun ActivityRow( ) ) ProfileText( - text = rpcConfig?.state, + text = (rpcConfig?.state + + if ( + rpcConfig?.party1?.toIntOrNull() != null && + rpcConfig?.party2?.toIntOrNull() != null && + rpcConfig?.party1?.toIntOrNull()!! > 0 && + rpcConfig?.party2?.toIntOrNull()!! > 0 && + rpcConfig?.party1?.toIntOrNull()!! <= rpcConfig?.party2?.toIntOrNull()!! + ) { + " " + stringResource(R.string.user_profile_party, rpcConfig.party1.toInt(), rpcConfig.party2.toInt()) + } else { + "" + }).takeIf { rpcConfig?.state?.isNotEmpty() == true }, style = MaterialTheme.typography.titleSmall .copy( fontFamily = FontFamily.Monospace, @@ -129,7 +141,7 @@ fun ActivityRow( } } if (showTs) - ProfileButton(label = "Special Button", link = special) + ProfileButton(label = stringResource(id = R.string.user_profile_special_button), link = special) if (rpcConfig != null) { ProfileButton(label = rpcConfig.button1, link = rpcConfig.button1link ) ProfileButton(label = rpcConfig.button2, link = rpcConfig.button2link ) diff --git a/feature_profile/src/main/java/com/my/kizzy/feature_profile/ui/component/LogoutButton.kt b/feature_profile/src/main/java/com/my/kizzy/feature_profile/ui/component/LogoutButton.kt index a63314d0..9d371fda 100644 --- a/feature_profile/src/main/java/com/my/kizzy/feature_profile/ui/component/LogoutButton.kt +++ b/feature_profile/src/main/java/com/my/kizzy/feature_profile/ui/component/LogoutButton.kt @@ -19,6 +19,8 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Shape +import androidx.compose.ui.res.stringResource +import com.my.kizzy.resources.R @Composable fun Logout( @@ -35,6 +37,6 @@ fun Logout( contentColor = MaterialTheme.colorScheme.onErrorContainer ) ) { - Text(text = "Logout") + Text(text = stringResource(id = R.string.logout)) } } \ No newline at end of file diff --git a/feature_profile/src/main/java/com/my/kizzy/feature_profile/ui/component/ProfileCard.kt b/feature_profile/src/main/java/com/my/kizzy/feature_profile/ui/component/ProfileCard.kt index 6fe87060..7bc67ed2 100644 --- a/feature_profile/src/main/java/com/my/kizzy/feature_profile/ui/component/ProfileCard.kt +++ b/feature_profile/src/main/java/com/my/kizzy/feature_profile/ui/component/ProfileCard.kt @@ -45,6 +45,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalUriHandler import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.tooling.preview.Preview @@ -66,7 +67,7 @@ fun ProfileCard( borderColors: List = listOf(Color(0xFFa3a1ed), Color(0xFFA77798)), backgroundColors: List = listOf(Color(0xFFC2C0FA), Color(0xFFFADAF0)), padding: Dp = 30.dp, - type: String = "USING KIZZY RICH PRESENCE", + type: String = stringResource(id = R.string.user_profile_rpc_name), rpcConfig: RpcConfig? = null, showTs: Boolean = true ) { @@ -74,7 +75,7 @@ fun ProfileCard( mutableStateOf(0) } LaunchedEffect(elapsed) { - if (elapsed == 60) + if (elapsed == 90) elapsed = 0 else { delay(1000) @@ -163,9 +164,14 @@ fun ProfileCard( .background(Color.White) ) { ProfileText( - text = user.globalName ?: (user.username + "#" + user.discriminator), + text = user.globalName ?: user.username, style = MaterialTheme.typography.titleLarge, ) + ProfileText( + text = user.username + if (user.discriminator != "0") "#" + user.discriminator else "", + style = MaterialTheme.typography.titleSmall, + bold = false + ) Spacer( modifier = Modifier .fillMaxWidth() @@ -174,7 +180,7 @@ fun ProfileCard( .background(Color(0xFFC2C0FA)) ) ProfileText( - text = "ABOUT ME", + text = stringResource(id = R.string.user_profile_bio), style = MaterialTheme.typography.titleSmall ) ProfileText( @@ -251,7 +257,7 @@ fun PreviewProfileCard() { discriminator = null, id = null, publicFlags = null, - username = null, + username = "yizzK", special = null, verified = false ) diff --git a/feature_profile/src/main/java/com/my/kizzy/feature_profile/ui/component/ProfileNetworkError.kt b/feature_profile/src/main/java/com/my/kizzy/feature_profile/ui/component/ProfileNetworkError.kt index e0ba57ef..b5dd8317 100644 --- a/feature_profile/src/main/java/com/my/kizzy/feature_profile/ui/component/ProfileNetworkError.kt +++ b/feature_profile/src/main/java/com/my/kizzy/feature_profile/ui/component/ProfileNetworkError.kt @@ -32,9 +32,11 @@ import androidx.compose.ui.draw.drawWithCache import androidx.compose.ui.geometry.Offset import androidx.compose.ui.geometry.Size import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import com.my.kizzy.resources.R @Composable fun ProfileNetworkError( @@ -74,7 +76,7 @@ fun ProfileNetworkError( tint = Color(0xFFCE8500) ) Text( - text = "Could not Update User Profile:\n$error", + text = stringResource(R.string.user_profile_error) + "\n$error", style = MaterialTheme.typography.titleMedium.copy( fontWeight = FontWeight.ExtraBold, color = Color(0xFFCE8500) @@ -92,6 +94,6 @@ fun Preview_Profile_Network_Error_Card() { modifier = Modifier .fillMaxWidth() .padding(10.dp), - error = "No Internet Connection. Try again after some time" + error = stringResource(R.string.user_profile_error) ) } \ No newline at end of file diff --git a/feature_profile/src/main/java/com/my/kizzy/feature_profile/ui/user/UserScreen.kt b/feature_profile/src/main/java/com/my/kizzy/feature_profile/ui/user/UserScreen.kt index fb80ed7a..4ee27522 100644 --- a/feature_profile/src/main/java/com/my/kizzy/feature_profile/ui/user/UserScreen.kt +++ b/feature_profile/src/main/java/com/my/kizzy/feature_profile/ui/user/UserScreen.kt @@ -18,12 +18,14 @@ import androidx.compose.material3.* import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.my.kizzy.domain.model.user.User import com.my.kizzy.feature_profile.ui.component.Logout import com.my.kizzy.feature_profile.ui.component.ProfileCard import com.my.kizzy.feature_profile.ui.component.ProfileNetworkError +import com.my.kizzy.resources.R import com.my.kizzy.ui.components.BackButton import com.my.kizzy.ui.components.shimmer.AnimatedShimmer import com.my.kizzy.ui.components.shimmer.ShimmerProfileCard @@ -37,6 +39,7 @@ fun UserScreen( ) { val snackbarHostState = remember { SnackbarHostState() } val scope = rememberCoroutineScope() + val ctx = LocalContext.current Scaffold( snackbarHost = { SnackbarHost(snackbarHostState) }, @@ -81,8 +84,8 @@ fun UserScreen( ) { scope.launch { snackbarHostState.showSnackbar( - message = "Are you sure ?", - actionLabel = "Yes", + message = ctx.getString(R.string.are_you_sure), + actionLabel = ctx.getString(R.string.yes), duration = SnackbarDuration.Short, withDismissAction = true ).run { diff --git a/feature_rpc_base/src/main/java/com/my/kizzy/feature_rpc_base/services/CustomRpcService.kt b/feature_rpc_base/src/main/java/com/my/kizzy/feature_rpc_base/services/CustomRpcService.kt index dfabb2f0..f4a42b6d 100644 --- a/feature_rpc_base/src/main/java/com/my/kizzy/feature_rpc_base/services/CustomRpcService.kt +++ b/feature_rpc_base/src/main/java/com/my/kizzy/feature_rpc_base/services/CustomRpcService.kt @@ -92,6 +92,7 @@ class CustomRpcService : Service() { setName(it.name.ifEmpty { "" }) setDetails(it.details.ifEmpty { null }) setState(it.state.ifEmpty { null }) + setPartySize(it.party1.toIntOrNull(), it.party2.toIntOrNull()) setStatus(it.status.ifEmpty { "online" }) setType(it.type.toIntOrNull() ?: 0) setStartTimestamps(it.timestampsStart.toLongOrNull()) diff --git a/feature_rpc_base/src/main/java/com/my/kizzy/feature_rpc_base/services/ExperimentalRpc.kt b/feature_rpc_base/src/main/java/com/my/kizzy/feature_rpc_base/services/ExperimentalRpc.kt index 33675a83..63625ad4 100644 --- a/feature_rpc_base/src/main/java/com/my/kizzy/feature_rpc_base/services/ExperimentalRpc.kt +++ b/feature_rpc_base/src/main/java/com/my/kizzy/feature_rpc_base/services/ExperimentalRpc.kt @@ -25,6 +25,7 @@ import com.my.kizzy.domain.model.rpc.RpcButtons import com.my.kizzy.feature_rpc_base.Constants import com.my.kizzy.feature_rpc_base.setLargeIcon import com.my.kizzy.preference.Prefs +import com.my.kizzy.preference.Prefs.MEDIA_RPC_ENABLE_TIMESTAMPS import com.my.kizzy.resources.R import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.CoroutineScope @@ -79,6 +80,8 @@ class ExperimentalRpc : Service() { setType(Prefs[Prefs.CUSTOM_ACTIVITY_TYPE, 0]) setStatus(Prefs[Prefs.CUSTOM_ACTIVITY_STATUS,"dnd"]) setDetails(collectedData.details) + setStartTimestamps(if (Prefs[MEDIA_RPC_ENABLE_TIMESTAMPS, false]) System.currentTimeMillis() else null) + setStopTimestamps(if (Prefs[MEDIA_RPC_ENABLE_TIMESTAMPS, false]) System.currentTimeMillis() else null) setLargeImage(collectedData.largeImage, collectedData.largeText) setSmallImage(collectedData.smallImage, collectedData.smallText) if (Prefs[Prefs.USE_RPC_BUTTONS, false]) { diff --git a/feature_rpc_base/src/main/java/com/my/kizzy/feature_rpc_base/services/MediaRpcService.kt b/feature_rpc_base/src/main/java/com/my/kizzy/feature_rpc_base/services/MediaRpcService.kt index 602273f4..a5af4aa2 100644 --- a/feature_rpc_base/src/main/java/com/my/kizzy/feature_rpc_base/services/MediaRpcService.kt +++ b/feature_rpc_base/src/main/java/com/my/kizzy/feature_rpc_base/services/MediaRpcService.kt @@ -73,7 +73,7 @@ class MediaRpcService : Service() { startForeground( Constants.NOTIFICATION_ID, notificationBuilder .setSmallIcon(R.drawable.ic_media_rpc) - .addAction(R.drawable.ic_media_rpc, "Exit", pendingIntent) + .addAction(R.drawable.ic_media_rpc, getString(R.string.exit), pendingIntent) .setContentText("Browsing Home Page..") .build() ) @@ -86,8 +86,10 @@ class MediaRpcService : Service() { notificationManager.notify( Constants.NOTIFICATION_ID, notificationBuilder + .setContentTitle(playingMedia.name.ifEmpty { getString(R.string.app_name) }) .setContentText( - (playingMedia.details ?: "").ifEmpty { "Browsing Home Page.." }) + (playingMedia.details ?: "").ifEmpty { getString(R.string.idling_notification) } + ) .setLargeIcon( rpcImage = playingMedia.largeImage, context = this@MediaRpcService @@ -105,10 +107,12 @@ class MediaRpcService : Service() { false -> { kizzyRPC.apply { - setName(playingMedia.name.ifEmpty { "YouTube" }) + setName(playingMedia.name) setType(Prefs[Prefs.CUSTOM_ACTIVITY_TYPE, 0]) setDetails(playingMedia.details) setState(playingMedia.state) + setStartTimestamps(if (enableTimestamps) playingMedia.time?.start else null) + setStopTimestamps(if (enableTimestamps) playingMedia.time?.end else null) setStatus(Prefs[Prefs.CUSTOM_ACTIVITY_STATUS,"dnd"]) setLargeImage(playingMedia.largeImage, if (Prefs[Prefs.MEDIA_RPC_ALBUM_NAME, false]) playingMedia.largeText else null) setSmallImage(if (Prefs[Prefs.MEDIA_RPC_APP_ICON, false]) playingMedia.smallImage else null, playingMedia.smallText) diff --git a/feature_settings/src/main/java/com/my/kizzy/feature_settings/Settings.kt b/feature_settings/src/main/java/com/my/kizzy/feature_settings/Settings.kt index 41ba458b..d77f6e06 100644 --- a/feature_settings/src/main/java/com/my/kizzy/feature_settings/Settings.kt +++ b/feature_settings/src/main/java/com/my/kizzy/feature_settings/Settings.kt @@ -29,8 +29,6 @@ import androidx.compose.ui.res.vectorResource import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign -import androidx.compose.ui.text.style.TextIndent -import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.withStyle import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp @@ -118,13 +116,13 @@ fun SettingsDrawer( } item { Subtitle( - text = "HELP", + text = stringResource(id = R.string.drawer_subtitle_help), modifier = Modifier ) } item { SettingsItemCard( - title = "FAQ", + title = stringResource(id = R.string.drawer_faq), icon = Icons.Rounded.HelpOutline ) { uriHandler.openUri("https://kizzy.vercel.app/#FAQ") @@ -276,7 +274,7 @@ fun ProfileCardSmall( Icon( imageVector = Icons.Rounded.ArrowForwardIos, modifier = Modifier.size(28.dp), - contentDescription = "Go to Profile", + contentDescription = stringResource(R.string.go_to_profile), tint = MaterialTheme.colorScheme.secondary ) } diff --git a/feature_settings/src/main/java/com/my/kizzy/feature_settings/rpc_settings/RpcSettings.kt b/feature_settings/src/main/java/com/my/kizzy/feature_settings/rpc_settings/RpcSettings.kt index b09d8693..755a3dac 100644 --- a/feature_settings/src/main/java/com/my/kizzy/feature_settings/rpc_settings/RpcSettings.kt +++ b/feature_settings/src/main/java/com/my/kizzy/feature_settings/rpc_settings/RpcSettings.kt @@ -75,7 +75,7 @@ import kotlinx.serialization.json.Json fun RpcSettings(onBackPressed: () -> Boolean) { val context = LocalContext.current var isLowResIconsEnabled by remember { mutableStateOf(Prefs[Prefs.RPC_USE_LOW_RES_ICON, false]) } - var configsDir by remember { mutableStateOf(Prefs[Prefs.CONFIGS_DIRECTORY, "Directory to store Custom RPC configs"]) } + var configsDir by remember { mutableStateOf(Prefs[Prefs.CONFIGS_DIRECTORY, ""]) } var showDirConfigDialog by remember { mutableStateOf(false) } var useButtonConfigs by remember { mutableStateOf(Prefs[Prefs.USE_RPC_BUTTONS, false]) } var showButtonsConfigDialog by remember { mutableStateOf(false) } @@ -114,7 +114,7 @@ fun RpcSettings(onBackPressed: () -> Boolean) { item { SettingItem( title = stringResource(id = R.string.configs_directory), - description = configsDir, + description = configsDir.ifEmpty { stringResource(id = R.string.custom_rpc_directory) }, icon = Icons.Default.Storage, ) { showDirConfigDialog = true @@ -220,7 +220,7 @@ fun RpcSettings(onBackPressed: () -> Boolean) { imageVector = Icons.Default.Storage, contentDescription = null ) }, - title = { Text("Select Directory") }, + title = { Text(stringResource(R.string.select_directory)) }, text = { Column { SingleChoiceItem( @@ -261,7 +261,7 @@ fun RpcSettings(onBackPressed: () -> Boolean) { imageVector = Icons.Default.Storage, contentDescription = null ) }, - title = { Text("Enter Details") }, + title = { Text(stringResource(R.string.enter_details)) }, text = { Column { RpcField( @@ -374,11 +374,11 @@ fun RpcSettings(onBackPressed: () -> Boolean) { confirmButton = {}, text = { val statusMap = mapOf( - "Online" to "online", - "AFK" to "idle", - "Do Not Disturb" to "dnd", - "Offline" to "offline", - "Invisible and shown as offline" to "invisible" + stringResource(R.string.status_online) to "online", + stringResource(R.string.status_idle) to "idle", + stringResource(R.string.status_dnd) to "dnd", + stringResource(R.string.status_offline) to "offline", + stringResource(R.string.status_invisible_offline) to "invisible" ) Column { statusMap.forEach { (key, value) -> diff --git a/feature_startup/src/main/java/com/my/kizzy/feature_startup/StartUp.kt b/feature_startup/src/main/java/com/my/kizzy/feature_startup/StartUp.kt index edeabbd3..81a4a3d2 100644 --- a/feature_startup/src/main/java/com/my/kizzy/feature_startup/StartUp.kt +++ b/feature_startup/src/main/java/com/my/kizzy/feature_startup/StartUp.kt @@ -157,7 +157,7 @@ fun StartUp( } item { SetupCard( - title = "Usage Access Permission", + title = stringResource(id = R.string.usage_access), description = stringResource(id = R.string.usage_access_desc), status = usageAccessStatus.value ) { @@ -166,8 +166,8 @@ fun StartUp( } item { SetupCard( - title = "Notification Access Permission", - description = "Notification Access is needed for app to extract media information", + title = stringResource(id = R.string.notification_access), + description = stringResource(id = R.string.request_for_notification_access), status = mediaControlStatus.value ) { context.startActivity(Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS)) @@ -176,8 +176,8 @@ fun StartUp( if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { item { SetupCard( - title = "Post Notification", - description = "Grant Permission to Show Notification", + title = stringResource(id = R.string.post_notification), + description = stringResource(id = R.string.request_for_post_notification), status = notificationPostingPerm ) { launcher.launch(POST_NOTIFICATIONS) @@ -186,8 +186,8 @@ fun StartUp( } else { item { SetupCard( - title = "Grant Storage Access Permission", - description = stringResource(id = R.string.request_for_permission), + title = stringResource(id = R.string.storage_access), + description = stringResource(id = R.string.request_for_storage_access), status = storagePermissionState.status.isGranted ) { when (storagePermissionState.status) { @@ -237,7 +237,7 @@ fun StartUp( ) { TextButton(onClick = { navigateToHome() }, enabled = notificationPostingPerm && usageAccessStatus.value || mediaControlStatus.value) { val text = - if (usageAccessStatus.value && mediaControlStatus.value) "Start App Now" else "Skip" + if (usageAccessStatus.value && mediaControlStatus.value) stringResource(R.string.start_app_now) else stringResource(R.string.skip) val style = if (usageAccessStatus.value && mediaControlStatus.value) MaterialTheme.typography.titleLarge else MaterialTheme.typography.titleLarge.copy( fontSize = 20.sp diff --git a/gateway/src/main/java/kizzy/gateway/entities/presence/Activity.kt b/gateway/src/main/java/kizzy/gateway/entities/presence/Activity.kt index 40ede175..e25ea293 100644 --- a/gateway/src/main/java/kizzy/gateway/entities/presence/Activity.kt +++ b/gateway/src/main/java/kizzy/gateway/entities/presence/Activity.kt @@ -11,6 +11,8 @@ data class Activity( val state: String? = null, @SerialName("details") val details: String? = null, + @SerialName("party") + val party: Party? = null, @SerialName("type") val type: Int? = 0, @SerialName("timestamps") diff --git a/gateway/src/main/java/kizzy/gateway/entities/presence/Party.kt b/gateway/src/main/java/kizzy/gateway/entities/presence/Party.kt new file mode 100644 index 00000000..cb54a721 --- /dev/null +++ b/gateway/src/main/java/kizzy/gateway/entities/presence/Party.kt @@ -0,0 +1,29 @@ +package kizzy.gateway.entities.presence + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class Party( + @SerialName("id") + val id: String = "kizzy", + @SerialName("size") + val size: Array = arrayOf(0, 0) +) { + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (javaClass != other?.javaClass) return false + + other as Party + + if (id != other.id) return false + if (!size.contentEquals(other.size)) return false + + return true + } + override fun hashCode(): Int { + var result = id.hashCode() + result = 31 * result + size.contentHashCode() + return result + } +} \ No newline at end of file