Revision: 27850 http://sourceforge.net/p/bibdesk/svn/27850 Author: hofman Date: 2022-08-30 18:00:57 +0000 (Tue, 30 Aug 2022) Log Message: ----------- Instead only notify without resetting publications when sharing client finds nil publications
Modified Paths: -------------- trunk/bibdesk/BDSKSharedGroup.m Modified: trunk/bibdesk/BDSKSharedGroup.m =================================================================== --- trunk/bibdesk/BDSKSharedGroup.m 2022-08-30 17:09:11 UTC (rev 27849) +++ trunk/bibdesk/BDSKSharedGroup.m 2022-08-30 18:00:57 UTC (rev 27850) @@ -184,29 +184,28 @@ - (void)handleClientUpdatedNotification:(NSNotification *)notification { [self willChangeValueForKey:@"icon"]; - if ([[[notification userInfo] objectForKey:BDSKSharingClientFailedKey] boolValue]) { + NSData *pubsArchive = [client archivedPublications]; + NSData *macrosArchive = [client archivedMacros]; + NSArray *pubs = nil; + NSDictionary *macros = nil; + + [NSString setMacroResolverForUnarchiving:[self macroResolver]]; + if (pubsArchive) + pubs = [NSKeyedUnarchiver unarchiveObjectWithData:pubsArchive]; + if (macrosArchive) + macros = [NSKeyedUnarchiver unarchiveObjectWithData:macrosArchive]; + [NSString setMacroResolverForUnarchiving:nil]; + + // we set the macroResolver so we know the fields of this item may refer to it, so we can prevent scripting from adding this to the wrong document + [pubs setValue:macroResolver forKey:@"macroResolver"]; + + [[self macroResolver] setMacroDefinitions:macros]; + + if (pubs || [self publications]) + [self setPublications:pubs]; + else // don't use setPublications: on authentication failure or cancel, as it will immediately get the publications again [self notifyUpdate]; - } else { - NSData *pubsArchive = [client archivedPublications]; - NSData *macrosArchive = [client archivedMacros]; - NSArray *pubs = nil; - NSDictionary *macros = nil; - - [NSString setMacroResolverForUnarchiving:[self macroResolver]]; - if (pubsArchive) - pubs = [NSKeyedUnarchiver unarchiveObjectWithData:pubsArchive]; - if (macrosArchive) - macros = [NSKeyedUnarchiver unarchiveObjectWithData:macrosArchive]; - [NSString setMacroResolverForUnarchiving:nil]; - - // we set the macroResolver so we know the fields of this item may refer to it, so we can prevent scripting from adding this to the wrong document - [pubs setValue:macroResolver forKey:@"macroResolver"]; - - [[self macroResolver] setMacroDefinitions:macros]; - // don't set to nil, as that will keep reloading the shared group when selected - [self setPublications:pubs ?: [NSArray array]]; - } [self didChangeValueForKey:@"icon"]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit