Skip to content

Commit

Permalink
v1.0.1 Release
Browse files Browse the repository at this point in the history
Fixed an issue that would cause playback to pause and be unable to resume if an audio download failed
  • Loading branch information
CreatureSurvive committed Mar 28, 2022
1 parent b356e83 commit 57816dd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
23 changes: 19 additions & 4 deletions Classes/TranquilListItemsController.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ - (void)listItemSelected:(NSIndexPath *)indexPath
if ([self audioFileNeedsDownload:indexPath]) {

// prevent playing default sound when selecting a sound that is not yet downloaded
[[(TranquilPreferencesController *) self.parentController preferences] setBool:YES forKey:@"kPauseForDownload"];
[self _setPlaybackPausedForDownload:YES withPlaybackValue:nil notifyModule:NO];
[super listItemSelected:indexPath];
[self downloadAudioFileForSpecifierAtIndexPath:indexPath];

Expand Down Expand Up @@ -109,6 +109,8 @@ - (void)downloadAudioFileForSpecifierAtIndexPath:(NSIndexPath *)indexPath
[self _selectDefaultValue];
[(PSListController *) self.parentController reloadSpecifier:self.specifier];
[self setDownloadIconForCell:[self.table cellForRowAtIndexPath:indexPath]];

[self _setPlaybackPausedForDownload:NO withPlaybackValue:nil notifyModule:YES];
});

return;
Expand All @@ -118,9 +120,7 @@ - (void)downloadAudioFileForSpecifierAtIndexPath:(NSIndexPath *)indexPath
NSDictionary *filePermissions = @{ NSFileOwnerAccountID: @(501), NSFileGroupOwnerAccountID: @(501), NSFilePosixPermissions: @(0755) };
[NSFileManager.defaultManager setAttributes:filePermissions ofItemAtPath:destinationPath error:nil];

[[(TranquilPreferencesController *) self.parentController preferences] setBool:NO forKey:@"kPauseForDownload"];
[self.parentController setPreferenceValue:specifier.values.firstObject specifier:self.specifier];
CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.creaturecoding.tranquil/preferences-changed"), NULL, NULL, TRUE);
[self _setPlaybackPausedForDownload:NO withPlaybackValue:specifier.values.firstObject notifyModule:YES];

dispatch_async(dispatch_get_main_queue(), ^{
[self setSpinnerForCellAtIndexPath:indexPath enabled:NO];
Expand Down Expand Up @@ -273,4 +273,19 @@ - (void)_selectDefaultValue
[self listItemSelected:[NSIndexPath indexPathForRow:index inSection:0]];
}

- (void)_setPlaybackPausedForDownload:(BOOL)pause withPlaybackValue:(NSString *)playbackValue notifyModule:(BOOL)notify
{
[[(TranquilPreferencesController *) self.parentController preferences] setBool:pause forKey:@"kPauseForDownload"];

if (playbackValue) {

[self.parentController setPreferenceValue:playbackValue specifier:self.specifier];
}

if (notify) {

CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.creaturecoding.tranquil/preferences-changed"), NULL, NULL, TRUE);
}
}

@end
Binary file not shown.
Binary file modified Resources/Assets.car
Binary file not shown.
2 changes: 1 addition & 1 deletion layout/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: com.creaturecoding.tranquil
Name: Tranquil
Depends: mobilesubstrate, com.opa334.ccsupport
Version: 1.0.0
Version: 1.0.1
Architecture: iphoneos-arm
Description: Background sounds feature from iOS 15 on iOS 11+
Maintainer: CreatureSurvive <[email protected]>
Expand Down

0 comments on commit 57816dd

Please sign in to comment.