@@ -36,14 +36,6 @@ import org.nypl.simplified.feeds.api.FeedEntry
36
36
import org.nypl.simplified.feeds.api.FeedFacet
37
37
import org.nypl.simplified.feeds.api.FeedLoaderType
38
38
import org.nypl.simplified.feeds.api.FeedSearch
39
- import org.nypl.simplified.opds.core.OPDSAvailabilityHeld
40
- import org.nypl.simplified.opds.core.OPDSAvailabilityHeldReady
41
- import org.nypl.simplified.opds.core.OPDSAvailabilityHoldable
42
- import org.nypl.simplified.opds.core.OPDSAvailabilityLoanable
43
- import org.nypl.simplified.opds.core.OPDSAvailabilityLoaned
44
- import org.nypl.simplified.opds.core.OPDSAvailabilityMatcherType
45
- import org.nypl.simplified.opds.core.OPDSAvailabilityOpenAccess
46
- import org.nypl.simplified.opds.core.OPDSAvailabilityRevoked
47
39
import org.nypl.simplified.profiles.controller.api.ProfileFeedRequest
48
40
import org.nypl.simplified.profiles.controller.api.ProfilesControllerType
49
41
import org.nypl.simplified.taskrecorder.api.TaskResult
@@ -320,6 +312,7 @@ sealed class CatalogFragment : Fragment(), MainBackButtonConsumerType {
320
312
screenSize = this .screenSize,
321
313
container = this .contentContainer,
322
314
covers = this .covers,
315
+ onBookSAMLDownloadRequested = this ::onBookSAMLDownloadRequested,
323
316
onShowErrorDetails = this ::onShowErrorDetails,
324
317
onBookBorrowRequested = this ::onBookBorrowRequested,
325
318
onBookBorrowCancelRequested = this ::onBookBorrowCancelRequested,
@@ -373,8 +366,6 @@ sealed class CatalogFragment : Fragment(), MainBackButtonConsumerType {
373
366
}
374
367
}
375
368
376
- this .onStateChangeToDetailsConfigureToolbar(newState, view)
377
-
378
369
/*
379
370
* Subscribe to the entry on the OPDS client. We'll receive the initial
380
371
* entry on subscription.
@@ -478,25 +469,6 @@ sealed class CatalogFragment : Fragment(), MainBackButtonConsumerType {
478
469
}
479
470
}
480
471
481
- private fun onStateChangeToDetailsConfigureToolbar (
482
- newState : LoadedFeedEntry ,
483
- view : CatalogFeedViewDetails2
484
- ) {
485
- try {
486
- val account =
487
- this .profiles.profileCurrent()
488
- .account(newState.request.entry.accountID)
489
-
490
- val title =
491
- when (val e = newState.request.entry) {
492
- is FeedEntry .FeedEntryCorrupt -> " "
493
- is FeedEntry .FeedEntryOPDS -> e.feedEntry.title
494
- }
495
- } catch (e: Throwable ) {
496
- // Nothing sensible we can do about this.
497
- }
498
- }
499
-
500
472
private fun onBookBorrowRequested (
501
473
parameters : CatalogBorrowParameters
502
474
) {
@@ -577,64 +549,6 @@ sealed class CatalogFragment : Fragment(), MainBackButtonConsumerType {
577
549
}
578
550
}
579
551
580
- /* *
581
- * Determine whether or not a book can be "deleted".
582
- *
583
- * A book can be deleted if:
584
- *
585
- * * It is loaned, downloaded, and not revocable (because otherwise, a revocation is needed).
586
- * * It is loanable, but there is a book database entry for it
587
- * * It is open access but there is a book database entry for it
588
- */
589
-
590
- private fun onBookCanBeDeleted (
591
- status : CatalogBookStatus <* >
592
- ): Boolean {
593
- return try {
594
- val services =
595
- Services .serviceDirectory()
596
- val profiles =
597
- services.requireService(ProfilesControllerType ::class .java)
598
- val book =
599
- status.book
600
- val profile =
601
- profiles.profileCurrent()
602
- val account =
603
- profile.account(book.account)
604
-
605
- return if (account.bookDatabase.books().contains(book.id)) {
606
- book.entry.availability.matchAvailability(
607
- object : OPDSAvailabilityMatcherType <Boolean , Exception > {
608
- override fun onHeldReady (availability : OPDSAvailabilityHeldReady ): Boolean =
609
- false
610
-
611
- override fun onHeld (availability : OPDSAvailabilityHeld ): Boolean =
612
- false
613
-
614
- override fun onHoldable (availability : OPDSAvailabilityHoldable ): Boolean =
615
- false
616
-
617
- override fun onLoaned (availability : OPDSAvailabilityLoaned ): Boolean =
618
- availability.revoke.isNone && book.isDownloaded
619
-
620
- override fun onLoanable (availability : OPDSAvailabilityLoanable ): Boolean =
621
- true
622
-
623
- override fun onOpenAccess (availability : OPDSAvailabilityOpenAccess ): Boolean =
624
- true
625
-
626
- override fun onRevoked (availability : OPDSAvailabilityRevoked ): Boolean =
627
- false
628
- })
629
- } else {
630
- false
631
- }
632
- } catch (e: Throwable ) {
633
- this .logger.debug(" could not determine if the book could be deleted: " , e)
634
- false
635
- }
636
- }
637
-
638
552
private fun onBookCanBeRevoked (
639
553
status : CatalogBookStatus <* >
640
554
): Boolean {
@@ -702,12 +616,6 @@ sealed class CatalogFragment : Fragment(), MainBackButtonConsumerType {
702
616
)
703
617
}
704
618
705
- private fun onBookResetStatusInitial (
706
- status : CatalogBookStatus <* >
707
- ) {
708
- // XXX: Unclear what the point of this method ever was...
709
- }
710
-
711
619
private fun onBookViewerOpen (
712
620
book : Book ,
713
621
bookFormat : BookFormat
@@ -725,12 +633,6 @@ sealed class CatalogFragment : Fragment(), MainBackButtonConsumerType {
725
633
)
726
634
}
727
635
728
- private fun onBookReserveRequested (
729
- parameters : CatalogBorrowParameters
730
- ) {
731
- this .onBookBorrowRequested(parameters)
732
- }
733
-
734
636
private fun onStateChangedToGroups (
735
637
newState : LoadedFeedWithGroups
736
638
) {
0 commit comments