Skip to content

Commit a7b46b0

Browse files
committed
chore: Remove deprecated constants
1 parent ec0099d commit a7b46b0

6 files changed

Lines changed: 5 additions & 91 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project attempts to adhere to [Semantic Versioning](https://semver.org/
77

88
## [Unreleased]
99

10+
### ❗ Breaking Changes
11+
12+
- Removed deprecated `PrimaryDirectoryPath`, `StorageVolumesDirectoryPaths`, and `MusicDirectoryPath`.
13+
- It seems like `getTypedExportedConstants()`, which creates these constants caused crashes on some devices according to the Google Play Console.
14+
1015
## [0.9.0] - 2025-05-24
1116

1217
### ⚡ Changes

README.md

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ const base64Artwork = await getArtwork(uri);
3737

3838
## Constants
3939

40-
> [!CAUTION]
41-
> All exported constants relating to directory paths from this library will be removed in `v1.0.0`.
42-
4340
### MediaMetadataPublicFields
4441

4542
```ts
@@ -56,32 +53,6 @@ const MetadataPresets: Record<string, MediaMetadataPublicField[]>;
5653

5754
An object containing several metadata presets we can use to retrieve metadata.
5855

59-
### [Deprecated] MusicDirectoryPath
60-
61-
```ts
62-
const MusicDirectoryPath: string | null;
63-
```
64-
65-
Default path to the `Music` folder on device. This is usually `/storage/emulated/0/Music` or `/sdcard/Music` for older devices.
66-
67-
### [Deprecated] PrimaryDirectoryPath
68-
69-
```ts
70-
const PrimaryDirectoryPath: string;
71-
```
72-
73-
Path to the primary shared/external storage directory. This is usually `/storage/emulated/0`.
74-
75-
### [Deprecated] StorageVolumesDirectoryPaths
76-
77-
```ts
78-
const StorageVolumesDirectoryPaths: string[];
79-
```
80-
81-
An array of directory paths for all shared/external storage volumes.
82-
83-
**Example output:** `["/storage/emulated/0", "/storage/0A08-1F1A"]`
84-
8556
## Functions
8657

8758
### getArtwork

android/src/main/java/com/cyanchill/missingcore/metadataretriever/MetadataRetrieverModule.kt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,6 @@ class MetadataRetrieverModule internal constructor(reactContext: ReactApplicatio
1818
MetadataRetrieverSpec(reactContext) {
1919
private val context = reactContext
2020

21-
override fun getTypedExportedConstants(): Map<String, Any?> {
22-
val primaryPath = Environment.getExternalStorageDirectory()?.absolutePath
23-
var storagePaths = this.reactApplicationContext.getExternalFilesDirs(null)?.mapNotNull { it.absolutePath.split("/Android")[0] }
24-
val musicPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC)?.absolutePath
25-
26-
if (storagePaths?.size == 0) storagePaths = null // Use fallback value.
27-
28-
val fallbackDefaultPath = "/storage/emulated/0"
29-
val constants: MutableMap<String, Any?> = hashMapOf(
30-
"PrimaryDirectoryPath" to (primaryPath ?: fallbackDefaultPath),
31-
"StorageVolumesDirectoryPaths" to (storagePaths ?: listOf(fallbackDefaultPath)),
32-
"MusicDirectoryPath" to musicPath // We'll let this be `null`.
33-
)
34-
35-
return constants
36-
}
37-
3821
@ReactMethod
3922
override fun getMetadata(uri: String, options: ReadableArray, promise: Promise) {
4023
// Populate return object with default values based on input.

android/src/oldarch/MetadataRetrieverSpec.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ import com.facebook.react.bridge.Promise
77

88
abstract class MetadataRetrieverSpec internal constructor(context: ReactApplicationContext) :
99
ReactContextBaseJavaModule(context) {
10-
abstract fun getTypedExportedConstants(): Map<String, Any?>
11-
12-
override fun getConstants(): Map<String, Any?> {
13-
return getTypedExportedConstants()
14-
}
15-
1610
abstract fun getMetadata(uri: String, options: ReadableArray, promise: Promise)
1711

1812
abstract fun getArtwork(uri: String, promise: Promise)

src/NativeMetadataRetriever.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,6 @@ import type { TurboModule } from 'react-native';
22
import { TurboModuleRegistry } from 'react-native';
33

44
export interface Spec extends TurboModule {
5-
readonly getConstants: () => {
6-
/**
7-
* Path of primary storage volume on device.
8-
*
9-
* @example `"/storage/emulated/0"`
10-
* @deprecated
11-
*/
12-
PrimaryDirectoryPath: string;
13-
/**
14-
* Array of directory paths for all shared/external storage volumes.
15-
*
16-
* @example `["/storage/emulated/0", "/storage/0A08-1F1A"]`
17-
* @see https://developer.android.com/reference/android/content/Context#getExternalFilesDirs(java.lang.String)
18-
* @deprecated
19-
*/
20-
StorageVolumesDirectoryPaths: string[];
21-
/**
22-
* Default path to the `Music` folder on device.
23-
*
24-
* @example `/storage/emulated/0/Music`
25-
* @example `/sdcard/Music`
26-
* @deprecated
27-
*/
28-
MusicDirectoryPath: string | null;
29-
};
30-
315
getMetadata(
326
uri: string,
337
options: readonly string[]

src/index.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,10 @@ export function getArtwork(uri: string): Promise<string | null> {
2626
return MetadataRetriever.getArtwork(uri);
2727
}
2828

29-
const {
30-
MusicDirectoryPath,
31-
PrimaryDirectoryPath,
32-
StorageVolumesDirectoryPaths,
33-
} = MetadataRetriever.getConstants();
34-
3529
export {
3630
type MediaMetadata,
3731
type MediaMetadataExcerpt,
3832
type MediaMetadataPublicField,
3933
MediaMetadataPublicFields,
4034
MetadataPresets,
41-
// System paths.
42-
/** @deprecated */
43-
MusicDirectoryPath,
44-
/** @deprecated */
45-
PrimaryDirectoryPath,
46-
/** @deprecated */
47-
StorageVolumesDirectoryPaths,
4835
};

0 commit comments

Comments
 (0)