diff --git a/Simplified/Book/Models/NYPLBook.h b/Simplified/Book/Models/NYPLBook.h index ff1484639..764d45358 100644 --- a/Simplified/Book/Models/NYPLBook.h +++ b/Simplified/Book/Models/NYPLBook.h @@ -102,9 +102,4 @@ /// @return The default NYPLBookContentType - (NYPLBookContentType)defaultBookContentType; -/// Add a custom expiration date to banned book if -/// 1. book is distributed by Axis360 -/// 2. book does not contain an expiration date -- (void)addBannedBookExpiration; - @end diff --git a/Simplified/Book/Models/NYPLBook.m b/Simplified/Book/Models/NYPLBook.m index 6d0c1fe16..bc10cd4d6 100644 --- a/Simplified/Book/Models/NYPLBook.m +++ b/Simplified/Book/Models/NYPLBook.m @@ -618,26 +618,4 @@ - (NYPLBookContentType)defaultBookContentType return defaultType; } -- (void)addBannedBookExpiration -{ - if ([self.defaultAcquisitionIfOpenAccess.type isEqualToString:ContentTypeAxis360] && - !self.defaultAcquisitionIfOpenAccess.availability.until) - { - NYPLOPDSAcquisitionAvailabilityLimited *currentAvailability = (NYPLOPDSAcquisitionAvailabilityLimited *)self.defaultAcquisition.availability; - NYPLOPDSAcquisitionAvailabilityLimited *newAvailability = [[NYPLOPDSAcquisitionAvailabilityLimited alloc] - initWithCopiesAvailable:currentAvailability.copiesAvailable - copiesTotal:currentAvailability.copiesTotal - since:currentAvailability.since - until:[self createBannedBookExpirationDate]]; - [self.defaultAcquisition setAvailability:newAvailability]; - } -} - -// Create an expiration date object with value of 2 months from now -- (NSDate *)createBannedBookExpirationDate { - NSDateComponents *dateComponents = [[NSDateComponents alloc] init]; - [dateComponents setMonth:2]; - NSCalendar *calendar = [NSCalendar currentCalendar]; - return [calendar dateByAddingComponents:dateComponents toDate:[NSDate new] options:0]; -} @end diff --git a/Simplified/Catalog/NYPLCatalogGroupedFeed.m b/Simplified/Catalog/NYPLCatalogGroupedFeed.m index f77acbe4f..8142f2a8f 100644 --- a/Simplified/Catalog/NYPLCatalogGroupedFeed.m +++ b/Simplified/Catalog/NYPLCatalogGroupedFeed.m @@ -110,13 +110,6 @@ - (instancetype)initWithOPDSFeed:(NYPLOPDSFeed *)feed continue; } - /// Add a custom expiration date (2 months from now) to banned book. - /// This expiration date will be overwritten by the updatedBookMetadata function below - /// if the book is already checked out. - if (!NYPLUserAccount.sharedAccount.requiresUserAuthentication) { - [book addBannedBookExpiration]; - } - NYPLBook *updatedBook = [[NYPLBookRegistry sharedRegistry] updatedBookMetadata:book]; if(updatedBook) { book = updatedBook; diff --git a/Simplified/Catalog/NYPLCatalogUngroupedFeed.m b/Simplified/Catalog/NYPLCatalogUngroupedFeed.m index a259a30fc..02f180f93 100644 --- a/Simplified/Catalog/NYPLCatalogUngroupedFeed.m +++ b/Simplified/Catalog/NYPLCatalogUngroupedFeed.m @@ -50,13 +50,6 @@ - (instancetype)initWithOPDSFeed:(NYPLOPDSFeed *const)feed continue; } - /// Add a custom expiration date (2 months from now) to banned book. - /// This expiration date will be overwritten by the updatedBookMetadata function below - /// if the book is already checked out. - if (!NYPLUserAccount.sharedAccount.requiresUserAuthentication) { - [book addBannedBookExpiration]; - } - NYPLBook *updatedBook = [[NYPLBookRegistry sharedRegistry] updatedBookMetadata:book]; if(updatedBook) { book = updatedBook; diff --git a/Simplified/OPDS/NYPLOPDSAcquisition.h b/Simplified/OPDS/NYPLOPDSAcquisition.h index 9b8f36bb6..0a5bc89f9 100644 --- a/Simplified/OPDS/NYPLOPDSAcquisition.h +++ b/Simplified/OPDS/NYPLOPDSAcquisition.h @@ -72,7 +72,7 @@ NYPLOPDSAcquisitionRelationString(NYPLOPDSAcquisitionRelation relation); @property (nonatomic, readonly, nonnull) NSArray *indirectAcquisitions; /// The availability of the result of the acquisition. -@property (nonatomic, nonnull) id availability; +@property (nonatomic, readonly, nonnull) id availability; + (instancetype _Null_unspecified)new NS_UNAVAILABLE; - (instancetype _Null_unspecified)init NS_UNAVAILABLE; diff --git a/Simplified/OPDS/NYPLOPDSAcquisition.m b/Simplified/OPDS/NYPLOPDSAcquisition.m index 3fdb68ccc..41cd5d8f3 100644 --- a/Simplified/OPDS/NYPLOPDSAcquisition.m +++ b/Simplified/OPDS/NYPLOPDSAcquisition.m @@ -106,6 +106,7 @@ @interface NYPLOPDSAcquisition () @property (nonatomic, copy, nonnull) NSString *type; @property (nonatomic, nonnull) NSURL *hrefURL; @property (nonatomic, nonnull) NSArray *indirectAcquisitions; +@property (nonatomic, nonnull) id availability; @end