Skip to content

Commit

Permalink
Update 2.6.0 - Fixed #67
Browse files Browse the repository at this point in the history
  • Loading branch information
LucJosin committed Feb 1, 2022
1 parent 7452b78 commit 20d99ac
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 19 deletions.
16 changes: 16 additions & 0 deletions on_audio_query/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion on_audio_query/DEPRECATED.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
1 change: 1 addition & 0 deletions on_audio_query/PLATFORMS.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Here you'll see a extra information about every method/type etc..
| `permissionsRequest` | `✔️` | `✔️` | `` | <br>
| `permissionsStatus` | `✔️` | `✔️` | `` | <br>
| `queryDeviceInfo` | `✔️` | `✔️` | `✔️` | <br>
| `scanMedia` | `✔️` | `` | `` | <br>

## SortTypes

Expand Down
3 changes: 2 additions & 1 deletion on_audio_query/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ NOTE: Feel free to help with readme translations
| `permissionsRequest` | `✔️` | `✔️` | `` | <br>
| `permissionsStatus` | `✔️` | `✔️` | `` | <br>
| `queryDeviceInfo` | `✔️` | `✔️` | `✔️` | <br>
| `scanMedia` | `✔️` | `` | `` | <br>

✔️ -> Supported <br>
❌ -> Not Supported <br>
Expand All @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion on_audio_query/README.pt-BR.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ NOTE: Fique à vontade para ajudar nas traduções
| `permissionsRequest` | `✔️` | `✔️` | `` | <br>
| `permissionsStatus` | `✔️` | `✔️` | `` | <br>
| `queryDeviceInfo` | `✔️` | `✔️` | `✔️` | <br>
| `scanMedia` | `✔️` | `` | `` | <br>

✔️ -> Tem suporte <br>
❌ -> Não tem suporte <br>
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
=============
*/
Expand All @@ -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
Expand Down Expand Up @@ -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<String>("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()
}
Expand Down
4 changes: 2 additions & 2 deletions on_audio_query/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
=============
*/
Expand Down
49 changes: 45 additions & 4 deletions on_audio_query/lib/details/on_audio_query_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
=============
*/
Expand Down Expand Up @@ -528,7 +528,7 @@ class OnAudioQuery {
return renamePlaylist(playlistId, newName);
}

//Permissions methods
// Permissions methods

/// Used to check Android permissions status
///
Expand Down Expand Up @@ -566,7 +566,7 @@ class OnAudioQuery {
return platform.permissionsRequest();
}

//Device Information
// Device Information

/// Used to return Device Info
///
Expand All @@ -587,4 +587,45 @@ class OnAudioQuery {
Future<DeviceModel> 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 |
/// |--------------|-----------------|-----------------|
/// | `✔️` | `❌` | `❌` | <br>
///
/// See more about [platforms support](https://github.com/LucJosin/on_audio_query/blob/main/on_audio_query/PLATFORMS.md)
Future<bool> scanMedia(String path) async {
return await platform.scanMedia(path);
}
}
4 changes: 2 additions & 2 deletions on_audio_query/lib/on_audio_query.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
=============
*/
Expand Down
4 changes: 2 additions & 2 deletions on_audio_query/lib/widget/query_artwork_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
=============
*/
Expand Down
8 changes: 4 additions & 4 deletions on_audio_query/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
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'
flutter: ">=1.20.0"

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:
Expand Down

0 comments on commit 20d99ac

Please sign in to comment.