Skip to content
This repository has been archived by the owner on Aug 25, 2018. It is now read-only.

Updated for iOS 9 #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions FireChat-Swift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
5FFF76C4199C191F00AE0269 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5FFF76C2199C191F00AE0269 /* Main.storyboard */; };
5FFF76C6199C191F00AE0269 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5FFF76C5199C191F00AE0269 /* Images.xcassets */; };
5FFF76D2199C191F00AE0269 /* FireChat_SwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FFF76D1199C191F00AE0269 /* FireChat_SwiftTests.swift */; };
5FFF76DC199C192600AE0269 /* libc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5FFF76DB199C192600AE0269 /* libc++.dylib */; };
5FFF76DE199C192900AE0269 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5FFF76DD199C192900AE0269 /* libicucore.dylib */; };
5FFF76E0199C193200AE0269 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5FFF76DF199C193200AE0269 /* SystemConfiguration.framework */; };
5FFF76E2199C193700AE0269 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5FFF76E1199C193700AE0269 /* CFNetwork.framework */; };
5FFF76E4199C194800AE0269 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5FFF76E3199C194800AE0269 /* Security.framework */; };
Expand Down Expand Up @@ -77,6 +75,8 @@
63891102199EB21D00B8998F /* FirebaseSimpleLogin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63891101199EB21D00B8998F /* FirebaseSimpleLogin.framework */; };
63891104199EB24200B8998F /* Accounts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63891103199EB24200B8998F /* Accounts.framework */; };
63891106199EB24800B8998F /* Social.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63891105199EB24800B8998F /* Social.framework */; };
D705A7E01BC02F1300258168 /* libicucore.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = D705A7DF1BC02F1300258168 /* libicucore.tbd */; };
D705A7E21BC02F1E00258168 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = D705A7E11BC02F1E00258168 /* libc++.tbd */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -102,8 +102,6 @@
5FFF76CB199C191F00AE0269 /* FireChat-SwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "FireChat-SwiftTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
5FFF76D0199C191F00AE0269 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5FFF76D1199C191F00AE0269 /* FireChat_SwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FireChat_SwiftTests.swift; sourceTree = "<group>"; };
5FFF76DB199C192600AE0269 /* libc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libc++.dylib"; path = "usr/lib/libc++.dylib"; sourceTree = SDKROOT; };
5FFF76DD199C192900AE0269 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = usr/lib/libicucore.dylib; sourceTree = SDKROOT; };
5FFF76DF199C193200AE0269 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
5FFF76E1199C193700AE0269 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
5FFF76E3199C194800AE0269 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -194,13 +192,17 @@
63891101199EB21D00B8998F /* FirebaseSimpleLogin.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = FirebaseSimpleLogin.framework; sourceTree = "<group>"; };
63891103199EB24200B8998F /* Accounts.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accounts.framework; path = System/Library/Frameworks/Accounts.framework; sourceTree = SDKROOT; };
63891105199EB24800B8998F /* Social.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Social.framework; path = System/Library/Frameworks/Social.framework; sourceTree = SDKROOT; };
D705A7DF1BC02F1300258168 /* libicucore.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libicucore.tbd; path = usr/lib/libicucore.tbd; sourceTree = SDKROOT; };
D705A7E11BC02F1E00258168 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
5FFF76B6199C191F00AE0269 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
D705A7E21BC02F1E00258168 /* libc++.tbd in Frameworks */,
D705A7E01BC02F1300258168 /* libicucore.tbd in Frameworks */,
63891106199EB24800B8998F /* Social.framework in Frameworks */,
63891104199EB24200B8998F /* Accounts.framework in Frameworks */,
5FFF7812199C201200AE0269 /* UIKit.framework in Frameworks */,
Expand All @@ -210,8 +212,6 @@
5FFF76E8199C19CF00AE0269 /* Firebase.framework in Frameworks */,
5FFF76E2199C193700AE0269 /* CFNetwork.framework in Frameworks */,
5FFF76E0199C193200AE0269 /* SystemConfiguration.framework in Frameworks */,
5FFF76DE199C192900AE0269 /* libicucore.dylib in Frameworks */,
5FFF76DC199C192600AE0269 /* libc++.dylib in Frameworks */,
63891102199EB21D00B8998F /* FirebaseSimpleLogin.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -229,6 +229,8 @@
5F5814D5199E8D65000E0E87 /* Frameworks */ = {
isa = PBXGroup;
children = (
D705A7E11BC02F1E00258168 /* libc++.tbd */,
D705A7DF1BC02F1300258168 /* libicucore.tbd */,
63891105199EB24800B8998F /* Social.framework */,
63891103199EB24200B8998F /* Accounts.framework */,
63891101199EB21D00B8998F /* FirebaseSimpleLogin.framework */,
Expand All @@ -241,8 +243,6 @@
5FFF76E3199C194800AE0269 /* Security.framework */,
5FFF76E1199C193700AE0269 /* CFNetwork.framework */,
5FFF76DF199C193200AE0269 /* SystemConfiguration.framework */,
5FFF76DD199C192900AE0269 /* libicucore.dylib */,
5FFF76DB199C192600AE0269 /* libc++.dylib */,
);
name = Frameworks;
sourceTree = "<group>";
Expand Down Expand Up @@ -526,7 +526,9 @@
5FFF76B1199C191F00AE0269 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0600;
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0700;
ORGANIZATIONNAME = Firebase;
TargetAttributes = {
5FFF76B8199C191F00AE0269 = {
Expand Down Expand Up @@ -689,6 +691,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
Expand Down Expand Up @@ -760,6 +763,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = "com.firebase.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "FireChat-Swift/FireChat-Swift-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -781,6 +785,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = "com.firebase.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "FireChat-Swift/FireChat-Swift-Bridging-Header.h";
TARGETED_DEVICE_FAMILY = 1;
Expand All @@ -801,6 +806,7 @@
);
INFOPLIST_FILE = "FireChat-SwiftTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.firebase.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FireChat-Swift.app/FireChat-Swift";
};
Expand All @@ -816,6 +822,7 @@
);
INFOPLIST_FILE = "FireChat-SwiftTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.firebase.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FireChat-Swift.app/FireChat-Swift";
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "5C880BE1B99588B39156D68833EAB2407BF6A594",
"DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : {

},
"DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
"90530B99EB0008E7A50951FDFBE02169118FA649" : 0,
"3295696B2ABB63B244A5608CBC7B986155E10CBC" : 0,
"5C880BE1B99588B39156D68833EAB2407BF6A594" : 0
},
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "96E77F1C-9044-4101-98FB-14166C7D9D17",
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
"90530B99EB0008E7A50951FDFBE02169118FA649" : "FireChat-SwiftJSQMessagesViewController",
"3295696B2ABB63B244A5608CBC7B986155E10CBC" : "FireChat-SwiftJSQSystemSoundPlayer",
"5C880BE1B99588B39156D68833EAB2407BF6A594" : "FireChat-Swift"
},
"DVTSourceControlWorkspaceBlueprintNameKey" : "FireChat-Swift",
"DVTSourceControlWorkspaceBlueprintVersion" : 204,
"DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "FireChat-Swift.xcodeproj",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:jessesquires\/JSQSystemSoundPlayer.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "3295696B2ABB63B244A5608CBC7B986155E10CBC"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:katfang\/firechat-swift.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "5C880BE1B99588B39156D68833EAB2407BF6A594"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:jessesquires\/JSQMessagesViewController.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "90530B99EB0008E7A50951FDFBE02169118FA649"
}
]
}
2 changes: 1 addition & 1 deletion FireChat-Swift/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.firebase.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
4 changes: 2 additions & 2 deletions FireChat-Swift/LoginViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class LoginViewController : UIViewController, UIActionSheetDelegate {
}

func selectTwitterAccount(accounts: [ACAccount]) {
var selectUserActionSheet = UIActionSheet(title: "Select Twitter Account", delegate: self, cancelButtonTitle: "Cancel", destructiveButtonTitle: "Destruct", otherButtonTitles: "Other")
let selectUserActionSheet = UIActionSheet(title: "Select Twitter Account", delegate: self, cancelButtonTitle: "Cancel", destructiveButtonTitle: "Destruct", otherButtonTitles: "Other")

for account in accounts {
selectUserActionSheet.addButtonWithTitle(account.username)
Expand Down Expand Up @@ -83,7 +83,7 @@ class LoginViewController : UIViewController, UIActionSheetDelegate {
}

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
var messagesVc = segue.destinationViewController as! MessagesViewController
let messagesVc = segue.destinationViewController as! MessagesViewController
if let authData = sender as? FAuthData {
messagesVc.user = authData
messagesVc.ref = ref
Expand Down
22 changes: 11 additions & 11 deletions FireChat-Swift/MessagesViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class MessagesViewController: JSQMessagesViewController {
if let url = NSURL(string: stringUrl) {
if let data = NSData(contentsOfURL: url) {
let image = UIImage(data: data)
let diameter = incoming ? UInt(collectionView.collectionViewLayout.incomingAvatarViewSize.width) : UInt(collectionView.collectionViewLayout.outgoingAvatarViewSize.width)
let diameter = incoming ? UInt(collectionView!.collectionViewLayout.incomingAvatarViewSize.width) : UInt(collectionView!.collectionViewLayout.outgoingAvatarViewSize.width)
let avatarImage = JSQMessagesAvatarFactory.avatarWithImage(image, diameter: diameter)
avatars[name] = avatarImage
return
Expand All @@ -73,24 +73,24 @@ class MessagesViewController: JSQMessagesViewController {
}

func setupAvatarColor(name: String, incoming: Bool) {
let diameter = incoming ? UInt(collectionView.collectionViewLayout.incomingAvatarViewSize.width) : UInt(collectionView.collectionViewLayout.outgoingAvatarViewSize.width)
let diameter = incoming ? UInt(collectionView!.collectionViewLayout.incomingAvatarViewSize.width) : UInt(collectionView!.collectionViewLayout.outgoingAvatarViewSize.width)

let rgbValue = name.hash
let r = CGFloat(Float((rgbValue & 0xFF0000) >> 16)/255.0)
let g = CGFloat(Float((rgbValue & 0xFF00) >> 8)/255.0)
let b = CGFloat(Float(rgbValue & 0xFF)/255.0)
let color = UIColor(red: r, green: g, blue: b, alpha: 0.5)

let nameLength = count(name)
let initials : String? = name.substringToIndex(advance(sender.startIndex, min(3, nameLength)))
let nameLength = name.characters.count
let initials : String? = name.substringToIndex(sender.startIndex.advancedBy(min(3, nameLength)))
let userImage = JSQMessagesAvatarFactory.avatarWithUserInitials(initials, backgroundColor: color, textColor: UIColor.blackColor(), font: UIFont.systemFontOfSize(CGFloat(13)), diameter: diameter)

avatars[name] = userImage
}

override func viewDidLoad() {
super.viewDidLoad()
inputToolbar.contentView.leftBarButtonItem = nil
inputToolbar!.contentView!.leftBarButtonItem = nil
automaticallyScrollsToMostRecentMessage = true
navigationController?.navigationBar.topItem?.title = "Logout"

Expand All @@ -109,7 +109,7 @@ class MessagesViewController: JSQMessagesViewController {

override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
collectionView.collectionViewLayout.springinessEnabled = true
collectionView!.collectionViewLayout.springinessEnabled = true
}

override func viewWillDisappear(animated: Bool) {
Expand Down Expand Up @@ -137,7 +137,7 @@ class MessagesViewController: JSQMessagesViewController {
}

override func didPressAccessoryButton(sender: UIButton!) {
println("Camera pressed!")
print("Camera pressed!")
}

override func collectionView(collectionView: JSQMessagesCollectionView!, messageDataForItemAtIndexPath indexPath: NSIndexPath!) -> JSQMessageData! {
Expand Down Expand Up @@ -173,13 +173,13 @@ class MessagesViewController: JSQMessagesViewController {

let message = messages[indexPath.item]
if message.sender() == sender {
cell.textView.textColor = UIColor.blackColor()
cell.textView!.textColor = UIColor.blackColor()
} else {
cell.textView.textColor = UIColor.whiteColor()
cell.textView!.textColor = UIColor.whiteColor()
}

let attributes : [NSObject:AnyObject] = [NSForegroundColorAttributeName:cell.textView.textColor, NSUnderlineStyleAttributeName: 1]
cell.textView.linkTextAttributes = attributes
let attributes : [NSObject:AnyObject] = [NSForegroundColorAttributeName:cell.textView!.textColor, NSUnderlineStyleAttributeName: 1]
cell.textView!.linkTextAttributes = attributes

// cell.textView.linkTextAttributes = [NSForegroundColorAttributeName: cell.textView.textColor,
// NSUnderlineStyleAttributeName: NSUnderlineStyle.StyleSingle]
Expand Down
2 changes: 1 addition & 1 deletion FireChat-SwiftTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.firebase.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down