Skip to content

Commit 58e5935

Browse files
Merge pull request #623 from NYPL-Simplified/v2.0.2
V2.0.2
2 parents 763c78d + 59f299a commit 58e5935

18 files changed

+398
-135
lines changed

Simplified.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
03B092301E78871A00AD338D /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 03B0922F1E78871A00AD338D /* MediaPlayer.framework */; };
2828
03CE00EA1E0C436400C91489 /* libePub3-iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 03CE00E91E0C436400C91489 /* libePub3-iOS.a */; };
2929
03DE7BE91DBF0DE400E89064 /* UpdateCheckShim.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DC8D9DD1D09F9B4007DD125 /* UpdateCheckShim.swift */; };
30+
03E5F42D1EA5BCE400DFFC3A /* NYPLTOC.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 03E5F42A1EA5BCE400DFFC3A /* NYPLTOC.storyboard */; };
3031
03F94CCF1DD627AA00CE8F4F /* Accounts.json in Resources */ = {isa = PBXBuildFile; fileRef = 03F94CCE1DD627AA00CE8F4F /* Accounts.json */; };
3132
03F94CD11DD6288C00CE8F4F /* Accounts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F94CD01DD6288C00CE8F4F /* Accounts.swift */; };
3233
081387571BC574DA003DEA6A /* UILabel+NYPLAppearanceAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 081387561BC574DA003DEA6A /* UILabel+NYPLAppearanceAdditions.m */; };
@@ -174,6 +175,7 @@
174175
E15AF04E809009612AA10D16 /* libPods-SimplyETests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BEEC686A5C71AFACFAC2A884 /* libPods-SimplyETests.a */; };
175176
E6202A021DD4E6F300C99553 /* NYPLSettingsAccountDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E6202A011DD4E6F300C99553 /* NYPLSettingsAccountDetailViewController.m */; };
176177
E6202A041DD52B8600C99553 /* NYPLWelcomeScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6202A031DD52B8600C99553 /* NYPLWelcomeScreen.swift */; };
178+
E63F2C6C1EAA81B3002B6373 /* ExtendedNavBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E63F2C6B1EAA81B3002B6373 /* ExtendedNavBarView.swift */; };
177179
E671FF7D1E3A7068002AB13F /* NYPLNetworkQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = E671FF7C1E3A7068002AB13F /* NYPLNetworkQueue.swift */; };
178180
E694040A1E4A789800E566ED /* NYPLReachabilityManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E69404091E4A789800E566ED /* NYPLReachabilityManager.m */; };
179181
E6B1F4FB1DD20EA900D73CA1 /* NYPLSettingsAccountsList.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6B1F4FA1DD20EA900D73CA1 /* NYPLSettingsAccountsList.swift */; };
@@ -244,6 +246,7 @@
244246
03B0922D1E7886ED00AD338D /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; };
245247
03B0922F1E78871A00AD338D /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; };
246248
03CE00E91E0C436400C91489 /* libePub3-iOS.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libePub3-iOS.a"; path = "readium-sdk/Platform/Apple/build/Release-iphoneos/libePub3-iOS.a"; sourceTree = "<group>"; };
249+
03E5F42A1EA5BCE400DFFC3A /* NYPLTOC.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = NYPLTOC.storyboard; sourceTree = "<group>"; };
247250
03F94CCE1DD627AA00CE8F4F /* Accounts.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = Accounts.json; sourceTree = "<group>"; };
248251
03F94CD01DD6288C00CE8F4F /* Accounts.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Accounts.swift; sourceTree = "<group>"; };
249252
080ADCBE1C04C26100C0575F /* libCHRTextFieldFormatter.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libCHRTextFieldFormatter.a; path = "Pods/../build/Debug-iphoneos/libCHRTextFieldFormatter.a"; sourceTree = "<group>"; };
@@ -536,6 +539,7 @@
536539
E6202A001DD4E6F300C99553 /* NYPLSettingsAccountDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NYPLSettingsAccountDetailViewController.h; sourceTree = "<group>"; };
537540
E6202A011DD4E6F300C99553 /* NYPLSettingsAccountDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NYPLSettingsAccountDetailViewController.m; sourceTree = "<group>"; };
538541
E6202A031DD52B8600C99553 /* NYPLWelcomeScreen.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NYPLWelcomeScreen.swift; sourceTree = "<group>"; };
542+
E63F2C6B1EAA81B3002B6373 /* ExtendedNavBarView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExtendedNavBarView.swift; sourceTree = "<group>"; };
539543
E66AE32F1DC0FCFC00124AE2 /* NYPLCirculationAnalytics.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NYPLCirculationAnalytics.swift; sourceTree = "<group>"; };
540544
E671FF7C1E3A7068002AB13F /* NYPLNetworkQueue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NYPLNetworkQueue.swift; sourceTree = "<group>"; };
541545
E69404081E4A789800E566ED /* NYPLReachabilityManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NYPLReachabilityManager.h; sourceTree = "<group>"; };
@@ -774,6 +778,8 @@
774778
119504051994061E009FB788 /* Reader */ = {
775779
isa = PBXGroup;
776780
children = (
781+
E63F2C6B1EAA81B3002B6373 /* ExtendedNavBarView.swift */,
782+
03E5F42A1EA5BCE400DFFC3A /* NYPLTOC.storyboard */,
777783
113137E51A48DAB90082954E /* NYPLReaderReadiumView.h */,
778784
113137E61A48DAB90082954E /* NYPLReaderReadiumView.m */,
779785
5A5B90191B946FAD002C53E9 /* NYPLReaderContainerDelegate.h */,
@@ -1316,6 +1322,7 @@
13161322
A823D823192BABA400B55DE2 /* Images.xcassets in Resources */,
13171323
5A6929101B95ACD100FB4C10 /* sdk.css in Resources */,
13181324
84B7A3471B84E8FE00584FB2 /* OpenDyslexic3-Bold.ttf in Resources */,
1325+
03E5F42D1EA5BCE400DFFC3A /* NYPLTOC.storyboard in Resources */,
13191326
5A6929251B95C93B00FB4C10 /* readium-shared-js_all.js.map in Resources */,
13201327
030713661E749D5600DDE3FA /* CodabarLarge.ttf in Resources */,
13211328
11C113D219F842BE005B3F63 /* host_app_feedback.js in Resources */,
@@ -1553,6 +1560,7 @@
15531560
112C684F19EF003300106973 /* NYPLCatalogFacetGroup.m in Sources */,
15541561
085D31DF1BE3CD3C007F7672 /* NSURLRequest+NYPLURLRequestAdditions.m in Sources */,
15551562
11548C0B1939136C009DBF2E /* NYPLRootTabBarController.m in Sources */,
1563+
E63F2C6C1EAA81B3002B6373 /* ExtendedNavBarView.swift in Sources */,
15561564
118A0B1B19915BDF00792DDE /* NYPLCatalogSearchViewController.m in Sources */,
15571565
A4E254FA1B0E610900193FE4 /* NYPLBasicAuth.m in Sources */,
15581566
1188F3E11A1ECC4B006B2F36 /* NYPLReaderSettings.m in Sources */,
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
Copyright (C) 2016 Apple Inc. All Rights Reserved.
3+
See LICENSE.txt for this sample’s licensing information
4+
5+
Abstract:
6+
A UIView subclass that draws a gray hairline along its bottom
7+
border, similar to a navigation bar. This view is used as the navigation
8+
bar extension view in the Extended Navigation Bar example.
9+
*/
10+
11+
import UIKit
12+
13+
class ExtendedNavBarView: UIView {
14+
15+
/**
16+
* Called when the view is about to be displayed. May be called more than
17+
* once.
18+
*/
19+
override func willMove(toWindow newWindow: UIWindow?) {
20+
super.willMove(toWindow: newWindow)
21+
22+
// Use the layer shadow to draw a one pixel hairline under this view.
23+
layer.shadowOffset = CGSize(width: 0, height: CGFloat(1) / UIScreen.main.scale)
24+
layer.shadowRadius = 0
25+
26+
// UINavigationBar's hairline is adaptive, its properties change with
27+
// the contents it overlies. You may need to experiment with these
28+
// values to best match your content.
29+
layer.shadowColor = #colorLiteral(red: 0, green: 0, blue: 0, alpha: 1).cgColor
30+
layer.shadowOpacity = 0.25
31+
}
32+
33+
}

Simplified/NYPLAccountSignInViewController.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,7 @@ - (void)tableView:(__attribute__((unused)) UITableView *)tableView
288288
requestTimeoutInterval:20.0
289289
completionHandler:^(NSString *const username, NSString *const PIN, BOOL const userInitiated) {
290290
if (userInitiated) {
291-
// If SettingsAccount has been presented modally, dismiss both
292-
// the CardCreator and the modal window.
291+
// Dismiss CardCreator & SignInVC when user finishes Credential Review
293292
[weakSelf dismissViewControllerAnimated:YES completion:nil];
294293
[weakSelf dismissViewControllerAnimated:YES completion:nil];
295294
} else {
@@ -741,6 +740,7 @@ - (void)validateCredentials
741740
if (statusCode == 401) {
742741
NSError *error401 = [[NSError alloc] initWithDomain:NSURLErrorDomain code:NSURLErrorCancelled userInfo:nil];
743742
[self showLoginAlertWithError:error401];
743+
return;
744744
}
745745
[self showLoginAlertWithError:error];
746746

Simplified/NYPLBookCoverRegistry.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ - (instancetype)init
4747
configuration.HTTPCookieStorage = nil;
4848
configuration.HTTPMaximumConnectionsPerHost = 8;
4949
configuration.HTTPShouldUsePipelining = YES;
50-
configuration.timeoutIntervalForRequest = 5.0;
51-
configuration.timeoutIntervalForResource = 20.0;
50+
configuration.timeoutIntervalForRequest = 15.0;
51+
configuration.timeoutIntervalForResource = 30.0;
5252
configuration.URLCache.diskCapacity = 1024 * 1024 * diskCacheInMegabytes;
5353
configuration.URLCache.memoryCapacity = 1024 * 1024 * memoryCacheInMegabytes;
5454
configuration.URLCredentialStorage = nil;

Simplified/NYPLCatalogNavigationController.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ - (void)switchLibrary
102102
#if defined(FEATURE_DRM_CONNECTOR)
103103
if([NYPLADEPT sharedInstance].workflowsInProgress) {
104104
[self presentViewController:[NYPLAlertController
105-
alertWithTitle:@"SettingsAccountViewControllerCannotLogOutTitle"
106-
message:@"SettingsAccountViewControllerCannotLogOutMessage"]
105+
alertWithTitle:@"PleaseWait"
106+
message:@"PleaseWaitMessage"]
107107
animated:YES
108108
completion:nil];
109109
} else {

Simplified/NYPLCatalogSearchViewController.m

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#import "NYPLOpenSearchDescription.h"
1010
#import "NYPLReloadView.h"
1111
#import "UIView+NYPLViewAdditions.h"
12+
#import <PureLayout/PureLayout.h>
1213

1314
#import "NYPLCatalogSearchViewController.h"
1415

@@ -17,6 +18,7 @@ @interface NYPLCatalogSearchViewController ()
1718
UISearchBarDelegate>
1819

1920
@property (nonatomic) UIActivityIndicatorView *activityIndicatorView;
21+
@property (nonatomic) UILabel *activityIndicatorLabel;
2022
@property (nonatomic) NYPLCatalogUngroupedFeed *category;
2123
@property (nonatomic) UILabel *noResultsLabel;
2224
@property (nonatomic) NYPLReloadView *reloadView;
@@ -57,6 +59,14 @@ - (void)viewDidLoad
5759
self.activityIndicatorView.hidden = YES;
5860
[self.view addSubview:self.activityIndicatorView];
5961

62+
self.activityIndicatorLabel = [[UILabel alloc] init];
63+
self.activityIndicatorLabel.font = [UIFont systemFontOfSize:14.0];
64+
self.activityIndicatorLabel.text = NSLocalizedString(@"ActivitySlowLoadMessage", @"Message explaining that the download is still going");
65+
self.activityIndicatorLabel.hidden = YES;
66+
[self.view addSubview:self.activityIndicatorLabel];
67+
[self.activityIndicatorLabel autoAlignAxis:ALAxisVertical toSameAxisOfView:self.activityIndicatorView];
68+
[self.activityIndicatorLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:self.activityIndicatorView withOffset:8.0];
69+
6070
self.searchBar = [[UISearchBar alloc] init];
6171
self.searchBar.delegate = self;
6272
self.searchBar.placeholder = self.searchDescription.humanReadableDescription;
@@ -107,6 +117,19 @@ - (void)viewWillDisappear:(BOOL)animated
107117
[self.searchBar resignFirstResponder];
108118
}
109119

120+
- (void)addActivityIndicatorLabel:(NSTimer*)timer
121+
{
122+
if (!self.activityIndicatorView.isHidden) {
123+
[UIView transitionWithView:self.activityIndicatorLabel
124+
duration:0.5
125+
options:UIViewAnimationOptionTransitionCrossDissolve
126+
animations:^{
127+
self.activityIndicatorLabel.hidden = NO;
128+
} completion:nil];
129+
}
130+
[timer invalidate];
131+
}
132+
110133
#pragma mark UICollectionViewDataSource
111134

112135
- (NSInteger)collectionView:(__attribute__((unused)) UICollectionView *)collectionView
@@ -162,6 +185,11 @@ - (void)searchBarSearchButtonClicked:(__attribute__((unused)) UISearchBar *)sear
162185
self.reloadView.hidden = YES;
163186
self.activityIndicatorView.hidden = NO;
164187
[self.activityIndicatorView startAnimating];
188+
189+
self.activityIndicatorLabel.hidden = YES;
190+
[NSTimer scheduledTimerWithTimeInterval: 10.0 target: self
191+
selector: @selector(addActivityIndicatorLabel:) userInfo: nil repeats: NO];
192+
165193
self.searchBar.userInteractionEnabled = NO;
166194
self.searchBar.alpha = 0.5;
167195
[self.searchBar resignFirstResponder];
@@ -196,6 +224,7 @@ - (void)updateUIAfterSearchSuccess:(BOOL)success
196224
{
197225
self.activityIndicatorView.hidden = YES;
198226
[self.activityIndicatorView stopAnimating];
227+
self.activityIndicatorLabel.hidden = YES;
199228
self.searchBar.userInteractionEnabled = YES;
200229
self.searchBar.alpha = 1.0;
201230

Simplified/NYPLReaderReadiumView.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ - (void)calculateBookLength
811811
[spineItemDict setObject:title forKey:@"tocElementTitle"];
812812
}
813813
else {
814-
[spineItemDict setObject:NSLocalizedString(@"chapter", nil) forKey:@"tocElementTitle"];
814+
[spineItemDict setObject:NSLocalizedString(@"ReaderViewControllerCurrentChapter", nil) forKey:@"tocElementTitle"];
815815
}
816816

817817
[bookDicts setObject:spineItemDict forKey:spineItem.idref];
@@ -893,8 +893,14 @@ - (void)pollReadyState
893893
dispatch_time_t const dispatchTime =
894894
dispatch_time(DISPATCH_TIME_NOW, (int64_t)(readyStateCheckIntervalInSeconds * NSEC_PER_SEC));
895895

896+
// A weak reference is needed here so that the main queue does not retain
897+
// `NYPLReaderReadiumView` indefinitely. After the reference to `weakSelf`
898+
// becomes nil, the block passed to `dispatch_after` will be called one
899+
// final time and will not be rescheduled (because `pollReadyState` will
900+
// be sent to nil).
901+
__weak NYPLReaderReadiumView *const weakSelf = self;
896902
dispatch_after(dispatchTime, dispatch_get_main_queue(), ^{
897-
[self pollReadyState];
903+
[weakSelf pollReadyState];
898904
});
899905
}
900906

Simplified/NYPLReaderSettings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ BOOL NYPLReaderSettingsIncreasedFontSize(NYPLReaderSettingsFontSize input,
6363
@property (nonatomic) NYPLReaderSettingsFontSize fontSize;
6464
@property (nonatomic) NYPLReaderSettingsMediaOverlaysEnableClick mediaOverlaysEnableClick;
6565
@property (nonatomic, readonly) UIColor *foregroundColor;
66-
@property (nonatomic) id currentReaderReadiumView;
66+
@property (nonatomic, weak) id currentReaderReadiumView;
6767

6868
- (void) toggleMediaOverlayPlayback;
6969

Simplified/NYPLReaderTOCCell.h

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
1-
// TODO: This class pulls the current color scheme from NYPLReaderSettings. This may or may not be
2-
// an appropriate way of handling color schemes. If the color scheme changes, all tables containing
3-
// a NYPLReaderTOCCell must be reloaded.
4-
51
@interface NYPLReaderTOCCell : UITableViewCell
62

7-
@property (nonatomic) NSUInteger nestingLevel;
8-
@property (nonatomic) NSString *title;
9-
10-
+ (id)new NS_UNAVAILABLE;
11-
- (id)init NS_UNAVAILABLE;
12-
- (id)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE;
13-
- (id)initWithFrame:(CGRect)frame NS_UNAVAILABLE;
14-
- (id)initWithStyle:(UITableViewCellStyle)style
15-
reuseIdentifier:(NSString *)reuseIdentifier NS_UNAVAILABLE;
16-
17-
// designated initializer
18-
- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier;
3+
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
4+
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *leadingEdgeConstraint;
195

206
@end

Simplified/NYPLReaderTOCCell.m

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,5 @@
1-
#import "NYPLReaderSettings.h"
2-
31
#import "NYPLReaderTOCCell.h"
42

5-
@interface NYPLReaderTOCCell ()
6-
7-
@property (nonatomic) UILabel *titleLabel;
8-
9-
@end
10-
113
@implementation NYPLReaderTOCCell
124

13-
#pragma mark UITableViewCell
14-
15-
- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier
16-
{
17-
self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
18-
if(!self) return nil;
19-
20-
self.titleLabel = [[UILabel alloc] init];
21-
[self.contentView addSubview:self.titleLabel];
22-
23-
self.backgroundColor = [NYPLReaderSettings sharedSettings].backgroundColor;
24-
self.titleLabel.textColor = [NYPLReaderSettings sharedSettings].foregroundColor;
25-
26-
return self;
27-
}
28-
29-
#pragma mark UIView
30-
31-
- (void)layoutSubviews
32-
{
33-
CGRect frame = self.contentView.bounds;
34-
frame.origin.x = self.nestingLevel * 20 + 10;
35-
frame.size.width -= self.nestingLevel * 20 + 20;
36-
self.titleLabel.frame = frame;
37-
}
38-
39-
#pragma mark -
40-
41-
- (void)setNestingLevel:(NSUInteger)nestingLevel
42-
{
43-
_nestingLevel = nestingLevel;
44-
45-
[self setNeedsLayout];
46-
}
47-
48-
- (NSString *)title
49-
{
50-
return self.titleLabel.text;
51-
}
52-
53-
- (void)setTitle:(NSString *const)title
54-
{
55-
self.titleLabel.text = title;
56-
}
57-
585
@end

0 commit comments

Comments
 (0)