@@ -15,99 +15,96 @@ - (instancetype) init {
1515- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule :
1616 (const facebook::react::ObjCTurboModule::InitParams &)params
1717{
18- return std::make_shared<facebook::react::NativeMusicLibrarySpecJSI>(params);
18+ return std::make_shared<facebook::react::NativeMusicLibrarySpecJSI>(params);
1919}
2020
2121- (void )getTracksAsync : (JS::NativeMusicLibrary::InternalTrackOptions &)options resolve : (nonnull RCTPromiseResolveBlock)resolve reject : (nonnull RCTPromiseRejectBlock)reject {
22- NSLog (@" 🎵 [MusicLibrary.mm] getTracksAsync called from Objective-C" );
23-
24- // Extract values from Objective-C types with proper casting
22+ // Extract values and create TrackOptions object
2523 int first = (int )options.first ();
2624 NSString *after = options.after ();
2725 NSString *directory = options.directory ();
2826 NSArray *sortBy = (NSArray *)options.sortBy ();
29-
30- // Call Swift function directly
31- NSDictionary *result = [musicLibrary getTracksAsyncWithFirst: first after: after sortBy: sortBy directory: directory];
32-
33- NSLog (@" 🎵 [MusicLibrary.mm] getTracksAsync resolved with result: %@ " , result);
34- resolve (result);
27+
28+ TrackOptions *trackOptions = [[TrackOptions alloc ] initAfter: after first: first sortBy: sortBy directory: directory];
29+
30+ // Call Swift function with options object
31+ [musicLibrary getTracksAsyncWithOptions: trackOptions resolve: resolve reject: reject];
3532}
3633
37- - (void )getTrackMetadataAsync : (nonnull NSString *)trackId resolve : (nonnull RCTPromiseResolveBlock)resolve reject : (nonnull RCTPromiseRejectBlock)reject {
34+ - (void )getTrackMetadataAsync : (nonnull NSString *)trackId resolve : (nonnull RCTPromiseResolveBlock)resolve reject : (nonnull RCTPromiseRejectBlock)reject {
3835 NSLog (@" 🎵 [MusicLibrary.mm] getTrackMetadataAsync called with trackId: %@ " , trackId);
39-
36+
4037 NSDictionary *result = [musicLibrary getTrackMetadataAsync: trackId];
41-
38+
4239 NSLog (@" 🎵 [MusicLibrary.mm] getTrackMetadataAsync resolved with result: %@ " , result);
4340 resolve (result);
4441}
4542
46- - (void )getTracksByAlbumAsync : (nonnull NSString *)albumId resolve : (nonnull RCTPromiseResolveBlock)resolve reject : (nonnull RCTPromiseRejectBlock)reject {
43+ - (void )getTracksByAlbumAsync : (nonnull NSString *)albumId resolve : (nonnull RCTPromiseResolveBlock)resolve reject : (nonnull RCTPromiseRejectBlock)reject {
4744 NSLog (@" 🎵 [MusicLibrary.mm] getTracksByAlbumAsync called with albumId: %@ " , albumId);
48-
45+
4946 NSArray *result = [musicLibrary getTracksByAlbumAsync: albumId];
50-
47+
5148 NSLog (@" 🎵 [MusicLibrary.mm] getTracksByAlbumAsync resolved with result: %@ " , result);
5249 resolve (result);
5350}
5451
55- - (void )getTracksByArtistAsync : (nonnull NSString *)artistId options : (JS::NativeMusicLibrary::InternalTrackOptions &)options resolve : (nonnull RCTPromiseResolveBlock)resolve reject : (nonnull RCTPromiseRejectBlock)reject {
52+ - (void )getTracksByArtistAsync : (nonnull NSString *)artistId options : (JS::NativeMusicLibrary::InternalTrackOptions &)options resolve : (nonnull RCTPromiseResolveBlock)resolve reject : (nonnull RCTPromiseRejectBlock)reject {
5653 NSLog (@" 🎵 [MusicLibrary.mm] getTracksByArtistAsync called with artistId: %@ " , artistId);
57-
54+
5855 // Extract values from Objective-C types with proper casting
5956 int first = (int )options.first ();
6057 NSString *after = options.after ();
6158 NSString *directory = options.directory ();
6259 NSArray *sortBy = (NSArray *)options.sortBy ();
63-
60+
6461 // Call Swift function directly
6562 NSDictionary *result = [musicLibrary getTracksByArtistAsync: artistId first: first after: after sortBy: sortBy directory: directory];
66-
63+
6764 NSLog (@" 🎵 [MusicLibrary.mm] getTracksByArtistAsync resolved with result: %@ " , result);
6865 resolve (result);
6966}
7067
71- - (void )getAlbumsAsync : (JS::NativeMusicLibrary::InternalAlbumOptions &)options resolve : (nonnull RCTPromiseResolveBlock)resolve reject : (nonnull RCTPromiseRejectBlock)reject {
68+ - (void )getAlbumsAsync : (JS::NativeMusicLibrary::InternalAlbumOptions &)options resolve : (nonnull RCTPromiseResolveBlock)resolve reject : (nonnull RCTPromiseRejectBlock)reject {
7269 NSLog (@" 🎵 [MusicLibrary.mm] getAlbumsAsync called from Objective-C" );
73-
70+
7471 // Extract values from Objective-C types with proper casting
7572 int first = (int )options.first ();
7673 NSString *after = options.after ();
7774 NSArray *sortBy = (NSArray *)options.sortBy ();
78-
75+
7976 // Call Swift function directly
8077 NSDictionary *result = [musicLibrary getAlbumsAsyncWithFirst: first after: after sortBy: sortBy];
81-
78+
8279 NSLog (@" 🎵 [MusicLibrary.mm] getAlbumsAsync resolved with result: %@ " , result);
8380 resolve (result);
8481}
8582
86- - (void )getAlbumsByArtistAsync : (nonnull NSString *)artistId resolve : (nonnull RCTPromiseResolveBlock)resolve reject : (nonnull RCTPromiseRejectBlock)reject {
83+ - (void )getAlbumsByArtistAsync : (nonnull NSString *)artistId resolve : (nonnull RCTPromiseResolveBlock)resolve reject : (nonnull RCTPromiseRejectBlock)reject {
8784 NSLog (@" 🎵 [MusicLibrary.mm] getAlbumsByArtistAsync called with artistId: %@ " , artistId);
88-
85+
8986 NSArray *result = [musicLibrary getAlbumsByArtistAsync: artistId];
90-
87+
9188 NSLog (@" 🎵 [MusicLibrary.mm] getAlbumsByArtistAsync resolved with result: %@ " , result);
9289 resolve (result);
9390}
9491
95- - (void )getArtistsAsync : (JS::NativeMusicLibrary::InternalArtistOptions &)options resolve : (nonnull RCTPromiseResolveBlock)resolve reject : (nonnull RCTPromiseRejectBlock)reject {
92+ - (void )getArtistsAsync : (JS::NativeMusicLibrary::InternalArtistOptions &)options resolve : (nonnull RCTPromiseResolveBlock)resolve reject : (nonnull RCTPromiseRejectBlock)reject {
9693 NSLog (@" 🎵 [MusicLibrary.mm] getArtistsAsync called from Objective-C" );
97-
94+
9895 // Extract values from Objective-C types with proper casting
9996 int first = (int )options.first ();
10097 NSString *after = options.after ();
10198 NSArray *sortBy = (NSArray *)options.sortBy ();
102-
99+
103100 // Call Swift function directly
104101 NSDictionary *result = [musicLibrary getArtistsAsyncWithFirst: first after: after sortBy: sortBy];
105-
102+
106103 NSLog (@" 🎵 [MusicLibrary.mm] getArtistsAsync resolved with result: %@ " , result);
107104 resolve (result);
108105}
109106
110- + (NSString *)moduleName {
107+ + (NSString *)moduleName {
111108 return @" MusicLibraryImpl" ;
112109}
113110
0 commit comments