Removing APNavigation as a dependency.

pull/1/head
Frederic Jacobs 9 years ago
parent 8189e593ef
commit 3d4d4123f7

@ -19,4 +19,3 @@ pod 'DJWActionSheet'
pod 'SocketRocket', :git => 'https://github.com/FredericJacobs/SocketRocket.git', :commit => 'dd7e47fed78214785d7c032081da94008335fc35'
pod 'JSQMessagesViewController', :git => 'https://github.com/WhisperSystems/JSQMessagesViewController', :commit => 'e5582fef8a6b3e35f8070361ef37237222da712b'
pod 'APDropDownNavToolbar', :git => 'https://github.com/corbett/APDropDownNavToolbar.git', :branch => 'master'

@ -21,7 +21,6 @@ PODS:
- AFNetworking/UIKit (2.6.1):
- AFNetworking/NSURLConnection
- AFNetworking/NSURLSession
- APDropDownNavToolbar (1.1)
- AxolotlKit (0.7):
- 25519 (~> 2.0.1)
- HKDFKit (~> 0.0.3)
@ -64,8 +63,6 @@ PODS:
DEPENDENCIES:
- AFNetworking (~> 2.6)
- APDropDownNavToolbar (from `https://github.com/corbett/APDropDownNavToolbar.git`,
branch `master`)
- AxolotlKit
- DJWActionSheet
- FFCircularProgressView (~> 0.5)
@ -84,9 +81,6 @@ DEPENDENCIES:
- YapDatabase/SQLCipher (~> 2.7.2)
EXTERNAL SOURCES:
APDropDownNavToolbar:
:branch: master
:git: https://github.com/corbett/APDropDownNavToolbar.git
JSQMessagesViewController:
:commit: e5582fef8a6b3e35f8070361ef37237222da712b
:git: https://github.com/WhisperSystems/JSQMessagesViewController
@ -95,9 +89,6 @@ EXTERNAL SOURCES:
:git: https://github.com/FredericJacobs/SocketRocket.git
CHECKOUT OPTIONS:
APDropDownNavToolbar:
:commit: 98a606b343c0ccc6cca1cd243b296325716f21e7
:git: https://github.com/corbett/APDropDownNavToolbar.git
JSQMessagesViewController:
:commit: e5582fef8a6b3e35f8070361ef37237222da712b
:git: https://github.com/WhisperSystems/JSQMessagesViewController
@ -108,7 +99,6 @@ CHECKOUT OPTIONS:
SPEC CHECKSUMS:
'25519': dc4bad7e2dbcbf1efa121068a705a44cd98c80fc
AFNetworking: 8e4e60500beb8bec644cf575beee72990a76d399
APDropDownNavToolbar: 5d0c3f363208543d20e86ddb4630927c28cdfd4b
AxolotlKit: 8652fca51f4bc8225cbda791b0026c21e912b694
CocoaLumberjack: 17fe8581f84914d5d7e6360f7c70022b173c3ae0
DJWActionSheet: 2fe54b1298a7f0fe44462233752c76a530e0cd80

@ -1 +1 @@
Subproject commit 89f829c06ce4605393867fa5660ccdbb3ce7cf53
Subproject commit 0f4532971e696c73005950fa7d9154297fdfa746

@ -1451,10 +1451,6 @@ A0 09 9A FF A8 8A 09 99</string>
<color key="barTintColor" red="0.067691504955291748" green="0.55628502368927002" blue="0.92999207973480225" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</navigationBar>
<nil name="viewControllers"/>
<toolbar key="toolbar" opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="Ili-XA-ka5">
<autoresizingMask key="autoresizingMask"/>
<animations/>
</toolbar>
<connections>
<segue destination="MY2-bB-USa" kind="relationship" relationship="rootViewController" id="3Fm-tH-SUz"/>
</connections>

@ -2,6 +2,7 @@
#import "CollapsingFutures.h"
#import "Contact.h"
#import "ObservableValue.h"
#import <Contacts/Contacts.h>
/**
*
@ -26,6 +27,8 @@ typedef void(^ABReloadRequestCompletionBlock)(NSArray *contacts);
@private NSDictionary *latestWhisperUsersById;
}
@property CNContactStore *contactStore;
-(ObservableValue *) getObservableContacts;
-(ObservableValue *) getObservableRedPhoneUsers;

@ -29,7 +29,18 @@ typedef BOOL (^ContactSearchBlock)(id, NSUInteger, BOOL*);
}
-(void) doAfterEnvironmentInitSetup {
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(_iOS_9)) {
self.contactStore = [[CNContactStore alloc] init];
[self.contactStore requestAccessForEntityType:CNEntityTypeContacts completionHandler:^(BOOL granted, NSError * _Nullable error) {
if (!granted) {
// We're still using the old addressbook API.
// User warned if permission not granted in that setup.
}
}];
}
[self setupAddressBook];
[observableContactsController watchLatestValueOnArbitraryThread:^(NSArray *latestContacts) {
@synchronized(self) {
[self setupLatestContacts:latestContacts];

@ -0,0 +1,24 @@
//
// APNavigationController.h
// DropDownToolBar
//
// Created by Ankur Patel on 2/24/14.
// Copyright (c) 2014 Encore Dev Labs LLC. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface APNavigationController : UINavigationController
@property (nonatomic, strong) UIToolbar *dropDownToolbar; // Reference to dynamically change items based on which bar button item is clicked
@property (nonatomic, strong) NSString *activeNavigationBarTitle; // Navigation bar title when the toolbar is shown
@property (nonatomic, strong) NSString *activeBarButtonTitle; // UIBarButton title when toolbar is shown
@property (nonatomic, assign) BOOL isDropDownVisible;
- (void)setActiveBarButtonTitle:(NSString*)title;
- (void)setActiveNavigationBarTitle:(NSString*)title;
- (void)toggleDropDown:(id)sender;
- (void)hideDropDown:(id)sender;
- (void)showDropDown:(id)sender;
@end

@ -0,0 +1,108 @@
//
// APNavigationController.m
// DropDownToolBar
//
// Created by Ankur Patel on 2/24/14.
// Copyright (c) 2014 Encore Dev Labs LLC. All rights reserved.
//
#import "APNavigationController.h"
@interface APNavigationController ()
@property (nonatomic, copy) NSString *originalNavigationBarTitle;
@property (nonatomic, copy) NSString *originalBarButtonTitle;
@end
@implementation APNavigationController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
self.dropDownToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 64)];
self.dropDownToolbar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
self.dropDownToolbar.tintColor = self.navigationBar.tintColor;
[self.navigationBar.superview insertSubview:self.dropDownToolbar belowSubview:self.navigationBar];
self.originalNavigationBarTitle = self.navigationBar.topItem.title;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)toggleDropDown:(id)sender
{
if (self.isDropDownVisible) {
[self hideDropDown:sender];
} else {
[self showDropDown:sender];
}
}
- (void)hideDropDown:(id)sender
{
if(self.isDropDownVisible){
__weak APNavigationController *weakSelf = self;
CGRect frame = self.dropDownToolbar.frame;
frame.origin.y = CGRectGetMaxY(self.navigationBar.frame);
self.dropDownToolbar.frame = frame;
[UIView animateWithDuration:0.25 animations:^{
CGRect frame = self.dropDownToolbar.frame;
frame.origin.y = 0.;
weakSelf.dropDownToolbar.frame = frame;
} completion:^(BOOL finished) {
weakSelf.isDropDownVisible = !weakSelf.isDropDownVisible;
weakSelf.dropDownToolbar.hidden = YES;
}];
if (self.activeNavigationBarTitle) {
self.navigationBar.topItem.title = self.originalNavigationBarTitle;
}
if(sender && [sender isKindOfClass:[UIBarButtonItem class]]){
[(UIBarButtonItem *)sender setTitle:self.originalBarButtonTitle];
}
}
}
- (void)showDropDown:(id)sender
{
if(!self.isDropDownVisible){
__weak APNavigationController *weakSelf = self;
CGRect frame = self.dropDownToolbar.frame;
frame.origin.y = 0.f;
self.dropDownToolbar.hidden = NO;
self.dropDownToolbar.frame = frame;
[UIView animateWithDuration:0.25 animations:^{
CGRect frame = self.dropDownToolbar.frame;
frame.origin.y = CGRectGetMaxY(self.navigationBar.frame);
weakSelf.dropDownToolbar.frame = frame;
} completion:^(BOOL finished) {
weakSelf.isDropDownVisible = !weakSelf.isDropDownVisible;
}];
if (self.activeNavigationBarTitle) {
self.navigationBar.topItem.title = self.activeNavigationBarTitle;
}
if(sender && [sender isKindOfClass:[UIBarButtonItem class]]){
self.originalBarButtonTitle = [(UIBarButtonItem *)sender title];
if (self.activeBarButtonTitle) {
[(UIBarButtonItem *)sender setTitle:self.activeBarButtonTitle];
}
}
}
}
@end
Loading…
Cancel
Save