diff --git a/on_audio_query/CHANGELOG.md b/on_audio_query/CHANGELOG.md
index b9f316de..142c17b0 100644
--- a/on_audio_query/CHANGELOG.md
+++ b/on_audio_query/CHANGELOG.md
@@ -1,3 +1,19 @@
+## [2.6.0] - [02.01.2022]
+### Features
+- **[Added]** `[scanMedia]` method that will scan the given path and update the `[Android]` MediaStore.
+
+### Fixes
+- **[Fixed]** media showing when calling `[querySongs]` even after deleting with `[dart:io]`. - [#67](https://github.com/LucJosin/on_audio_query/issues/67)
+
+### Changes
+- **[Updated]** some required packages.
+
+### Documentation
+- Updated `README` documentation.
+- Updated `DEPRECATED` documentation.
+- Updated `PLATFORMS` documentation.
+- Updated some `broken` links.
+
## [2.5.3+1] - [01.20.2022]
### Changes
- **[Updated]** all Github links.
diff --git a/on_audio_query/DEPRECATED.md b/on_audio_query/DEPRECATED.md
index caa27239..855d0c0e 100644
--- a/on_audio_query/DEPRECATED.md
+++ b/on_audio_query/DEPRECATED.md
@@ -1,4 +1,4 @@
-## [2.5.0] - [10.15.2021] -> [X.X.X] - [XX.XX.XXXX]
+## [2.5.0] - [10.15.2021] -> [2.6.0] - [02.01.2022]
### Deprecated
- `[albumId]` from `[AlbumModel]`.
- Use `[id]` instead.
diff --git a/on_audio_query/PLATFORMS.md b/on_audio_query/PLATFORMS.md
index 8d773f9d..c8ae7535 100644
--- a/on_audio_query/PLATFORMS.md
+++ b/on_audio_query/PLATFORMS.md
@@ -54,6 +54,7 @@ Here you'll see a extra information about every method/type etc..
| `permissionsRequest` | `✔️` | `✔️` | `❌` |
| `permissionsStatus` | `✔️` | `✔️` | `❌` |
| `queryDeviceInfo` | `✔️` | `✔️` | `✔️` |
+| `scanMedia` | `✔️` | `❌` | `❌` |
## SortTypes
diff --git a/on_audio_query/README.md b/on_audio_query/README.md
index b20f0906..500acf8d 100644
--- a/on_audio_query/README.md
+++ b/on_audio_query/README.md
@@ -53,6 +53,7 @@ NOTE: Feel free to help with readme translations
| `permissionsRequest` | `✔️` | `✔️` | `❌` |
| `permissionsStatus` | `✔️` | `✔️` | `❌` |
| `queryDeviceInfo` | `✔️` | `✔️` | `✔️` |
+| `scanMedia` | `✔️` | `❌` | `❌` |
✔️ -> Supported
❌ -> Not Supported
@@ -63,7 +64,7 @@ NOTE: Feel free to help with readme translations
Add the following code to your `pubspec.yaml`:
```yaml
dependencies:
- on_audio_query: ^2.5.3+1
+ on_audio_query: ^2.6.0
```
### Request Permission:
diff --git a/on_audio_query/README.pt-BR.md b/on_audio_query/README.pt-BR.md
index b334c936..534c3803 100644
--- a/on_audio_query/README.pt-BR.md
+++ b/on_audio_query/README.pt-BR.md
@@ -53,6 +53,7 @@ NOTE: Fique à vontade para ajudar nas traduções
| `permissionsRequest` | `✔️` | `✔️` | `❌` |
| `permissionsStatus` | `✔️` | `✔️` | `❌` |
| `queryDeviceInfo` | `✔️` | `✔️` | `✔️` |
+| `scanMedia` | `✔️` | `❌` | `❌` |
✔️ -> Tem suporte
❌ -> Não tem suporte
@@ -63,7 +64,7 @@ NOTE: Fique à vontade para ajudar nas traduções
Adicione o seguinte codigo para seu `pubspec.yaml`:
```yaml
dependencies:
- on_audio_query: ^2.5.3
+ on_audio_query: ^2.6.0
```
#### Solicitar Permissões:
diff --git a/on_audio_query/android/src/main/kotlin/com/lucasjosino/on_audio_query/OnAudioQueryPlugin.kt b/on_audio_query/android/src/main/kotlin/com/lucasjosino/on_audio_query/OnAudioQueryPlugin.kt
index 36f6a2bf..5afb2b3d 100644
--- a/on_audio_query/android/src/main/kotlin/com/lucasjosino/on_audio_query/OnAudioQueryPlugin.kt
+++ b/on_audio_query/android/src/main/kotlin/com/lucasjosino/on_audio_query/OnAudioQueryPlugin.kt
@@ -2,12 +2,12 @@
=============
Author: Lucas Josino
Github: https://github.com/LucJosin
-Website: https://lucasjosino.com/
+Website: https://www.lucasjosino.com/
=============
Plugin/Id: on_audio_query#0
Homepage: https://github.com/LucJosin/on_audio_query
Pub: https://pub.dev/packages/on_audio_query
-License: https://github.com/LucJosin/on_audio_query/blob/main/LICENSE
+License: https://github.com/LucJosin/on_audio_query/blob/main/on_audio_query/LICENSE
Copyright: © 2021, Lucas Josino. All rights reserved.
=============
*/
@@ -18,6 +18,7 @@ import android.Manifest
import android.app.Activity
import android.content.Context
import android.content.pm.PackageManager
+import android.media.MediaScannerConnection
import androidx.annotation.NonNull
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
@@ -79,6 +80,20 @@ class OnAudioQueryPlugin : FlutterPlugin, MethodCallHandler, ActivityAware,
// Device information
"queryDeviceInfo" -> queryDeviceInfo(result)
+ // This method will scan the given path to update the 'state'.
+ // When deleting a file using 'dart:io', call this method to update the file 'state'.
+ "scan" -> {
+ val sPath: String? = call.argument("path")
+
+ // Check if the given file is null or empty.
+ if (sPath == null || sPath.isEmpty()) result.success(false)
+
+ // Scan and return
+ MediaScannerConnection.scanFile(pContext, arrayOf(sPath), null) { _, _ ->
+ result.success(true)
+ }
+ }
+
// All others methods
else -> onAudioController.onAudioController()
}
diff --git a/on_audio_query/example/lib/main.dart b/on_audio_query/example/lib/main.dart
index 95ac7f42..43387f49 100644
--- a/on_audio_query/example/lib/main.dart
+++ b/on_audio_query/example/lib/main.dart
@@ -2,12 +2,12 @@
=============
Author: Lucas Josino
Github: https://github.com/LucJosin
-Website: https://lucasjosino.com/
+Website: https://www.lucasjosino.com/
=============
Plugin/Id: on_audio_query#0
Homepage: https://github.com/LucJosin/on_audio_query
Pub: https://pub.dev/packages/on_audio_query
-License: https://github.com/LucJosin/on_audio_query/blob/main/LICENSE
+License: https://github.com/LucJosin/on_audio_query/blob/main/on_audio_query/LICENSE
Copyright: © 2021, Lucas Josino. All rights reserved.
=============
*/
diff --git a/on_audio_query/lib/details/on_audio_query_controller.dart b/on_audio_query/lib/details/on_audio_query_controller.dart
index b42eab38..b52c31c5 100644
--- a/on_audio_query/lib/details/on_audio_query_controller.dart
+++ b/on_audio_query/lib/details/on_audio_query_controller.dart
@@ -2,12 +2,12 @@
=============
Author: Lucas Josino
Github: https://github.com/LucJosin
-Website: https://lucasjosino.com/
+Website: https://www.lucasjosino.com/
=============
Plugin/Id: on_audio_query#0
Homepage: https://github.com/LucJosin/on_audio_query
Pub: https://pub.dev/packages/on_audio_query
-License: https://github.com/LucJosin/on_audio_query/blob/main/LICENSE
+License: https://github.com/LucJosin/on_audio_query/blob/main/on_audio_query/LICENSE
Copyright: © 2021, Lucas Josino. All rights reserved.
=============
*/
@@ -528,7 +528,7 @@ class OnAudioQuery {
return renamePlaylist(playlistId, newName);
}
- //Permissions methods
+ // Permissions methods
/// Used to check Android permissions status
///
@@ -566,7 +566,7 @@ class OnAudioQuery {
return platform.permissionsRequest();
}
- //Device Information
+ // Device Information
/// Used to return Device Info
///
@@ -587,4 +587,45 @@ class OnAudioQuery {
Future queryDeviceInfo() async {
return platform.queryDeviceInfo();
}
+
+ // Others
+
+ /// Used to scan the given [path]
+ ///
+ /// Will return:
+ ///
+ /// * A boolean indicating if the path was scanned or not.
+ ///
+ /// Usage:
+ ///
+ /// * When using the [Android] platform. After deleting a media using the [dart:io],
+ /// call this method to update the media. If the media was successfully and the path
+ /// not scanned. Will keep showing on [querySongs].
+ ///
+ /// Example:
+ ///
+ /// ```dart
+ /// OnAudioQuery _audioQuery = OnAudioQuery();
+ /// File file = File('path');
+ ///
+ /// try {
+ /// if (file.existsSync()) {
+ /// file.deleteSync();
+ /// _audioQuery.scanMedia(file.path); // Scan the media 'path'
+ /// }
+ /// } catch (e) {
+ /// debugPrint('$e');
+ /// }
+ /// ```
+ ///
+ /// Platforms:
+ ///
+ /// | Android | IOS | Web |
+ /// |--------------|-----------------|-----------------|
+ /// | `✔️` | `❌` | `❌` |
+ ///
+ /// See more about [platforms support](https://github.com/LucJosin/on_audio_query/blob/main/on_audio_query/PLATFORMS.md)
+ Future scanMedia(String path) async {
+ return await platform.scanMedia(path);
+ }
}
diff --git a/on_audio_query/lib/on_audio_query.dart b/on_audio_query/lib/on_audio_query.dart
index 8cd3cf0f..a8898968 100644
--- a/on_audio_query/lib/on_audio_query.dart
+++ b/on_audio_query/lib/on_audio_query.dart
@@ -2,12 +2,12 @@
=============
Author: Lucas Josino
Github: https://github.com/LucJosin
-Website: https://lucasjosino.com/
+Website: https://www.lucasjosino.com/
=============
Plugin/Id: on_audio_query#0
Homepage: https://github.com/LucJosin/on_audio_query
Pub: https://pub.dev/packages/on_audio_query
-License: https://github.com/LucJosin/on_audio_query/blob/main/LICENSE
+License: https://github.com/LucJosin/on_audio_query/blob/main/on_audio_query/LICENSE
Copyright: © 2021, Lucas Josino. All rights reserved.
=============
*/
diff --git a/on_audio_query/lib/widget/query_artwork_widget.dart b/on_audio_query/lib/widget/query_artwork_widget.dart
index 985f8556..ffe9593f 100644
--- a/on_audio_query/lib/widget/query_artwork_widget.dart
+++ b/on_audio_query/lib/widget/query_artwork_widget.dart
@@ -2,12 +2,12 @@
=============
Author: Lucas Josino
Github: https://github.com/LucJosin
-Website: https://lucasjosino.com/
+Website: https://www.lucasjosino.com/
=============
Plugin/Id: on_audio_query#0
Homepage: https://github.com/LucJosin/on_audio_query
Pub: https://pub.dev/packages/on_audio_query
-License: https://github.com/LucJosin/on_audio_query/blob/main/LICENSE
+License: https://github.com/LucJosin/on_audio_query/blob/main/on_audio_query/LICENSE
Copyright: © 2021, Lucas Josino. All rights reserved.
=============
*/
diff --git a/on_audio_query/pubspec.yaml b/on_audio_query/pubspec.yaml
index 1a6c566a..ab3d00f2 100644
--- a/on_audio_query/pubspec.yaml
+++ b/on_audio_query/pubspec.yaml
@@ -1,12 +1,12 @@
name: on_audio_query
description: Flutter Plugin used to query audios/songs infos [title, artist, album, etc..] from device storage.
-version: 2.5.3+1
+version: 2.6.0
homepage: https://github.com/LucJosin/on_audio_query/tree/main/on_audio_query
# pub.dev: https://pub.dev/packages/on_audio_query
# ========
# author: Lucas Josino
# github: https://github.com/LucJosin
-# website: https://lucasjosino.com/
+# website: https://www.lucasjosino.com/
environment:
sdk: '>=2.12.0 <3.0.0'
@@ -14,8 +14,8 @@ environment:
dependencies:
# on_audio_query
- on_audio_query_platform_interface: ^1.3.1+1
- on_audio_query_web: ^1.3.2+1
+ on_audio_query_platform_interface: ^1.4.0
+ on_audio_query_web: ^1.3.2+2
# Flutter
flutter: