Add podspecs
This commit is contained in:
parent
dedf40e525
commit
faa2449d54
File diff suppressed because it is too large
Load Diff
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#import "UITableView+ChatSecure.h"
|
#import "UITableView+ChatSecure.h"
|
||||||
#import "OTRXMPPBuddy.h"
|
#import "OTRXMPPBuddy.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
#import "OTRXMPPManager_Private.h"
|
#import "OTRXMPPManager_Private.h"
|
||||||
@import OTRAssets;
|
@import OTRAssets;
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#import "OTRConstants.h"
|
#import "OTRConstants.h"
|
||||||
#import "OTRXMPPAccount.h"
|
#import "OTRXMPPAccount.h"
|
||||||
#import "OTRXMPPTorAccount.h"
|
#import "OTRXMPPTorAccount.h"
|
||||||
#import "OTRGoogleOAuthXMPPAccount.h"
|
|
||||||
#import "OTRAccount.h"
|
#import "OTRAccount.h"
|
||||||
#import "OTRIncomingMessage.h"
|
#import "OTRIncomingMessage.h"
|
||||||
#import "OTROutgoingMessage.h"
|
#import "OTROutgoingMessage.h"
|
||||||
|
@ -29,7 +28,7 @@
|
||||||
#import "OTRSignalSession.h"
|
#import "OTRSignalSession.h"
|
||||||
#import "OTRSettingsManager.h"
|
#import "OTRSettingsManager.h"
|
||||||
#import "OTRXMPPPresenceSubscriptionRequest.h"
|
#import "OTRXMPPPresenceSubscriptionRequest.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
|
|
||||||
|
|
||||||
@interface OTRDatabaseManager ()
|
@interface OTRDatabaseManager ()
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#import "OTRIncomingMessage.h"
|
#import "OTRIncomingMessage.h"
|
||||||
#import "OTRLog.h"
|
#import "OTRLog.h"
|
||||||
#import "OTROutgoingMessage.h"
|
#import "OTROutgoingMessage.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
|
|
||||||
NSString *OTRArchiveFilteredConversationsName = @"OTRFilteredConversationsName";
|
NSString *OTRArchiveFilteredConversationsName = @"OTRFilteredConversationsName";
|
||||||
NSString *OTRBuddyFilteredConversationsName = @"OTRBuddyFilteredConversationsName";
|
NSString *OTRBuddyFilteredConversationsName = @"OTRBuddyFilteredConversationsName";
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#import "OTRLog.h"
|
#import "OTRLog.h"
|
||||||
#import "OTRXMPPManager.h"
|
#import "OTRXMPPManager.h"
|
||||||
#import "OTRYapMessageSendAction.h"
|
#import "OTRYapMessageSendAction.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
|
|
||||||
@import AVFoundation;
|
@import AVFoundation;
|
||||||
@import XMPPFramework;
|
@import XMPPFramework;
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
//
|
|
||||||
// OTROAuthRefresher.h
|
|
||||||
// Off the Record
|
|
||||||
//
|
|
||||||
// Created by David Chiles on 3/28/14.
|
|
||||||
// Copyright (c) 2014 Chris Ballinger. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
@import Foundation;
|
|
||||||
|
|
||||||
@class GTMOAuth2Authentication;
|
|
||||||
@class FBAccessTokenData;
|
|
||||||
@class OTROAuthXMPPAccount;
|
|
||||||
|
|
||||||
typedef void(^OTROAuthCompletionBlock)(id token,NSError *);
|
|
||||||
|
|
||||||
@interface OTROAuthRefresher : NSObject
|
|
||||||
|
|
||||||
+ (void)refreshAccount:(OTROAuthXMPPAccount *)account completion:(OTROAuthCompletionBlock)completionBlock;
|
|
||||||
|
|
||||||
@end
|
|
|
@ -1,41 +0,0 @@
|
||||||
//
|
|
||||||
// OTROAuthRefresher.m
|
|
||||||
// Off the Record
|
|
||||||
//
|
|
||||||
// Created by David Chiles on 3/28/14.
|
|
||||||
// Copyright (c) 2014 Chris Ballinger. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "OTROAuthRefresher.h"
|
|
||||||
|
|
||||||
#import "GTMOAuth2Authentication.h"
|
|
||||||
#import "OTRSecrets.h"
|
|
||||||
#import "OTRConstants.h"
|
|
||||||
|
|
||||||
#import "OTROAuthXMPPAccount.h"
|
|
||||||
|
|
||||||
|
|
||||||
@implementation OTROAuthRefresher
|
|
||||||
|
|
||||||
+ (void)refreshGoogleToken:(GTMOAuth2Authentication *)authToken completion:(OTROAuthCompletionBlock)completionBlock
|
|
||||||
{
|
|
||||||
[authToken authorizeRequest:nil completionHandler:^(NSError *error) {
|
|
||||||
if (completionBlock) {
|
|
||||||
if (!error) {
|
|
||||||
completionBlock(authToken,nil);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
completionBlock(nil,error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (void)refreshAccount:(OTROAuthXMPPAccount *)account completion:(OTROAuthCompletionBlock)completionBlock
|
|
||||||
{
|
|
||||||
if (account.accountType == OTRAccountTypeGoogleTalk) {
|
|
||||||
[self refreshGoogleToken:[account accountSpecificToken] completion:completionBlock];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
|
@ -26,8 +26,6 @@
|
||||||
#import "OTRIncomingMessage.h"
|
#import "OTRIncomingMessage.h"
|
||||||
#import "OTROutgoingMessage.h"
|
#import "OTROutgoingMessage.h"
|
||||||
#import "OTRConstants.h"
|
#import "OTRConstants.h"
|
||||||
#import "OTROAuthRefresher.h"
|
|
||||||
#import "OTROAuthXMPPAccount.h"
|
|
||||||
#import "OTRDatabaseManager.h"
|
#import "OTRDatabaseManager.h"
|
||||||
#import "OTRPushTLVHandler.h"
|
#import "OTRPushTLVHandler.h"
|
||||||
#import <BBlock/NSObject+BBlock.h>
|
#import <BBlock/NSObject+BBlock.h>
|
||||||
|
@ -36,7 +34,7 @@
|
||||||
@import KVOController;
|
@import KVOController;
|
||||||
@import OTRAssets;
|
@import OTRAssets;
|
||||||
#import "OTRLog.h"
|
#import "OTRLog.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
#import "OTRXMPPPresenceSubscriptionRequest.h"
|
#import "OTRXMPPPresenceSubscriptionRequest.h"
|
||||||
|
|
||||||
@interface OTRProtocolManager ()
|
@interface OTRProtocolManager ()
|
||||||
|
@ -136,22 +134,7 @@
|
||||||
if (!account) { return; }
|
if (!account) { return; }
|
||||||
id <OTRProtocol> protocol = [self protocolForAccount:account];
|
id <OTRProtocol> protocol = [self protocolForAccount:account];
|
||||||
|
|
||||||
if([account isKindOfClass:[OTROAuthXMPPAccount class]])
|
[protocol connectUserInitiated:userInitiated];
|
||||||
{
|
|
||||||
[OTROAuthRefresher refreshAccount:(OTROAuthXMPPAccount *)account completion:^(id token, NSError *error) {
|
|
||||||
if (!error) {
|
|
||||||
((OTROAuthXMPPAccount *)account).accountSpecificToken = token;
|
|
||||||
[protocol connectUserInitiated:userInitiated];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
DDLogError(@"Error Refreshing Token");
|
|
||||||
}
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
[protocol connectUserInitiated:userInitiated];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)loginAccount:(OTRAccount *)account
|
- (void)loginAccount:(OTRAccount *)account
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
//
|
|
||||||
// OTRPurchaseController.h
|
|
||||||
// Off the Record
|
|
||||||
//
|
|
||||||
// Created by Christopher Ballinger on 9/28/12.
|
|
||||||
// Copyright (c) 2012 Chris Ballinger. All rights reserved.
|
|
||||||
//
|
|
||||||
// This file is part of ChatSecure.
|
|
||||||
//
|
|
||||||
// ChatSecure is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// ChatSecure is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with ChatSecure. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <StoreKit/StoreKit.h>
|
|
||||||
#import "OTRStoreTableViewCell.h"
|
|
||||||
|
|
||||||
#define kOTRPurchaseControllerProductUpdateNotification @"kOTRPurchaseControllerProductUpdateNotification"
|
|
||||||
|
|
||||||
@protocol OTRPurchaseControllerDelegate <NSObject>
|
|
||||||
@required
|
|
||||||
- (void) productsUpdated:(NSArray*)products;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface OTRPurchaseController : NSObject <SKProductsRequestDelegate, SKPaymentTransactionObserver>
|
|
||||||
|
|
||||||
@property (nonatomic, weak) id<OTRPurchaseControllerDelegate> delegate;
|
|
||||||
@property (nonatomic, strong) NSArray *products;
|
|
||||||
|
|
||||||
- (void) requestProducts;
|
|
||||||
- (void) buyProduct:(SKProduct *)product;
|
|
||||||
- (void) restorePurchases;
|
|
||||||
|
|
||||||
- (BOOL) isProductIdentifierPurchased:(NSString*)productIdentifier;
|
|
||||||
- (void) setProductIdentifier:(NSString*)productIdentifier purchased:(BOOL)purchased;
|
|
||||||
|
|
||||||
+ (OTRPurchaseController*) sharedInstance;
|
|
||||||
|
|
||||||
@end
|
|
|
@ -1,176 +0,0 @@
|
||||||
//
|
|
||||||
// OTRPurchaseController.m
|
|
||||||
// Off the Record
|
|
||||||
//
|
|
||||||
// Created by Christopher Ballinger on 9/28/12.
|
|
||||||
// Copyright (c) 2012 Chris Ballinger. All rights reserved.
|
|
||||||
//
|
|
||||||
// This file is part of ChatSecure.
|
|
||||||
//
|
|
||||||
// ChatSecure is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// ChatSecure is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with ChatSecure. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#import "OTRPurchaseController.h"
|
|
||||||
#import "AFNetworking.h"
|
|
||||||
#import "Strings.h"
|
|
||||||
#import "OTRPushAPIClient.h"
|
|
||||||
|
|
||||||
#define REQUEST_PRODUCT_IDENTIFIERS @"request_product_identifiers"
|
|
||||||
#define PRODUCT_IDENTIFIERS_KEY @"identifiers"
|
|
||||||
|
|
||||||
#define PRODUCTS_KEY @"products"
|
|
||||||
|
|
||||||
@implementation OTRPurchaseController
|
|
||||||
@synthesize products;
|
|
||||||
|
|
||||||
- (void) dealloc {
|
|
||||||
[[SKPaymentQueue defaultQueue] removeTransactionObserver:self];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) init {
|
|
||||||
if (self = [super init]) {
|
|
||||||
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (OTRPurchaseController*)sharedInstance
|
|
||||||
{
|
|
||||||
static dispatch_once_t once;
|
|
||||||
static OTRPurchaseController *sharedInstance;
|
|
||||||
dispatch_once(&once, ^{
|
|
||||||
sharedInstance = [[OTRPurchaseController alloc] init];
|
|
||||||
});
|
|
||||||
return sharedInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) requestProducts {
|
|
||||||
if (products) {
|
|
||||||
[self.delegate productsUpdated:products];
|
|
||||||
} else {
|
|
||||||
[self requestProductIdentifiers];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) requestProductIdentifiers {
|
|
||||||
// Code to request product identifiers here
|
|
||||||
NSURL *requestURL = [NSURL URLWithString:REQUEST_PRODUCT_IDENTIFIERS relativeToURL:[OTRPushAPIClient sharedClient].baseURL];
|
|
||||||
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
|
|
||||||
[manager GET:requestURL.absoluteString parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
|
|
||||||
[self fetchProductsWithIdentifiers:[NSSet setWithArray:[responseObject objectForKey:PRODUCT_IDENTIFIERS_KEY]]];
|
|
||||||
} failure:^(NSURLSessionDataTask *task, NSError *error) {
|
|
||||||
NSLog(@"Error loading product identifiers: %@%@", [error localizedDescription], [error userInfo]);
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) fetchProductsWithIdentifiers:(NSSet*)identifiers {
|
|
||||||
SKProductsRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers:identifiers];
|
|
||||||
request.delegate = self;
|
|
||||||
[request start];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void) productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
|
|
||||||
if ([response.invalidProductIdentifiers count] > 0) {
|
|
||||||
NSLog(@"Invalid products identifiers: %@", [response.invalidProductIdentifiers description]);
|
|
||||||
}
|
|
||||||
self.products = response.products;
|
|
||||||
[self.delegate productsUpdated:products];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) buyProduct:(SKProduct *)product {
|
|
||||||
if ([SKPaymentQueue canMakePayments]) {
|
|
||||||
SKPayment *payment = [SKPayment paymentWithProduct:product];
|
|
||||||
[[SKPaymentQueue defaultQueue] addPayment:payment];
|
|
||||||
} else {
|
|
||||||
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:ERROR_STRING message:PAYMENTS_SETUP_ERROR_STRING delegate:nil cancelButtonTitle:nil otherButtonTitles:OK_STRING, nil];
|
|
||||||
[alert show];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {
|
|
||||||
for (SKPaymentTransaction *transaction in transactions) {
|
|
||||||
NSLog(@"Transaction: %@", transaction.transactionIdentifier);
|
|
||||||
switch (transaction.transactionState) {
|
|
||||||
case SKPaymentTransactionStatePurchased:
|
|
||||||
NSLog(@"Transaction purchased");
|
|
||||||
//[[OTRPushController sharedInstance] registerWithReceipt:transaction.transactionReceipt resetAccount:NO];
|
|
||||||
[self setProductIdentifier:transaction.payment.productIdentifier purchased:YES];
|
|
||||||
[self sendProductUpdateNotification];
|
|
||||||
[[SKPaymentQueue defaultQueue] finishTransaction: transaction];
|
|
||||||
break;
|
|
||||||
case SKPaymentTransactionStateFailed:
|
|
||||||
NSLog(@"Transaction failed");
|
|
||||||
[self sendProductUpdateNotification];
|
|
||||||
[[SKPaymentQueue defaultQueue] finishTransaction: transaction];
|
|
||||||
break;
|
|
||||||
case SKPaymentTransactionStateRestored:
|
|
||||||
NSLog(@"Original transaction restored: %@", transaction.originalTransaction.transactionIdentifier);
|
|
||||||
//[[OTRPushController sharedInstance] registerWithReceipt:transaction.transactionReceipt resetAccount:YES];
|
|
||||||
[self setProductIdentifier:transaction.payment.productIdentifier purchased:YES];
|
|
||||||
[self sendProductUpdateNotification];
|
|
||||||
[[SKPaymentQueue defaultQueue] finishTransaction: transaction];
|
|
||||||
NSLog(@"Transaction restored");
|
|
||||||
break;
|
|
||||||
case SKPaymentTransactionStatePurchasing:
|
|
||||||
NSLog(@"Purchasing transaction... ");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) sendProductUpdateNotification {
|
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:kOTRPurchaseControllerProductUpdateNotification object:self];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL) isProductIdentifierPurchased:(NSString*)productIdentifier {
|
|
||||||
NSMutableDictionary *productsDictionary = [self productsDictionary];
|
|
||||||
NSNumber *productValue = [productsDictionary objectForKey:productIdentifier];
|
|
||||||
if (!productValue) {
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
return [productValue boolValue];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSMutableDictionary*) productsDictionary {
|
|
||||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
|
||||||
NSMutableDictionary *productDictionary = [NSMutableDictionary dictionaryWithDictionary:[defaults objectForKey:PRODUCTS_KEY]];
|
|
||||||
if (!productDictionary) {
|
|
||||||
productDictionary = [NSMutableDictionary dictionary];
|
|
||||||
}
|
|
||||||
return productDictionary;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) saveProductsDictionary:(NSMutableDictionary*)productsDictionary {
|
|
||||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
|
||||||
[defaults setObject:productsDictionary forKey:PRODUCTS_KEY];
|
|
||||||
BOOL success = [defaults synchronize];
|
|
||||||
if (!success) {
|
|
||||||
NSLog(@"Product preferences not saved to disk!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void) setProductIdentifier:(NSString*)productIdentifier purchased:(BOOL)purchased {
|
|
||||||
NSMutableDictionary *productsDictionary = [self productsDictionary];
|
|
||||||
[productsDictionary setObject:[NSNumber numberWithBool:purchased] forKey:productIdentifier];
|
|
||||||
[self saveProductsDictionary:productsDictionary];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) restorePurchases {
|
|
||||||
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
|
@ -36,7 +36,7 @@
|
||||||
#import "OTRIntSetting.h"
|
#import "OTRIntSetting.h"
|
||||||
#import "OTRCertificateSetting.h"
|
#import "OTRCertificateSetting.h"
|
||||||
#import "OTRUtilities.h"
|
#import "OTRUtilities.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
|
|
||||||
#import "OTRUtilities.h"
|
#import "OTRUtilities.h"
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#import "OTRXMPPBuddyManager.h"
|
#import "OTRXMPPBuddyManager.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
@import XMPPFramework;
|
@import XMPPFramework;
|
||||||
#import "OTRXMPPBuddy.h"
|
#import "OTRXMPPBuddy.h"
|
||||||
@import YapDatabase;
|
@import YapDatabase;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#import "OTRXMPPManager.h"
|
#import "OTRXMPPManager.h"
|
||||||
#import "OTRCertificatePinning.h"
|
#import "OTRCertificatePinning.h"
|
||||||
#import "OTRXMPPBuddyManager.h"
|
#import "OTRXMPPBuddyManager.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
#import "OTRXMPPRoomManager.h"
|
#import "OTRXMPPRoomManager.h"
|
||||||
#import "OTRXMPPBuddyTimers.h"
|
#import "OTRXMPPBuddyTimers.h"
|
||||||
@import XMPPFramework;
|
@import XMPPFramework;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#import "OTRXMPPRoomManager.h"
|
#import "OTRXMPPRoomManager.h"
|
||||||
@import XMPPFramework;
|
@import XMPPFramework;
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
#import "OTRBuddy.h"
|
#import "OTRBuddy.h"
|
||||||
#import "OTRBuddyCache.h"
|
#import "OTRBuddyCache.h"
|
||||||
@import YapDatabase;
|
@import YapDatabase;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#import "OTRBuddyCache.h"
|
#import "OTRBuddyCache.h"
|
||||||
#import "OTRDatabaseManager.h"
|
#import "OTRDatabaseManager.h"
|
||||||
#import "OTRYapDatabaseObject.h"
|
#import "OTRYapDatabaseObject.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
|
|
||||||
@implementation OTRXMPPRoomRuntimeProperties
|
@implementation OTRXMPPRoomRuntimeProperties
|
||||||
- (instancetype)init {
|
- (instancetype)init {
|
||||||
|
|
|
@ -13,14 +13,13 @@
|
||||||
|
|
||||||
#import "OTRXMPPAccount.h"
|
#import "OTRXMPPAccount.h"
|
||||||
#import "OTRXMPPTorAccount.h"
|
#import "OTRXMPPTorAccount.h"
|
||||||
#import "OTRGoogleOAuthXMPPAccount.h"
|
|
||||||
#import "OTRDatabaseManager.h"
|
#import "OTRDatabaseManager.h"
|
||||||
@import YapDatabase;
|
@import YapDatabase;
|
||||||
#import "OTRBuddy.h"
|
#import "OTRBuddy.h"
|
||||||
#import "OTRImages.h"
|
#import "OTRImages.h"
|
||||||
#import "NSURL+ChatSecure.h"
|
#import "NSURL+ChatSecure.h"
|
||||||
#import "OTRProtocolManager.h"
|
#import "OTRProtocolManager.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
#import "OTRColors.h"
|
#import "OTRColors.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,8 +62,6 @@ NSString *const OTRXMPPTorImageName = @"xmpp-tor-logo.png";
|
||||||
|
|
||||||
+ (nullable Class) accountClassForAccountType:(OTRAccountType)accountType {
|
+ (nullable Class) accountClassForAccountType:(OTRAccountType)accountType {
|
||||||
switch(accountType) {
|
switch(accountType) {
|
||||||
case OTRAccountTypeGoogleTalk:
|
|
||||||
return [OTRGoogleOAuthXMPPAccount class];
|
|
||||||
case OTRAccountTypeJabber:
|
case OTRAccountTypeJabber:
|
||||||
return [OTRXMPPAccount class];
|
return [OTRXMPPAccount class];
|
||||||
case OTRAccountTypeXMPPTor:
|
case OTRAccountTypeXMPPTor:
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
//
|
|
||||||
// OTRFacebookOAuthXMPPAccount.h
|
|
||||||
// Off the Record
|
|
||||||
//
|
|
||||||
// Created by David Chiles on 3/28/14.
|
|
||||||
// Copyright (c) 2014 Chris Ballinger. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "OTROAuthXMPPAccount.h"
|
|
||||||
|
|
||||||
@interface OTRFacebookOAuthXMPPAccount : OTROAuthXMPPAccount
|
|
||||||
|
|
||||||
@end
|
|
|
@ -1,13 +0,0 @@
|
||||||
//
|
|
||||||
// OTRFacebookOAuthXMPPAccount.m
|
|
||||||
// Off the Record
|
|
||||||
//
|
|
||||||
// Created by David Chiles on 3/28/14.
|
|
||||||
// Copyright (c) 2014 Chris Ballinger. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "OTRFacebookOAuthXMPPAccount.h"
|
|
||||||
|
|
||||||
@implementation OTRFacebookOAuthXMPPAccount
|
|
||||||
|
|
||||||
@end
|
|
|
@ -1,13 +0,0 @@
|
||||||
//
|
|
||||||
// OTRGoogleOAuthXMPPAccount.h
|
|
||||||
// Off the Record
|
|
||||||
//
|
|
||||||
// Created by David Chiles on 3/28/14.
|
|
||||||
// Copyright (c) 2014 Chris Ballinger. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "OTROAuthXMPPAccount.h"
|
|
||||||
|
|
||||||
@interface OTRGoogleOAuthXMPPAccount : OTROAuthXMPPAccount
|
|
||||||
|
|
||||||
@end
|
|
|
@ -1,98 +0,0 @@
|
||||||
//
|
|
||||||
// OTRGoogleOAuthXMPPAccount.m
|
|
||||||
// Off the Record
|
|
||||||
//
|
|
||||||
// Created by David Chiles on 3/28/14.
|
|
||||||
// Copyright (c) 2014 Chris Ballinger. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "OTRGoogleOAuthXMPPAccount.h"
|
|
||||||
@import gtm_oauth2;
|
|
||||||
@import OTRAssets;
|
|
||||||
#import "OTRConstants.h"
|
|
||||||
|
|
||||||
|
|
||||||
NSString *const kOTRExpirationDateKey = @"kOTRExpirationDateKey";
|
|
||||||
NSString *const kOTRExpiresInKey = @"expires_in";
|
|
||||||
|
|
||||||
|
|
||||||
@implementation OTRGoogleOAuthXMPPAccount
|
|
||||||
|
|
||||||
- (UIImage *)accountImage
|
|
||||||
{
|
|
||||||
return [UIImage imageNamed:OTRGoogleTalkImageName inBundle:[OTRAssets resourcesBundle] compatibleWithTraitCollection:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSString *)accessTokenString {
|
|
||||||
return [self authToken].accessToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void)setOAuthTokenDictionary:(NSDictionary *)oAuthTokenDictionary
|
|
||||||
{
|
|
||||||
if ([oAuthTokenDictionary count]) {
|
|
||||||
NSMutableDictionary * mutableTokenDictionary = [oAuthTokenDictionary mutableCopy];
|
|
||||||
NSNumber * expiresIn = [mutableTokenDictionary objectForKey:kOTRExpiresInKey];
|
|
||||||
[mutableTokenDictionary removeObjectForKey:kOTRExpiresInKey];
|
|
||||||
NSDate *date = nil;
|
|
||||||
if (expiresIn) {
|
|
||||||
unsigned long deltaSeconds = [expiresIn unsignedLongValue];
|
|
||||||
if (deltaSeconds > 0) {
|
|
||||||
date = [NSDate dateWithTimeIntervalSinceNow:deltaSeconds];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(date) {
|
|
||||||
[mutableTokenDictionary setObject:date forKey:kOTRExpirationDateKey];
|
|
||||||
}
|
|
||||||
oAuthTokenDictionary = mutableTokenDictionary;
|
|
||||||
}
|
|
||||||
[super setOAuthTokenDictionary:oAuthTokenDictionary];
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary *)oAuthTokenDictionary
|
|
||||||
{
|
|
||||||
NSMutableDictionary * mutableTokenDictionary = [[super oAuthTokenDictionary] mutableCopy];
|
|
||||||
NSDate * expirationDate = [mutableTokenDictionary objectForKey:kOTRExpirationDateKey];
|
|
||||||
|
|
||||||
NSTimeInterval timeInterval = [expirationDate timeIntervalSinceDate:[NSDate date]];
|
|
||||||
mutableTokenDictionary[kOTRExpiresInKey] = @(timeInterval);
|
|
||||||
return mutableTokenDictionary;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(GTMOAuth2Authentication *)authToken
|
|
||||||
{
|
|
||||||
GTMOAuth2Authentication * auth = nil;
|
|
||||||
NSDictionary * tokenDictionary = [self oAuthTokenDictionary];
|
|
||||||
if ([tokenDictionary count]) {
|
|
||||||
auth = [[GTMOAuth2Authentication alloc] init];
|
|
||||||
[auth setParameters:[tokenDictionary mutableCopy]];
|
|
||||||
} else {
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
auth.clientID = [OTRBranding googleAppId];
|
|
||||||
auth.clientSecret = [OTRSecrets googleAppSecret];
|
|
||||||
auth.scope = [OTRBranding googleAppScope];
|
|
||||||
auth.tokenURL = [GTMOAuth2SignIn googleTokenURL];
|
|
||||||
return auth;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id)accountSpecificToken
|
|
||||||
{
|
|
||||||
return [self authToken];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setAccountSpecificToken:(id)accountSpecificToken
|
|
||||||
{
|
|
||||||
if ([accountSpecificToken isKindOfClass:[GTMOAuth2Authentication class]]) {
|
|
||||||
GTMOAuth2Authentication *token = (GTMOAuth2Authentication *)accountSpecificToken;
|
|
||||||
[self setOAuthTokenDictionary:token.parameters];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma - mark Class Methods
|
|
||||||
|
|
||||||
+ (NSString *)collection
|
|
||||||
{
|
|
||||||
return NSStringFromClass([OTRAccount class]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
|
@ -1,16 +0,0 @@
|
||||||
//
|
|
||||||
// OTROAuthXMPPAccount.h
|
|
||||||
// Off the Record
|
|
||||||
//
|
|
||||||
// Created by David Chiles on 3/28/14.
|
|
||||||
// Copyright (c) 2014 Chris Ballinger. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "OTRXMPPAccount.h"
|
|
||||||
|
|
||||||
@interface OTROAuthXMPPAccount : OTRXMPPAccount
|
|
||||||
|
|
||||||
@property (nonatomic, strong) NSDictionary *oAuthTokenDictionary;
|
|
||||||
@property (nonatomic, strong) id accountSpecificToken;
|
|
||||||
|
|
||||||
@end
|
|
|
@ -1,94 +0,0 @@
|
||||||
//
|
|
||||||
// OTROAuthXMPPAccount.m
|
|
||||||
// Off the Record
|
|
||||||
//
|
|
||||||
// Created by David Chiles on 3/28/14.
|
|
||||||
// Copyright (c) 2014 Chris Ballinger. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "OTROAuthXMPPAccount.h"
|
|
||||||
@import SAMKeychain;
|
|
||||||
#import "OTRLog.h"
|
|
||||||
#import "OTRConstants.h"
|
|
||||||
|
|
||||||
@implementation OTROAuthXMPPAccount
|
|
||||||
|
|
||||||
-(void)setPassword:(NSString *)password
|
|
||||||
{
|
|
||||||
if(![password length])
|
|
||||||
{
|
|
||||||
[self setOAuthTokenDictionary:nil];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-(NSString *)password
|
|
||||||
{
|
|
||||||
return [self accessTokenString];
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSString *)accessTokenString
|
|
||||||
{
|
|
||||||
return @"";
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void)setOAuthTokenDictionary:(NSDictionary *)oAuthTokenDictionary
|
|
||||||
{
|
|
||||||
if (![oAuthTokenDictionary count]) {
|
|
||||||
[super setPassword:nil];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
NSError *error = nil;
|
|
||||||
|
|
||||||
SAMKeychainQuery * keychainQuery = [self baseKeychainQuery];
|
|
||||||
|
|
||||||
keychainQuery.passwordObject = oAuthTokenDictionary;
|
|
||||||
|
|
||||||
[keychainQuery save:&error];
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
DDLogError(@"Error saving password to keychain: %@%@", [error localizedDescription], [error userInfo]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSDictionary *)oAuthTokenDictionary
|
|
||||||
{
|
|
||||||
NSError * error = nil;
|
|
||||||
NSDictionary *dictionary = nil;
|
|
||||||
|
|
||||||
SAMKeychainQuery * keychainQuery = [self baseKeychainQuery];
|
|
||||||
[keychainQuery fetch:&error];
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
DDLogError(@"Error retreiving password from keychain: %@%@", [error localizedDescription], [error userInfo]);
|
|
||||||
error = nil;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
dictionary = (NSDictionary *)keychainQuery.passwordObject;
|
|
||||||
}
|
|
||||||
return dictionary;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(SAMKeychainQuery *)baseKeychainQuery
|
|
||||||
{
|
|
||||||
SAMKeychainQuery * keychainQuery = [[SAMKeychainQuery alloc] init];
|
|
||||||
keychainQuery.service = kOTRServiceName;
|
|
||||||
keychainQuery.account = self.uniqueId;
|
|
||||||
return keychainQuery;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#pragma - mark Class Methods
|
|
||||||
|
|
||||||
+ (NSString *)collection
|
|
||||||
{
|
|
||||||
return NSStringFromClass([OTRAccount class]);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (NSDictionary*) encodingBehaviorsByPropertyKey {
|
|
||||||
NSMutableDictionary *encodingBehaviors = [NSMutableDictionary dictionaryWithDictionary:[super encodingBehaviorsByPropertyKey]];
|
|
||||||
[encodingBehaviors setObject:@(MTLModelEncodingBehaviorExcluded) forKey:NSStringFromSelector(@selector(accountSpecificToken))];
|
|
||||||
[encodingBehaviors setObject:@(MTLModelEncodingBehaviorExcluded) forKey:NSStringFromSelector(@selector(oAuthTokenDictionary))];
|
|
||||||
return encodingBehaviors;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
|
@ -9,7 +9,7 @@
|
||||||
#import "OTRXMPPAccount.h"
|
#import "OTRXMPPAccount.h"
|
||||||
#import "OTRXMPPManager.h"
|
#import "OTRXMPPManager.h"
|
||||||
#import "OTRConstants.h"
|
#import "OTRConstants.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
@import OTRAssets;
|
@import OTRAssets;
|
||||||
|
|
||||||
@import XMPPFramework;
|
@import XMPPFramework;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#import "OMEMODevice.h"
|
#import "OMEMODevice.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
|
|
||||||
@implementation OMEMODevice
|
@implementation OMEMODevice
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
@import CocoaLumberjack;
|
@import CocoaLumberjack;
|
||||||
#import "OTRLog.h"
|
#import "OTRLog.h"
|
||||||
#import "OTRMessageEncryptionInfo.h"
|
#import "OTRMessageEncryptionInfo.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
|
|
||||||
@interface OTRBaseMessage()
|
@interface OTRBaseMessage()
|
||||||
@property (nonatomic) BOOL transportedSecurely;
|
@property (nonatomic) BOOL transportedSecurely;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
@import YapDatabase;
|
@import YapDatabase;
|
||||||
#import "OTRImages.h"
|
#import "OTRImages.h"
|
||||||
@import JSQMessagesViewController;
|
@import JSQMessagesViewController;
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
@import OTRKit;
|
@import OTRKit;
|
||||||
#import "OTRLog.h"
|
#import "OTRLog.h"
|
||||||
#import "OTRColors.h"
|
#import "OTRColors.h"
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#import "OTRImages.h"
|
#import "OTRImages.h"
|
||||||
#import "OTRDownloadMessage.h"
|
#import "OTRDownloadMessage.h"
|
||||||
#import "UIActivity+ChatSecure.h"
|
#import "UIActivity+ChatSecure.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
|
|
||||||
@interface OTRDirectDownloadMessage()
|
@interface OTRDirectDownloadMessage()
|
||||||
@property (nonatomic, strong, readonly) NSString *parentMessageKey;
|
@property (nonatomic, strong, readonly) NSString *parentMessageKey;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
@import OTRAssets;
|
@import OTRAssets;
|
||||||
#import "OTRLog.h"
|
#import "OTRLog.h"
|
||||||
#import "OTRMediaItem+Private.h"
|
#import "OTRMediaItem+Private.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
|
|
||||||
@interface OTRHTMLMetadata : NSObject
|
@interface OTRHTMLMetadata : NSObject
|
||||||
@property (nonatomic, strong, nullable) NSString *title;
|
@property (nonatomic, strong, nullable) NSString *title;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
@import MobileCoreServices;
|
@import MobileCoreServices;
|
||||||
@import OTRAssets;
|
@import OTRAssets;
|
||||||
#import "OTRDatabaseManager.h"
|
#import "OTRDatabaseManager.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
|
|
||||||
static NSString* GetExtensionForMimeType(NSString* mimeType) {
|
static NSString* GetExtensionForMimeType(NSString* mimeType) {
|
||||||
NSCParameterAssert(mimeType.length > 0);
|
NSCParameterAssert(mimeType.length > 0);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#import "OTROutgoingMessage.h"
|
#import "OTROutgoingMessage.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
#import "OTRMessageEncryptionInfo.h"
|
#import "OTRMessageEncryptionInfo.h"
|
||||||
|
|
||||||
@implementation OTROutgoingMessage
|
@implementation OTROutgoingMessage
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#import "OTRXMPPBuddy.h"
|
#import "OTRXMPPBuddy.h"
|
||||||
#import "OTRBuddyCache.h"
|
#import "OTRBuddyCache.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
@import XMPPFramework;
|
@import XMPPFramework;
|
||||||
@import OTRAssets;
|
@import OTRAssets;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
@import YapDatabase;
|
@import YapDatabase;
|
||||||
#import "OTRDatabaseManager.h"
|
#import "OTRDatabaseManager.h"
|
||||||
#import "OTRXMPPAccount.h"
|
#import "OTRXMPPAccount.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
|
|
||||||
const struct OTRXMPPPresenceSubscriptionRequestAttributes OTRXMPPPresenceSubscriptionRequestAttributes = {
|
const struct OTRXMPPPresenceSubscriptionRequestAttributes OTRXMPPPresenceSubscriptionRequestAttributes = {
|
||||||
.date = @"date",
|
.date = @"date",
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#import "OTRYapMessageSendAction.h"
|
#import "OTRYapMessageSendAction.h"
|
||||||
#import "OTRBuddy.h"
|
#import "OTRBuddy.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
|
|
||||||
@interface OTRYapMessageSendAction()
|
@interface OTRYapMessageSendAction()
|
||||||
@property (nonatomic, strong, nonnull) NSString *buddyKey DEPRECATED_MSG_ATTRIBUTE("Deprecated in favor of threadKey");
|
@property (nonatomic, strong, nonnull) NSString *buddyKey DEPRECATED_MSG_ATTRIBUTE("Deprecated in favor of threadKey");
|
||||||
|
|
|
@ -10,7 +10,7 @@ import Foundation
|
||||||
import YapTaskQueue
|
import YapTaskQueue
|
||||||
import YapDatabase
|
import YapDatabase
|
||||||
|
|
||||||
public extension OTRYapMessageSendAction: YapDatabaseRelationshipNode {
|
extension OTRYapMessageSendAction: YapDatabaseRelationshipNode {
|
||||||
|
|
||||||
// Relationship only really used to make sure tasks are deleted when messages are deleted
|
// Relationship only really used to make sure tasks are deleted when messages are deleted
|
||||||
public func yapDatabaseRelationshipEdges() -> [YapDatabaseRelationshipEdge]? {
|
public func yapDatabaseRelationshipEdges() -> [YapDatabaseRelationshipEdge]? {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#import "OTRSignalSignedPreKey.h"
|
#import "OTRSignalSignedPreKey.h"
|
||||||
#import "OTRAccount.h"
|
#import "OTRAccount.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
|
|
||||||
@implementation OTRSignalSignedPreKey
|
@implementation OTRSignalSignedPreKey
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
@import XMPPFramework;
|
@import XMPPFramework;
|
||||||
#import "OTRProtocolManager.h"
|
#import "OTRProtocolManager.h"
|
||||||
#import "OTRInviteViewController.h"
|
#import "OTRInviteViewController.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
#import "OTRMessagesViewController.h"
|
#import "OTRMessagesViewController.h"
|
||||||
#import "OTRXMPPTorAccount.h"
|
#import "OTRXMPPTorAccount.h"
|
||||||
@import OTRAssets;
|
@import OTRAssets;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#import "OMEMODevice.h"
|
#import "OMEMODevice.h"
|
||||||
#import "OTRBuddyCache.h"
|
#import "OTRBuddyCache.h"
|
||||||
#import "OTRPasswordGenerator.h"
|
#import "OTRPasswordGenerator.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
@import OTRAssets;
|
@import OTRAssets;
|
||||||
|
|
||||||
@implementation OTRChatDemo
|
@implementation OTRChatDemo
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
@import XMPPFramework;
|
@import XMPPFramework;
|
||||||
@import OTRAssets;
|
@import OTRAssets;
|
||||||
|
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
|
|
||||||
NSString *const OTRXMPPErrorDomain = @"OTRXMPPErrorDomain";
|
NSString *const OTRXMPPErrorDomain = @"OTRXMPPErrorDomain";
|
||||||
NSString *const OTRXMPPXMLErrorKey = @"OTRXMPPXMLErrorKey";
|
NSString *const OTRXMPPXMLErrorKey = @"OTRXMPPXMLErrorKey";
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#import "OTRAccount.h"
|
#import "OTRAccount.h"
|
||||||
@import MBProgressHUD;
|
@import MBProgressHUD;
|
||||||
#import "OTRXLFormCreator.h"
|
#import "OTRXLFormCreator.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
#import "OTRXMPPServerInfo.h"
|
#import "OTRXMPPServerInfo.h"
|
||||||
#import "OTRXMPPAccount.h"
|
#import "OTRXMPPAccount.h"
|
||||||
@import OTRAssets;
|
@import OTRAssets;
|
||||||
|
|
|
@ -14,9 +14,6 @@
|
||||||
#import "OTRXLFormCreator.h"
|
#import "OTRXLFormCreator.h"
|
||||||
#import "OTRXMPPLoginHandler.h"
|
#import "OTRXMPPLoginHandler.h"
|
||||||
#import "OTRXMPPCreateAccountHandler.h"
|
#import "OTRXMPPCreateAccountHandler.h"
|
||||||
#import "OTRGoogleOAuthXMPPAccount.h"
|
|
||||||
#import "OTRGoolgeOAuthLoginHandler.h"
|
|
||||||
@import gtm_oauth2;
|
|
||||||
#import "OTRDatabaseManager.h"
|
#import "OTRDatabaseManager.h"
|
||||||
#import "OTRWelcomeAccountTableViewDelegate.h"
|
#import "OTRWelcomeAccountTableViewDelegate.h"
|
||||||
@import OTRAssets;
|
@import OTRAssets;
|
||||||
|
@ -105,34 +102,6 @@
|
||||||
[strongSelf.navigationController pushViewController:loginViewController animated:YES];
|
[strongSelf.navigationController pushViewController:loginViewController animated:YES];
|
||||||
}]];
|
}]];
|
||||||
|
|
||||||
[accountArray addObject:[OTRWelcomeAccountInfo accountInfoWithText:@"Google" image:[UIImage imageNamed:@"gtalk" inBundle:[OTRAssets resourcesBundle] compatibleWithTraitCollection:nil] didSelectBlock:^{
|
|
||||||
__typeof__(self) strongSelf = weakSelf;
|
|
||||||
//Authenicate and go through google oauth
|
|
||||||
GTMOAuth2ViewControllerTouch * oauthViewController = [GTMOAuth2ViewControllerTouch controllerWithScope:[OTRBranding googleAppScope] clientID:[OTRBranding googleAppId] clientSecret:[OTRSecrets googleAppSecret] keychainItemName:nil completionHandler:^(GTMOAuth2ViewControllerTouch *viewController, GTMOAuth2Authentication *auth, NSError *error) {
|
|
||||||
if (!error) {
|
|
||||||
OTRGoogleOAuthXMPPAccount *googleAccount = [[OTRGoogleOAuthXMPPAccount alloc] initWithUsername:auth.userEmail accountType:OTRAccountTypeGoogleTalk];
|
|
||||||
googleAccount.oAuthTokenDictionary = auth.parameters;
|
|
||||||
|
|
||||||
[[OTRDatabaseManager sharedInstance].writeConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
|
||||||
[googleAccount saveWithTransaction:transaction];
|
|
||||||
}];
|
|
||||||
|
|
||||||
OTRBaseLoginViewController *loginViewController = [[OTRBaseLoginViewController alloc] initWithAccount:googleAccount];
|
|
||||||
OTRGoolgeOAuthLoginHandler *loginHandler = [[OTRGoolgeOAuthLoginHandler alloc] init];
|
|
||||||
loginViewController.loginHandler = loginHandler;
|
|
||||||
|
|
||||||
NSMutableArray *viewControllers = [strongSelf.navigationController.viewControllers mutableCopy];
|
|
||||||
[viewControllers removeObject:viewController];
|
|
||||||
[viewControllers addObject:loginViewController];
|
|
||||||
[strongSelf.navigationController setViewControllers:viewControllers animated:YES];
|
|
||||||
}
|
|
||||||
}];
|
|
||||||
[oauthViewController setPopViewBlock:^{
|
|
||||||
|
|
||||||
}];
|
|
||||||
[strongSelf.navigationController pushViewController:oauthViewController animated:YES];
|
|
||||||
}]];
|
|
||||||
|
|
||||||
return accountArray;
|
return accountArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
//
|
|
||||||
// OTRGoolgeOAuthLoginHandler.h
|
|
||||||
// ChatSecure
|
|
||||||
//
|
|
||||||
// Created by David Chiles on 5/13/15.
|
|
||||||
// Copyright (c) 2015 Chris Ballinger. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
@import Foundation;
|
|
||||||
#import "OTRXMPPLoginHandler.h"
|
|
||||||
|
|
||||||
@interface OTRGoolgeOAuthLoginHandler : OTRXMPPLoginHandler
|
|
||||||
|
|
||||||
@end
|
|
|
@ -1,36 +0,0 @@
|
||||||
//
|
|
||||||
// OTRGoolgeOAuthLoginHandler.m
|
|
||||||
// ChatSecure
|
|
||||||
//
|
|
||||||
// Created by David Chiles on 5/13/15.
|
|
||||||
// Copyright (c) 2015 Chris Ballinger. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "OTRGoolgeOAuthLoginHandler.h"
|
|
||||||
#import "OTRGoogleOAuthXMPPAccount.h"
|
|
||||||
#import "OTROAuthRefresher.h"
|
|
||||||
#import "OTRXMPPLoginHandler.h"
|
|
||||||
#import "OTRXMPPManager.h"
|
|
||||||
|
|
||||||
@implementation OTRGoolgeOAuthLoginHandler
|
|
||||||
|
|
||||||
- (void)performActionWithValidForm:(XLFormDescriptor *)form account:(OTROAuthXMPPAccount *)account progress:(void (^)(NSInteger progress, NSString *summaryString))progress completion:(void (^)(OTRAccount * account, NSError *error))completion
|
|
||||||
{
|
|
||||||
[OTROAuthRefresher refreshAccount:account completion:^(id token, NSError *error) {
|
|
||||||
if (!error) {
|
|
||||||
account.accountSpecificToken = token;
|
|
||||||
[super performActionWithValidForm:form account:account progress:progress completion:completion];
|
|
||||||
} else if (completion) {
|
|
||||||
//Error refreshing account
|
|
||||||
completion(account, error);
|
|
||||||
}
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Override superclass to prevent password clash
|
|
||||||
- (void) finishConnectingWithForm:(XLFormDescriptor *)form account:(OTRXMPPAccount *)account {
|
|
||||||
[self prepareForXMPPConnectionFrom:form account:account];
|
|
||||||
[self.xmppManager connectUserInitiated:YES];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
|
@ -8,19 +8,15 @@
|
||||||
|
|
||||||
#import "OTRLoginHandler.h"
|
#import "OTRLoginHandler.h"
|
||||||
#import "OTRXMPPLoginHandler.h"
|
#import "OTRXMPPLoginHandler.h"
|
||||||
#import "OTRGoolgeOAuthLoginHandler.h"
|
|
||||||
#import "OTRAccount.h"
|
#import "OTRAccount.h"
|
||||||
#import "OTRXMPPAccount.h"
|
#import "OTRXMPPAccount.h"
|
||||||
#import "OTRGoogleOAuthXMPPAccount.h"
|
|
||||||
|
|
||||||
@implementation OTRLoginHandler
|
@implementation OTRLoginHandler
|
||||||
|
|
||||||
+ (id<OTRBaseLoginViewControllerHandlerProtocol>)loginHandlerForAccount:(OTRAccount *)account
|
+ (id<OTRBaseLoginViewControllerHandlerProtocol>)loginHandlerForAccount:(OTRAccount *)account
|
||||||
{
|
{
|
||||||
id<OTRBaseLoginViewControllerHandlerProtocol>loginHandler = nil;
|
id<OTRBaseLoginViewControllerHandlerProtocol>loginHandler = nil;
|
||||||
if (account.accountType == OTRAccountTypeGoogleTalk) {
|
if (account.accountType == OTRAccountTypeJabber || account.accountType == OTRAccountTypeXMPPTor) {
|
||||||
loginHandler = [[OTRGoolgeOAuthLoginHandler alloc] init];
|
|
||||||
} else if (account.accountType == OTRAccountTypeJabber || account.accountType == OTRAccountTypeXMPPTor) {
|
|
||||||
loginHandler = [[OTRXMPPLoginHandler alloc] init];
|
loginHandler = [[OTRXMPPLoginHandler alloc] init];
|
||||||
}
|
}
|
||||||
NSParameterAssert(loginHandler != nil);
|
NSParameterAssert(loginHandler != nil);
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#import "OTRImages.h"
|
#import "OTRImages.h"
|
||||||
#import "OTRXMPPServerListViewController.h"
|
#import "OTRXMPPServerListViewController.h"
|
||||||
#import "OTRXMPPServerInfo.h"
|
#import "OTRXMPPServerInfo.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
|
|
||||||
#import "OTRXMPPTorAccount.h"
|
#import "OTRXMPPTorAccount.h"
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#import "OTRProtocolManager.h"
|
#import "OTRProtocolManager.h"
|
||||||
#import "OTRDatabaseManager.h"
|
#import "OTRDatabaseManager.h"
|
||||||
#import "OTRPasswordGenerator.h"
|
#import "OTRPasswordGenerator.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
@import XMPPFramework;
|
@import XMPPFramework;
|
||||||
#import "OTRXMPPServerInfo.h"
|
#import "OTRXMPPServerInfo.h"
|
||||||
#import "OTRXMPPTorAccount.h"
|
#import "OTRXMPPTorAccount.h"
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#import "OTRAccountsManager.h"
|
#import "OTRAccountsManager.h"
|
||||||
#import "OTRAccount.h"
|
#import "OTRAccount.h"
|
||||||
@import PureLayout;
|
@import PureLayout;
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
|
|
||||||
|
|
||||||
@interface OTRChooseAccountViewController () <UITableViewDataSource, UITableViewDelegate>
|
@interface OTRChooseAccountViewController () <UITableViewDataSource, UITableViewDelegate>
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#import "OTRChooseAccountViewController.h"
|
#import "OTRChooseAccountViewController.h"
|
||||||
#import "UITableView+ChatSecure.h"
|
#import "UITableView+ChatSecure.h"
|
||||||
|
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
|
|
||||||
@import OTRAssets;
|
@import OTRAssets;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#import "OTRAppDelegate.h"
|
#import "OTRAppDelegate.h"
|
||||||
#import "OTRProtocolManager.h"
|
#import "OTRProtocolManager.h"
|
||||||
#import "OTRInviteViewController.h"
|
#import "OTRInviteViewController.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
@import OTRAssets;
|
@import OTRAssets;
|
||||||
|
|
||||||
#import "OTRXMPPManager.h"
|
#import "OTRXMPPManager.h"
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#import "OTRColors.h"
|
#import "OTRColors.h"
|
||||||
@import OTRAssets;
|
@import OTRAssets;
|
||||||
|
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
|
|
||||||
static CGFloat const kOTRInvitePadding = 10;
|
static CGFloat const kOTRInvitePadding = 10;
|
||||||
static CGFloat const kOTRButtonHeight = 40;
|
static CGFloat const kOTRButtonHeight = 40;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#import "OTRXMPPManager.h"
|
#import "OTRXMPPManager.h"
|
||||||
#import "OTRXMPPAccount.h"
|
#import "OTRXMPPAccount.h"
|
||||||
|
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
|
|
||||||
static Float64 kOTRMessagesMinimumAudioTime = .5;
|
static Float64 kOTRMessagesMinimumAudioTime = .5;
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
#import "UIImage+ChatSecure.h"
|
#import "UIImage+ChatSecure.h"
|
||||||
#import "OTRBaseLoginViewController.h"
|
#import "OTRBaseLoginViewController.h"
|
||||||
|
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
#import "OTRYapMessageSendAction.h"
|
#import "OTRYapMessageSendAction.h"
|
||||||
#import "UIViewController+ChatSecure.h"
|
#import "UIViewController+ChatSecure.h"
|
||||||
#import "OTRBuddyCache.h"
|
#import "OTRBuddyCache.h"
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
@import XMPPFramework;
|
@import XMPPFramework;
|
||||||
|
|
||||||
#import "NSURL+ChatSecure.h"
|
#import "NSURL+ChatSecure.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
|
|
||||||
@interface OTRNewBuddyViewController () <QRCodeReaderDelegate>
|
@interface OTRNewBuddyViewController () <QRCodeReaderDelegate>
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
#import "OTRDonateSetting.h"
|
#import "OTRDonateSetting.h"
|
||||||
@import KVOController;
|
@import KVOController;
|
||||||
#import "OTRInviteViewController.h"
|
#import "OTRInviteViewController.h"
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
@import OTRAssets;
|
@import OTRAssets;
|
||||||
@import MobileCoreServices;
|
@import MobileCoreServices;
|
||||||
|
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
//
|
|
||||||
// OTRStoreViewController.h
|
|
||||||
// Off the Record
|
|
||||||
//
|
|
||||||
// Created by Christopher Ballinger on 9/28/12.
|
|
||||||
// Copyright (c) 2012 Chris Ballinger. All rights reserved.
|
|
||||||
//
|
|
||||||
// This file is part of ChatSecure.
|
|
||||||
//
|
|
||||||
// ChatSecure is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// ChatSecure is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with ChatSecure. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
|
||||||
#import <StoreKit/StoreKit.h>
|
|
||||||
#import "OTRStoreTableViewCell.h"
|
|
||||||
#import "OTRPurchaseController.h"
|
|
||||||
#import "OTRPushController.h"
|
|
||||||
|
|
||||||
@interface OTRStoreViewController : UIViewController <UITableViewDataSource, UITableViewDelegate, OTRPurchaseControllerDelegate>
|
|
||||||
|
|
||||||
@property (nonatomic, weak) OTRPurchaseController *purchaseController;
|
|
||||||
@property (nonatomic, weak) OTRPushController *pushController;
|
|
||||||
@property (nonatomic, weak) NSArray *products;
|
|
||||||
@property (nonatomic, strong) UITableView *productTableView;
|
|
||||||
|
|
||||||
@end
|
|
|
@ -1,186 +0,0 @@
|
||||||
//
|
|
||||||
// OTRStoreViewController.m
|
|
||||||
// Off the Record
|
|
||||||
//
|
|
||||||
// Created by Christopher Ballinger on 9/28/12.
|
|
||||||
// Copyright (c) 2012 Chris Ballinger. All rights reserved.
|
|
||||||
//
|
|
||||||
// This file is part of ChatSecure.
|
|
||||||
//
|
|
||||||
// ChatSecure is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// ChatSecure is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with ChatSecure. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#import "OTRStoreViewController.h"
|
|
||||||
#import "MBProgressHUD.h"
|
|
||||||
#import "Strings.h"
|
|
||||||
#import "OTRPushAccessViewController.h"
|
|
||||||
#import "OTRConstants.h"
|
|
||||||
|
|
||||||
enum {
|
|
||||||
ACCOUNT_INFO_SECTION = 0,
|
|
||||||
PATS_SECTION,
|
|
||||||
PRODUCTS_SECTION
|
|
||||||
};
|
|
||||||
|
|
||||||
enum {
|
|
||||||
ACCOUNT_INFO_ACCOUNT_ROW = 0,
|
|
||||||
ACCOUNT_INFO_PASSWORD_ROW,
|
|
||||||
ACCOUNT_INFO_EXPIRATION_ROW
|
|
||||||
};
|
|
||||||
|
|
||||||
@interface OTRStoreViewController ()
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation OTRStoreViewController
|
|
||||||
@synthesize productTableView, products, purchaseController, pushController;
|
|
||||||
|
|
||||||
- (void) dealloc {
|
|
||||||
self.productTableView = nil;
|
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id)init {
|
|
||||||
if(self = [super init]) {
|
|
||||||
self.productTableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
|
|
||||||
self.productTableView.delegate = self;
|
|
||||||
self.productTableView.dataSource = self;
|
|
||||||
self.title = STORE_STRING;
|
|
||||||
self.purchaseController = [OTRPurchaseController sharedInstance];
|
|
||||||
self.pushController = [OTRPushController sharedInstance];
|
|
||||||
purchaseController.delegate = self;
|
|
||||||
self.products = [NSArray array];
|
|
||||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:RESTORE_STRING style:UIBarButtonItemStyleBordered target:self action:@selector(restorePurchases:)];
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receivedProductUpdateNotification:) name:kOTRPurchaseControllerProductUpdateNotification object:purchaseController];
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receivedProductUpdateNotification:) name:kOTRPushAccountUpdateNotification object:pushController];
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) receivedProductUpdateNotification:(NSNotification*)notification {
|
|
||||||
[self.productTableView reloadData];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) loadView {
|
|
||||||
[super loadView];
|
|
||||||
[self.view addSubview:productTableView];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) hideHUD {
|
|
||||||
[MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) showHUD {
|
|
||||||
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) restorePurchases:(id)sender {
|
|
||||||
[purchaseController restorePurchases];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) viewWillAppear:(BOOL)animated {
|
|
||||||
[super viewWillAppear:animated];
|
|
||||||
self.productTableView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
|
|
||||||
self.productTableView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
|
|
||||||
[self showHUD];
|
|
||||||
[purchaseController requestProducts];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (UITableViewCell*) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
||||||
if (indexPath.section == ACCOUNT_INFO_SECTION) {
|
|
||||||
static NSString *cellIdentifier = @"InfoCellIdentifier";
|
|
||||||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
|
|
||||||
if (!cell) {
|
|
||||||
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
|
|
||||||
}
|
|
||||||
if (indexPath.row == ACCOUNT_INFO_ACCOUNT_ROW) {
|
|
||||||
cell.textLabel.text = ACCOUNT_ID_STRING;
|
|
||||||
cell.detailTextLabel.text = pushController.accountID;
|
|
||||||
} else if (indexPath.row == ACCOUNT_INFO_PASSWORD_ROW) {
|
|
||||||
cell.textLabel.text = PASSWORD_STRING;
|
|
||||||
cell.detailTextLabel.text = pushController.password;
|
|
||||||
} else if (indexPath.row == ACCOUNT_INFO_EXPIRATION_ROW) {
|
|
||||||
cell.textLabel.text = EXPIRATION_TITLE_STRING;
|
|
||||||
cell.detailTextLabel.text = [pushController.expirationDate description];
|
|
||||||
}
|
|
||||||
return cell;
|
|
||||||
}
|
|
||||||
if (indexPath.section == PRODUCTS_SECTION) {
|
|
||||||
static NSString *cellIdentifier = @"StoreCellIdentifier";
|
|
||||||
OTRStoreTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
|
|
||||||
if (!cell) {
|
|
||||||
cell = [[OTRStoreTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
|
|
||||||
}
|
|
||||||
SKProduct *product = [products objectAtIndex:indexPath.row];
|
|
||||||
cell.product = product;
|
|
||||||
return cell;
|
|
||||||
}
|
|
||||||
if (indexPath.section == PATS_SECTION) {
|
|
||||||
static NSString *cellIdentifier = @"CellIdentifier";
|
|
||||||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
|
|
||||||
if (!cell) {
|
|
||||||
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
|
|
||||||
}
|
|
||||||
cell.textLabel.text = PATS_SECTION_STRING;
|
|
||||||
return cell;
|
|
||||||
}
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
||||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
|
||||||
if (indexPath.section == PATS_SECTION) {
|
|
||||||
OTRPushAccessViewController *patViewController = [[OTRPushAccessViewController alloc] init];
|
|
||||||
[self.navigationController pushViewController:patViewController animated:YES];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString*) tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
|
|
||||||
if (section == ACCOUNT_INFO_SECTION) {
|
|
||||||
return ACCOUNT_INFO_STRING;
|
|
||||||
} else if (section == PRODUCTS_SECTION) {
|
|
||||||
return PRODUCTS_SECTION_STRING;
|
|
||||||
} else if (section == PATS_SECTION) {
|
|
||||||
return PATS_SECTION_STRING;
|
|
||||||
}
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|
||||||
if (section == ACCOUNT_INFO_SECTION) {
|
|
||||||
return 3;
|
|
||||||
} else if (section == PRODUCTS_SECTION) {
|
|
||||||
return [products count];
|
|
||||||
} else if (section == PATS_SECTION) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)didReceiveMemoryWarning
|
|
||||||
{
|
|
||||||
[super didReceiveMemoryWarning];
|
|
||||||
// Dispose of any resources that can be recreated.
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) productsUpdated:(NSArray*)newProducts {
|
|
||||||
self.products = newProducts;
|
|
||||||
[self hideHUD];
|
|
||||||
[self.productTableView reloadData];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
|
@ -1,466 +0,0 @@
|
||||||
//
|
|
||||||
// OMEMODeviceVerificationViewController.swift
|
|
||||||
// ChatSecure
|
|
||||||
//
|
|
||||||
// Created by Chris Ballinger on 10/13/16.
|
|
||||||
// Copyright © 2016 Chris Ballinger. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
import XLForm
|
|
||||||
import YapDatabase
|
|
||||||
import OTRAssets
|
|
||||||
|
|
||||||
open class KeyManagementViewController: XLFormViewController {
|
|
||||||
|
|
||||||
@objc open var completionBlock: (()->Void)?
|
|
||||||
|
|
||||||
// Crypto Chooser row tags
|
|
||||||
open static let DefaultRowTag = "DefaultRowTag"
|
|
||||||
open static let PlaintextRowTag = "PlaintextRowTag"
|
|
||||||
open static let OTRRowTag = "OTRRowTag"
|
|
||||||
open static let OMEMORowTag = "OMEMORowTag"
|
|
||||||
open static let ShowAdvancedCryptoSettingsTag = "ShowAdvancedCryptoSettingsTag"
|
|
||||||
|
|
||||||
open let accountKey:String
|
|
||||||
open var readConnection: YapDatabaseConnection
|
|
||||||
open var writeConnection: YapDatabaseConnection
|
|
||||||
|
|
||||||
lazy var signalCoordinator:OTROMEMOSignalCoordinator? = {
|
|
||||||
var account:OTRAccount? = nil
|
|
||||||
self.readConnection.read { (transaction) in
|
|
||||||
account = OTRAccount.fetchObject(withUniqueID: self.accountKey, transaction: transaction)
|
|
||||||
}
|
|
||||||
|
|
||||||
guard let acct = account else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
guard let xmpp = OTRProtocolManager.sharedInstance().protocol(for: acct) as? XMPPManager else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return xmpp.omemoSignalCoordinator
|
|
||||||
}()
|
|
||||||
|
|
||||||
@objc public init(accountKey:String,
|
|
||||||
readConnection: YapDatabaseConnection,
|
|
||||||
writeConnection:YapDatabaseConnection,
|
|
||||||
form: XLFormDescriptor) {
|
|
||||||
self.accountKey = accountKey
|
|
||||||
self.readConnection = readConnection
|
|
||||||
self.writeConnection = writeConnection
|
|
||||||
super.init(nibName: nil, bundle: nil)
|
|
||||||
|
|
||||||
self.form = form
|
|
||||||
}
|
|
||||||
|
|
||||||
required public init!(coder aDecoder: NSCoder!) {
|
|
||||||
fatalError("init(coder:) has not been implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
open override func viewDidLoad() {
|
|
||||||
// gotta register cell before super
|
|
||||||
OMEMODeviceFingerprintCell.registerCellClass(OMEMODeviceFingerprintCell.defaultRowDescriptorType())
|
|
||||||
UserInfoProfileCell.registerCellClass(UserInfoProfileCell.defaultRowDescriptorType())
|
|
||||||
|
|
||||||
super.viewDidLoad()
|
|
||||||
self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(doneButtonPressed(_:)))
|
|
||||||
self.tableView.allowsMultipleSelectionDuringEditing = false
|
|
||||||
|
|
||||||
// Overriding superclass behaviour. This prevents the red icon on left of cell for deletion. Just want swipe to delete on device/fingerprint.
|
|
||||||
self.tableView.setEditing(false, animated: false)
|
|
||||||
}
|
|
||||||
|
|
||||||
open override func didReceiveMemoryWarning() {
|
|
||||||
super.didReceiveMemoryWarning()
|
|
||||||
// Dispose of any resources that can be recreated.
|
|
||||||
}
|
|
||||||
|
|
||||||
@objc open func doneButtonPressed(_ sender: AnyObject?) {
|
|
||||||
var devicesToSave: [OMEMODevice] = []
|
|
||||||
var otrFingerprintsToSave: [OTRFingerprint] = []
|
|
||||||
for (_, value) in form.formValues() {
|
|
||||||
switch value {
|
|
||||||
case let device as OMEMODevice:
|
|
||||||
devicesToSave.append(device)
|
|
||||||
case let fingerprint as OTRFingerprint:
|
|
||||||
otrFingerprintsToSave.append(fingerprint)
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
OTRDatabaseManager.sharedInstance().readWriteDatabaseConnection?.asyncReadWrite({ (t: YapDatabaseReadWriteTransaction) in
|
|
||||||
for viewedDevice in devicesToSave {
|
|
||||||
if var device = t.object(forKey: viewedDevice.uniqueId, inCollection: OMEMODevice.collection) as? OMEMODevice {
|
|
||||||
device = device.copy() as! OMEMODevice
|
|
||||||
device.trustLevel = viewedDevice.trustLevel
|
|
||||||
|
|
||||||
if (device.trustLevel == .trustedUser && device.isExpired()) {
|
|
||||||
device.lastSeenDate = viewedDevice.lastSeenDate
|
|
||||||
}
|
|
||||||
|
|
||||||
device.save(with: t)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
otrFingerprintsToSave.forEach { (fingerprint) in
|
|
||||||
OTRProtocolManager.encryptionManager.save(fingerprint)
|
|
||||||
}
|
|
||||||
if let completion = self.completionBlock {
|
|
||||||
completion()
|
|
||||||
}
|
|
||||||
dismiss(animated: true, completion: nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
fileprivate func isAbleToDeleteCellAtIndexPath(_ indexPath:IndexPath) -> Bool {
|
|
||||||
if let rowDescriptor = self.form.formRow(atIndex: indexPath) {
|
|
||||||
|
|
||||||
switch rowDescriptor.value {
|
|
||||||
case let device as OMEMODevice:
|
|
||||||
if let myBundle = self.signalCoordinator?.fetchMyBundle() {
|
|
||||||
// This is only used to compare so we don't allow delete UI on our device
|
|
||||||
let thisDeviceYapKey = OMEMODevice.yapKey(withDeviceId: NSNumber(value: myBundle.deviceId as UInt32), parentKey: self.accountKey, parentCollection: OTRAccount.collection)
|
|
||||||
if device.uniqueId != thisDeviceYapKey {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case let fingerprint as OTRFingerprint:
|
|
||||||
if (fingerprint.accountName != fingerprint.username) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
fileprivate func performEdit(_ action:UITableViewCellEditingStyle, indexPath:IndexPath) {
|
|
||||||
if ( action == .delete ) {
|
|
||||||
if let rowDescriptor = self.form.formRow(atIndex: indexPath) {
|
|
||||||
rowDescriptor.sectionDescriptor.removeFormRow(rowDescriptor)
|
|
||||||
switch rowDescriptor.value {
|
|
||||||
case let device as OMEMODevice:
|
|
||||||
|
|
||||||
self.signalCoordinator?.removeDevice([device], completion: { (success) in
|
|
||||||
|
|
||||||
})
|
|
||||||
break
|
|
||||||
case let fingerprint as OTRFingerprint:
|
|
||||||
do {
|
|
||||||
try OTRProtocolManager.encryptionManager.otrKit.delete(fingerprint)
|
|
||||||
} catch {
|
|
||||||
|
|
||||||
}
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
open static func cryptoChooserRows(_ buddy: OTRBuddy, connection: YapDatabaseConnection) -> [XLFormRowDescriptor] {
|
|
||||||
|
|
||||||
let bestAvailableRow = XLFormRowDescriptor(tag: DefaultRowTag, rowType: XLFormRowDescriptorTypeBooleanCheck, title: Best_Available())
|
|
||||||
let plaintextOnlyRow = XLFormRowDescriptor(tag: PlaintextRowTag, rowType: XLFormRowDescriptorTypeBooleanCheck, title: Plaintext_Only())
|
|
||||||
let plaintextOtrRow = XLFormRowDescriptor(tag: PlaintextRowTag, rowType: XLFormRowDescriptorTypeBooleanCheck, title: Plaintext_Opportunistic_OTR())
|
|
||||||
let otrRow = XLFormRowDescriptor(tag: OTRRowTag, rowType: XLFormRowDescriptorTypeBooleanCheck, title: "OTR")
|
|
||||||
let omemoRow = XLFormRowDescriptor(tag: OMEMORowTag, rowType: XLFormRowDescriptorTypeBooleanCheck, title: "OMEMO")
|
|
||||||
|
|
||||||
var hasDevices = false
|
|
||||||
|
|
||||||
connection.read { (transaction: YapDatabaseReadTransaction) in
|
|
||||||
if OMEMODevice.allDevices(forParentKey: buddy.uniqueId, collection: type(of: buddy).collection, transaction: transaction).count > 0 {
|
|
||||||
hasDevices = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!hasDevices) {
|
|
||||||
omemoRow.disabled = NSNumber(value: true as Bool)
|
|
||||||
}
|
|
||||||
|
|
||||||
let trueValue = NSNumber(value: true as Bool)
|
|
||||||
switch buddy.preferredSecurity {
|
|
||||||
case .plaintextOnly:
|
|
||||||
plaintextOnlyRow.value = trueValue
|
|
||||||
break
|
|
||||||
case .bestAvailable:
|
|
||||||
bestAvailableRow.value = trueValue
|
|
||||||
break
|
|
||||||
case .OTR:
|
|
||||||
otrRow.value = trueValue
|
|
||||||
break
|
|
||||||
case .OMEMO:
|
|
||||||
omemoRow.value = trueValue
|
|
||||||
break
|
|
||||||
case .omemOandOTR:
|
|
||||||
omemoRow.value = trueValue
|
|
||||||
break
|
|
||||||
case .plaintextWithOTR:
|
|
||||||
plaintextOtrRow.value = trueValue
|
|
||||||
}
|
|
||||||
|
|
||||||
let formRows = [bestAvailableRow, plaintextOnlyRow, plaintextOtrRow, otrRow, omemoRow]
|
|
||||||
|
|
||||||
var currentRow: XLFormRowDescriptor? = nil
|
|
||||||
var rowsToDeselect: NSMutableSet = NSMutableSet()
|
|
||||||
let onChangeBlock = { (oldValue: Any?, newValue: Any?, rowDescriptor: XLFormRowDescriptor) in
|
|
||||||
// Prevent infinite loops
|
|
||||||
// Allow deselection
|
|
||||||
if rowsToDeselect.count > 0 {
|
|
||||||
rowsToDeselect.remove(rowDescriptor)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if currentRow != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
currentRow = rowDescriptor
|
|
||||||
|
|
||||||
// Don't allow user to unselect a true value
|
|
||||||
if (newValue as AnyObject?)?.boolValue == false {
|
|
||||||
rowDescriptor.value = NSNumber(value: true as Bool)
|
|
||||||
currentRow = nil
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deselect other rows
|
|
||||||
rowsToDeselect = NSMutableSet(array: formRows.filter({ $0 != rowDescriptor }))
|
|
||||||
for row in rowsToDeselect {
|
|
||||||
guard let row = row as? XLFormRowDescriptor else {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
let newValue = NSNumber(value: false as Bool)
|
|
||||||
row.value = newValue
|
|
||||||
// Wow that's janky
|
|
||||||
(row.sectionDescriptor.formDescriptor.delegate as! XLFormViewControllerDelegate).reloadFormRow!(row)
|
|
||||||
}
|
|
||||||
|
|
||||||
var preferredSecurity: OTRSessionSecurity = .bestAvailable
|
|
||||||
if (plaintextOnlyRow.value as AnyObject?)?.boolValue == true {
|
|
||||||
preferredSecurity = .plaintextOnly
|
|
||||||
} else if (otrRow.value as AnyObject?)?.boolValue == true {
|
|
||||||
preferredSecurity = .OTR
|
|
||||||
} else if (omemoRow.value as AnyObject?)?.boolValue == true {
|
|
||||||
preferredSecurity = .OMEMO
|
|
||||||
} else if (bestAvailableRow.value as AnyObject?)?.boolValue == true {
|
|
||||||
preferredSecurity = .bestAvailable
|
|
||||||
} else if (plaintextOtrRow.value as AnyObject?)?.boolValue == true {
|
|
||||||
preferredSecurity = .plaintextWithOTR
|
|
||||||
}
|
|
||||||
|
|
||||||
OTRDatabaseManager.sharedInstance().readWriteDatabaseConnection?.readWrite({ (transaction: YapDatabaseReadWriteTransaction) in
|
|
||||||
guard var buddy = transaction.object(forKey: buddy.uniqueId, inCollection: type(of: buddy).collection) as? OTRBuddy else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
guard let account = buddy.account(with: transaction) else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
buddy = buddy.copy() as! OTRBuddy
|
|
||||||
buddy.preferredSecurity = preferredSecurity
|
|
||||||
buddy.save(with: transaction)
|
|
||||||
// Cancel OTR session if plaintext or omemo only
|
|
||||||
if (preferredSecurity == .plaintextOnly || preferredSecurity == .OMEMO) {
|
|
||||||
OTRProtocolManager.encryptionManager.otrKit.disableEncryption(withUsername: buddy.username, accountName: account.username, protocol: account.protocolTypeString())
|
|
||||||
}
|
|
||||||
})
|
|
||||||
currentRow = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
for row in formRows {
|
|
||||||
row.onChangeBlock = onChangeBlock
|
|
||||||
}
|
|
||||||
|
|
||||||
return formRows
|
|
||||||
}
|
|
||||||
|
|
||||||
//MARK UITableView Delegate overrides
|
|
||||||
|
|
||||||
open override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
|
|
||||||
if self.isAbleToDeleteCellAtIndexPath(indexPath) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
open override func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCellEditingStyle {
|
|
||||||
if self.isAbleToDeleteCellAtIndexPath(indexPath) {
|
|
||||||
return .delete
|
|
||||||
}
|
|
||||||
return .none
|
|
||||||
}
|
|
||||||
|
|
||||||
open override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
|
|
||||||
|
|
||||||
self.performEdit(editingStyle, indexPath: indexPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@objc open static func profileFormDescriptorForAccount(_ account: OTRAccount, buddies: [OTRBuddy], connection: YapDatabaseConnection) -> XLFormDescriptor {
|
|
||||||
let form = XLFormDescriptor(title: Profile_String())
|
|
||||||
|
|
||||||
let yourProfileSection = XLFormSectionDescriptor.formSection(withTitle: Me_String())
|
|
||||||
let yourProfileRow = XLFormRowDescriptor(tag: account.uniqueId, rowType: UserInfoProfileCell.defaultRowDescriptorType())
|
|
||||||
yourProfileRow.value = account
|
|
||||||
yourProfileSection.addFormRow(yourProfileRow)
|
|
||||||
|
|
||||||
guard let xmpp = OTRProtocolManager.sharedInstance().protocol(for: account) as? XMPPManager else {
|
|
||||||
return form
|
|
||||||
}
|
|
||||||
guard let myBundle = xmpp.omemoSignalCoordinator?.fetchMyBundle() else {
|
|
||||||
return form
|
|
||||||
}
|
|
||||||
let thisDevice = OMEMODevice(deviceId: NSNumber(value: myBundle.deviceId as UInt32), trustLevel: .trustedUser, parentKey: account.uniqueId, parentCollection: type(of: account).collection, publicIdentityKeyData: myBundle.identityKey, lastSeenDate: Date())
|
|
||||||
var ourDevices: [OMEMODevice] = []
|
|
||||||
connection.read { (transaction: YapDatabaseReadTransaction) in
|
|
||||||
ourDevices = OMEMODevice.allDevices(forParentKey: account.uniqueId, collection: type(of: account).collection, transaction: transaction)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let ourFilteredDevices = ourDevices.filter({ (device: OMEMODevice) -> Bool in
|
|
||||||
return device.uniqueId != thisDevice.uniqueId
|
|
||||||
})
|
|
||||||
|
|
||||||
// TODO - Sort ourDevices and theirDevices by lastSeen
|
|
||||||
|
|
||||||
let addDevicesToSection: ([OMEMODevice], XLFormSectionDescriptor) -> Void = { devices, section in
|
|
||||||
for device in devices {
|
|
||||||
guard let _ = device.publicIdentityKeyData else {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
let row = XLFormRowDescriptor(tag: device.uniqueId, rowType: OMEMODeviceFingerprintCell.defaultRowDescriptorType())
|
|
||||||
row.value = device.copy()
|
|
||||||
|
|
||||||
// Don't allow editing of your own device
|
|
||||||
if device.uniqueId == thisDevice.uniqueId {
|
|
||||||
row.disabled = true
|
|
||||||
}
|
|
||||||
|
|
||||||
section.addFormRow(row)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let otrKit = OTRProtocolManager.encryptionManager.otrKit
|
|
||||||
let allFingerprints = otrKit.allFingerprints()
|
|
||||||
let myFingerprint = otrKit.fingerprint(forAccountName: account.username, protocol: account.protocolTypeString())
|
|
||||||
let addFingerprintsToSection: ([OTRFingerprint], XLFormSectionDescriptor) -> Void = { fingerprints, section in
|
|
||||||
for fingerprint in fingerprints {
|
|
||||||
let row = XLFormRowDescriptor(tag: (fingerprint.fingerprint as NSData).otr_hexString(), rowType: OMEMODeviceFingerprintCell.defaultRowDescriptorType())
|
|
||||||
if let myFingerprint = myFingerprint {
|
|
||||||
if (fingerprint === myFingerprint) {
|
|
||||||
// We implicitly trust ourselves with OTR
|
|
||||||
row.disabled = true
|
|
||||||
} else {
|
|
||||||
row.disabled = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
row.value = fingerprint
|
|
||||||
|
|
||||||
section.addFormRow(row)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var allMyDevices: [OMEMODevice] = []
|
|
||||||
allMyDevices.append(thisDevice)
|
|
||||||
allMyDevices.append(contentsOf: ourFilteredDevices)
|
|
||||||
addDevicesToSection(allMyDevices, yourProfileSection)
|
|
||||||
|
|
||||||
var theirSections: [XLFormSectionDescriptor] = []
|
|
||||||
|
|
||||||
if let myFingerprint = myFingerprint {
|
|
||||||
addFingerprintsToSection([myFingerprint], yourProfileSection)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add section for each buddy's device
|
|
||||||
for buddy in buddies {
|
|
||||||
let theirSection = XLFormSectionDescriptor.formSection(withTitle: buddy.username)
|
|
||||||
|
|
||||||
let buddyRow = XLFormRowDescriptor(tag: buddy.uniqueId, rowType: UserInfoProfileCell.defaultRowDescriptorType())
|
|
||||||
buddyRow.value = buddy
|
|
||||||
theirSection.addFormRow(buddyRow)
|
|
||||||
var theirDevices: [OMEMODevice] = []
|
|
||||||
connection.read({ (transaction: YapDatabaseReadTransaction) in
|
|
||||||
theirDevices = OMEMODevice.allDevices(forParentKey: buddy.uniqueId, collection: type(of: buddy).collection, transaction: transaction)
|
|
||||||
})
|
|
||||||
let theirFingerprints = allFingerprints.filter({ (fingerprint: OTRFingerprint) -> Bool in
|
|
||||||
return fingerprint.username == buddy.username &&
|
|
||||||
fingerprint.accountName == account.username
|
|
||||||
})
|
|
||||||
|
|
||||||
addDevicesToSection(theirDevices, theirSection)
|
|
||||||
addFingerprintsToSection(theirFingerprints, theirSection)
|
|
||||||
theirSections.append(theirSection)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var sectionsToAdd: [XLFormSectionDescriptor] = []
|
|
||||||
sectionsToAdd.append(contentsOf: theirSections)
|
|
||||||
|
|
||||||
// cryptoChooserRows is only meaningful for 1:1 conversations at the moment
|
|
||||||
if buddies.count == 1 {
|
|
||||||
let buddy = buddies.first!
|
|
||||||
let cryptoSection = XLFormSectionDescriptor.formSection(withTitle: Advanced_Encryption_Settings())
|
|
||||||
cryptoSection.footerTitle = Advanced_Crypto_Warning()
|
|
||||||
let showAdvancedSwitch = XLFormRowDescriptor.init(tag: self.ShowAdvancedCryptoSettingsTag, rowType: XLFormRowDescriptorTypeBooleanSwitch, title: Show_Advanced_Encryption_Settings())
|
|
||||||
showAdvancedSwitch.value = NSNumber(value: false as Bool)
|
|
||||||
let cryptoChooser = cryptoChooserRows(buddy, connection: connection)
|
|
||||||
for row in cryptoChooser {
|
|
||||||
cryptoSection.addFormRow(row)
|
|
||||||
}
|
|
||||||
cryptoSection.hidden = "$\(ShowAdvancedCryptoSettingsTag)==0"
|
|
||||||
let buddySection = theirSections.first!
|
|
||||||
buddySection.addFormRow(showAdvancedSwitch)
|
|
||||||
sectionsToAdd.append(cryptoSection)
|
|
||||||
}
|
|
||||||
|
|
||||||
sectionsToAdd.append(yourProfileSection)
|
|
||||||
|
|
||||||
for section in sectionsToAdd {
|
|
||||||
if section.formRows.count > 0 {
|
|
||||||
form.addFormSection(section)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return form
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - UITableViewDelegate
|
|
||||||
|
|
||||||
open override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
|
||||||
super.tableView(tableView, didSelectRowAt: indexPath)
|
|
||||||
tableView.deselectRow(at: indexPath, animated: true)
|
|
||||||
guard let cell = self.tableView(tableView, cellForRowAt: indexPath) as? OMEMODeviceFingerprintCell else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var fingerprint = ""
|
|
||||||
var username = ""
|
|
||||||
var cryptoType = ""
|
|
||||||
if let device = cell.rowDescriptor.value as? OMEMODevice {
|
|
||||||
cryptoType = "OMEMO"
|
|
||||||
fingerprint = device.humanReadableFingerprint
|
|
||||||
self.readConnection.read({ (transaction) in
|
|
||||||
if let buddy = transaction.object(forKey: device.parentKey, inCollection: device.parentCollection) as? OTRBuddy {
|
|
||||||
username = buddy.username
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if let otrFingerprint = cell.rowDescriptor.value as? OTRFingerprint {
|
|
||||||
cryptoType = "OTR"
|
|
||||||
fingerprint = (otrFingerprint.fingerprint as NSData).humanReadableFingerprint()
|
|
||||||
username = otrFingerprint.username
|
|
||||||
}
|
|
||||||
if fingerprint.count == 0 || username.count == 0 || cryptoType.count == 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let stringToShare = "\(username): \(cryptoType) \(fingerprint)"
|
|
||||||
let activityViewController = UIActivityViewController(activityItems: [stringToShare], applicationActivities: nil)
|
|
||||||
if let ppc = activityViewController.popoverPresentationController {
|
|
||||||
ppc.sourceView = cell
|
|
||||||
ppc.sourceRect = cell.frame
|
|
||||||
}
|
|
||||||
present(activityViewController, animated: true, completion: nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -18,7 +18,7 @@
|
||||||
#import "OTRVideoItem.h"
|
#import "OTRVideoItem.h"
|
||||||
@import OTRAssets;
|
@import OTRAssets;
|
||||||
@import YapDatabase;
|
@import YapDatabase;
|
||||||
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
#import "ChatSecureCoreCompat-Swift.h"
|
||||||
|
|
||||||
@interface OTRConversationCell ()
|
@interface OTRConversationCell ()
|
||||||
|
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
//
|
|
||||||
// OTRStoreTableViewCell.h
|
|
||||||
// Off the Record
|
|
||||||
//
|
|
||||||
// Created by Christopher Ballinger on 9/28/12.
|
|
||||||
// Copyright (c) 2012 Chris Ballinger. All rights reserved.
|
|
||||||
//
|
|
||||||
// This file is part of ChatSecure.
|
|
||||||
//
|
|
||||||
// ChatSecure is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// ChatSecure is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with ChatSecure. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
|
||||||
#import <StoreKit/StoreKit.h>
|
|
||||||
|
|
||||||
@interface OTRStoreTableViewCell : UITableViewCell
|
|
||||||
|
|
||||||
@property (nonatomic, strong) SKProduct *product;
|
|
||||||
|
|
||||||
@end
|
|
|
@ -1,66 +0,0 @@
|
||||||
//
|
|
||||||
// OTRStoreTableViewCell.m
|
|
||||||
// Off the Record
|
|
||||||
//
|
|
||||||
// Created by Christopher Ballinger on 9/28/12.
|
|
||||||
// Copyright (c) 2012 Chris Ballinger. All rights reserved.
|
|
||||||
//
|
|
||||||
// This file is part of ChatSecure.
|
|
||||||
//
|
|
||||||
// ChatSecure is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// ChatSecure is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with ChatSecure. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#import "OTRStoreTableViewCell.h"
|
|
||||||
#import "OTRPurchaseController.h"
|
|
||||||
#import "Strings.h"
|
|
||||||
|
|
||||||
@implementation OTRStoreTableViewCell
|
|
||||||
@synthesize product;
|
|
||||||
|
|
||||||
- (void) setProduct:(SKProduct *)newProduct {
|
|
||||||
product = newProduct;
|
|
||||||
self.textLabel.text = product.localizedTitle;
|
|
||||||
self.detailTextLabel.text = product.localizedDescription;
|
|
||||||
|
|
||||||
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
|
|
||||||
[numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
|
|
||||||
[numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
|
|
||||||
[numberFormatter setLocale:product.priceLocale];
|
|
||||||
NSString *priceString = [numberFormatter stringFromNumber:product.price];
|
|
||||||
|
|
||||||
BOOL productPurchased = [[OTRPurchaseController sharedInstance] isProductIdentifierPurchased:product.productIdentifier];
|
|
||||||
if (productPurchased) {
|
|
||||||
priceString = PURCHASED_STRING;
|
|
||||||
}
|
|
||||||
|
|
||||||
UISegmentedControl *buyButton = [[UISegmentedControl alloc]initWithItems:@[priceString]];
|
|
||||||
buyButton.segmentedControlStyle = UISegmentedControlStyleBar;
|
|
||||||
buyButton.momentary = YES;
|
|
||||||
if (productPurchased) {
|
|
||||||
buyButton.enabled = NO;
|
|
||||||
} else {
|
|
||||||
[buyButton addTarget:self
|
|
||||||
action:@selector(buyButtonPressed:)
|
|
||||||
forControlEvents:UIControlEventValueChanged];
|
|
||||||
}
|
|
||||||
self.accessoryView = buyButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) buyButtonPressed:(id)sender {
|
|
||||||
UIActivityIndicatorView *activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
|
|
||||||
[activityView startAnimating];
|
|
||||||
self.accessoryView = activityView;
|
|
||||||
[[OTRPurchaseController sharedInstance] buyProduct:self.product];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
|
@ -1,6 +1,10 @@
|
||||||
name: Alamofire, nameSpecified:
|
name: AFNetworking, nameSpecified:
|
||||||
body: Copyright (c) 2014 A…
|
body: Copyright (c) 2011-2…
|
||||||
version: 4.8.2
|
version: 3.2.1
|
||||||
|
|
||||||
|
name: AFNetworking, nameSpecified:
|
||||||
|
body: Copyright (c) 2011-2…
|
||||||
|
version: 3.2.1
|
||||||
|
|
||||||
name: Alamofire, nameSpecified:
|
name: Alamofire, nameSpecified:
|
||||||
body: Copyright (c) 2014 A…
|
body: Copyright (c) 2014 A…
|
||||||
|
@ -18,15 +22,6 @@ name: Appirater, nameSpecified:
|
||||||
body: Copyright 2017. Aras…
|
body: Copyright 2017. Aras…
|
||||||
version: 2.3.1
|
version: 2.3.1
|
||||||
|
|
||||||
name: Appirater, nameSpecified:
|
|
||||||
body: Copyright 2017. Aras…
|
|
||||||
version: 2.3.1
|
|
||||||
|
|
||||||
name: ARChromeActivity, nameSpecified:
|
|
||||||
body: ARChromeActivity
|
|
||||||
Cop…
|
|
||||||
version: 1.0.6
|
|
||||||
|
|
||||||
name: ARChromeActivity, nameSpecified:
|
name: ARChromeActivity, nameSpecified:
|
||||||
body: ARChromeActivity
|
body: ARChromeActivity
|
||||||
Cop…
|
Cop…
|
||||||
|
@ -45,14 +40,6 @@ name: BBlock, nameSpecified:
|
||||||
body: Copyright (c) 2012 D…
|
body: Copyright (c) 2012 D…
|
||||||
version: 1.2.1
|
version: 1.2.1
|
||||||
|
|
||||||
name: BBlock, nameSpecified:
|
|
||||||
body: Copyright (c) 2012 D…
|
|
||||||
version: 1.2.1
|
|
||||||
|
|
||||||
name: BButton, nameSpecified:
|
|
||||||
body: BButton - copyright …
|
|
||||||
version: 4.0.2
|
|
||||||
|
|
||||||
name: BButton, nameSpecified:
|
name: BButton, nameSpecified:
|
||||||
body: BButton - copyright …
|
body: BButton - copyright …
|
||||||
version: 4.0.2
|
version: 4.0.2
|
||||||
|
@ -69,13 +56,13 @@ name: ChatSecure-Push-iOS, nameSpecified:
|
||||||
body: …
|
body: …
|
||||||
version: 1.1
|
version: 1.1
|
||||||
|
|
||||||
name: ChatSecure-Push-iOS, nameSpecified:
|
name: ChatSecureCore, nameSpecified:
|
||||||
body: …
|
body: ChatSecure, an OTR-c…
|
||||||
version: 1.1
|
version: 0.1.0
|
||||||
|
|
||||||
name: CocoaAsyncSocket, nameSpecified:
|
name: ChatSecureCore, nameSpecified:
|
||||||
body: Public Domain Licens…
|
body: ChatSecure, an OTR-c…
|
||||||
version: 7.6.3
|
version: 0.1.0
|
||||||
|
|
||||||
name: CocoaAsyncSocket, nameSpecified:
|
name: CocoaAsyncSocket, nameSpecified:
|
||||||
body: Public Domain Licens…
|
body: Public Domain Licens…
|
||||||
|
@ -93,14 +80,6 @@ name: CocoaLumberjack, nameSpecified:
|
||||||
body: BSD 3-Clause License…
|
body: BSD 3-Clause License…
|
||||||
version: 3.5.2
|
version: 3.5.2
|
||||||
|
|
||||||
name: CocoaLumberjack, nameSpecified:
|
|
||||||
body: BSD 3-Clause License…
|
|
||||||
version: 3.5.2
|
|
||||||
|
|
||||||
name: CPAProxy, nameSpecified:
|
|
||||||
body: Copyright (c) 2013 C…
|
|
||||||
version: 1.2.0
|
|
||||||
|
|
||||||
name: CPAProxy, nameSpecified:
|
name: CPAProxy, nameSpecified:
|
||||||
body: Copyright (c) 2013 C…
|
body: Copyright (c) 2013 C…
|
||||||
version: 1.2.0
|
version: 1.2.0
|
||||||
|
@ -117,13 +96,13 @@ name: DTFoundation, nameSpecified:
|
||||||
body: Copyright (c) 2011, …
|
body: Copyright (c) 2011, …
|
||||||
version: 1.7.13
|
version: 1.7.13
|
||||||
|
|
||||||
name: DTFoundation, nameSpecified:
|
name: FormatterKit, nameSpecified:
|
||||||
body: Copyright (c) 2011, …
|
body: Copyright (c) 2011–2…
|
||||||
version: 1.7.13
|
version: 1.8.2
|
||||||
|
|
||||||
name: GCDWebServer, nameSpecified:
|
name: FormatterKit, nameSpecified:
|
||||||
body: Copyright (c) 2012-2…
|
body: Copyright (c) 2011–2…
|
||||||
version: 3.5.2
|
version: 1.8.2
|
||||||
|
|
||||||
name: GCDWebServer, nameSpecified:
|
name: GCDWebServer, nameSpecified:
|
||||||
body: Copyright (c) 2012-2…
|
body: Copyright (c) 2012-2…
|
||||||
|
@ -143,16 +122,6 @@ body:
|
||||||
…
|
…
|
||||||
version: 1.1
|
version: 1.1
|
||||||
|
|
||||||
name: gtm-http-fetcher, nameSpecified:
|
|
||||||
body:
|
|
||||||
…
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
name: gtm-oauth2, nameSpecified:
|
|
||||||
body:
|
|
||||||
…
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
name: gtm-oauth2, nameSpecified:
|
name: gtm-oauth2, nameSpecified:
|
||||||
body:
|
body:
|
||||||
…
|
…
|
||||||
|
@ -175,15 +144,13 @@ body: ## Licenses
|
||||||
The Hoc…
|
The Hoc…
|
||||||
version: 5.1.4
|
version: 5.1.4
|
||||||
|
|
||||||
name: HockeySDK-Source, nameSpecified:
|
name: HTMLReader, nameSpecified:
|
||||||
body: ## Licenses
|
body: HTMLReader is in the…
|
||||||
|
version: 2.1.3
|
||||||
|
|
||||||
The Hoc…
|
name: HTMLReader, nameSpecified:
|
||||||
version: 5.1.4
|
body: HTMLReader is in the…
|
||||||
|
version: 2.1.3
|
||||||
name: IOCipher, nameSpecified:
|
|
||||||
body: GNU LESSER GENER…
|
|
||||||
version: 0.1.0
|
|
||||||
|
|
||||||
name: IOCipher, nameSpecified:
|
name: IOCipher, nameSpecified:
|
||||||
body: GNU LESSER GENER…
|
body: GNU LESSER GENER…
|
||||||
|
@ -205,12 +172,6 @@ MIT License
|
||||||
Copyrig…
|
Copyrig…
|
||||||
version: 7.3.4
|
version: 7.3.4
|
||||||
|
|
||||||
name: JSQMessagesViewController, nameSpecified:
|
|
||||||
body:
|
|
||||||
MIT License
|
|
||||||
Copyrig…
|
|
||||||
version: 7.3.4
|
|
||||||
|
|
||||||
name: JTSImageViewController, nameSpecified:
|
name: JTSImageViewController, nameSpecified:
|
||||||
body: The MIT License (MIT…
|
body: The MIT License (MIT…
|
||||||
version: 1.5.1
|
version: 1.5.1
|
||||||
|
@ -219,14 +180,6 @@ name: JTSImageViewController, nameSpecified:
|
||||||
body: The MIT License (MIT…
|
body: The MIT License (MIT…
|
||||||
version: 1.5.1
|
version: 1.5.1
|
||||||
|
|
||||||
name: JTSImageViewController, nameSpecified:
|
|
||||||
body: The MIT License (MIT…
|
|
||||||
version: 1.5.1
|
|
||||||
|
|
||||||
name: KissXML, nameSpecified:
|
|
||||||
body: Copyright (c) 2012, …
|
|
||||||
version: 5.2.3
|
|
||||||
|
|
||||||
name: KissXML, nameSpecified:
|
name: KissXML, nameSpecified:
|
||||||
body: Copyright (c) 2012, …
|
body: Copyright (c) 2012, …
|
||||||
version: 5.2.3
|
version: 5.2.3
|
||||||
|
@ -243,15 +196,17 @@ name: Kvitto, nameSpecified:
|
||||||
body: Copyright (c) 2015, …
|
body: Copyright (c) 2015, …
|
||||||
version: 1.0.3
|
version: 1.0.3
|
||||||
|
|
||||||
name: Kvitto, nameSpecified:
|
name: KVOController, nameSpecified:
|
||||||
body: Copyright (c) 2015, …
|
body: BSD License
|
||||||
version: 1.0.3
|
|
||||||
|
|
||||||
name: libidn, nameSpecified:
|
For KVO…
|
||||||
body: libidn-podspec
|
version: 1.2.0
|
||||||
|
|
||||||
The …
|
name: KVOController, nameSpecified:
|
||||||
version: 1.35
|
body: BSD License
|
||||||
|
|
||||||
|
For KVO…
|
||||||
|
version: 1.2.0
|
||||||
|
|
||||||
name: libidn, nameSpecified:
|
name: libidn, nameSpecified:
|
||||||
body: libidn-podspec
|
body: libidn-podspec
|
||||||
|
@ -273,16 +228,6 @@ name: libsqlfs, nameSpecified:
|
||||||
body: GNU LESSER GENER…
|
body: GNU LESSER GENER…
|
||||||
version: 1.3.2
|
version: 1.3.2
|
||||||
|
|
||||||
name: libsqlfs, nameSpecified:
|
|
||||||
body: GNU LESSER GENER…
|
|
||||||
version: 1.3.2
|
|
||||||
|
|
||||||
name: LicensePlist, nameSpecified:
|
|
||||||
body: MIT License
|
|
||||||
|
|
||||||
Copyrig…
|
|
||||||
version: 2.5.0
|
|
||||||
|
|
||||||
name: LicensePlist, nameSpecified:
|
name: LicensePlist, nameSpecified:
|
||||||
body: MIT License
|
body: MIT License
|
||||||
|
|
||||||
|
@ -305,10 +250,21 @@ body: Apache License
|
||||||
…
|
…
|
||||||
version: 3.3.1
|
version: 3.3.1
|
||||||
|
|
||||||
name: LumberjackConsole, nameSpecified:
|
name: Mantle, nameSpecified:
|
||||||
body: Apache License
|
body: **Copyright (c) GitH…
|
||||||
…
|
version: 2.1.0
|
||||||
version: 3.3.1
|
|
||||||
|
name: Mantle, nameSpecified:
|
||||||
|
body: **Copyright (c) GitH…
|
||||||
|
version: 2.1.0
|
||||||
|
|
||||||
|
name: MBProgressHUD, nameSpecified:
|
||||||
|
body: Copyright © 2009-201…
|
||||||
|
version: 1.1.0
|
||||||
|
|
||||||
|
name: MBProgressHUD, nameSpecified:
|
||||||
|
body: Copyright © 2009-201…
|
||||||
|
version: 1.1.0
|
||||||
|
|
||||||
name: MWFeedParser, nameSpecified:
|
name: MWFeedParser, nameSpecified:
|
||||||
body: Copyright (c) 2010 M…
|
body: Copyright (c) 2010 M…
|
||||||
|
@ -318,14 +274,6 @@ name: MWFeedParser, nameSpecified:
|
||||||
body: Copyright (c) 2010 M…
|
body: Copyright (c) 2010 M…
|
||||||
version: 1.0.1
|
version: 1.0.1
|
||||||
|
|
||||||
name: MWFeedParser, nameSpecified:
|
|
||||||
body: Copyright (c) 2010 M…
|
|
||||||
version: 1.0.1
|
|
||||||
|
|
||||||
name: Navajo, nameSpecified:
|
|
||||||
body: Copyright (c) 2014 M…
|
|
||||||
version: 0.0.1
|
|
||||||
|
|
||||||
name: Navajo, nameSpecified:
|
name: Navajo, nameSpecified:
|
||||||
body: Copyright (c) 2014 M…
|
body: Copyright (c) 2014 M…
|
||||||
version: 0.0.1
|
version: 0.0.1
|
||||||
|
@ -344,14 +292,13 @@ body:
|
||||||
…
|
…
|
||||||
version: 2.1.0
|
version: 2.1.0
|
||||||
|
|
||||||
name: NBUCore, nameSpecified:
|
name: OTRAssets, nameSpecified:
|
||||||
body:
|
body: ChatSecure, an OTR-c…
|
||||||
…
|
version: 0.1.0
|
||||||
version: 2.1.0
|
|
||||||
|
|
||||||
name: OTRKit, nameSpecified:
|
name: OTRAssets, nameSpecified:
|
||||||
body: Software License Agr…
|
body: ChatSecure, an OTR-c…
|
||||||
version: 2.0.0
|
version: 0.1.0
|
||||||
|
|
||||||
name: OTRKit, nameSpecified:
|
name: OTRKit, nameSpecified:
|
||||||
body: Software License Agr…
|
body: Software License Agr…
|
||||||
|
@ -369,10 +316,6 @@ name: ParkedTextField, nameSpecified:
|
||||||
body: The MIT License (MIT…
|
body: The MIT License (MIT…
|
||||||
version: 0.5.0
|
version: 0.5.0
|
||||||
|
|
||||||
name: ParkedTextField, nameSpecified:
|
|
||||||
body: The MIT License (MIT…
|
|
||||||
version: 0.5.0
|
|
||||||
|
|
||||||
name: ProxyKit, nameSpecified:
|
name: ProxyKit, nameSpecified:
|
||||||
body: The MIT License (MIT…
|
body: The MIT License (MIT…
|
||||||
version: 1.2.0
|
version: 1.2.0
|
||||||
|
@ -381,9 +324,13 @@ name: ProxyKit, nameSpecified:
|
||||||
body: The MIT License (MIT…
|
body: The MIT License (MIT…
|
||||||
version: 1.2.0
|
version: 1.2.0
|
||||||
|
|
||||||
name: ProxyKit, nameSpecified:
|
name: PureLayout, nameSpecified:
|
||||||
body: The MIT License (MIT…
|
body: This code is distrib…
|
||||||
version: 1.2.0
|
version: 3.1.4
|
||||||
|
|
||||||
|
name: PureLayout, nameSpecified:
|
||||||
|
body: This code is distrib…
|
||||||
|
version: 3.1.4
|
||||||
|
|
||||||
name: QRCodeReaderViewController, nameSpecified:
|
name: QRCodeReaderViewController, nameSpecified:
|
||||||
body: The MIT License (MIT…
|
body: The MIT License (MIT…
|
||||||
|
@ -393,13 +340,13 @@ name: QRCodeReaderViewController, nameSpecified:
|
||||||
body: The MIT License (MIT…
|
body: The MIT License (MIT…
|
||||||
version: 4.0.2
|
version: 4.0.2
|
||||||
|
|
||||||
name: QRCodeReaderViewController, nameSpecified:
|
name: SAMKeychain, nameSpecified:
|
||||||
body: The MIT License (MIT…
|
body: Copyright (c) 2010-2…
|
||||||
version: 4.0.2
|
version: 1.5.3
|
||||||
|
|
||||||
name: SignalProtocolC, nameSpecified:
|
name: SAMKeychain, nameSpecified:
|
||||||
body: Copyright 20…
|
body: Copyright (c) 2010-2…
|
||||||
version: 2.3.2
|
version: 1.5.3
|
||||||
|
|
||||||
name: SignalProtocolC, nameSpecified:
|
name: SignalProtocolC, nameSpecified:
|
||||||
body: Copyright 20…
|
body: Copyright 20…
|
||||||
|
@ -417,10 +364,6 @@ name: SignalProtocolObjC, nameSpecified:
|
||||||
body: Copyright 2016-2017 …
|
body: Copyright 2016-2017 …
|
||||||
version: 1.1.0
|
version: 1.1.0
|
||||||
|
|
||||||
name: SignalProtocolObjC, nameSpecified:
|
|
||||||
body: Copyright 2016-2017 …
|
|
||||||
version: 1.1.0
|
|
||||||
|
|
||||||
name: SQLCipher, nameSpecified:
|
name: SQLCipher, nameSpecified:
|
||||||
body: Copyright (c) 2008, …
|
body: Copyright (c) 2008, …
|
||||||
version: 3.4.2
|
version: 3.4.2
|
||||||
|
@ -429,9 +372,13 @@ name: SQLCipher, nameSpecified:
|
||||||
body: Copyright (c) 2008, …
|
body: Copyright (c) 2008, …
|
||||||
version: 3.4.2
|
version: 3.4.2
|
||||||
|
|
||||||
name: SQLCipher, nameSpecified:
|
name: TTTAttributedLabel, nameSpecified:
|
||||||
body: Copyright (c) 2008, …
|
body: Copyright (c) 2011 M…
|
||||||
version: 3.4.2
|
version: 2.0.0
|
||||||
|
|
||||||
|
name: TTTAttributedLabel, nameSpecified:
|
||||||
|
body: Copyright (c) 2011 M…
|
||||||
|
version: 2.0.0
|
||||||
|
|
||||||
name: TUSafariActivity, nameSpecified:
|
name: TUSafariActivity, nameSpecified:
|
||||||
body: Copyright (c) 2012 T…
|
body: Copyright (c) 2012 T…
|
||||||
|
@ -441,13 +388,13 @@ name: TUSafariActivity, nameSpecified:
|
||||||
body: Copyright (c) 2012 T…
|
body: Copyright (c) 2012 T…
|
||||||
version: 1.0.4
|
version: 1.0.4
|
||||||
|
|
||||||
name: TUSafariActivity, nameSpecified:
|
name: XLForm, nameSpecified:
|
||||||
body: Copyright (c) 2012 T…
|
body: The MIT License (MIT…
|
||||||
version: 1.0.4
|
version: 4.0.1
|
||||||
|
|
||||||
name: XMPPFramework, nameSpecified:
|
name: XLForm, nameSpecified:
|
||||||
body: GCDAsyncSocket: (Pub…
|
body: The MIT License (MIT…
|
||||||
version: 4.0.0
|
version: 4.0.1
|
||||||
|
|
||||||
name: XMPPFramework, nameSpecified:
|
name: XMPPFramework, nameSpecified:
|
||||||
body: GCDAsyncSocket: (Pub…
|
body: GCDAsyncSocket: (Pub…
|
||||||
|
@ -465,10 +412,6 @@ name: YapDatabase, nameSpecified:
|
||||||
body: Software License Agr…
|
body: Software License Agr…
|
||||||
version: 3.1.1
|
version: 3.1.1
|
||||||
|
|
||||||
name: YapDatabase, nameSpecified:
|
|
||||||
body: Software License Agr…
|
|
||||||
version: 3.1.1
|
|
||||||
|
|
||||||
name: YapTaskQueue, nameSpecified:
|
name: YapTaskQueue, nameSpecified:
|
||||||
body: This is free and une…
|
body: This is free and une…
|
||||||
version: 0.3.0
|
version: 0.3.0
|
||||||
|
@ -477,9 +420,13 @@ name: YapTaskQueue, nameSpecified:
|
||||||
body: This is free and une…
|
body: This is free and une…
|
||||||
version: 0.3.0
|
version: 0.3.0
|
||||||
|
|
||||||
name: YapTaskQueue, nameSpecified:
|
name: ZXingObjC, nameSpecified:
|
||||||
body: This is free and une…
|
body: …
|
||||||
version: 0.3.0
|
version: 3.2.2
|
||||||
|
|
||||||
|
name: ZXingObjC, nameSpecified:
|
||||||
|
body: …
|
||||||
|
version: 3.2.2
|
||||||
|
|
||||||
name: AFNetworking, nameSpecified: , owner: AFNetworking, version: 3.2.1
|
name: AFNetworking, nameSpecified: , owner: AFNetworking, version: 3.2.1
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,14 @@
|
||||||
<key>Type</key>
|
<key>Type</key>
|
||||||
<string>PSChildPaneSpecifier</string>
|
<string>PSChildPaneSpecifier</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>File</key>
|
||||||
|
<string>com.mono0926.LicensePlist/ChatSecureCore</string>
|
||||||
|
<key>Title</key>
|
||||||
|
<string>ChatSecureCore (0.1.0)</string>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>PSChildPaneSpecifier</string>
|
||||||
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>File</key>
|
<key>File</key>
|
||||||
<string>com.mono0926.LicensePlist/CocoaAsyncSocket</string>
|
<string>com.mono0926.LicensePlist/CocoaAsyncSocket</string>
|
||||||
|
@ -300,6 +308,14 @@
|
||||||
<key>Type</key>
|
<key>Type</key>
|
||||||
<string>PSChildPaneSpecifier</string>
|
<string>PSChildPaneSpecifier</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>File</key>
|
||||||
|
<string>com.mono0926.LicensePlist/OTRAssets</string>
|
||||||
|
<key>Title</key>
|
||||||
|
<string>OTRAssets (0.1.0)</string>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>PSChildPaneSpecifier</string>
|
||||||
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>File</key>
|
<key>File</key>
|
||||||
<string>com.mono0926.LicensePlist/OTRKit</string>
|
<string>com.mono0926.LicensePlist/OTRKit</string>
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>PreferenceSpecifiers</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>FooterText</key>
|
||||||
|
<string>ChatSecure, an OTR-compatible iOS encrypted chat client
|
||||||
|
Copyright (C) 2012, Chris Ballinger
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
If you would like to relicense this code to sell it on the App Store,
|
||||||
|
please contact me at chris@chatsecure.org.</string>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>PSGroupSpecifier</string>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>PreferenceSpecifiers</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>FooterText</key>
|
||||||
|
<string>ChatSecure, an OTR-compatible iOS encrypted chat client
|
||||||
|
Copyright (C) 2012, Chris Ballinger
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
If you would like to relicense this code to sell it on the App Store,
|
||||||
|
please contact me at chris@chatsecure.org.</string>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>PSGroupSpecifier</string>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
|
@ -0,0 +1,90 @@
|
||||||
|
Pod::Spec.new do |s|
|
||||||
|
s.name = 'ChatSecureCore'
|
||||||
|
s.version = '0.1.0'
|
||||||
|
s.summary = 'A short description of ChatSecureCore.'
|
||||||
|
|
||||||
|
s.description = <<-DESC
|
||||||
|
TODO: Add long description of the pod here.
|
||||||
|
DESC
|
||||||
|
|
||||||
|
s.homepage = 'https://github.com/ChatSecure/ChatSecure-iOS'
|
||||||
|
s.license = { :type => 'GPLv3', :file => 'LICENSE' }
|
||||||
|
s.author = { 'Chris Ballinger' => 'chris@chatsecure.org' }
|
||||||
|
s.source = { :git => 'https://github.com/ChatSecure/ChatSecureCore.git', :tag => s.version.to_s }
|
||||||
|
s.social_media_url = 'https://twitter.com/ChatSecure'
|
||||||
|
|
||||||
|
s.ios.deployment_target = '9.0'
|
||||||
|
|
||||||
|
s.source_files = ['ChatSecure/Classes/**/*.{h,m,swift}', 'ChatSecureCore/**/*.h']
|
||||||
|
s.public_header_files = ['ChatSecureCore/ChatSecureCore.h',
|
||||||
|
'ChatSecureCore/Public/*.h',]
|
||||||
|
s.private_header_files = ['ChatSecureCore/Private/*.h']
|
||||||
|
|
||||||
|
s.xcconfig = { 'OTHER_CFLAGS' => '$(inherited) -DSQLITE_HAS_CODEC' }
|
||||||
|
|
||||||
|
s.frameworks = ['UIKit', 'StoreKit']
|
||||||
|
|
||||||
|
# User Interface
|
||||||
|
s.dependency "Appirater", '~> 2.0'
|
||||||
|
s.dependency 'OpenInChrome', '~> 0.0'
|
||||||
|
s.dependency 'JTSImageViewController', '~> 1.4'
|
||||||
|
s.dependency 'BButton', '~> 4.0'
|
||||||
|
s.dependency 'TUSafariActivity', '~> 1.0'
|
||||||
|
s.dependency 'ARChromeActivity', '~> 1.0'
|
||||||
|
s.dependency 'QRCodeReaderViewController', '~> 4.0'
|
||||||
|
s.dependency 'ParkedTextField'
|
||||||
|
|
||||||
|
|
||||||
|
s.dependency 'JSQMessagesViewController'
|
||||||
|
s.dependency 'LumberjackConsole'
|
||||||
|
|
||||||
|
|
||||||
|
# Utility
|
||||||
|
s.dependency 'CocoaLumberjack/Swift', '~> 3.5.0'
|
||||||
|
s.dependency 'MWFeedParser', '~> 1.0'
|
||||||
|
s.dependency 'Navajo', '~> 0.0'
|
||||||
|
s.dependency 'BBlock', '~> 1.2'
|
||||||
|
s.dependency 'HockeySDK-Source'
|
||||||
|
s.dependency 'LicensePlist'
|
||||||
|
|
||||||
|
# Network
|
||||||
|
s.dependency 'CocoaAsyncSocket', '~> 7.6.0'
|
||||||
|
s.dependency 'ProxyKit/Client', '~> 1.2.0'
|
||||||
|
s.dependency 'GCDWebServer', '~> 3.4'
|
||||||
|
s.dependency 'CPAProxy'
|
||||||
|
s.dependency 'XMPPFramework/Swift'
|
||||||
|
|
||||||
|
s.dependency 'ChatSecure-Push-iOS'
|
||||||
|
|
||||||
|
# Storage
|
||||||
|
# We are blocked on SQLCipher 4.0.0 migration https://github.com/ChatSecure/ChatSecure-iOS/issues/1078
|
||||||
|
s.dependency 'SQLCipher', '~> 3.4'
|
||||||
|
# Version 3.1.2 breaks YapTaskQueue 0.3.0
|
||||||
|
s.dependency 'YapDatabase/SQLCipher', '3.1.1'
|
||||||
|
|
||||||
|
# The upstream 1.3.2 has a regression https://github.com/ChatSecure/ChatSecure-iOS/issues/1075
|
||||||
|
s.dependency 'libsqlfs/SQLCipher'
|
||||||
|
s.dependency 'IOCipher/GCDWebServer'
|
||||||
|
s.dependency 'YapTaskQueue/SQLCipher'
|
||||||
|
|
||||||
|
# Crypto
|
||||||
|
s.dependency 'SignalProtocolObjC'
|
||||||
|
s.dependency 'OTRKit'
|
||||||
|
|
||||||
|
s.dependency 'Alamofire', '~> 4.4'
|
||||||
|
s.dependency 'Kvitto', '~> 1.0'
|
||||||
|
|
||||||
|
s.dependency "Mantle"
|
||||||
|
s.dependency "HTMLReader", '~> 2.1.1'
|
||||||
|
s.dependency "AFNetworking", '~> 3.1'
|
||||||
|
s.dependency "ZXingObjC", '~> 3.2.2'
|
||||||
|
s.dependency "SAMKeychain", '~> 1.5'
|
||||||
|
s.dependency "MBProgressHUD", '~> 1.1'
|
||||||
|
s.dependency "TTTAttributedLabel", '~> 2.0'
|
||||||
|
s.dependency "PureLayout", '~> 3.0'
|
||||||
|
s.dependency "KVOController", '~> 1.2'
|
||||||
|
s.dependency "XLForm", '~> 4.0.0'
|
||||||
|
s.dependency "FormatterKit", '~> 1.8'
|
||||||
|
|
||||||
|
s.dependency "OTRAssets"
|
||||||
|
end
|
|
@ -0,0 +1,16 @@
|
||||||
|
//
|
||||||
|
// ChatSecureCoreCompat-Swift.h
|
||||||
|
// ChatSecureCore
|
||||||
|
//
|
||||||
|
// Created by Christopher Ballinger on 9/14/15.
|
||||||
|
// Copyright © 2015 Chris Ballinger. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
// Import this header instead of <ChatSecureCore/ChatSecureCore-Swift.h>
|
||||||
|
// This allows the pod to be built as a static or dynamic framework
|
||||||
|
// See https://github.com/CocoaPods/CocoaPods/issues/7594
|
||||||
|
#if __has_include("ChatSecureCore-Swift.h")
|
||||||
|
#import "ChatSecureCore-Swift.h"
|
||||||
|
#else
|
||||||
|
#import <ChatSecureCore/ChatSecureCore-Swift.h>
|
||||||
|
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue