From d1836550878d0b7b4496a061b43181253cbd238c Mon Sep 17 00:00:00 2001 From: MSOB7YY Date: Fri, 3 Nov 2023 04:07:03 +0200 Subject: [PATCH] code: experimental mediaNotification() --- assets/language/langs.json | 7 +-- assets/language/translations/ar_SA.json | 27 ----------- assets/language/translations/en_US.json | 45 +++++++++++++++++++ lib/controller/notification_controller.dart | 50 +++++++++++++++++++++ lib/main.dart | 6 +-- 5 files changed, 99 insertions(+), 36 deletions(-) delete mode 100644 assets/language/translations/ar_SA.json diff --git a/assets/language/langs.json b/assets/language/langs.json index 2191db9a..2be54532 100644 --- a/assets/language/langs.json +++ b/assets/language/langs.json @@ -2,11 +2,6 @@ { "code": "en_US", "name": "English", - "country":"United States" - }, - { - "code": "ar_SA", - "name": "Arabic", - "country":"Saudi Arabia" + "country": "United States" } ] \ No newline at end of file diff --git a/assets/language/translations/ar_SA.json b/assets/language/translations/ar_SA.json deleted file mode 100644 index 1f738459..00000000 --- a/assets/language/translations/ar_SA.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "ALBUM_IDENTIFIERS": "Album Identifiers", - "ALWAYS_ASK": "Always ask", - "DIM_INTENSITY": "Dim Intensity", - "DIM_MINIPLAYER_AFTER_SECONDS": "Dim miniplayer after _SECONDS_ seconds of inactivity", - "DISPLAY_REMAINING_DURATION_INSTEAD_OF_TOTAL": "Display remaining duration instead of total", - "DOWNLOADS_METADATA_TAGS": "Downloads Metadata tags", - "DOWNLOADS_METADATA_TAGS_SUBTITLE": "Extract artist, title & album from video info by default", - "ENABLE_PARALLAX_EFFECT": "Enable Parallax Effect", - "GROUP_ARTWORKS_BY_ALBUM": "Group Artworks by Album", - "KEEP_CACHED_VERSIONS": "Keep cached versions", - "MAX_IMAGE_CACHE_SIZE": "Max image cache size", - "MAX_VIDEO_CACHE_SIZE": "Max video cache size", - "MOOD": "Mood", - "ON_OPENING_YOUTUBE_LINK": "On opening youtube link", - "OPEN_IN_YOUTUBE_VIEW": "Open in Youtube view", - "PICK_COLORS_FROM_DEVICE_WALLPAPER": "Pick Colors from Device Wallpaper", - "REQUIRES_CLEARING_IMAGE_CACHE_AND_RE_INDEXING": "Requires clearing image cache and re indexing", - "SET_FILE_LAST_MODIFIED_AS_VIDEO_UPLOAD_DATE": "Set file last modified as video upload date", - "THEME_SETTINGS": "المظهر", - "THEME_SETTINGS_SUBTITLE": "الشكل العام لمشغل الموسيقى خاصتك", - "TRACK": "تراك", - "TRACKS": "تراكات", - "YOUTUBE_SETTINGS_SUBTITLE": "Customize Youtube experience", - "YT_PREFER_NEW_COMMENTS": "Prefer new comments when possible", - "YT_PREFER_NEW_COMMENTS_SUBTITLE": "Cached version will only be used when there is no connection" -} \ No newline at end of file diff --git a/assets/language/translations/en_US.json b/assets/language/translations/en_US.json index c2fa7b4d..735fccf3 100644 --- a/assets/language/translations/en_US.json +++ b/assets/language/translations/en_US.json @@ -4,6 +4,9 @@ "ADD": "Add", "ADDED": "added", "ADD_FOLDER": "Add Folder", + "ADD_LANGUAGE": "Add Language", + "ADD_LANGUAGE_SUBTITLE": "Help translating Namida to your own language", + "ADD_LRC_FILE": "Add LRC file", "ADD_MORE_FROM_THIS_ALBUM": "Add more from this Album to queue", "ADD_MORE_FROM_THIS_ARTIST": "Add more from this Artist to queue", "ADD_MORE_FROM_THIS_FOLDER": "Add more from this Folder to queue", @@ -22,7 +25,9 @@ "ALBUM_THUMBNAIL_SIZE_IN_LIST": "Size of Album Thumbnail", "ALBUM_TILE_CUSTOMIZATION": "Album Tile Customization", "ALL_TIME": "All time", + "ALWAYS": "Always", "ALWAYS_ASK": "Always ask", + "ALWAYS_RESTORE": "Always restore", "ANIMATING_THUMBNAIL_INTENSITY": "Thumbnail Animation Intensity", "ANIMATING_THUMBNAIL_INVERSED": "Inverse Animations", "ANIMATING_THUMBNAIL_INVERSED_SUBTITLE": "High peaks will cause the thumbnail to get smaller", @@ -43,6 +48,7 @@ "AUTO_GENERATED": "Auto Generated", "BACKUP_AND_RESTORE": "Backup & Restore", "BACKUP_AND_RESTORE_SUBTITLE": "Backup your database and settings", + "BALANCED": "Balanced", "BETA": "Beta", "BETWEEN_DATES": "Between Dates", "BITRATE": "Bitrate", @@ -92,6 +98,9 @@ "CREATED_BACKUP_SUCCESSFULLY_SUB": "Backup file has been created successfully", "CREATE_BACKUP": "Create Backup", "CREATE_NEW_PLAYLIST": "Create new Playlist", + "CROSSFADE_DURATION": "Crossfade duration", + "CROSSFADE_TRIGGER_SECONDS": "Trigger Crossfade automatically in the last _SECONDS_ seconds", + "CROSSFADE_TRIGGER_SECONDS_DISABLED": "Do not trigger crossfade automatically", "CUSTOM": "Custom", "CUSTOMIZATIONS": "Customizations", "CUSTOMIZATIONS_SUBTITLE": "Customize how your player looks, make it yours", @@ -119,8 +128,10 @@ "DISC_NUMBER": "Disc Number", "DISC_NUMBER_TOTAL": "Disc Total", "DISLIKE": "Dislike", + "DISMISSIBLE_MINIPLAYER": "Dismissible Miniplayer", "DISPLAY_ALBUM_CARD_TOP_RIGHT_DATE": "Album Card top right date", "DISPLAY_ALBUM_CARD_TOP_RIGHT_DATE_SUBTITLE": "Display Album date at Album Card top right", + "DISPLAY_ARTIST_BEFORE_TITLE": "Display artist before title", "DISPLAY_AUDIO_INFO_IN_MINIPLAYER": "Display Audio Info", "DISPLAY_FAVOURITE_ICON_IN_TRACK_TILE": "Display Favourite Button", "DISPLAY_FAV_BUTTON_IN_NOTIFICATION": "Display Favourtie Button in Notification", @@ -131,6 +142,7 @@ "DISPLAY_TRACK_NUMBER_IN_ALBUM_PAGE": "Display Track number in Album Page", "DISPLAY_TRACK_NUMBER_IN_ALBUM_PAGE_SUBTITLE": "Display a small box containing the track number in the album page", "DONE": "Done", + "DONT_ASK_AGAIN": "Don't ask again", "DONT_RESTORE_POSITION": "Don't restore", "DOWNLOAD": "Download", "DOWNLOADING_WILL_OVERRIDE_IT": "Downloading will override it", @@ -148,9 +160,14 @@ "ENABLE_BLUR_EFFECT": "Enable Blur Effect", "ENABLE_BOTTOM_NAV_BAR": "Enable Bottom Navigation Bar", "ENABLE_BOTTOM_NAV_BAR_SUBTITLE": "Items are inside the drawer bothways", + "ENABLE_CROSSFADE_EFFECT": "Enable Crossfade Effect", "ENABLE_FADE_EFFECT_ON_PLAY_PAUSE": "Enable Fade Effect on Play/Pause", "ENABLE_FOLDERS_HIERARCHY": "Enable Folders Hierarchy", "ENABLE_GLOW_EFFECT": "Enable Glow Effect", + "ENABLE_M3U_SYNC": "Enable M3U Sync", + "ENABLE_M3U_SYNC_NOTE_1": "M3U Sync allows saving playlist changes to the original M3U file", + "ENABLE_M3U_SYNC_NOTE_2": "If anything went wrong, a backup of this playlist will be found in _PLAYLISTS_BACKUP_PATH_", + "ENABLE_M3U_SYNC_SUBTITLE": "If Denied, all changes done in this playlist will be lost on restart", "ENABLE_MINIPLAYER_PARTICLES": "Enable moving particles", "ENABLE_PARALLAX_EFFECT": "Enable Parallax Effect", "ENABLE_PARTY_MODE": "Enable Party Mode", @@ -166,6 +183,7 @@ "EXCLUDED_FODLERS": "Excluded Folders", "EXIT": "Exit", "EXIT_APP_SUBTITLE": "Tap again to exit", + "EXPORT_AS_M3U": "Export as M3U", "EXTENSION": "Extension", "EXTERNAL_FILES": "External Files", "EXTRACT": "Extract", @@ -197,6 +215,7 @@ "FOLDERS": "Folders", "FOLDER_NAME": "Folder Name", "FONT_SCALE": "Font Scale", + "FORCE_MINIPLAYER_FOLLOW_TRACK_COLORS": "Force miniplayer to follow track colors", "FORCE_SQUARED_ALBUM_THUMBNAIL": "Force Squared Album Thumbnail", "FORCE_SQUARED_THUMBNAIL_NOTE": "Thumbnail Size & Tile Height are NOT equal, Square-ish look will not be as expected, Do you wish to make them equal?", "FORCE_SQUARED_TRACK_THUMBNAIL": "Force Squared Track Thumbnail", @@ -207,21 +226,29 @@ "GENERATE_FROM_DATES_SUBTITLE": "Generate tracks you listened to in a time range", "GENRE": "Genre", "GENRES": "Genres", + "GOOD_LOOKING": "Good looking", "GO_TO_ALBUM": "Go to Album", "GO_TO_ARTIST": "Go to Artist", "GO_TO_CHANNEL": "Go to channel", "GO_TO_FOLDER": "Go to Folder", "GRANT_ACCESS": "Grant Access", + "GRANT_STORAGE_PERMISSION": "Grant Storage Permission", "GROUP_ARTWORKS_BY_ALBUM": "Group Artworks by Album", "GUIDE": "Guide", "HEIGHT_OF_ALBUM_TILE": "Height of Album Tile", "HEIGHT_OF_TRACK_TILE": "Height of Track Tile", "HIGH_MATCHES": "High matches", + "HIGH_PERFORMANCE": "High performance", "HISTORY": "History", "HISTORY_IMPORT_MISSING_ENTRIES_NOTE": "These entries couldn't be found inside library, if you believe they exist, please consider adding them manually", "HISTORY_LISTENS_REPLACE_WARNING": "_LISTENS_COUNT_ listens for _OLD_TRACK_INFO_ will be replaced with _NEW_TRACK_INFO_, confirm?", "HOME": "Home", "HOUR_FORMAT_12": "12 Hour Format", + "IF_NOT_PLAYING": "If not playing", + "IGNORES": "Ignores", + "IGNORE_BATTERY_OPTIMIZATIONS_SUBTITLE": "Downloads can be throttled when the app is battery restricted", + "IMMERSIVE_MODE": "Immersive Mode", + "IMMERSIVE_MODE_SUBTITLE": "Hide Status & Navigation bars while Miniplayer is expanded", "IMPORT_ALL": "Import all", "IMPORT_LAST_FM_HISTORY": "Import LastFm History", "IMPORT_LAST_FM_HISTORY_GUIDE": "1. Go to _LASTFM_CSV_LINK_\n\n2. Type your username, fetch and download csv file.\n\n3. Choose the file from the next screen.", @@ -237,6 +264,7 @@ "INSERTED": "inserted", "INSTANTLY_APPLIES": "Instantly Applies", "ITEM": "Item", + "I_READ_AND_AGREE": "I read & agree", "JUMP": "Jump", "JUMP_TO_DAY": "Jump to Day", "JUMP_TO_FIRST_TRACK_AFTER_QUEUE_FINISH": "Jump to first track after finishing queue", @@ -246,6 +274,7 @@ "KEEP_SCREEN_AWAKE_MINIPLAYER_EXPANDED_AND_VIDEO": "Miniplayer is Expanded and a Video is Playing", "KEEP_SCREEN_AWAKE_NONE": "Don't keep screen awake", "KEEP_SCREEN_AWAKE_WHEN": "Keep screen awake when", + "KILL_PLAYER_AFTER_DISMISSING_APP": "Kill player after dismissing app", "LANGUAGE": "Language", "LIBRARY_TABS": "Library Tabs", "LIBRARY_TABS_REORDER": "You can reorder the activated tabs.", @@ -259,6 +288,7 @@ "LOST_MEMORIES_SUBTITLE": "around this time, _NUM_ years ago", "LYRICIST": "Lyricist", "LYRICS": "Lyrics", + "M3U_PLAYLIST": "M3U Playlist", "MAKE_YOUR_FIRST_LISTEN": "Make your first listen!", "MANUAL_BACKUP": "Manual", "MANUAL_BACKUP_SUBTITLE": "pick up a specific file", @@ -295,6 +325,7 @@ "MULTIPLE_TRACKS_TAGS_EDIT_NOTE": "You are about to edit these tracks,\nUnchanged fields remains untouched.", "NAME": "Name", "NAME_CONTAINS_BAD_CHARACTER": "Name contains bad character", + "NEVER": "Never", "NEW_DIRECTORY": "New directory", "NEW_TRACKS_ADD": "Add Tracks", "NEW_TRACKS_MOODS": "Mood", @@ -323,6 +354,7 @@ "NO_TRACKS_IN_HISTORY": "You don't have enough tracks in history.", "NUMBER_OF_TRACKS": "Number of Tracks", "OF": "of", + "OFFSET": "Offset", "OLDEST_WATCH": "Oldest Watch", "OLD_DIRECTORY": "Old directory", "OLD_DIRECTORY_STILL_HAS_TRACKS": "Old Directory still have some tracks, confirm?", @@ -347,12 +379,14 @@ "PAUSE_FADE_DURATION": "Pause Fade Duration", "PAUSE_PLAYBACK": "Pause playback", "PERCENTAGE": "Percentage", + "PERFORMANCE_MODE": "Performance mode", "PERFORMANCE_NOTE": "Might affect performance", "PERMISSION_UPDATE": "Permission Update", "PICK_COLORS_FROM_DEVICE_WALLPAPER": "Pick Colors from Device Wallpaper", "PICK_FROM_STORAGE": "Pick from storage", "PINNED": "Pinned", "PITCH": "Pitch", + "PLAIN": "Plain", "PLAY": "Play", "PLAYBACK_SETTING": "Playback", "PLAYBACK_SETTING_SUBTITLE": "Can be accessed directly in the player by long pressing the audio button", @@ -371,6 +405,7 @@ "PREVENT_DUPLICATED_TRACKS": "Prevent Duplicated tracks", "PREVENT_DUPLICATED_TRACKS_SUBTITLE": "Uses filename to uniqely identify tracks", "PREVIEW": "Preview", + "PRIORITIZE_EMBEDDED_LYRICS": "Prioritize embedded lyrics", "PROGRESS": "Progress", "PROMPT_INDEXING_REFRESH": "_NEW_FILES_ new files has been found & _DELETED_FILES_ was deleted or filtered, wanna do a refresh?", "PROMPT_TO_CHANGE_TRACK_PATH": "Usually this happens when u delete/move/rename the file outside namida, Would you like to update current path?", @@ -405,6 +440,7 @@ "REPLIES": "Replies", "REQUIRES_CLEARING_IMAGE_CACHE_AND_RE_INDEXING": "Requires clearing image cache and re indexing", "RESCAN_VIDEOS": "Re-scan videos", + "RESET_BRIGHTNESS": "Reset brightness", "RESET_TO_DEFAULT": "Set to", "RESPECT_NO_MEDIA": "Respect .nomedia", "RESPECT_NO_MEDIA_SUBTITLE": "Don't include folders that has .nomedia", @@ -432,6 +468,7 @@ "SEPARATORS_BLACKLIST_SUBTITLE": "These words will not get split", "SEPARATORS_MESSAGE": "No need to insert spaces, unless you wanna use a letter/symbol that can be found in a whole word (like x and ft.)", "SETTINGS": "Settings", + "SETUP_FIRST_STARTUP": "Setup first startup", "SET_AS_DEFAULT": "Set as Default", "SET_FILE_LAST_MODIFIED_AS_VIDEO_UPLOAD_DATE": "Set file last modified as video upload date", "SET_MOODS": "Set moods", @@ -474,6 +511,8 @@ "SUPPORT": "Support", "SUPREMACY": "Supremacy", "SUSSY_BAKA": "Bruh no tracks", + "SWIPE_TO_OPEN_DRAWER": "Swipe to open drawer", + "SYNCED": "Synced", "SYNOPSIS": "Synopsis", "TAGS": "Tags", "TAG_FIELDS": "Tag Fields", @@ -525,6 +564,10 @@ "UPDATING": "Updating", "USED": "Used", "USE_COLLAPSED_SETTING_TILES": "Use Collapsed Setting Tiles", + "USE_MEDIA_STORE": "Use Media Store", + "USE_MEDIA_STORE_SUBTITLE": "✓ instant indexing time\nx respect .nomedia will be forcely enabled\nx some metadata tags will be missing\nx youtube integration for local library will not work", + "USE_PITCH_BLACK": "Use Pitch Black", + "USE_PITCH_BLACK_SUBTITLE": "Useful for AMOLED screens.. and looks cooler", "VALUE": "Value", "VALUE_BETWEEN_50_200": "Value should be between 50% and 200%", "VIDEO": "Video", @@ -544,6 +587,8 @@ "VIDEO_QUALITY": "Video Quality", "VIDEO_QUALITY_SUBTITLE": "Highest quality available will be picked.", "VIDEO_QUALITY_SUBTITLE_NOTE": "It's always good to keep more alternatives in case a quality isn't found, otherwise it will fallback to the worst quality", + "VIEW": "view", + "VIEWS": "views", "VIEW_ALL": "View All", "VOLUME": "Volume", "WARNING": "Warning", diff --git a/lib/controller/notification_controller.dart b/lib/controller/notification_controller.dart index 5d0796f5..c10909d2 100644 --- a/lib/controller/notification_controller.dart +++ b/lib/controller/notification_controller.dart @@ -1,3 +1,4 @@ +import 'package:flutter/material.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:namida/controller/json_to_history_parser.dart'; @@ -36,6 +37,55 @@ class NotificationService { ); } + void mediaNotification({ + required String title, + required String subText, + required String subtitle, + String? imagePath, + required int progressMS, + required int durationMS, + required DateTime displayTime, + required Color? color, + }) { + const id = 10; + final pic = imagePath == null ? null : FilePathAndroidBitmap(imagePath); + + _flutterLocalNotificationsPlugin.show( + id, + title, + subtitle, + NotificationDetails( + android: AndroidNotificationDetails( + '$id', + 'media', + channelDescription: 'media', + groupKey: '$id', + category: AndroidNotificationCategory.progress, + setAsGroupSummary: true, + channelShowBadge: false, + importance: Importance.high, + priority: Priority.high, + onlyAlertOnce: true, + showProgress: true, + ongoing: true, + visibility: NotificationVisibility.public, + styleInformation: const MediaStyleInformation(), // this gets displayed instead of subtitle + largeIcon: pic, + progress: progressMS, + maxProgress: durationMS, + icon: 'ic_stat_musicnote', + subText: subText, + color: color, + colorized: true, + // showWhen: displayTime != null, + when: displayTime.millisecondsSinceEpoch, + // tag: tag, + ), + ), + // payload: payload, + ); + } + void downloadYoutubeNotification({ required String notificationID, required String title, diff --git a/lib/main.dart b/lib/main.dart index 193d69b8..2c91267c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -380,9 +380,9 @@ class Namida extends StatelessWidget { // prevent accidental miniplayer swipe when performing back gesture Positioned( right: 0, - child: SizedBox( - width: 8.0, - height: context.height, + child: SizedBox( + width: 8.0, + height: context.height, child: GestureDetector( onHorizontalDragUpdate: (details) {}, ),