Skip to content

Commit

Permalink
code: experimental mediaNotification()
Browse files Browse the repository at this point in the history
  • Loading branch information
MSOB7YY committed Nov 3, 2023
1 parent b0b33fa commit d183655
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 36 deletions.
7 changes: 1 addition & 6 deletions assets/language/langs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
{
"code": "en_US",
"name": "English",
"country":"United States"
},
{
"code": "ar_SA",
"name": "Arabic",
"country":"Saudi Arabia"
"country": "United States"
}
]
27 changes: 0 additions & 27 deletions assets/language/translations/ar_SA.json

This file was deleted.

45 changes: 45 additions & 0 deletions assets/language/translations/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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.",
Expand All @@ -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",
Expand All @@ -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.",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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?",
Expand All @@ -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",
Expand All @@ -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?",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
50 changes: 50 additions & 0 deletions lib/controller/notification_controller.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {},
),
Expand Down

0 comments on commit d183655

Please sign in to comment.