Fixed `archivedDataWithRootObject:` is deprecated (#4310)

This commit is contained in:
Cœur 2022-12-14 14:42:49 +08:00 committed by GitHub
parent 6f1153cae4
commit 84c0001e2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 4 deletions

View File

@ -3724,7 +3724,8 @@ void onTorrentCompletenessChanged(tr_torrent* tor, tr_completeness status, bool
} }
[pasteboard declareTypes:@[ kTorrentTableViewDataType ] owner:self]; [pasteboard declareTypes:@[ kTorrentTableViewDataType ] owner:self];
[pasteboard setData:[NSKeyedArchiver archivedDataWithRootObject:indexSet] forType:kTorrentTableViewDataType]; [pasteboard setData:[NSKeyedArchiver archivedDataWithRootObject:indexSet requiringSecureCoding:YES error:nil]
forType:kTorrentTableViewDataType];
return YES; return YES;
} }
return NO; return NO;

View File

@ -356,7 +356,9 @@ GroupsController* fGroupsInstance = nil;
[groups addObject:tempDict]; [groups addObject:tempDict];
} }
[NSUserDefaults.standardUserDefaults setObject:[NSKeyedArchiver archivedDataWithRootObject:groups] forKey:@"GroupDicts"]; [NSUserDefaults.standardUserDefaults setObject:[NSKeyedArchiver archivedDataWithRootObject:groups requiringSecureCoding:YES
error:nil]
forKey:@"GroupDicts"];
} }
- (NSImage*)imageForGroupNone - (NSImage*)imageForGroupNone

View File

@ -93,7 +93,8 @@ typedef NS_ENUM(NSInteger, SegmentTag) {
- (BOOL)tableView:(NSTableView*)tableView writeRowsWithIndexes:(NSIndexSet*)rowIndexes toPasteboard:(NSPasteboard*)pboard - (BOOL)tableView:(NSTableView*)tableView writeRowsWithIndexes:(NSIndexSet*)rowIndexes toPasteboard:(NSPasteboard*)pboard
{ {
[pboard declareTypes:@[ kGroupTableViewDataType ] owner:self]; [pboard declareTypes:@[ kGroupTableViewDataType ] owner:self];
[pboard setData:[NSKeyedArchiver archivedDataWithRootObject:rowIndexes] forType:kGroupTableViewDataType]; [pboard setData:[NSKeyedArchiver archivedDataWithRootObject:rowIndexes requiringSecureCoding:YES error:nil]
forType:kGroupTableViewDataType];
return YES; return YES;
} }

View File

@ -156,7 +156,8 @@ static NSTimeInterval const kToggleProgressSeconds = 0.175;
- (void)saveCollapsedGroups - (void)saveCollapsedGroups
{ {
[self.fDefaults setObject:[NSKeyedArchiver archivedDataWithRootObject:self.fCollapsedGroups] forKey:@"CollapsedGroupIndexes"]; [self.fDefaults setObject:[NSKeyedArchiver archivedDataWithRootObject:self.fCollapsedGroups requiringSecureCoding:YES error:nil]
forKey:@"CollapsedGroupIndexes"];
} }
- (BOOL)outlineView:(NSOutlineView*)outlineView isGroupItem:(id)item - (BOOL)outlineView:(NSOutlineView*)outlineView isGroupItem:(id)item