Skip to content

Commit

Permalink
Merge pull request #1096 from FutureWorkshops/master
Browse files Browse the repository at this point in the history
Fixing the iPhone sample code for Xcode 10
  • Loading branch information
chrisballinger committed Oct 4, 2018
2 parents 2199643 + 32640f2 commit de41aa6
Show file tree
Hide file tree
Showing 14 changed files with 375 additions and 1,185 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
8 changes: 4 additions & 4 deletions Xcode/Examples/iPhoneXMPP/Classes/RootViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
#import "iPhoneXMPPAppDelegate.h"
#import "SettingsViewController.h"

#import "XMPPFramework.h"
#import "DDLog.h"
@import XMPPFramework;
@import CocoaLumberjack;

// Log levels: off, error, warn, info, verbose
#if DEBUG
static const int ddLogLevel = LOG_LEVEL_VERBOSE;
static const int ddLogLevel = DDLogLevelVerbose;
#else
static const int ddLogLevel = LOG_LEVEL_INFO;
static const int ddLogLevel = DDLogLevelInfo;
#endif

@implementation RootViewController
Expand Down
1 change: 1 addition & 0 deletions Xcode/Examples/iPhoneXMPP/Classes/SettingsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ @implementation SettingsViewController
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

- (void)awakeFromNib {
[super awakeFromNib];
self.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
}

Expand Down
22 changes: 11 additions & 11 deletions Xcode/Examples/iPhoneXMPP/Classes/XMPPFramework.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@
// THIS HEADER FILE SHOULD BE TAILORED TO MATCH YOUR APPLICATION.


#import "XMPP.h"
#import <XMPPFramework/XMPP.h>

// List the modules you're using here.

#import "XMPPReconnect.h"
#import <XMPPFramework/XMPPReconnect.h>

#import "XMPPRoster.h"
#import "XMPPRosterCoreDataStorage.h"
#import <XMPPFramework/XMPPRoster.h>
#import <XMPPFramework/XMPPRosterCoreDataStorage.h>

#import "XMPPvCardTempModule.h"
#import "XMPPvCardAvatarModule.h"
#import "XMPPvCardCoreDataStorage.h"
#import <XMPPFramework/XMPPvCardTempModule.h>
#import <XMPPFramework/XMPPvCardAvatarModule.h>
#import <XMPPFramework/XMPPvCardCoreDataStorage.h>

#import "XMPPCapabilities.h"
#import "XMPPCapabilitiesCoreDataStorage.h"
#import <XMPPFramework/XMPPCapabilities.h>
#import <XMPPFramework/XMPPCapabilitiesCoreDataStorage.h>

#import "XMPPMUC.h"
#import "XMPPRoomCoreDataStorage.h"
#import <XMPPFramework/XMPPMUC.h>
#import <XMPPFramework/XMPPRoomCoreDataStorage.h>
1 change: 1 addition & 0 deletions Xcode/Examples/iPhoneXMPP/Classes/iPhoneXMPPAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
NSString *password;

BOOL customCertEvaluation;
BOOL bypassTLS;

BOOL isXmppConnected;

Expand Down
38 changes: 17 additions & 21 deletions Xcode/Examples/iPhoneXMPP/Classes/iPhoneXMPPAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,17 @@
#import "RootViewController.h"
#import "SettingsViewController.h"

#import "GCDAsyncSocket.h"
#import "XMPP.h"
#import "XMPPLogging.h"
#import "XMPPReconnect.h"
#import "XMPPCapabilitiesCoreDataStorage.h"
#import "XMPPRosterCoreDataStorage.h"
#import "XMPPvCardAvatarModule.h"
#import "XMPPvCardCoreDataStorage.h"

#import "DDLog.h"
#import "DDTTYLogger.h"

#import <CFNetwork/CFNetwork.h>

// Log levels: off, error, warn, info, verbose
@import XMPPFramework;
@import CocoaAsyncSocket;
@import CocoaLumberjack;

//Log levels: off, error, warn, info, verbose
#if DEBUG
static const int ddLogLevel = LOG_LEVEL_VERBOSE;
static const int ddLogLevel = DDLogLevelVerbose;
#else
static const int ddLogLevel = LOG_LEVEL_INFO;
static const int ddLogLevel = DDLogLevelInfo;
#endif


Expand Down Expand Up @@ -57,8 +49,7 @@ @implementation iPhoneXMPPAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Configure logging framework

[DDLog addLogger:[DDTTYLogger sharedInstance] withLogLevel:XMPP_LOG_FLAG_SEND_RECV];
[DDLog addLogger:[DDTTYLogger sharedInstance] withLevel:XMPP_LOG_FLAG_SEND_RECV];

// Setup the XMPP stream

Expand All @@ -71,10 +62,10 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

if (![self connect])
{
__weak iPhoneXMPPAppDelegate *weakSelf = self;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, 0.0 * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){

[navigationController presentViewController:settingsViewController animated:YES completion:NULL];
[weakSelf.navigationController presentViewController:weakSelf.settingsViewController animated:YES completion:NULL];
});
}

Expand Down Expand Up @@ -217,8 +208,8 @@ - (void)setupStream
// If you don't specify a hostPort, then the default (5222) will be used.

// [xmppStream setHostName:@"talk.google.com"];
// [xmppStream setHostPort:5222];
// [xmppStream setHostPort:5222];
// bypassTLS = YES;

// You may need to alter these settings depending on the server you're connecting to
customCertEvaluation = YES;
Expand Down Expand Up @@ -449,6 +440,11 @@ - (void)xmppStream:(XMPPStream *)sender didReceiveTrust:(SecTrustRef)trust
// but will presumably perform some extra security code stuff.
// For example, allowing a specific self-signed certificate that is known to the app.

if (bypassTLS) {
completionHandler(YES);
return;
}

dispatch_queue_t bgQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(bgQueue, ^{

Expand Down
2 changes: 1 addition & 1 deletion Xcode/Examples/iPhoneXMPP/iPhoneXMPP-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.deusty.oss.xmppframework.${PRODUCT_NAME:rfc1034identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
Loading

0 comments on commit de41aa6

Please sign in to comment.