Skip to content

Commit

Permalink
Bug Fix: Change how bad playlist setup is handled
Browse files Browse the repository at this point in the history
Reset to defaults if no columns are visible. Also log this situation in
Firebase events, in case it becomes relevant.

Signed-off-by: Christopher Snowhill <[email protected]>
  • Loading branch information
kode54 committed Feb 16, 2025
1 parent 4face7d commit f239784
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions Playlist/PlaylistView.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#import "Logging.h"

@import Firebase;

static NSString *playlistSavedColumnsID = @"Playlist Saved Columns v0";

@implementation PlaylistView
Expand Down Expand Up @@ -152,14 +154,16 @@ - (void)awakeFromNib {
}

if(visibleTableColumns == 0) {
// Reset to defaults
NSString *message = @"Reset playlist columns to default";
DLog(@"%@", message);
[[FIRCrashlytics crashlytics] logWithFormat:@"%@", message];
for(NSTableColumn *col in columns) {
NSString *columnID = [col identifier];
NSUInteger index = [defaultColumnList indexOfObject:columnID];
if(index != NSNotFound) {
id column = [defaultColumns objectAtIndex:index];
[col setWidth:[[column objectForKey:@"width"] unsignedIntegerValue]];
[col setHidden:[[column objectForKey:@"hidden"] boolValue]];
}
[self removeTableColumn:col];
}
columns = oldColumns;
for(NSTableColumn *col in columns) {
[self addTableColumn:col];
}
}

Expand Down

0 comments on commit f239784

Please sign in to comment.