summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-08-28 21:16:56 +0300
committerGravatar Vitaly Takmazov2016-08-28 21:16:56 +0300
commit49cd38a2ef9ad9c9aa08bdb3ff2baafb6abede89 (patch)
treecda41995d9505b04460cadf4345b7b8fd3b13f34
parent188d8e4ea870d1a6c8edd5a9b323742804badeba (diff)
drop iOS6 support
-rw-r--r--Juick/AppDelegate.m33
-rw-r--r--Juick/Helpers/NSURL+PathParameters.m8
-rw-r--r--Juick/Model/User.m2
-rw-r--r--Juick/ViewControllers/MessagesViewController.h2
-rw-r--r--Juick/ViewControllers/MessagesViewController.m19
-rw-r--r--Juick/Views/MessageCell.xib2
6 files changed, 19 insertions, 47 deletions
diff --git a/Juick/AppDelegate.m b/Juick/AppDelegate.m
index 56b6ee9..51304dc 100644
--- a/Juick/AppDelegate.m
+++ b/Juick/AppDelegate.m
@@ -19,11 +19,8 @@
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
- // style the navigation bar
- if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1) {
- [[UINavigationBar appearance] setTintColor:[ColorScheme linkColor]];
- [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [ColorScheme linkColor]}];
- }
+ [[UINavigationBar appearance] setTintColor:[ColorScheme linkColor]];
+ [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [ColorScheme linkColor]}];
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
@@ -32,22 +29,16 @@
UINavigationController *main = [[UINavigationController alloc] initWithRootViewController:messages];
UINavigationController *rearNav = [[UINavigationController alloc] initWithRootViewController:rear];
- if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
- SWRevealViewController *reveal = [[SWRevealViewController alloc] initWithRearViewController:rearNav frontViewController:main];
- self.viewController = reveal;
- [messages.navigationController.navigationBar addGestureRecognizer:reveal.panGestureRecognizer];
- UIBarButtonItem *revealButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"reveal-icon.png"]
- style:UIBarButtonItemStylePlain target:reveal action:@selector(revealToggle:)];
- messages.navigationItem.leftBarButtonItem = revealButtonItem;
- UIBarButtonItem *compose = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose
- target:messages action:@selector(composePressed)];
- messages.navigationItem.rightBarButtonItem = compose;
- } else {
- UISplitViewController *split = [[UISplitViewController alloc] init];
- split.viewControllers = [NSArray arrayWithObjects:rearNav, main, nil];
- split.delegate = messages;
- self.viewController = split;
- }
+ SWRevealViewController *reveal = [[SWRevealViewController alloc] initWithRearViewController:rearNav frontViewController:main];
+ self.viewController = reveal;
+ [messages.navigationController.navigationBar addGestureRecognizer:reveal.panGestureRecognizer];
+ UIBarButtonItem *revealButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"reveal-icon.png"]
+ style:UIBarButtonItemStylePlain target:reveal action:@selector(revealToggle:)];
+ messages.navigationItem.leftBarButtonItem = revealButtonItem;
+ UIBarButtonItem *compose = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose
+ target:messages action:@selector(composePressed)];
+ messages.navigationItem.rightBarButtonItem = compose;
+
if ([User isAuthenticated]) {
[User checkIsValid:^(BOOL success) {
if (success) {
diff --git a/Juick/Helpers/NSURL+PathParameters.m b/Juick/Helpers/NSURL+PathParameters.m
index 83a55bb..6752757 100644
--- a/Juick/Helpers/NSURL+PathParameters.m
+++ b/Juick/Helpers/NSURL+PathParameters.m
@@ -35,13 +35,7 @@
@implementation NSString (URLParameters)
- (NSString *)stringByEscapingForURLArgument {
- // Encode all the reserved characters, per RFC 3986 (<http://www.ietf.org/rfc/rfc3986.txt>)
- NSString *escapedString = (__bridge NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
- (CFStringRef)self,
- NULL,
- (CFStringRef)@"!*'\"();:@&=+$,/?%#[] ",
- kCFStringEncodingUTF8);
- return [escapedString copy];
+ return [self stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"!*'\"();:@&=+$,/?%#[] "]];
}
@end
diff --git a/Juick/Model/User.m b/Juick/Model/User.m
index f4b1e00..3f860d7 100644
--- a/Juick/Model/User.m
+++ b/Juick/Model/User.m
@@ -31,7 +31,7 @@
if (statusCode == 400) {
callback(YES);
} else {
- [manager.requestSerializer setAuthorizationHeaderFieldWithUsername:nil password:nil];
+ [manager.requestSerializer setAuthorizationHeaderFieldWithUsername:@"" password:@""];
callback(NO);
}
}];}
diff --git a/Juick/ViewControllers/MessagesViewController.h b/Juick/ViewControllers/MessagesViewController.h
index 38123bd..613ac64 100644
--- a/Juick/ViewControllers/MessagesViewController.h
+++ b/Juick/ViewControllers/MessagesViewController.h
@@ -8,7 +8,7 @@
#import <UIKit/UIKit.h>
-@interface MessagesViewController : UITableViewController<UISplitViewControllerDelegate>
+@interface MessagesViewController : UITableViewController
- (void)loadFromPath:(NSString *)messagesPath withParams:(NSDictionary *)params withTitle:(NSString *)title;
- (void) refreshData;
- (void) composePressed;
diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m
index 28e7613..3a420e1 100644
--- a/Juick/ViewControllers/MessagesViewController.m
+++ b/Juick/ViewControllers/MessagesViewController.m
@@ -95,22 +95,18 @@ static NSString *CellIdentifier = @"MessageCell";
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
- if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1) {
- [[NSNotificationCenter defaultCenter] addObserver:self
+ [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(contentSizeCategoryChanged:)
name:UIContentSizeCategoryDidChangeNotification
object:nil];
- }
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
- if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1) {
- [[NSNotificationCenter defaultCenter] removeObserver:self
+ [[NSNotificationCenter defaultCenter] removeObserver:self
name:UIContentSizeCategoryDidChangeNotification
- object:nil];
- }
+ object:nil];
}
- (void)contentSizeCategoryChanged:(NSNotification *)notification
@@ -131,7 +127,6 @@ static NSString *CellIdentifier = @"MessageCell";
Message *msg = [_messages objectAtIndex:indexPath.row];
[cell setMessage:msg];
if ([msg.attach length] > 0) {
- __weak MessagesViewController * weakSelf = self;
[cell.attach yy_setImageWithURL:[NSURL URLWithString:msg.attach] placeholder:[UIImage imageNamed:@"AttachPlaceholder"] options:YYWebImageOptionProgressiveBlur | YYWebImageOptionSetImageWithFadeAnimation completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
dispatch_async(dispatch_get_main_queue(), ^{
[cell setNeedsUpdateConstraints];
@@ -157,14 +152,6 @@ static NSString *CellIdentifier = @"MessageCell";
[self.navigationController pushViewController:threadViewController animated:NO];
}
--(void)splitViewController:(UISplitViewController *)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem {
- self.navigationItem.leftBarButtonItem = nil;
-}
-
--(void)splitViewController:(UISplitViewController *)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)pc {
- self.navigationItem.leftBarButtonItem = barButtonItem;
-}
-
-(void)scrollViewDidScroll:(UIScrollView *)scrollView_ {
CGFloat actualPosition = scrollView_.contentOffset.y;
CGFloat contentHeight = scrollView_.contentSize.height - scrollView_.contentSize.height / 2;
diff --git a/Juick/Views/MessageCell.xib b/Juick/Views/MessageCell.xib
index 5cbf69d..25a35b5 100644
--- a/Juick/Views/MessageCell.xib
+++ b/Juick/Views/MessageCell.xib
@@ -49,7 +49,7 @@
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0Q9-qY-nj2">
<rect key="frame" x="0.0" y="54" width="40" height="189"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
- <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="53j-SC-IXj">