Commit aecf5633 authored by Felix Paul Kühne's avatar Felix Paul Kühne

MLAlbum: add selector add album tracks without working on the internal data

parent d2c30398
......@@ -36,6 +36,7 @@
@property (nonatomic, strong, readonly) NSSet *unreadTracks;
@property (weak, nonatomic, readonly) NSArray *sortedTracks;
- (void)addTrack:(MLAlbumTrack *)track;
- (void)removeTrack:(MLAlbumTrack *)track;
- (void)removeTrackWithNumber:(NSNumber *)trackNumber;
......
......@@ -8,7 +8,9 @@ Added Public APIs:
migrateLibraryToBasePath
deviceSpeedCategory
- MLFile:
- new selectors: setComputedThumbnailScaledForDevice
- new selector: setComputedThumbnailScaledForDevice
- MLAlbum:
- new selector: addAlbumTrack
Version 2.5
-----------
......
......@@ -65,8 +65,8 @@
}
@dynamic name;
@dynamic releaseYear;
@dynamic tracks;
@dynamic releaseYear;
@dynamic unreadTracks;
- (NSArray *)sortedTracks
......@@ -80,6 +80,19 @@
return [tracks sortedArrayUsingDescriptors:@[trackNumberDescriptor]];
}
- (void)addTrack:(MLAlbumTrack *)track
{
if (!track)
return;
NSMutableSet *tracks = [self mutableSetValueForKey:@"tracks"];
[tracks addObject:track];
[self willChangeValueForKey:@"tracks"];
[self setValue:tracks forKey:@"tracks"];
[self didChangeValueForKey:@"tracks"];
}
- (void)removeTrack:(MLAlbumTrack *)track
{
if (!track)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment