@andycui/react-native-get-music-files 3.0.2 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ios/TurboSongs.mm +11 -11
- package/lib/commonjs/NativeTurboSongs.js +23 -0
- package/lib/commonjs/NativeTurboSongs.js.map +1 -0
- package/lib/commonjs/index.js +58 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/module/NativeTurboSongs.js +19 -0
- package/lib/module/NativeTurboSongs.js.map +1 -0
- package/lib/module/index.js +52 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/src/NativeTurboSongs.d.ts +54 -0
- package/lib/typescript/src/NativeTurboSongs.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +17 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +8 -4
package/ios/TurboSongs.mm
CHANGED
|
@@ -69,10 +69,10 @@ RCT_EXPORT_METHOD(getAll:(NSDictionary *)options
|
|
|
69
69
|
|
|
70
70
|
if ([asset hasProtectedContent] == NO and durationInt >= minSongDuration) {
|
|
71
71
|
|
|
72
|
-
NSString *title = [song valueForProperty: MPMediaItemPropertyTitle];
|
|
73
|
-
NSString *albumTitle = [song valueForProperty: MPMediaItemPropertyAlbumTitle];
|
|
74
|
-
NSString *albumArtist = [song valueForProperty: MPMediaItemPropertyAlbumArtist];
|
|
75
|
-
NSString *genre = [song valueForProperty: MPMediaItemPropertyGenre]; // filterable
|
|
72
|
+
NSString *title = [song valueForProperty: MPMediaItemPropertyTitle] ?: @"";
|
|
73
|
+
NSString *albumTitle = [song valueForProperty: MPMediaItemPropertyAlbumTitle] ?: @"";
|
|
74
|
+
NSString *albumArtist = [song valueForProperty: MPMediaItemPropertyAlbumArtist] ?: @"";
|
|
75
|
+
NSString *genre = [song valueForProperty: MPMediaItemPropertyGenre] ?: @""; // filterable
|
|
76
76
|
|
|
77
77
|
[songDictionary setValue:[NSString stringWithString:assetURL.absoluteString] forKey:@"url"];
|
|
78
78
|
[songDictionary setValue:[NSString stringWithString:title] forKey:@"title"];
|
|
@@ -176,9 +176,9 @@ RCT_EXPORT_METHOD(getAlbums:(NSDictionary *)options
|
|
|
176
176
|
|
|
177
177
|
if ([asset hasProtectedContent] == NO) {
|
|
178
178
|
|
|
179
|
-
NSString *albumTitle = [album valueForProperty: MPMediaItemPropertyAlbumTitle]; // filterable
|
|
180
|
-
NSString *albumArtist = [album valueForProperty: MPMediaItemPropertyAlbumArtist]; //
|
|
181
|
-
NSString *numberOfSongs = [album valueForProperty: MPMediaItemPropertyAlbumTrackCount]; //
|
|
179
|
+
NSString *albumTitle = [album valueForProperty: MPMediaItemPropertyAlbumTitle] ?: @""; // filterable
|
|
180
|
+
NSString *albumArtist = [album valueForProperty: MPMediaItemPropertyAlbumArtist] ?: @""; //
|
|
181
|
+
NSString *numberOfSongs = [album valueForProperty: MPMediaItemPropertyAlbumTrackCount] ?: @"0"; //
|
|
182
182
|
|
|
183
183
|
[songDictionary setValue:[NSString stringWithString:assetURL.absoluteString] forKey:@"url"];
|
|
184
184
|
[songDictionary setValue:[NSString stringWithString:albumTitle] forKey:@"album"];
|
|
@@ -277,10 +277,10 @@ RCT_EXPORT_METHOD(search:(NSDictionary *)options
|
|
|
277
277
|
NSString *durationStr = [song valueForProperty: MPMediaItemPropertyPlaybackDuration];
|
|
278
278
|
NSInteger durationInt = [durationStr integerValue];
|
|
279
279
|
|
|
280
|
-
NSString *title = [song valueForProperty: MPMediaItemPropertyTitle];
|
|
281
|
-
NSString *albumTitle = [song valueForProperty: MPMediaItemPropertyAlbumTitle];
|
|
282
|
-
NSString *albumArtist = [song valueForProperty: MPMediaItemPropertyAlbumArtist];
|
|
283
|
-
NSString *genre = [song valueForProperty: MPMediaItemPropertyGenre]; // filterable
|
|
280
|
+
NSString *title = [song valueForProperty: MPMediaItemPropertyTitle] ?: @"";
|
|
281
|
+
NSString *albumTitle = [song valueForProperty: MPMediaItemPropertyAlbumTitle] ?: @"";
|
|
282
|
+
NSString *albumArtist = [song valueForProperty: MPMediaItemPropertyAlbumArtist] ?: @"";
|
|
283
|
+
NSString *genre = [song valueForProperty: MPMediaItemPropertyGenre] ?: @""; // filterable
|
|
284
284
|
|
|
285
285
|
[songDictionary setValue:[NSString stringWithString:assetURL.absoluteString] forKey:@"url"];
|
|
286
286
|
[songDictionary setValue:[NSString stringWithString:title] forKey:@"title"];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var SortSongOrder = /*#__PURE__*/function (SortSongOrder) {
|
|
9
|
+
SortSongOrder["ASC"] = "ASC";
|
|
10
|
+
SortSongOrder["DESC"] = "DESC";
|
|
11
|
+
return SortSongOrder;
|
|
12
|
+
}(SortSongOrder || {});
|
|
13
|
+
var SortSongFields = /*#__PURE__*/function (SortSongFields) {
|
|
14
|
+
SortSongFields["TITLE"] = "TITLE";
|
|
15
|
+
SortSongFields["DURATION"] = "DURATION";
|
|
16
|
+
SortSongFields["ARTIST"] = "ARTIST";
|
|
17
|
+
SortSongFields["GENRE"] = "GENRE";
|
|
18
|
+
SortSongFields["ALBUM"] = "ALBUM";
|
|
19
|
+
SortSongFields["DATE_ADDED"] = "DATE_ADDED";
|
|
20
|
+
return SortSongFields;
|
|
21
|
+
}(SortSongFields || {});
|
|
22
|
+
var _default = exports.default = _reactNative.TurboModuleRegistry.getEnforcing('TurboSongs');
|
|
23
|
+
//# sourceMappingURL=NativeTurboSongs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","SortSongOrder","SortSongFields","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeTurboSongs.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAY9CC,aAAa,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA,EAAbA,aAAa;AAAA,IAKbC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA,EAAdA,cAAc;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAyCJC,gCAAmB,CAACC,YAAY,CAAO,YAAY,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.searchSongs = exports.getAll = exports.getAlbums = exports.SortSongOrder = exports.SortSongFields = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
const LINKING_ERROR = `The package 'react-native-music-files' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
9
|
+
ios: "- You have run 'pod install'\n",
|
|
10
|
+
default: ''
|
|
11
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
12
|
+
|
|
13
|
+
// @ts-expect-error
|
|
14
|
+
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
15
|
+
const TurboSongsModule = isTurboModuleEnabled ? require('./NativeTurboSongs').default : _reactNative.NativeModules.TurboSongs;
|
|
16
|
+
const TurboSongs = TurboSongsModule ? TurboSongsModule : new Proxy({}, {
|
|
17
|
+
get() {
|
|
18
|
+
throw new Error(LINKING_ERROR);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
var SortSongOrder = exports.SortSongOrder = /*#__PURE__*/function (SortSongOrder) {
|
|
22
|
+
SortSongOrder["ASC"] = "ASC";
|
|
23
|
+
SortSongOrder["DESC"] = "DESC";
|
|
24
|
+
return SortSongOrder;
|
|
25
|
+
}(SortSongOrder || {});
|
|
26
|
+
var SortSongFields = exports.SortSongFields = /*#__PURE__*/function (SortSongFields) {
|
|
27
|
+
SortSongFields["TITLE"] = "TITLE";
|
|
28
|
+
SortSongFields["DURATION"] = "DURATION";
|
|
29
|
+
SortSongFields["ARTIST"] = "ARTIST";
|
|
30
|
+
SortSongFields["GENRE"] = "GENRE";
|
|
31
|
+
SortSongFields["ALBUM"] = "ALBUM";
|
|
32
|
+
return SortSongFields;
|
|
33
|
+
}(SortSongFields || {});
|
|
34
|
+
const getAll = async options => {
|
|
35
|
+
try {
|
|
36
|
+
return await TurboSongs.getAll(options);
|
|
37
|
+
} catch (e) {
|
|
38
|
+
return `${e}`;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
exports.getAll = getAll;
|
|
42
|
+
const getAlbums = async options => {
|
|
43
|
+
try {
|
|
44
|
+
return await TurboSongs.getAlbums(options);
|
|
45
|
+
} catch (e) {
|
|
46
|
+
return `${e}`;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
exports.getAlbums = getAlbums;
|
|
50
|
+
const searchSongs = async options => {
|
|
51
|
+
try {
|
|
52
|
+
return await TurboSongs.search(options);
|
|
53
|
+
} catch (e) {
|
|
54
|
+
return `${e}`;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.searchSongs = searchSongs;
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","isTurboModuleEnabled","global","__turboModuleProxy","TurboSongsModule","NativeModules","TurboSongs","Proxy","get","Error","SortSongOrder","exports","SortSongFields","getAll","options","e","getAlbums","searchSongs","search"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAQA,MAAMC,aAAa,GACjB,mFAAmF,GACnFC,qBAAQ,CAACC,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;AAEF,MAAMC,WAAW,GAAG,MAAOH,OAAqB,IAA+B;EAC7E,IAAI;IACF,OAAO,MAAMR,UAAU,CAACY,MAAM,CAACJ,OAAO,CAAC;EACzC,CAAC,CAAC,OAAOC,CAAC,EAAE;IACV,OAAO,GAAGA,CAAC,EAAE;EACf;AACF,CAAC;AAACJ,OAAA,CAAAM,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
4
|
+
var SortSongOrder = /*#__PURE__*/function (SortSongOrder) {
|
|
5
|
+
SortSongOrder["ASC"] = "ASC";
|
|
6
|
+
SortSongOrder["DESC"] = "DESC";
|
|
7
|
+
return SortSongOrder;
|
|
8
|
+
}(SortSongOrder || {});
|
|
9
|
+
var SortSongFields = /*#__PURE__*/function (SortSongFields) {
|
|
10
|
+
SortSongFields["TITLE"] = "TITLE";
|
|
11
|
+
SortSongFields["DURATION"] = "DURATION";
|
|
12
|
+
SortSongFields["ARTIST"] = "ARTIST";
|
|
13
|
+
SortSongFields["GENRE"] = "GENRE";
|
|
14
|
+
SortSongFields["ALBUM"] = "ALBUM";
|
|
15
|
+
SortSongFields["DATE_ADDED"] = "DATE_ADDED";
|
|
16
|
+
return SortSongFields;
|
|
17
|
+
}(SortSongFields || {});
|
|
18
|
+
export default TurboModuleRegistry.getEnforcing('TurboSongs');
|
|
19
|
+
//# sourceMappingURL=NativeTurboSongs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","SortSongOrder","SortSongFields","getEnforcing"],"sourceRoot":"../../src","sources":["NativeTurboSongs.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAAC,IAY9CC,aAAa,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA,EAAbA,aAAa;AAAA,IAKbC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA,EAAdA,cAAc;AAyCnB,eAAeF,mBAAmB,CAACG,YAAY,CAAO,YAAY,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NativeModules, Platform } from 'react-native';
|
|
4
|
+
const LINKING_ERROR = `The package 'react-native-music-files' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
5
|
+
ios: "- You have run 'pod install'\n",
|
|
6
|
+
default: ''
|
|
7
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
8
|
+
|
|
9
|
+
// @ts-expect-error
|
|
10
|
+
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
11
|
+
const TurboSongsModule = isTurboModuleEnabled ? require('./NativeTurboSongs').default : NativeModules.TurboSongs;
|
|
12
|
+
const TurboSongs = TurboSongsModule ? TurboSongsModule : new Proxy({}, {
|
|
13
|
+
get() {
|
|
14
|
+
throw new Error(LINKING_ERROR);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
var SortSongOrder = /*#__PURE__*/function (SortSongOrder) {
|
|
18
|
+
SortSongOrder["ASC"] = "ASC";
|
|
19
|
+
SortSongOrder["DESC"] = "DESC";
|
|
20
|
+
return SortSongOrder;
|
|
21
|
+
}(SortSongOrder || {});
|
|
22
|
+
var SortSongFields = /*#__PURE__*/function (SortSongFields) {
|
|
23
|
+
SortSongFields["TITLE"] = "TITLE";
|
|
24
|
+
SortSongFields["DURATION"] = "DURATION";
|
|
25
|
+
SortSongFields["ARTIST"] = "ARTIST";
|
|
26
|
+
SortSongFields["GENRE"] = "GENRE";
|
|
27
|
+
SortSongFields["ALBUM"] = "ALBUM";
|
|
28
|
+
return SortSongFields;
|
|
29
|
+
}(SortSongFields || {});
|
|
30
|
+
const getAll = async options => {
|
|
31
|
+
try {
|
|
32
|
+
return await TurboSongs.getAll(options);
|
|
33
|
+
} catch (e) {
|
|
34
|
+
return `${e}`;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const getAlbums = async options => {
|
|
38
|
+
try {
|
|
39
|
+
return await TurboSongs.getAlbums(options);
|
|
40
|
+
} catch (e) {
|
|
41
|
+
return `${e}`;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const searchSongs = async options => {
|
|
45
|
+
try {
|
|
46
|
+
return await TurboSongs.search(options);
|
|
47
|
+
} catch (e) {
|
|
48
|
+
return `${e}`;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
export { getAll, getAlbums, searchSongs, SortSongFields, SortSongOrder };
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","isTurboModuleEnabled","global","__turboModuleProxy","TurboSongsModule","require","TurboSongs","Proxy","get","Error","SortSongOrder","SortSongFields","getAll","options","e","getAlbums","searchSongs","search"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAQtD,MAAMC,aAAa,GACjB,mFAAmF,GACnFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA,MAAMC,oBAAoB,GAAGC,MAAM,CAACC,kBAAkB,IAAI,IAAI;AAE9D,MAAMC,gBAAgB,GAAGH,oBAAoB,GACzCI,OAAO,CAAC,oBAAoB,CAAC,CAACL,OAAO,GACrCL,aAAa,CAACW,UAAU;AAE5B,MAAMA,UAAU,GAAGF,gBAAgB,GAC/BA,gBAAgB,GAChB,IAAIG,KAAK,CACT,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACZ,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAAC,IAECa,aAAa,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA,EAAbA,aAAa;AAAA,IAKbC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA,EAAdA,cAAc;AAQnB,MAAMC,MAAM,GAAG,MAAOC,OAAqB,IAA+B;EACxE,IAAI;IACF,OAAO,MAAMP,UAAU,CAACM,MAAM,CAACC,OAAO,CAAC;EACzC,CAAC,CAAC,OAAOC,CAAC,EAAE;IACV,OAAO,GAAGA,CAAC,EAAE;EACf;AACF,CAAC;AAED,MAAMC,SAAS,GAAG,MAAOF,OAAsB,IAAgC;EAC7E,IAAI;IACF,OAAO,MAAMP,UAAU,CAACS,SAAS,CAACF,OAAO,CAAC;EAC5C,CAAC,CAAC,OAAOC,CAAC,EAAE;IACV,OAAO,GAAGA,CAAC,EAAE;EACf;AACF,CAAC;AAED,MAAME,WAAW,GAAG,MAAOH,OAAqB,IAA+B;EAC7E,IAAI;IACF,OAAO,MAAMP,UAAU,CAACW,MAAM,CAACJ,OAAO,CAAC;EACzC,CAAC,CAAC,OAAOC,CAAC,EAAE;IACV,OAAO,GAAGA,CAAC,EAAE;EACf;AACF,CAAC;AAED,SAASF,MAAM,EAAEG,SAAS,EAAEC,WAAW,EAAEL,cAAc,EAAED,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
export interface Song {
|
|
3
|
+
url: string;
|
|
4
|
+
title: string;
|
|
5
|
+
album: string;
|
|
6
|
+
artist: string;
|
|
7
|
+
duration: number;
|
|
8
|
+
genre: string;
|
|
9
|
+
cover: string;
|
|
10
|
+
}
|
|
11
|
+
declare enum SortSongOrder {
|
|
12
|
+
ASC = "ASC",
|
|
13
|
+
DESC = "DESC"
|
|
14
|
+
}
|
|
15
|
+
declare enum SortSongFields {
|
|
16
|
+
TITLE = "TITLE",
|
|
17
|
+
DURATION = "DURATION",
|
|
18
|
+
ARTIST = "ARTIST",
|
|
19
|
+
GENRE = "GENRE",
|
|
20
|
+
ALBUM = "ALBUM",
|
|
21
|
+
DATE_ADDED = "DATE_ADDED"
|
|
22
|
+
}
|
|
23
|
+
export interface SongOptions {
|
|
24
|
+
limit?: number;
|
|
25
|
+
offset?: number;
|
|
26
|
+
coverQuality?: number;
|
|
27
|
+
minSongDuration?: number;
|
|
28
|
+
searchBy?: string;
|
|
29
|
+
sortOrder?: SortSongOrder;
|
|
30
|
+
sortBy?: SortSongFields;
|
|
31
|
+
}
|
|
32
|
+
export interface Album {
|
|
33
|
+
url: string;
|
|
34
|
+
album: string;
|
|
35
|
+
artist: string;
|
|
36
|
+
numberOfSongs: string;
|
|
37
|
+
cover: string;
|
|
38
|
+
}
|
|
39
|
+
export interface AlbumOptions {
|
|
40
|
+
limit?: number;
|
|
41
|
+
offset?: number;
|
|
42
|
+
coverQuality?: number;
|
|
43
|
+
artist: string;
|
|
44
|
+
sortOrder?: SortSongOrder;
|
|
45
|
+
sortBy?: SortSongOrder;
|
|
46
|
+
}
|
|
47
|
+
export interface Spec extends TurboModule {
|
|
48
|
+
getAll(options?: SongOptions): Promise<Song[] | string>;
|
|
49
|
+
getAlbums(options?: AlbumOptions): Promise<Album[] | string>;
|
|
50
|
+
searchSongs(options?: SongOptions): Promise<Song[] | string>;
|
|
51
|
+
}
|
|
52
|
+
declare const _default: Spec;
|
|
53
|
+
export default _default;
|
|
54
|
+
//# sourceMappingURL=NativeTurboSongs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeTurboSongs.d.ts","sourceRoot":"","sources":["../../../src/NativeTurbo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AAW;IACvC,MAAM,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC,CAAC;IACxD,SAAS,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,KAAK,EAAE,GAAG,MAAM,CAAC,CAAC;IAC7D,WAAW,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC,CAAC;CAC9D;;AAED,wBAAoE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Album, AlbumOptions, Song, SongOptions } from './NativeTurboSongs';
|
|
2
|
+
declare enum SortSongOrder {
|
|
3
|
+
ASC = "ASC",
|
|
4
|
+
DESC = "DESC"
|
|
5
|
+
}
|
|
6
|
+
declare enum SortSongFields {
|
|
7
|
+
TITLE = "TITLE",
|
|
8
|
+
DURATION = "DURATION",
|
|
9
|
+
ARTIST = "ARTIST",
|
|
10
|
+
GENRE = "GENRE",
|
|
11
|
+
ALBUM = "ALBUM"
|
|
12
|
+
}
|
|
13
|
+
declare const getAll: (options?: SongOptions) => Promise<Song[] | string>;
|
|
14
|
+
declare const getAlbums: (options?: AlbumOptions) => Promise<Album[] | string>;
|
|
15
|
+
declare const searchSongs: (options?: SongOptions) => Promise<Song[] | string>;
|
|
16
|
+
export { getAll, getAlbums, searchSongs, SortSongFields, SortSongOrder };
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,KAAK,EACL,YAAY,EACZ,IAAI,EACJ,WAAW,EACZ,MAAM,oBAAoB,CAAC;AA0B5B,aAAK,aAAa;IAChB,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AAED,aAAK,cAAc;IACjB,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AAED,QAAA,MAAM,MAAM,GAAU,UAAU,WAAW,KAAG,OAAO,CAAC,IAAI,EAAE,GAAG,MAAM,CAMpE,CAAC;AAEF,QAAA,MAAM,SAAS,GAAU,UAAU,YAAY,KAAG,OAAO,CAAC,KAAK,EAAE,GAAG,MAAM,CAMzE,CAAC;AAEF,QAAA,MAAM,WAAW,GAAU,UAAU,WAAW,KAAG,OAAO,CAAC,IAAI,EAAE,GAAG,MAAM,CAMzE,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andycui/react-native-get-music-files",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "React Native package to get music files from local and sd for iOS and Android",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"typecheck": "tsc --noEmit",
|
|
32
32
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
33
33
|
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
34
|
-
"release": "release-it"
|
|
34
|
+
"release": "release-it",
|
|
35
|
+
"prepare": "bob build"
|
|
35
36
|
},
|
|
36
37
|
"keywords": [
|
|
37
38
|
"react-native",
|
|
@@ -43,7 +44,10 @@
|
|
|
43
44
|
"react",
|
|
44
45
|
"native"
|
|
45
46
|
],
|
|
46
|
-
"repository":
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "git+https://github.com/andy380743909/react-native-get-music-files.git"
|
|
50
|
+
},
|
|
47
51
|
"author": "Andy Cui <andy380743909@gmail.com>",
|
|
48
52
|
"license": "MIT",
|
|
49
53
|
"bugs": {
|
|
@@ -75,7 +79,7 @@
|
|
|
75
79
|
"react-native-builder-bob": "^0.40.17",
|
|
76
80
|
"release-it": "^15.0.0",
|
|
77
81
|
"turbo": "^1.10.7",
|
|
78
|
-
"typescript": "^5.
|
|
82
|
+
"typescript": "^5.9.3"
|
|
79
83
|
},
|
|
80
84
|
"resolutions": {
|
|
81
85
|
"@types/react": "17.0.21"
|