Compare commits

...

No commits in common. "master" and "gh-pages" have entirely different histories.

262 changed files with 325 additions and 17068 deletions

View File

@ -1,7 +0,0 @@
highlight-color: "#43D15B"
highlight-dark-color: "#319942"
darker-color: "#8A998C"
darker-dark-color: "#454D46"
background-color: "#D7E5CF"
alt-link-color: "#00A81C"
warning-color: "#0FB82B"

24
.gitignore vendored
View File

@ -1,25 +1 @@
# Xcode
.DS_Store
/build/*
*/build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
*.hmap
*.xccheckout
#CocoaPods
Pods

View File

@ -1,10 +0,0 @@
language: objective-c
before_install:
- export LANG=en_US.UTF-8
- gem install cocoapods
- brew update
- if brew outdated | grep -qx xctool; then brew upgrade xctool; fi
script:
- xctool clean build test -workspace JSQMessages.xcworkspace -scheme JSQMessages -sdk iphonesimulator7.1 ONLY_ACTIVE_ARCH=NO

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,3 +0,0 @@
## How To Contribute
Please follow these sweet [contribution guidelines](https://github.com/jessesquires/HowToContribute).

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:JSQMessages.xcodeproj">
</FileRef>
</Workspace>

View File

@ -1,124 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0600"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4F6B28C25B7B1259BD8C5B8B"
BuildableName = "libPods.a"
BlueprintName = "Pods"
ReferencedContainer = "container:Pods/Pods.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "88A25F0119D8DEC400924534"
BuildableName = "JSQMessages.app"
BlueprintName = "JSQMessages"
ReferencedContainer = "container:JSQMessages.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "88A25F1A19D8DEC400924534"
BuildableName = "JSQMessagesTests.xctest"
BlueprintName = "JSQMessagesTests"
ReferencedContainer = "container:JSQMessages.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "88A25F1A19D8DEC400924534"
BuildableName = "JSQMessagesTests.xctest"
BlueprintName = "JSQMessagesTests"
ReferencedContainer = "container:JSQMessages.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "88A25F0119D8DEC400924534"
BuildableName = "JSQMessages.app"
BlueprintName = "JSQMessages"
ReferencedContainer = "container:JSQMessages.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "88A25F0119D8DEC400924534"
BuildableName = "JSQMessages.app"
BlueprintName = "JSQMessages"
ReferencedContainer = "container:JSQMessages.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "88A25F0119D8DEC400924534"
BuildableName = "JSQMessages.app"
BlueprintName = "JSQMessages"
ReferencedContainer = "container:JSQMessages.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:JSQMessages.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>

View File

@ -1,26 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// Documentation
// http://cocoadocs.org/docsets/JSQMessagesViewController
//
//
// GitHub
// https://github.com/jessesquires/JSQMessagesViewController
//
//
// License
// Copyright (c) 2014 Jesse Squires
// Released under an MIT license: http://opensource.org/licenses/MIT
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end

View File

@ -1,35 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// Documentation
// http://cocoadocs.org/docsets/JSQMessagesViewController
//
//
// GitHub
// https://github.com/jessesquires/JSQMessagesViewController
//
//
// License
// Copyright (c) 2014 Jesse Squires
// Released under an MIT license: http://opensource.org/licenses/MIT
//
#import "AppDelegate.h"
#import "NSUserDefaults+DemoSettings.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Load our default settings
[NSUserDefaults saveIncomingAvatarSetting:YES];
[NSUserDefaults saveOutgoingAvatarSetting:YES];
return YES;
}
@end

View File

@ -1,360 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6245" systemVersion="13F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="JRd-Be-psV">
<dependencies>
<deployment defaultVersion="1792" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
</dependencies>
<scenes>
<!--Root View Controller-->
<scene sceneID="IjL-71-Ll6">
<objects>
<tableViewController id="rXs-qR-ns2" customClass="TableViewController" sceneMemberID="viewController">
<tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="d0b-Sx-5kJ">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="CellIdentifier" textLabel="2qz-Z2-GmT" style="IBUITableViewCellStyleDefault" id="k8B-cw-dMU">
<rect key="frame" x="0.0" y="119" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="k8B-cw-dMU" id="kX4-QF-oKx">
<rect key="frame" x="0.0" y="0.0" width="287" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="2qz-Z2-GmT">
<rect key="frame" x="15" y="0.0" width="270" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
</tableViewCell>
</prototypes>
</tableView>
<navigationItem key="navigationItem" title="Root View Controller" id="irr-Pn-9x5"/>
<connections>
<segue destination="JdJ-0X-ZL8" kind="push" identifier="seguePushDemoVC" id="Hvf-k8-GSP"/>
<segue destination="s4z-xn-r6C" kind="modal" identifier="segueModalDemoVC" id="4UP-0e-ylo"/>
<segue destination="y7K-ZU-Xs9" kind="push" identifier="SegueToSettings" id="u7b-st-FND"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="IcC-ug-dCB" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-2982" y="274"/>
</scene>
<!--Settings-->
<scene sceneID="6rZ-ao-qyI">
<objects>
<tableViewController id="y7K-ZU-Xs9" customClass="DemoSettingsViewController" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" allowsSelection="NO" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="GY5-ob-knb">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<sections>
<tableViewSection headerTitle="Messages" id="ygb-Dp-o4r">
<cells>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="Eii-ro-1yZ">
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Eii-ro-1yZ" id="qU9-o3-MWC">
<autoresizingMask key="autoresizingMask"/>
<subviews>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="K7N-os-fuc">
<rect key="frame" x="263" y="6" width="51" height="31"/>
<constraints>
<constraint firstAttribute="width" constant="49" id="A6s-Sr-u8U"/>
<constraint firstAttribute="height" constant="31" id="z9i-uJ-MBq"/>
</constraints>
<connections>
<action selector="didTapSwitch:" destination="y7K-ZU-Xs9" eventType="valueChanged" id="Ebi-bs-7Bc"/>
</connections>
</switch>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Load extra messages" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bSS-CD-nfD">
<rect key="frame" x="8" y="10" width="247" height="24"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="bSS-CD-nfD" firstAttribute="top" secondItem="qU9-o3-MWC" secondAttribute="top" constant="10" id="4Iw-W0-qZs"/>
<constraint firstAttribute="trailing" secondItem="K7N-os-fuc" secondAttribute="trailing" constant="8" id="Fex-nr-C1R"/>
<constraint firstAttribute="bottom" secondItem="K7N-os-fuc" secondAttribute="bottom" constant="6" id="IBG-gn-Fpk"/>
<constraint firstItem="bSS-CD-nfD" firstAttribute="leading" secondItem="qU9-o3-MWC" secondAttribute="leading" constant="8" id="N5B-E5-Pzk"/>
<constraint firstItem="K7N-os-fuc" firstAttribute="leading" secondItem="bSS-CD-nfD" secondAttribute="trailing" constant="8" id="O2Y-G9-d6n"/>
<constraint firstItem="K7N-os-fuc" firstAttribute="top" secondItem="qU9-o3-MWC" secondAttribute="top" constant="6" id="UbM-aE-caS"/>
<constraint firstAttribute="bottom" secondItem="bSS-CD-nfD" secondAttribute="bottom" constant="9" id="poL-wE-Eir"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="bZI-G1-eYA">
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="bZI-G1-eYA" id="1Ho-Zz-KN0">
<autoresizingMask key="autoresizingMask"/>
<subviews>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hMq-Ee-EJK">
<rect key="frame" x="263" y="6" width="51" height="31"/>
<constraints>
<constraint firstAttribute="height" constant="31" id="gM4-dK-cl7"/>
<constraint firstAttribute="width" constant="49" id="hvu-Yy-NTG"/>
</constraints>
<connections>
<action selector="didTapSwitch:" destination="y7K-ZU-Xs9" eventType="valueChanged" id="JCb-EJ-M9U"/>
</connections>
</switch>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Load really long message" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YV3-GH-Yul">
<rect key="frame" x="8" y="10" width="247" height="24"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="hMq-Ee-EJK" firstAttribute="leading" secondItem="YV3-GH-Yul" secondAttribute="trailing" constant="8" id="KFO-nO-4r4"/>
<constraint firstItem="YV3-GH-Yul" firstAttribute="top" secondItem="1Ho-Zz-KN0" secondAttribute="top" constant="10" id="Lgl-fY-a8c"/>
<constraint firstAttribute="bottom" secondItem="YV3-GH-Yul" secondAttribute="bottom" constant="9" id="NvL-b8-QDl"/>
<constraint firstAttribute="bottom" secondItem="hMq-Ee-EJK" secondAttribute="bottom" constant="6" id="aef-Rh-49d"/>
<constraint firstItem="hMq-Ee-EJK" firstAttribute="top" secondItem="1Ho-Zz-KN0" secondAttribute="top" constant="6" id="csX-us-yCd"/>
<constraint firstAttribute="trailing" secondItem="hMq-Ee-EJK" secondAttribute="trailing" constant="8" id="xDE-tf-5mB"/>
<constraint firstItem="YV3-GH-Yul" firstAttribute="leading" secondItem="1Ho-Zz-KN0" secondAttribute="leading" constant="8" id="xyR-oc-iUp"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="2Th-gL-oAN">
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="2Th-gL-oAN" id="OFq-Mz-mbl">
<autoresizingMask key="autoresizingMask"/>
<subviews>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="baL-Tb-bTJ">
<rect key="frame" x="263" y="6" width="51" height="31"/>
<constraints>
<constraint firstAttribute="width" constant="49" id="SaV-RG-DVL"/>
<constraint firstAttribute="height" constant="31" id="dXb-pb-etA"/>
</constraints>
<connections>
<action selector="didTapSwitch:" destination="y7K-ZU-Xs9" eventType="valueChanged" id="w1H-5W-oip"/>
</connections>
</switch>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Empty view, no messages" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DoU-SU-Nek">
<rect key="frame" x="8" y="10" width="247" height="24"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="DoU-SU-Nek" firstAttribute="leading" secondItem="OFq-Mz-mbl" secondAttribute="leading" constant="8" id="A9k-hI-0BH"/>
<constraint firstAttribute="bottom" secondItem="baL-Tb-bTJ" secondAttribute="bottom" constant="6" id="Ff7-1T-EbZ"/>
<constraint firstItem="DoU-SU-Nek" firstAttribute="top" secondItem="OFq-Mz-mbl" secondAttribute="top" constant="10" id="Uji-LE-8IA"/>
<constraint firstAttribute="trailing" secondItem="baL-Tb-bTJ" secondAttribute="trailing" constant="8" id="dUp-7b-g3p"/>
<constraint firstItem="baL-Tb-bTJ" firstAttribute="leading" secondItem="DoU-SU-Nek" secondAttribute="trailing" constant="8" id="fxZ-zy-ksL"/>
<constraint firstAttribute="bottom" secondItem="DoU-SU-Nek" secondAttribute="bottom" constant="9" id="h0B-EX-3MW"/>
<constraint firstItem="baL-Tb-bTJ" firstAttribute="top" secondItem="OFq-Mz-mbl" secondAttribute="top" constant="6" id="v5e-xk-srk"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
</cells>
</tableViewSection>
<tableViewSection headerTitle="Avatars" id="ns0-OO-PGu">
<cells>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="hYS-4f-iL6">
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="hYS-4f-iL6" id="dk1-tc-gux">
<autoresizingMask key="autoresizingMask"/>
<subviews>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fLZ-NC-aPO">
<rect key="frame" x="263" y="6" width="51" height="31"/>
<constraints>
<constraint firstAttribute="width" constant="49" id="1lf-6y-hgz"/>
<constraint firstAttribute="height" constant="31" id="rdQ-ol-d20"/>
</constraints>
<connections>
<action selector="didTapSwitch:" destination="y7K-ZU-Xs9" eventType="valueChanged" id="WnT-b7-og6"/>
</connections>
</switch>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Incoming avatars" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="RUq-Pa-3nx">
<rect key="frame" x="8" y="10" width="247" height="24"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="RUq-Pa-3nx" secondAttribute="bottom" constant="9" id="7Yt-uN-sOS"/>
<constraint firstItem="RUq-Pa-3nx" firstAttribute="top" secondItem="dk1-tc-gux" secondAttribute="top" constant="10" id="Aih-Lc-tq7"/>
<constraint firstItem="fLZ-NC-aPO" firstAttribute="leading" secondItem="RUq-Pa-3nx" secondAttribute="trailing" constant="8" id="Cfo-7m-Vyd"/>
<constraint firstAttribute="trailing" secondItem="fLZ-NC-aPO" secondAttribute="trailing" constant="8" id="Mgz-VG-tDn"/>
<constraint firstItem="fLZ-NC-aPO" firstAttribute="top" secondItem="dk1-tc-gux" secondAttribute="top" constant="6" id="S6i-he-vB9"/>
<constraint firstItem="RUq-Pa-3nx" firstAttribute="leading" secondItem="dk1-tc-gux" secondAttribute="leading" constant="8" id="mhd-oX-p53"/>
<constraint firstAttribute="bottom" secondItem="fLZ-NC-aPO" secondAttribute="bottom" constant="6" id="yyq-Sg-nJi"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="VF7-uo-6Pc">
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="VF7-uo-6Pc" id="zad-JQ-TRI">
<autoresizingMask key="autoresizingMask"/>
<subviews>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="LuM-mk-Zj6">
<rect key="frame" x="263" y="6" width="51" height="31"/>
<constraints>
<constraint firstAttribute="height" constant="31" id="QXv-ty-g0B"/>
<constraint firstAttribute="width" constant="49" id="rZ3-cO-f8t"/>
</constraints>
<connections>
<action selector="didTapSwitch:" destination="y7K-ZU-Xs9" eventType="valueChanged" id="rNB-Bx-Uh3"/>
</connections>
</switch>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Outgoing avatars" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9Rr-S8-Uae">
<rect key="frame" x="8" y="10" width="247" height="24"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="LuM-mk-Zj6" secondAttribute="bottom" constant="6" id="1G7-8S-rYC"/>
<constraint firstAttribute="bottom" secondItem="9Rr-S8-Uae" secondAttribute="bottom" constant="9" id="5xp-ez-tac"/>
<constraint firstItem="LuM-mk-Zj6" firstAttribute="leading" secondItem="9Rr-S8-Uae" secondAttribute="trailing" constant="8" id="C5c-2A-mli"/>
<constraint firstAttribute="trailing" secondItem="LuM-mk-Zj6" secondAttribute="trailing" constant="8" id="Lep-LY-D1h"/>
<constraint firstItem="LuM-mk-Zj6" firstAttribute="top" secondItem="zad-JQ-TRI" secondAttribute="top" constant="6" id="Y6a-JS-aLj"/>
<constraint firstItem="9Rr-S8-Uae" firstAttribute="leading" secondItem="zad-JQ-TRI" secondAttribute="leading" constant="8" id="Yao-VR-Is6"/>
<constraint firstItem="9Rr-S8-Uae" firstAttribute="top" secondItem="zad-JQ-TRI" secondAttribute="top" constant="10" id="Yiv-t6-Xj5"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
</cells>
</tableViewSection>
<tableViewSection headerTitle="Dynamic Behaviors" footerTitle="NOTE: This feature is experimental" id="o5m-OT-1Iw">
<cells>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="q07-lZ-YdI">
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="q07-lZ-YdI" id="btE-Mk-fSE">
<autoresizingMask key="autoresizingMask"/>
<subviews>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uXC-2j-cgi">
<rect key="frame" x="263" y="6" width="51" height="31"/>
<constraints>
<constraint firstAttribute="height" constant="31" id="5bI-xQ-njj"/>
<constraint firstAttribute="width" constant="49" id="PG2-X2-FdD"/>
</constraints>
<connections>
<action selector="didTapSwitch:" destination="y7K-ZU-Xs9" eventType="valueChanged" id="oHB-iq-JSz"/>
</connections>
</switch>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Springy bubbles" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3d2-fZ-dx9">
<rect key="frame" x="8" y="10" width="247" height="24"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="3d2-fZ-dx9" firstAttribute="leading" secondItem="btE-Mk-fSE" secondAttribute="leading" constant="8" id="6Cs-6l-Xzp"/>
<constraint firstItem="uXC-2j-cgi" firstAttribute="leading" secondItem="3d2-fZ-dx9" secondAttribute="trailing" constant="8" id="7Mq-HR-4nY"/>
<constraint firstItem="uXC-2j-cgi" firstAttribute="top" secondItem="btE-Mk-fSE" secondAttribute="top" constant="6" id="Ajq-5g-XKo"/>
<constraint firstAttribute="bottom" secondItem="3d2-fZ-dx9" secondAttribute="bottom" constant="9" id="EzH-aB-ePQ"/>
<constraint firstAttribute="bottom" secondItem="uXC-2j-cgi" secondAttribute="bottom" constant="6" id="RCb-Mi-FHX"/>
<constraint firstItem="3d2-fZ-dx9" firstAttribute="top" secondItem="btE-Mk-fSE" secondAttribute="top" constant="10" id="btF-q4-HJg"/>
<constraint firstAttribute="trailing" secondItem="uXC-2j-cgi" secondAttribute="trailing" constant="8" id="zzu-aP-ZiL"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
</cells>
</tableViewSection>
</sections>
<connections>
<outlet property="dataSource" destination="y7K-ZU-Xs9" id="4gP-Ip-VMs"/>
<outlet property="delegate" destination="y7K-ZU-Xs9" id="RdT-hW-mFp"/>
</connections>
</tableView>
<navigationItem key="navigationItem" title="Settings" id="hrw-Dp-Tor"/>
<connections>
<outlet property="emptySwitch" destination="baL-Tb-bTJ" id="qk7-dH-53U"/>
<outlet property="extraMessagesSwitch" destination="K7N-os-fuc" id="qlF-0W-3JO"/>
<outlet property="incomingAvatarsSwitch" destination="fLZ-NC-aPO" id="0ck-t9-Hwt"/>
<outlet property="longMessageSwitch" destination="hMq-Ee-EJK" id="Vs2-fX-Hys"/>
<outlet property="outgoingAvatarsSwitch" destination="LuM-mk-Zj6" id="EAh-35-xjI"/>
<outlet property="springySwitch" destination="uXC-2j-cgi" id="Jzx-1y-VZP"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="5u5-k6-W2j" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-2982" y="1039"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="eGf-GM-ORQ">
<objects>
<navigationController definesPresentationContext="YES" id="s4z-xn-r6C" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="G3q-Gy-0Lf">
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="2Qx-iu-03V" kind="relationship" relationship="rootViewController" id="cuu-7c-yOr"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="8DO-Rt-kgb" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-2409" y="619"/>
</scene>
<!--Demo Messages View Controller-->
<scene sceneID="gOX-cv-CuN">
<objects>
<viewController storyboardIdentifier="DemoVC" id="JdJ-0X-ZL8" customClass="DemoMessagesViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="TE8-r2-pE8"/>
<viewControllerLayoutGuide type="bottom" id="H2n-HB-Ssl"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Vop-TB-ImV">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" id="URv-4c-d6h"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="B2s-hQ-gD4" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-2409" y="-71"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="A8N-cL-8VP">
<objects>
<navigationController definesPresentationContext="YES" id="JRd-Be-psV" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="YZb-OI-WKd">
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="rXs-qR-ns2" kind="relationship" relationship="rootViewController" id="8xe-QC-QaY"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="OC7-Ng-9xQ" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-3413" y="274"/>
</scene>
<!--Demo Messages View Controller-->
<scene sceneID="Rr5-W8-Xyh">
<objects>
<viewController id="2Qx-iu-03V" customClass="DemoMessagesViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="hTc-sT-can"/>
<viewControllerLayoutGuide type="bottom" id="BPF-eU-3uQ"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="SsE-pA-zOd">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" id="gBw-Dh-o4F"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="jTG-EA-PIP" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-1989" y="619"/>
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>

View File

@ -1,48 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// Documentation
// http://cocoadocs.org/docsets/JSQMessagesViewController
//
//
// GitHub
// https://github.com/jessesquires/JSQMessagesViewController
//
//
// License
// Copyright (c) 2014 Jesse Squires
// Released under an MIT license: http://opensource.org/licenses/MIT
//
// Import all the things
#import "JSQMessages.h"
#import "DemoModelData.h"
#import "NSUserDefaults+DemoSettings.h"
@class DemoMessagesViewController;
@protocol JSQDemoViewControllerDelegate <NSObject>
- (void)didDismissJSQDemoViewController:(DemoMessagesViewController *)vc;
@end
@interface DemoMessagesViewController : JSQMessagesViewController <UIActionSheetDelegate>
@property (weak, nonatomic) id<JSQDemoViewControllerDelegate> delegateModal;
@property (strong, nonatomic) DemoModelData *demoData;
- (void)receiveMessagePressed:(UIBarButtonItem *)sender;
- (void)closePressed:(UIBarButtonItem *)sender;
@end

View File

@ -1,584 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// Documentation
// http://cocoadocs.org/docsets/JSQMessagesViewController
//
//
// GitHub
// https://github.com/jessesquires/JSQMessagesViewController
//
//
// License
// Copyright (c) 2014 Jesse Squires
// Released under an MIT license: http://opensource.org/licenses/MIT
//
#import "DemoMessagesViewController.h"
#import "JSQCallCollectionViewCell.h"
#import "JSQCall.h"
#import "JSQDisplayedMessageCollectionViewCell.h"
#import "JSQErrorMessage.h"
#import "JSQInfoMessage.h"
@implementation DemoMessagesViewController
#pragma mark - View lifecycle
/**
* Override point for customization.
*
* Customize your view.
* Look at the properties on `JSQMessagesViewController` and `JSQMessagesCollectionView` to see what is possible.
*
* Customize your layout.
* Look at the properties on `JSQMessagesCollectionViewFlowLayout` to see what is possible.
*/
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = @"JSQMessages";
/**
* You MUST set your senderId and display name
*/
self.senderId = kJSQDemoAvatarIdSquires;
self.senderDisplayName = kJSQDemoAvatarDisplayNameSquires;
/**
* Load up our fake data for the demo
*/
self.demoData = [[DemoModelData alloc] init];
/**
* You can set custom avatar sizes
*/
if (![NSUserDefaults incomingAvatarSetting]) {
self.collectionView.collectionViewLayout.incomingAvatarViewSize = CGSizeZero;
}
if (![NSUserDefaults outgoingAvatarSetting]) {
self.collectionView.collectionViewLayout.outgoingAvatarViewSize = CGSizeZero;
}
self.showLoadEarlierMessagesHeader = YES;
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage jsq_defaultTypingIndicatorImage]
style:UIBarButtonItemStyleBordered
target:self
action:@selector(receiveMessagePressed:)];
/**
* Customize your toolbar buttons
*
* self.inputToolbar.contentView.leftBarButtonItem = custom button or nil to remove
* self.inputToolbar.contentView.rightBarButtonItem = custom button or nil to remove
*/
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
if (self.delegateModal) {
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop
target:self
action:@selector(closePressed:)];
}
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
/**
* Enable/disable springy bubbles, default is NO.
* You must set this from `viewDidAppear:`
* Note: this feature is mostly stable, but still experimental
*/
self.collectionView.collectionViewLayout.springinessEnabled = [NSUserDefaults springinessSetting];
}
#pragma mark - Testing
- (void)pushMainViewController
{
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UINavigationController *nc = [sb instantiateInitialViewController];
[self.navigationController pushViewController:nc.topViewController animated:YES];
}
#pragma mark - Actions
- (void)receiveMessagePressed:(UIBarButtonItem *)sender
{
/**
* DEMO ONLY
*
* The following is simply to simulate received messages for the demo.
* Do not actually do this.
*/
/**
* Show the typing indicator to be shown
*/
self.showTypingIndicator = !self.showTypingIndicator;
/**
* Scroll to actually view the indicator
*/
[self scrollToBottomAnimated:YES];
/**
* Copy last sent message, this will be the new "received" message
*/
JSQMessage *copyMessage = [[self.demoData.messages lastObject] copy];
if (!copyMessage) {
copyMessage = [JSQMessage messageWithSenderId:kJSQDemoAvatarIdJobs
displayName:kJSQDemoAvatarDisplayNameJobs
text:@"First received!"];
}
/**
* Allow typing indicator to show
*/
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NSMutableArray *userIds = [[self.demoData.users allKeys] mutableCopy];
[userIds removeObject:self.senderId];
NSString *randomUserId = userIds[arc4random_uniform((int)[userIds count])];
JSQMessage *newMessage = nil;
id<JSQMessageMediaData> newMediaData = nil;
id newMediaAttachmentCopy = nil;
if ([copyMessage isKindOfClass:[JSQMessage class]]) {
/**
* Last message was a media message
*/
id<JSQMessageMediaData> copyMediaData = copyMessage.media;
if ([copyMediaData isKindOfClass:[JSQPhotoMediaItem class]]) {
JSQPhotoMediaItem *photoItemCopy = [((JSQPhotoMediaItem *)copyMediaData) copy];
photoItemCopy.appliesMediaViewMaskAsOutgoing = NO;
newMediaAttachmentCopy = [UIImage imageWithCGImage:photoItemCopy.image.CGImage];
/**
* Set image to nil to simulate "downloading" the image
* and show the placeholder view
*/
photoItemCopy.image = nil;
newMediaData = photoItemCopy;
}
else if ([copyMediaData isKindOfClass:[JSQLocationMediaItem class]]) {
JSQLocationMediaItem *locationItemCopy = [((JSQLocationMediaItem *)copyMediaData) copy];
locationItemCopy.appliesMediaViewMaskAsOutgoing = NO;
newMediaAttachmentCopy = [locationItemCopy.location copy];
/**
* Set location to nil to simulate "downloading" the location data
*/
locationItemCopy.location = nil;
newMediaData = locationItemCopy;
}
else if ([copyMediaData isKindOfClass:[JSQVideoMediaItem class]]) {
JSQVideoMediaItem *videoItemCopy = [((JSQVideoMediaItem *)copyMediaData) copy];
videoItemCopy.appliesMediaViewMaskAsOutgoing = NO;
newMediaAttachmentCopy = [videoItemCopy.fileURL copy];
/**
* Reset video item to simulate "downloading" the video
*/
videoItemCopy.fileURL = nil;
videoItemCopy.isReadyToPlay = NO;
newMediaData = videoItemCopy;
}
else {
NSLog(@"%s error: unrecognized media item", __PRETTY_FUNCTION__);
}
newMessage = [JSQMessage messageWithSenderId:randomUserId
displayName:self.demoData.users[randomUserId]
media:newMediaData];
}
else {
/**
* Last message was a text message
*/
newMessage = [JSQMessage messageWithSenderId:randomUserId
displayName:self.demoData.users[randomUserId]
text:copyMessage.text];
}
/**
* Upon receiving a message, you should:
*
* 1. Play sound (optional)
* 2. Add new id<JSQMessageData> object to your data source
* 3. Call `finishReceivingMessage`
*/
[JSQSystemSoundPlayer jsq_playMessageReceivedSound];
[self.demoData.messages addObject:newMessage];
[self finishReceivingMessageAnimated:YES];
if (newMessage.isMediaMessage) {
/**
* Simulate "downloading" media
*/
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
/**
* Media is "finished downloading", re-display visible cells
*
* If media cell is not visible, the next time it is dequeued the view controller will display its new attachment data
*
* Reload the specific item, or simply call `reloadData`
*/
if ([newMediaData isKindOfClass:[JSQPhotoMediaItem class]]) {
((JSQPhotoMediaItem *)newMediaData).image = newMediaAttachmentCopy;
[self.collectionView reloadData];
}
else if ([newMediaData isKindOfClass:[JSQLocationMediaItem class]]) {
[((JSQLocationMediaItem *)newMediaData)setLocation:newMediaAttachmentCopy withCompletionHandler:^{
[self.collectionView reloadData];
}];
}
else if ([newMediaData isKindOfClass:[JSQVideoMediaItem class]]) {
((JSQVideoMediaItem *)newMediaData).fileURL = newMediaAttachmentCopy;
((JSQVideoMediaItem *)newMediaData).isReadyToPlay = YES;
[self.collectionView reloadData];
}
else {
NSLog(@"%s error: unrecognized media item", __PRETTY_FUNCTION__);
}
});
}
});
}
- (void)closePressed:(UIBarButtonItem *)sender
{
[self.delegateModal didDismissJSQDemoViewController:self];
}
#pragma mark - JSQMessagesViewController method overrides
- (void)didPressSendButton:(UIButton *)button
withMessageText:(NSString *)text
senderId:(NSString *)senderId
senderDisplayName:(NSString *)senderDisplayName
date:(NSDate *)date
{
/**
* Sending a message. Your implementation of this method should do *at least* the following:
*
* 1. Play sound (optional)
* 2. Add new id<JSQMessageData> object to your data source
* 3. Call `finishSendingMessage`
*/
[JSQSystemSoundPlayer jsq_playMessageSentSound];
JSQMessage *message = [[JSQMessage alloc] initWithSenderId:senderId
senderDisplayName:senderDisplayName
date:date
text:text];
[self.demoData.messages addObject:message];
[self finishSendingMessageAnimated:YES];
}
- (void)didPressAccessoryButton:(UIButton *)sender
{
UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"Media messages"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Send photo", @"Send location", @"Send video", nil];
[sheet showFromToolbar:self.inputToolbar];
}
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex
{
if (buttonIndex == actionSheet.cancelButtonIndex) {
return;
}
switch (buttonIndex) {
case 0:
[self.demoData addPhotoMediaMessage];
break;
case 1:
{
__weak UICollectionView *weakView = self.collectionView;
[self.demoData addLocationMediaMessageCompletion:^{
[weakView reloadData];
}];
}
break;
case 2:
[self.demoData addVideoMediaMessage];
break;
}
[JSQSystemSoundPlayer jsq_playMessageSentSound];
[self finishSendingMessageAnimated:YES];
}
#pragma mark - JSQMessages CollectionView DataSource
- (id<JSQMessageData>)collectionView:(JSQMessagesCollectionView *)collectionView messageDataForItemAtIndexPath:(NSIndexPath *)indexPath
{
return [self.demoData.messages objectAtIndex:indexPath.item];
}
- (id<JSQMessageBubbleImageDataSource>)collectionView:(JSQMessagesCollectionView *)collectionView messageBubbleImageDataForItemAtIndexPath:(NSIndexPath *)indexPath
{
/**
* You may return nil here if you do not want bubbles.
* In this case, you should set the background color of your collection view cell's textView.
*
* Otherwise, return your previously created bubble image data objects.
*/
JSQMessage *message = [self.demoData.messages objectAtIndex:indexPath.item];
if ([message.senderId isEqualToString:self.senderId]) {
return self.demoData.outgoingBubbleImageData;
}
return self.demoData.incomingBubbleImageData;
}
- (id<JSQMessageAvatarImageDataSource>)collectionView:(JSQMessagesCollectionView *)collectionView avatarImageDataForItemAtIndexPath:(NSIndexPath *)indexPath
{
/**
* Return `nil` here if you do not want avatars.
* If you do return `nil`, be sure to do the following in `viewDidLoad`:
*
* self.collectionView.collectionViewLayout.incomingAvatarViewSize = CGSizeZero;
* self.collectionView.collectionViewLayout.outgoingAvatarViewSize = CGSizeZero;
*
* It is possible to have only outgoing avatars or only incoming avatars, too.
*/
/**
* Return your previously created avatar image data objects.
*
* Note: these the avatars will be sized according to these values:
*
* self.collectionView.collectionViewLayout.incomingAvatarViewSize
* self.collectionView.collectionViewLayout.outgoingAvatarViewSize
*
* Override the defaults in `viewDidLoad`
*/
JSQMessage *message = [self.demoData.messages objectAtIndex:indexPath.item];
if (![message isKindOfClass:[JSQCall class]] || ![message isKindOfClass:[JSQErrorMessage class]] || ![message isKindOfClass:[JSQInfoMessage class]]) return nil;
if ([message.senderId isEqualToString:self.senderId]) {
if (![NSUserDefaults outgoingAvatarSetting]) {
return nil;
}
}
else {
if (![NSUserDefaults incomingAvatarSetting]) {
return nil;
}
}
return [self.demoData.avatars objectForKey:message.senderId];
}
- (NSAttributedString *)collectionView:(JSQMessagesCollectionView *)collectionView attributedTextForCellTopLabelAtIndexPath:(NSIndexPath *)indexPath
{
/**
* This logic should be consistent with what you return from `heightForCellTopLabelAtIndexPath:`
* The other label text delegate methods should follow a similar pattern.
*
* Show a timestamp for every 3rd message
*/
if (indexPath.item % 3 == 0) {
JSQMessage *message = [self.demoData.messages objectAtIndex:indexPath.item];
return [[JSQMessagesTimestampFormatter sharedFormatter] attributedTimestampForDate:message.date];
}
return nil;
}
- (NSAttributedString *)collectionView:(JSQMessagesCollectionView *)collectionView attributedTextForMessageBubbleTopLabelAtIndexPath:(NSIndexPath *)indexPath
{
JSQMessage *message = [self.demoData.messages objectAtIndex:indexPath.item];
/**
* iOS7-style sender name labels
*/
if ([message.senderId isEqualToString:self.senderId]) {
return nil;
}
if (indexPath.item - 1 > 0) {
JSQMessage *previousMessage = [self.demoData.messages objectAtIndex:indexPath.item - 1];
if ([[previousMessage senderId] isEqualToString:message.senderId]) {
return nil;
}
}
/**
* Don't specify attributes to use the defaults.
*/
return [[NSAttributedString alloc] initWithString:message.senderDisplayName];
}
- (NSAttributedString *)collectionView:(JSQMessagesCollectionView *)collectionView attributedTextForCellBottomLabelAtIndexPath:(NSIndexPath *)indexPath
{
return nil;
}
#pragma mark - UICollectionView DataSource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return [self.demoData.messages count];
}
- (UICollectionViewCell *)collectionView:(JSQMessagesCollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
/**
* Override point for customizing cells
*/
JSQMessage *msg = [self.demoData.messages objectAtIndex:indexPath.item];
if ([msg isKindOfClass:[JSQMessage class]])
{
JSQMessagesCollectionViewCell *cell = (JSQMessagesCollectionViewCell *)[super collectionView:collectionView cellForItemAtIndexPath:indexPath];
if (!msg.isMediaMessage) {
if ([msg.senderId isEqualToString:self.senderId]) {
cell.textView.textColor = [UIColor blackColor];
}
else {
cell.textView.textColor = [UIColor whiteColor];
}
cell.textView.linkTextAttributes = @{ NSForegroundColorAttributeName : cell.textView.textColor,
NSUnderlineStyleAttributeName : @(NSUnderlineStyleSingle | NSUnderlinePatternSolid) };
}
return cell;
} else if ([msg isKindOfClass:[JSQCall class]]) {
JSQCallCollectionViewCell *cell = (JSQCallCollectionViewCell *)[super collectionView:collectionView cellForItemAtIndexPath:indexPath];
return cell;
} else {
JSQDisplayedMessageCollectionViewCell * cell = (JSQDisplayedMessageCollectionViewCell *)[super collectionView:collectionView cellForItemAtIndexPath:indexPath];
return cell;
}
}
#pragma mark - JSQMessages collection view flow layout delegate
#pragma mark - Adjusting cell label heights
- (CGFloat)collectionView:(JSQMessagesCollectionView *)collectionView
layout:(JSQMessagesCollectionViewFlowLayout *)collectionViewLayout heightForCellTopLabelAtIndexPath:(NSIndexPath *)indexPath
{
/**
* Each label in a cell has a `height` delegate method that corresponds to its text dataSource method
*/
/**
* This logic should be consistent with what you return from `attributedTextForCellTopLabelAtIndexPath:`
* The other label height delegate methods should follow similarly
*
* Show a timestamp for every 3rd message
*/
// if (indexPath.item % 3 == 0) {
// return kJSQMessagesCollectionViewCellLabelHeightDefault;
// }
return 0.0f;
}
- (CGFloat)collectionView:(JSQMessagesCollectionView *)collectionView
layout:(JSQMessagesCollectionViewFlowLayout *)collectionViewLayout heightForMessageBubbleTopLabelAtIndexPath:(NSIndexPath *)indexPath
{
/**
* iOS7-style sender name labels
*/
JSQMessage *currentMessage = [self.demoData.messages objectAtIndex:indexPath.item];
if ([[currentMessage senderId] isEqualToString:self.senderId]) {
return 0.0f;
}
if (indexPath.item - 1 > 0) {
JSQMessage *previousMessage = [self.demoData.messages objectAtIndex:indexPath.item - 1];
if ([[previousMessage senderId] isEqualToString:[currentMessage senderId]]) {
return 0.0f;
}
}
return kJSQMessagesCollectionViewCellLabelHeightDefault;
}
- (CGFloat)collectionView:(JSQMessagesCollectionView *)collectionView
layout:(JSQMessagesCollectionViewFlowLayout *)collectionViewLayout heightForCellBottomLabelAtIndexPath:(NSIndexPath *)indexPath
{
return 0.0f;
}
#pragma mark - Responding to collection view tap events
- (void)collectionView:(JSQMessagesCollectionView *)collectionView
header:(JSQMessagesLoadEarlierHeaderView *)headerView didTapLoadEarlierMessagesButton:(UIButton *)sender
{
NSLog(@"Load earlier messages!");
}
- (void)collectionView:(JSQMessagesCollectionView *)collectionView didTapAvatarImageView:(UIImageView *)avatarImageView atIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"Tapped avatar!");
}
- (void)collectionView:(JSQMessagesCollectionView *)collectionView didTapMessageBubbleAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"Tapped message bubble!");
}
- (void)collectionView:(JSQMessagesCollectionView *)collectionView didTapCellAtIndexPath:(NSIndexPath *)indexPath touchLocation:(CGPoint)touchLocation
{
NSLog(@"Tapped cell at %@!", NSStringFromCGPoint(touchLocation));
}
@end

View File

@ -1,61 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// Documentation
// http://cocoadocs.org/docsets/JSQMessagesViewController
//
//
// GitHub
// https://github.com/jessesquires/JSQMessagesViewController
//
//
// License
// Copyright (c) 2014 Jesse Squires
// Released under an MIT license: http://opensource.org/licenses/MIT
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
#import "JSQMessages.h"
/**
* This is for demo/testing purposes only.
* This object sets up some fake model data.
* Do not actually do anything like this.
*/
static NSString * const kJSQDemoAvatarDisplayNameSquires = @"Jesse Squires";
static NSString * const kJSQDemoAvatarDisplayNameCook = @"Tim Cook";
static NSString * const kJSQDemoAvatarDisplayNameJobs = @"Jobs";
static NSString * const kJSQDemoAvatarDisplayNameWoz = @"Steve Wozniak";
static NSString * const kJSQDemoAvatarIdSquires = @"053496-4509-289";
static NSString * const kJSQDemoAvatarIdCook = @"468-768355-23123";
static NSString * const kJSQDemoAvatarIdJobs = @"707-8956784-57";
static NSString * const kJSQDemoAvatarIdWoz = @"309-41802-93823";
@interface DemoModelData : NSObject
@property (strong, nonatomic) NSMutableArray *messages;
@property (strong, nonatomic) NSDictionary *avatars;
@property (strong, nonatomic) JSQMessagesBubbleImage *outgoingBubbleImageData;
@property (strong, nonatomic) JSQMessagesBubbleImage *incomingBubbleImageData;
@property (strong, nonatomic) NSDictionary *users;
- (void)addPhotoMediaMessage;
- (void)addLocationMediaMessageCompletion:(JSQLocationMediaItemCompletionBlock)completion;
- (void)addVideoMediaMessage;
@end

View File

@ -1,236 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// Documentation
// http://cocoadocs.org/docsets/JSQMessagesViewController
//
//
// GitHub
// https://github.com/jessesquires/JSQMessagesViewController
//
//
// License
// Copyright (c) 2014 Jesse Squires
// Released under an MIT license: http://opensource.org/licenses/MIT
//
#import "DemoModelData.h"
#import "NSUserDefaults+DemoSettings.h"
#import "JSQCall.h"
#import "JSQInfoMessage.h"
#import "JSQErrorMessage.h"
/**
* This is for demo/testing purposes only.
* This object sets up some fake model data.
* Do not actually do anything like this.
*/
@implementation DemoModelData
- (instancetype)init
{
self = [super init];
if (self) {
if ([NSUserDefaults emptyMessagesSetting]) {
self.messages = [NSMutableArray new];
}
else {
[self loadFakeMessages];
}
/**
* Create avatar images once.
*
* Be sure to create your avatars one time and reuse them for good performance.
*
* If you are not using avatars, ignore this.
*/
JSQMessagesAvatarImage *jsqImage = [JSQMessagesAvatarImageFactory avatarImageWithUserInitials:@"JSQ"
backgroundColor:[UIColor colorWithWhite:0.85f alpha:1.0f]
textColor:[UIColor colorWithWhite:0.60f alpha:1.0f]
font:[UIFont systemFontOfSize:14.0f]
diameter:kJSQMessagesCollectionViewAvatarSizeDefault];
JSQMessagesAvatarImage *cookImage = [JSQMessagesAvatarImageFactory avatarImageWithImage:[UIImage imageNamed:@"demo_avatar_cook"]
diameter:kJSQMessagesCollectionViewAvatarSizeDefault];
JSQMessagesAvatarImage *jobsImage = [JSQMessagesAvatarImageFactory avatarImageWithImage:[UIImage imageNamed:@"demo_avatar_jobs"]
diameter:kJSQMessagesCollectionViewAvatarSizeDefault];
JSQMessagesAvatarImage *wozImage = [JSQMessagesAvatarImageFactory avatarImageWithImage:[UIImage imageNamed:@"demo_avatar_woz"]
diameter:kJSQMessagesCollectionViewAvatarSizeDefault];
self.avatars = @{ kJSQDemoAvatarIdSquires : jsqImage,
kJSQDemoAvatarIdCook : cookImage,
kJSQDemoAvatarIdJobs : jobsImage,
kJSQDemoAvatarIdWoz : wozImage };
self.users = @{ kJSQDemoAvatarIdJobs : kJSQDemoAvatarDisplayNameJobs,
kJSQDemoAvatarIdCook : kJSQDemoAvatarDisplayNameCook,
kJSQDemoAvatarIdWoz : kJSQDemoAvatarDisplayNameWoz,
kJSQDemoAvatarIdSquires : kJSQDemoAvatarDisplayNameSquires };
/**
* Create message bubble images objects.
*
* Be sure to create your bubble images one time and reuse them for good performance.
*
*/
JSQMessagesBubbleImageFactory *bubbleFactory = [[JSQMessagesBubbleImageFactory alloc] init];
self.outgoingBubbleImageData = [bubbleFactory outgoingMessagesBubbleImageWithColor:[UIColor jsq_messageBubbleLightGrayColor]];
self.incomingBubbleImageData = [bubbleFactory incomingMessagesBubbleImageWithColor:[UIColor jsq_messageBubbleGreenColor]];
}
return self;
}
- (void)loadFakeMessages
{
/**
* Load some fake messages for demo.
*
* You should have a mutable array or orderedSet, or something.
*/
self.messages = [[NSMutableArray alloc] initWithObjects:
[[JSQCall alloc] initWithCallerId:kJSQDemoAvatarIdWoz
callerDisplayName:kJSQDemoAvatarDisplayNameWoz
date:[NSDate date]
status:kCallOutgoing],
[[JSQMessage alloc] initWithSenderId:kJSQDemoAvatarIdSquires
senderDisplayName:kJSQDemoAvatarDisplayNameSquires
date:[NSDate distantPast]
text:@"Welcome to JSQMessages: A messaging UI framework for iOS."],
[[JSQMessage alloc] initWithSenderId:kJSQDemoAvatarIdSquires
senderDisplayName:kJSQDemoAvatarDisplayNameSquires
date:[NSDate distantPast]
text:@"Welcome to JSQMessages: A messaging UI framework for iOS."],
[[JSQMessage alloc] initWithSenderId:kJSQDemoAvatarIdWoz
senderDisplayName:kJSQDemoAvatarDisplayNameWoz
date:[NSDate distantPast]
text:@"It is simple, elegant, and easy to use. There are super sweet default settings, but you can customize like crazy."],
[[JSQMessage alloc] initWithSenderId:kJSQDemoAvatarIdSquires
senderDisplayName:kJSQDemoAvatarDisplayNameSquires
date:[NSDate distantPast]
text:@"It even has data detectors. You can call me tonight. My cell number is 123-456-7890. My website is www.hexedbits.com."],
[[JSQMessage alloc] initWithSenderId:kJSQDemoAvatarIdJobs
senderDisplayName:kJSQDemoAvatarDisplayNameJobs
date:[NSDate date]
text:@"JSQMessagesViewController is nearly an exact replica of the iOS Messages App. And perhaps, better."],
[[JSQMessage alloc] initWithSenderId:kJSQDemoAvatarIdCook
senderDisplayName:kJSQDemoAvatarDisplayNameCook
date:[NSDate date]
text:@"It is unit-tested, free, open-source, and documented."],
[[JSQMessage alloc] initWithSenderId:kJSQDemoAvatarIdSquires
senderDisplayName:kJSQDemoAvatarDisplayNameSquires
date:[NSDate date]
text:@"Now with media messages!"],
[[JSQCall alloc] initWithCallerId:kJSQDemoAvatarIdWoz
callerDisplayName:kJSQDemoAvatarDisplayNameWoz
date:[NSDate date]
status:kCallIncoming],
[[JSQCall alloc] initWithCallerId:kJSQDemoAvatarIdWoz
callerDisplayName:kJSQDemoAvatarDisplayNameWoz
date:[NSDate date]
status:kCallMissed],
[[JSQInfoMessage alloc] initWithInfoType:JSQInfoMessageTypeSessionDidEnd
senderId:kJSQDemoAvatarIdCook
senderDisplayName:kJSQDemoAvatarDisplayNameCook
date:[NSDate date]],
[[JSQErrorMessage alloc] initWithErrorType:JSQErrorMessageMissingKeyId
senderId:kJSQDemoAvatarIdCook
senderDisplayName:kJSQDemoAvatarDisplayNameCook
date:[NSDate date]],
[[JSQErrorMessage alloc] initWithErrorType:JSQErrorMessageInvalidMessage
senderId:kJSQDemoAvatarIdCook
senderDisplayName:kJSQDemoAvatarDisplayNameCook
date:[NSDate date]],
[[JSQErrorMessage alloc] initWithErrorType:JSQErrorMessageInvalidVersion
senderId:kJSQDemoAvatarIdCook
senderDisplayName:kJSQDemoAvatarDisplayNameCook
date:[NSDate date]],
[[JSQErrorMessage alloc] initWithErrorType:JSQErrorMessageInvalidKeyException
senderId:kJSQDemoAvatarIdCook
senderDisplayName:kJSQDemoAvatarDisplayNameCook
date:[NSDate date]],
[[JSQErrorMessage alloc] initWithErrorType:JSQErrorMessageWrongTrustedIdentityKey
senderId:kJSQDemoAvatarIdCook
senderDisplayName:kJSQDemoAvatarDisplayNameCook
date:[NSDate date]],
nil];
[self addPhotoMediaMessage];
/**
* Setting to load extra messages for testing/demo
*/
if ([NSUserDefaults extraMessagesSetting]) {
NSArray *copyOfMessages = [self.messages copy];
for (NSUInteger i = 0; i < 4; i++) {
[self.messages addObjectsFromArray:copyOfMessages];
}
}
/**
* Setting to load REALLY long message for testing/demo
* You should see "END" twice
*/
if ([NSUserDefaults longMessageSetting]) {
JSQMessage *reallyLongMessage = [JSQMessage messageWithSenderId:kJSQDemoAvatarIdSquires
displayName:kJSQDemoAvatarDisplayNameSquires
text:@"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? END Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? END"];
[self.messages addObject:reallyLongMessage];
}
}
- (void)addPhotoMediaMessage
{
JSQPhotoMediaItem *photoItem = [[JSQPhotoMediaItem alloc] initWithImage:[UIImage imageNamed:@"goldengate"]];
JSQMessage *photoMessage = [JSQMessage messageWithSenderId:kJSQDemoAvatarIdSquires
displayName:kJSQDemoAvatarDisplayNameSquires
media:photoItem];
[self.messages addObject:photoMessage];
}
- (void)addLocationMediaMessageCompletion:(JSQLocationMediaItemCompletionBlock)completion
{
CLLocation *ferryBuildingInSF = [[CLLocation alloc] initWithLatitude:37.795313 longitude:-122.393757];
JSQLocationMediaItem *locationItem = [[JSQLocationMediaItem alloc] init];
[locationItem setLocation:ferryBuildingInSF withCompletionHandler:completion];
JSQMessage *locationMessage = [JSQMessage messageWithSenderId:kJSQDemoAvatarIdSquires
displayName:kJSQDemoAvatarDisplayNameSquires
media:locationItem];
[self.messages addObject:locationMessage];
}
- (void)addVideoMediaMessage
{
// don't have a real video, just pretending
NSURL *videoURL = [NSURL URLWithString:@"file://"];
JSQVideoMediaItem *videoItem = [[JSQVideoMediaItem alloc] initWithFileURL:videoURL isReadyToPlay:YES];
JSQMessage *videoMessage = [JSQMessage messageWithSenderId:kJSQDemoAvatarIdSquires
displayName:kJSQDemoAvatarDisplayNameSquires
media:videoItem];
[self.messages addObject:videoMessage];
}
@end

View File

@ -1,42 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// Documentation
// http://cocoadocs.org/docsets/JSQMessagesViewController
//
//
// GitHub
// https://github.com/jessesquires/JSQMessagesViewController
//
//
// License
// Copyright (c) 2014 Jesse Squires
// Released under an MIT license: http://opensource.org/licenses/MIT
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
/**
* This is for demo/testing purposes only.
*
* This is a terrible idea for a real app.
*/
@interface DemoSettingsViewController : UITableViewController
@property (weak, nonatomic) IBOutlet UISwitch *extraMessagesSwitch;
@property (weak, nonatomic) IBOutlet UISwitch *longMessageSwitch;
@property (weak, nonatomic) IBOutlet UISwitch *emptySwitch;
@property (weak, nonatomic) IBOutlet UISwitch *incomingAvatarsSwitch;
@property (weak, nonatomic) IBOutlet UISwitch *outgoingAvatarsSwitch;
@property (weak, nonatomic) IBOutlet UISwitch *springySwitch;
@end

View File

@ -1,72 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// Documentation
// http://cocoadocs.org/docsets/JSQMessagesViewController
//
//
// GitHub
// https://github.com/jessesquires/JSQMessagesViewController
//
//
// License
// Copyright (c) 2014 Jesse Squires
// Released under an MIT license: http://opensource.org/licenses/MIT
//
#import "DemoSettingsViewController.h"
#import "NSUserDefaults+DemoSettings.h"
/**
* This is for demo/testing purposes only.
*
* This is a terrible idea for a real app.
*/
@implementation DemoSettingsViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.extraMessagesSwitch.on = [NSUserDefaults extraMessagesSetting];
self.longMessageSwitch.on = [NSUserDefaults longMessageSetting];
self.emptySwitch.on = [NSUserDefaults emptyMessagesSetting];
self.incomingAvatarsSwitch.on = [NSUserDefaults incomingAvatarSetting];
self.outgoingAvatarsSwitch.on = [NSUserDefaults outgoingAvatarSetting];
self.springySwitch.on = [NSUserDefaults springinessSetting];
}
- (IBAction)didTapSwitch:(UISwitch *)sender
{
if (sender == self.extraMessagesSwitch) {
[NSUserDefaults saveExtraMessagesSetting:sender.on];
}
else if (sender == self.longMessageSwitch) {
[NSUserDefaults saveLongMessageSetting:sender.on];
}
else if (sender == self.emptySwitch) {
[NSUserDefaults saveEmptyMessagesSetting:sender.on];
}
else if (sender == self.incomingAvatarsSwitch) {
[NSUserDefaults saveIncomingAvatarSetting:sender.on];
}
else if (sender == self.outgoingAvatarsSwitch) {
[NSUserDefaults saveOutgoingAvatarSetting:sender.on];
}
else if (sender == self.springySwitch) {
[NSUserDefaults saveSpringinessSetting:sender.on];
}
[[NSUserDefaults standardUserDefaults] synchronize];
}
@end

View File

@ -1,80 +0,0 @@
{
"images" : [
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-Small@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-87.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-Spotlight-iOS7@2x-1.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-120-1.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-120.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-180.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-Small.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-Small@2x-1.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-Spotlight-iOS7.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-Spotlight-iOS7@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-76.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-76@2x.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 947 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -1,23 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "demo_avatar_cook.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "demo_avatar_cook@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "demo_avatar_cook@3x.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

View File

@ -1,23 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "demo_avatar_jobs.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "demo_avatar_jobs@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "demo_avatar_jobs@3x.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

View File

@ -1,23 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "demo_avatar_woz.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "demo_avatar_woz@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "demo_avatar_woz@3x.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

View File

@ -1,84 +0,0 @@
{
"images" : [
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "736h",
"filename" : "jsq_messages_splash_55inch.png",
"minimum-system-version" : "8.0",
"orientation" : "portrait",
"scale" : "3x"
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "736h",
"filename" : "jsq_messages_splash_55inch_landscape.png",
"minimum-system-version" : "8.0",
"orientation" : "landscape",
"scale" : "3x"
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "667h",
"filename" : "jsq_messages_splash_47inch.png",
"minimum-system-version" : "8.0",
"orientation" : "portrait",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"filename" : "splash_iphone35inch.png",
"scale" : "2x"
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "retina4",
"filename" : "slpash_iphone4inch.png",
"minimum-system-version" : "7.0",
"orientation" : "portrait",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"filename" : "jsq_messages_splash_ipad.png",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"filename" : "jsq_messages_splash_ipad~landscape.png",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"filename" : "jsq_messages_splash_ipad@2x.png",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"filename" : "jsq_messages_splash_ipad@2x~landscape.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View File

@ -1,23 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "goldengate.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "goldengate@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "goldengate@3x.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 651 KiB

View File

@ -1,47 +0,0 @@
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.hexedbits.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>6.1.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>6.1.1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View File

@ -1,41 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// Documentation
// http://cocoadocs.org/docsets/JSQMessagesViewController
//
//
// GitHub
// https://github.com/jessesquires/JSQMessagesViewController
//
//
// License
// Copyright (c) 2014 Jesse Squires
// Released under an MIT license: http://opensource.org/licenses/MIT
//
#import <Foundation/Foundation.h>
@interface NSUserDefaults (DemoSettings)
+ (void)saveExtraMessagesSetting:(BOOL)value;
+ (BOOL)extraMessagesSetting;
+ (void)saveLongMessageSetting:(BOOL)value;
+ (BOOL)longMessageSetting;
+ (void)saveEmptyMessagesSetting:(BOOL)value;
+ (BOOL)emptyMessagesSetting;
+ (void)saveSpringinessSetting:(BOOL)value;
+ (BOOL)springinessSetting;
+ (void)saveOutgoingAvatarSetting:(BOOL)value;
+ (BOOL)outgoingAvatarSetting;
+ (void)saveIncomingAvatarSetting:(BOOL)value;
+ (BOOL)incomingAvatarSetting;
@end

View File

@ -1,91 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// Documentation
// http://cocoadocs.org/docsets/JSQMessagesViewController
//
//
// GitHub
// https://github.com/jessesquires/JSQMessagesViewController
//
//
// License
// Copyright (c) 2014 Jesse Squires
// Released under an MIT license: http://opensource.org/licenses/MIT
//
#import "NSUserDefaults+DemoSettings.h"
static NSString * const kSettingExtraMessages = @"kSettingExtraMessages";
static NSString * const kSettingLongMessage = @"kSettingLongMessage";
static NSString * const kSettingEmptyMessages = @"kSettingEmptyMessages";
static NSString * const kSettingSpringiness = @"kSettingSpringiness";
static NSString * const kSettingIncomingAvatar = @"kSettingIncomingAvatar";
static NSString * const kSettingOutgoingAvatar = @"kSettingOutgoingAvatar";
@implementation NSUserDefaults (DemoSettings)
+ (void)saveExtraMessagesSetting:(BOOL)value
{
[[NSUserDefaults standardUserDefaults] setBool:value forKey:kSettingExtraMessages];
}
+ (BOOL)extraMessagesSetting
{
return [[NSUserDefaults standardUserDefaults] boolForKey:kSettingExtraMessages];
}
+ (void)saveLongMessageSetting:(BOOL)value
{
[[NSUserDefaults standardUserDefaults] setBool:value forKey:kSettingLongMessage];
}
+ (BOOL)longMessageSetting
{
return [[NSUserDefaults standardUserDefaults] boolForKey:kSettingLongMessage];
}
+ (void)saveEmptyMessagesSetting:(BOOL)value
{
[[NSUserDefaults standardUserDefaults] setBool:value forKey:kSettingEmptyMessages];
}
+ (BOOL)emptyMessagesSetting
{
return [[NSUserDefaults standardUserDefaults] boolForKey:kSettingEmptyMessages];
}
+ (void)saveSpringinessSetting:(BOOL)value
{
[[NSUserDefaults standardUserDefaults] setBool:value forKey:kSettingSpringiness];
}
+ (BOOL)springinessSetting
{
return [[NSUserDefaults standardUserDefaults] boolForKey:kSettingSpringiness];
}
+ (void)saveOutgoingAvatarSetting:(BOOL)value
{
[[NSUserDefaults standardUserDefaults] setBool:value forKey:kSettingOutgoingAvatar];
}
+ (BOOL)outgoingAvatarSetting
{
return [[NSUserDefaults standardUserDefaults] boolForKey:kSettingOutgoingAvatar];
}
+ (void)saveIncomingAvatarSetting:(BOOL)value
{
[[NSUserDefaults standardUserDefaults] setBool:value forKey:kSettingIncomingAvatar];
}
+ (BOOL)incomingAvatarSetting
{
return [[NSUserDefaults standardUserDefaults] boolForKey:kSettingIncomingAvatar];
}
@end

View File

@ -1,28 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// Documentation
// http://cocoadocs.org/docsets/JSQMessagesViewController
//
//
// GitHub
// https://github.com/jessesquires/JSQMessagesViewController
//
//
// License
// Copyright (c) 2014 Jesse Squires
// Released under an MIT license: http://opensource.org/licenses/MIT
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "DemoMessagesViewController.h"
@interface TableViewController : UITableViewController <JSQDemoViewControllerDelegate>
- (IBAction)unwindSegue:(UIStoryboardSegue *)sender;
@end

View File

@ -1,171 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// Documentation
// http://cocoadocs.org/docsets/JSQMessagesViewController
//
//
// GitHub
// https://github.com/jessesquires/JSQMessagesViewController
//
//
// License
// Copyright (c) 2014 Jesse Squires
// Released under an MIT license: http://opensource.org/licenses/MIT
//
#import "TableViewController.h"
@implementation TableViewController
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = @"JSQMessagesViewController";
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES];
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 3;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (section == 2) {
return 1;
}
return 2;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"CellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
if (indexPath.section == 0) {
switch (indexPath.row) {
case 0:
cell.textLabel.text = @"Push via storyboard";
break;
case 1:
cell.textLabel.text = @"Push programmatically";
break;
}
}
else if (indexPath.section == 1) {
switch (indexPath.row) {
case 0:
cell.textLabel.text = @"Modal via storyboard";
break;
case 1:
cell.textLabel.text = @"Modal programmatically";
break;
}
}
else if (indexPath.section == 2) {
switch (indexPath.row) {
case 0:
cell.textLabel.text = @"Settings";
break;
}
}
return cell;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
switch (section) {
case 0:
return @"Presentation";
case 2:
return @"Demo options";
default:
return nil;
}
}
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section
{
return (section == [tableView numberOfSections] - 1) ? @"Copyright © 2014\nJesse Squires\nMIT License" : nil;
}
#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 0) {
switch (indexPath.row) {
case 0:
[self performSegueWithIdentifier:@"seguePushDemoVC" sender:self];
break;
case 1:
{
DemoMessagesViewController *vc = [DemoMessagesViewController messagesViewController];
[self.navigationController pushViewController:vc animated:YES];
}
break;
}
}
else if (indexPath.section == 1) {
switch (indexPath.row) {
case 0:
[self performSegueWithIdentifier:@"segueModalDemoVC" sender:self];
break;
case 1:
{
DemoMessagesViewController *vc = [DemoMessagesViewController messagesViewController];
vc.delegateModal = self;
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:vc];
[self presentViewController:nc animated:YES completion:nil];
}
break;
}
}
else if (indexPath.section == 2) {
switch (indexPath.row) {
case 0:
[self performSegueWithIdentifier:@"SegueToSettings" sender:self];
break;
}
}
}
#pragma mark - Segues
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"segueModalDemoVC"]) {
UINavigationController *nc = segue.destinationViewController;
DemoMessagesViewController *vc = (DemoMessagesViewController *)nc.topViewController;
vc.delegateModal = self;
}
}
- (IBAction)unwindSegue:(UIStoryboardSegue *)sender { }
#pragma mark - Demo delegate
- (void)didDismissJSQDemoViewController:(DemoMessagesViewController *)vc
{
[self dismissViewControllerAnimated:YES completion:nil];
}
@end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,28 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// Documentation
// http://cocoadocs.org/docsets/JSQMessagesViewController
//
//
// GitHub
// https://github.com/jessesquires/JSQMessagesViewController
//
//
// License
// Copyright (c) 2014 Jesse Squires
// Released under an MIT license: http://opensource.org/licenses/MIT
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}

View File

@ -1,40 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "NSString+JSQMessages.h"
@interface JSQMessagesNSStringTests : XCTestCase
@end
@implementation JSQMessagesNSStringTests
- (void)testTrimingStringWhitespace
{
// GIVEN: a string of text
NSString *loremIpsum = @"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.";
// WHEN: the text is wrapped in white space
NSString *string1 = [NSString stringWithFormat:@" %@ ", loremIpsum];
NSString *string2 = [NSString stringWithFormat:@" %@", loremIpsum];
NSString *string3 = [NSString stringWithFormat:@"%@ ", loremIpsum];
// THEN: we can successfully trim extra white space
XCTAssertEqualObjects(loremIpsum, [string1 jsq_stringByTrimingWhitespace], @"Strings should be equal after trimming whitespace");
XCTAssertEqualObjects(loremIpsum, [string2 jsq_stringByTrimingWhitespace], @"Strings should be equal after trimming whitespace");
XCTAssertEqualObjects(loremIpsum, [string3 jsq_stringByTrimingWhitespace], @"Strings should be equal after trimming whitespace");
}
@end

View File

@ -1,61 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "UIColor+JSQMessages.h"
@interface JSQMessagesUIColorTests : XCTestCase
@end
@implementation JSQMessagesUIColorTests
- (void)testDarkeningColors
{
// GIVEN: a color and darkening value
CGFloat r = 0.89f, g = 0.34f, b = 0.67f, a = 1.0f;
CGFloat darkeningValue = 0.12f;
UIColor *color = [UIColor colorWithRed:r green:g blue:b alpha:a];
// WHEN: we darken that color
UIColor *darkColor = [color jsq_colorByDarkeningColorWithValue:darkeningValue];
// THEN: each RGB value is changed accordingly
CGFloat dr, dg, db, da;
[darkColor getRed:&dr green:&dg blue:&db alpha:&da];
XCTAssertEqual(dr, r - darkeningValue, @"Red values should be equal");
XCTAssertEqual(dg, g - darkeningValue, @"Green values should be equal");
XCTAssertEqual(db, b - darkeningValue, @"Blue values should be equal");
XCTAssertEqual(da, a, @"Alpha values should be equal");
}
- (void)testDarkeningColorsFloorToZero
{
// GIVEN: a color and darkening value
CGFloat r = 0.89f, g = 0.24f, b = 0.67f, a = 1.0f;
CGFloat darkeningValue = 0.5f;
UIColor *color = [UIColor colorWithRed:r green:g blue:b alpha:a];
// WHEN: we dark that color, such that some RGB values will be negative
UIColor *darkColor = [color jsq_colorByDarkeningColorWithValue:darkeningValue];
// THEN: the RGB values are floored to zero instead of being negative
CGFloat dr, dg, db, da;
[darkColor getRed:&dr green:&dg blue:&db alpha:&da];
XCTAssertEqual(dr, r - darkeningValue, @"Red values should be equal");
XCTAssertEqual(dg, 0.0f, @"Green values should be floored to zero");
XCTAssertEqual(db, b - darkeningValue, @"Blue values should be equal");
XCTAssertEqual(da, a, @"Alpha values should be equal");
}
@end

View File

@ -1,67 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "UIImage+JSQMessages.h"
@interface JSQMessagesUIImageTests : XCTestCase
@end
@implementation JSQMessagesUIImageTests
- (void)testImageMasking
{
// GIVEN: an image
UIImage *img = [UIImage jsq_bubbleCompactImage];
XCTAssertNotNil(img, @"Image should not be nil");
// WHEN: we mask that image
UIImage *imgMasked = [img jsq_imageMaskedWithColor:[UIColor whiteColor]];
XCTAssertNotNil(imgMasked, @"Image should not be nil");
// THEN: masking should succeed, and the new image should have the same properties
XCTAssertTrue(CGSizeEqualToSize(img.size, imgMasked.size), @"Image sizes should be equal");
XCTAssertEqual(img.scale, imgMasked.scale, @"Image scales should be equal");
XCTAssertThrows([img jsq_imageMaskedWithColor:nil], @"Should throw when passing nil color");
}
- (void)testImageAssets
{
// GIVEN: our image assets
// WHEN: we create a new UIImage object
// THEN: the image is created successfully
XCTAssertNotNil([UIImage jsq_bubbleRegularImage]);
XCTAssertNotNil([UIImage jsq_bubbleRegularTaillessImage]);
XCTAssertNotNil([UIImage jsq_bubbleRegularStrokedImage]);
XCTAssertNotNil([UIImage jsq_bubbleRegularStrokedTaillessImage]);
XCTAssertNotNil([UIImage jsq_bubbleCompactImage]);
XCTAssertNotNil([UIImage jsq_bubbleCompactTaillessImage]);
XCTAssertNotNil([UIImage jsq_defaultAccessoryImage]);
XCTAssertNotNil([UIImage jsq_defaultTypingIndicatorImage]);
XCTAssertNotNil([UIImage jsq_defaultPlayImage]);
}
@end

View File

@ -1,59 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "UIView+JSQMessages.h"
@interface JSQMessagesUIViewTests : XCTestCase
@end
@implementation JSQMessagesUIViewTests
- (void)testViewAutoLayoutPinEdges
{
// GIVEN: a superview and subview
UIView *superview = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 50.0f, 50.0f)];
[superview setTranslatesAutoresizingMaskIntoConstraints:NO];
UIView *subview = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 25.0f, 25.0f)];
[subview setTranslatesAutoresizingMaskIntoConstraints:NO];
// WHEN: we add the subview to the superview
[superview addSubview:subview];
// WHEN: we pin the edges of the subview to the superview
XCTAssertNoThrow([superview jsq_pinAllEdgesOfSubview:subview], @"Pinning edges of subview to superview should not throw");
[superview setNeedsUpdateConstraints];
[superview layoutIfNeeded];
// THEN: add the layout constraints and laying out the views succeeds
XCTAssertEqual([[superview constraints] count], 4U, @"Superview should have 4 constraints");
XCTAssertEqual([[subview constraints] count], 0U, @"Subview should have 0 constraints");
for (NSLayoutConstraint *eachConstraint in [superview constraints]) {
XCTAssertEqualObjects(eachConstraint.firstItem, superview, @"Constraint first item should be equal to superview");
XCTAssertEqualObjects(eachConstraint.secondItem, subview, @"Constraint second item should be equal to subview");
XCTAssertEqual(eachConstraint.relation, NSLayoutRelationEqual, @"Constraint relation should be NSLayoutRelationEqual");
XCTAssertEqual(eachConstraint.multiplier, 1.0f, @"Constraint multiplier should be 1.0");
XCTAssertEqual(eachConstraint.constant, 0.0f, @"Constraint constant should be 0.0");
}
}
@end

View File

@ -1,46 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "JSQMessagesKeyboardController.h"
@interface JSQMessagesKeyboardControllerTests : XCTestCase
@end
@implementation JSQMessagesKeyboardControllerTests
- (void)setUp
{
[super setUp];
}
- (void)tearDown
{
[super tearDown];
}
- (void)testKeyboardControllerInit
{
JSQMessagesKeyboardController *keyboardController = [[JSQMessagesKeyboardController alloc] initWithTextView:[UITextView new]
contextView:[UIView new]
panGestureRecognizer:[UIPanGestureRecognizer new]
delegate:nil];
XCTAssertNotNil(keyboardController, @"Keyboard controller should not be nil");
XCTAssertThrows([[JSQMessagesKeyboardController alloc] initWithTextView:nil
contextView:nil
panGestureRecognizer:nil
delegate:nil], @"Invalid init should throw");
}
@end

View File

@ -1,103 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import <OCMock/OCMock.h>
#import "JSQMessagesViewController.h"
#import "DemoMessagesViewController.h"
@interface JSQMessagesViewController ()
- (void)jsq_configureMessagesViewController;
@end
@interface JSQMessagesViewControllerTests : XCTestCase
@end
@implementation JSQMessagesViewControllerTests
- (void)setUp
{
[super setUp];
}
- (void)tearDown
{
[super tearDown];
}
- (void)testJSQMessagesViewControllerInit
{
UINib *nib = [JSQMessagesViewController nib];
XCTAssertNotNil(nib, @"Nib should not be nil");
JSQMessagesViewController *vc = [JSQMessagesViewController messagesViewController];
[vc view];
XCTAssertNotNil(vc, @"View controller should not be nil");
XCTAssertNotNil(vc.view, @"View should not be nil");
XCTAssertNotNil(vc.collectionView, @"Collection view should not be nil");
XCTAssertNotNil(vc.inputToolbar, @"Input toolbar should not be nil");
XCTAssertEqualObjects(vc.senderId, @"JSQDefaultSender", @"Property should be equal to default value");
XCTAssertEqualObjects(vc.senderDisplayName, @"JSQDefaultSender", @"Property should be equal to default value");
XCTAssertEqual(vc.automaticallyAdjustsScrollViewInsets, YES, @"Property should be equal to default value");
XCTAssertEqualObjects(vc.incomingCellIdentifier, [JSQMessagesCollectionViewCellIncoming cellReuseIdentifier], @"Property should be equal to default value");
XCTAssertEqualObjects(vc.outgoingCellIdentifier, [JSQMessagesCollectionViewCellOutgoing cellReuseIdentifier], @"Property should be equal to default value");
XCTAssertEqual(vc.showTypingIndicator, NO, @"Property should be equal to default value");
XCTAssertEqual(vc.showLoadEarlierMessagesHeader, NO, @"Property should be equal to default value");
}
- (void)testJSQMessagesViewControllerSubclassInitProgramatically
{
DemoMessagesViewController *demoVC = [DemoMessagesViewController messagesViewController];
[demoVC view];
XCTAssertNotNil(demoVC, @"View controller should not be nil");
XCTAssertTrue([demoVC isKindOfClass:[DemoMessagesViewController class]], @"View controller should be kind of class: %@", [DemoMessagesViewController class]);
XCTAssertNotNil(demoVC.view, @"View should not be nil");
XCTAssertNotNil(demoVC.collectionView, @"Collection view should not be nil");
XCTAssertNotNil(demoVC.inputToolbar, @"Input toolbar should not be nil");
}
- (void)testJSQMessagesViewControllerSubclassInitStoryboards
{
UIStoryboard *mainSB = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
XCTAssertNotNil(mainSB, @"Storyboard should not be nil");
DemoMessagesViewController *demoVC = [mainSB instantiateViewControllerWithIdentifier:@"DemoVC"];
[demoVC view];
XCTAssertNotNil(demoVC, @"View controller should not be nil");
XCTAssertTrue([demoVC isKindOfClass:[DemoMessagesViewController class]], @"View controller should be kind of class: %@", [DemoMessagesViewController class]);
XCTAssertNotNil(demoVC.view, @"View should not be nil");
XCTAssertNotNil(demoVC.collectionView, @"Collection view should not be nil");
XCTAssertNotNil(demoVC.inputToolbar, @"Input toolbar should not be nil");
}
- (void)testViewConfiguration
{
JSQMessagesViewController *vc = [JSQMessagesViewController messagesViewController];
id mockVC = [OCMockObject partialMockForObject:vc];
[[mockVC expect] jsq_configureMessagesViewController];
[vc view];
[mockVC verify];
}
@end

View File

@ -1,73 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "JSQMessagesAvatarImageFactory.h"
@interface JSQMessagesAvatarImageFactoryTests : XCTestCase
@end
@implementation JSQMessagesAvatarImageFactoryTests
- (void)setUp
{
[super setUp];
}
- (void)tearDown
{
[super tearDown];
}
- (void)testAvatarImage
{
UIImage *image = [UIImage imageNamed:@"demo_avatar_jobs"];
XCTAssertNotNil(image, @"Image should not be nil");
CGFloat diameter = 50.0f;
JSQMessagesAvatarImage *avatar = [JSQMessagesAvatarImageFactory avatarImageWithPlaceholder:image diameter:diameter];
XCTAssertNotNil(avatar, @"Avatar should not be nil");
XCTAssertTrue(CGSizeEqualToSize(avatar.avatarPlaceholderImage.size, CGSizeMake(diameter, diameter)), @"Avatar size should be equal to diameter");
XCTAssertEqual(avatar.avatarPlaceholderImage.scale, [UIScreen mainScreen].scale, @"Avatar scale should be equal to screen scale");
avatar.avatarImage = [JSQMessagesAvatarImageFactory circularAvatarImage:image withDiameter:diameter];
XCTAssertTrue(CGSizeEqualToSize(avatar.avatarImage.size, CGSizeMake(diameter, diameter)), @"Avatar size should be equal to diameter");
XCTAssertEqual(avatar.avatarImage.scale, [UIScreen mainScreen].scale, @"Avatar scale should be equal to screen scale");
avatar.avatarHighlightedImage = [JSQMessagesAvatarImageFactory circularAvatarHighlightedImage:image withDiameter:diameter];
XCTAssertTrue(CGSizeEqualToSize(avatar.avatarHighlightedImage.size, CGSizeMake(diameter, diameter)), @"Avatar size should be equal to diameter");
XCTAssertEqual(avatar.avatarHighlightedImage.scale, [UIScreen mainScreen].scale, @"Avatar scale should be equal to screen scale");
}
- (void)testAvatarInitialsImage
{
CGFloat diameter = 50.0f;
JSQMessagesAvatarImage *avatar = [JSQMessagesAvatarImageFactory avatarImageWithUserInitials:@"JSQ"
backgroundColor:[UIColor lightGrayColor]
textColor:[UIColor darkGrayColor]
font:[UIFont systemFontOfSize:13.0f]
diameter:diameter];
XCTAssertNotNil(avatar, @"Avatar should not be nil");
XCTAssertTrue(CGSizeEqualToSize(avatar.avatarImage.size, CGSizeMake(diameter, diameter)), @"Avatar size should be equal to diameter");
XCTAssertEqual(avatar.avatarImage.scale, [UIScreen mainScreen].scale, @"Avatar scale should be equal to screen scale");
XCTAssertTrue(CGSizeEqualToSize(avatar.avatarHighlightedImage.size, CGSizeMake(diameter, diameter)), @"Avatar size should be equal to diameter");
XCTAssertEqual(avatar.avatarHighlightedImage.scale, [UIScreen mainScreen].scale, @"Avatar scale should be equal to screen scale");
XCTAssertTrue(CGSizeEqualToSize(avatar.avatarPlaceholderImage.size, CGSizeMake(diameter, diameter)), @"Avatar size should be equal to diameter");
XCTAssertEqual(avatar.avatarPlaceholderImage.scale, [UIScreen mainScreen].scale, @"Avatar scale should be equal to screen scale");
}
@end

View File

@ -1,135 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "JSQMessagesBubbleImageFactory.h"
#import "UIImage+JSQMessages.h"
@interface JSQMessagesBubbleImageFactoryTests : XCTestCase
@property (strong, nonatomic) JSQMessagesBubbleImageFactory *factory;
@end
@implementation JSQMessagesBubbleImageFactoryTests
- (void)setUp
{
[super setUp];
self.factory = [[JSQMessagesBubbleImageFactory alloc] init];
}
- (void)tearDown
{
self.factory = nil;
[super tearDown];
}
- (void)testOutgoingMessageBubbleImageView
{
UIImage *bubble = [UIImage jsq_bubbleCompactImage];
XCTAssertNotNil(bubble, @"Bubble image should not be nil");
CGPoint center = CGPointMake(bubble.size.width / 2.0f, bubble.size.height / 2.0f);
UIEdgeInsets capInsets = UIEdgeInsetsMake(center.y, center.x, center.y, center.x);
JSQMessagesBubbleImage *bubbleImage = [self.factory outgoingMessagesBubbleImageWithColor:[UIColor lightGrayColor]];
XCTAssertNotNil(bubbleImage, @"Bubble image should not be nil");
XCTAssertNotNil(bubbleImage.messageBubbleImage, "Image should not be nil");
XCTAssertEqual(bubbleImage.messageBubbleImage.scale, bubble.scale, @"Image scale should equal bubble image scale");
XCTAssertEqual(bubbleImage.messageBubbleImage.imageOrientation, bubble.imageOrientation, @"Image orientation should equal bubble image orientation");
XCTAssertTrue(bubbleImage.messageBubbleImage.resizingMode == UIImageResizingModeStretch, @"Image should be stretchable");
XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(bubbleImage.messageBubbleImage.capInsets, capInsets), @"Image capInsets should be equal to capInsets");
XCTAssertNotNil(bubbleImage.messageBubbleHighlightedImage, @"Highlighted image should not be nil");
XCTAssertEqual(bubbleImage.messageBubbleHighlightedImage.scale, bubble.scale, @"HighlightedImage scale should equal bubble image scale");
XCTAssertEqual(bubbleImage.messageBubbleHighlightedImage.imageOrientation, bubble.imageOrientation, @"HighlightedImage orientation should equal bubble image orientation");
XCTAssertTrue(bubbleImage.messageBubbleHighlightedImage.resizingMode == UIImageResizingModeStretch, @"HighlightedImage should be stretchable");
XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(bubbleImage.messageBubbleHighlightedImage.capInsets, capInsets), @"HighlightedImage capInsets should be equal to capInsets");
}
- (void)testIncomingMessageBubbleImageView
{
UIImage *bubble = [UIImage jsq_bubbleCompactImage];
XCTAssertNotNil(bubble, @"Bubble image should not be nil");
CGPoint center = CGPointMake(bubble.size.width / 2.0f, bubble.size.height / 2.0f);
UIEdgeInsets capInsets = UIEdgeInsetsMake(center.y, center.x, center.y, center.x);
JSQMessagesBubbleImage *bubbleImage = [self.factory incomingMessagesBubbleImageWithColor:[UIColor lightGrayColor]];
XCTAssertNotNil(bubbleImage, @"Bubble image should not be nil");
XCTAssertNotNil(bubbleImage.messageBubbleImage, "Image should not be nil");
XCTAssertEqual(bubbleImage.messageBubbleImage.scale, bubble.scale, @"Image scale should equal bubble image scale");
XCTAssertEqual(bubbleImage.messageBubbleImage.imageOrientation, UIImageOrientationUpMirrored, @"Image orientation should be flipped");
XCTAssertTrue(bubbleImage.messageBubbleImage.resizingMode == UIImageResizingModeStretch, @"Image should be stretchable");
XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(bubbleImage.messageBubbleImage.capInsets, capInsets), @"Image capInsets should be equal to capInsets");
XCTAssertNotNil(bubbleImage.messageBubbleHighlightedImage, @"Highlighted image should not be nil");
XCTAssertEqual(bubbleImage.messageBubbleHighlightedImage.scale, bubble.scale, @"HighlightedImage scale should equal bubble image scale");
XCTAssertEqual(bubbleImage.messageBubbleHighlightedImage.imageOrientation, UIImageOrientationUpMirrored, @"Image orientation should be flipped");
XCTAssertTrue(bubbleImage.messageBubbleHighlightedImage.resizingMode == UIImageResizingModeStretch, @"HighlightedImage should be stretchable");
XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(bubbleImage.messageBubbleHighlightedImage.capInsets, capInsets), @"HighlightedImage capInsets should be equal to capInsets");
}
- (void)testCustomOutgoingMessageBubbleImageView
{
UIImage *bubble = [UIImage jsq_bubbleRegularStrokedTaillessImage];
XCTAssertNotNil(bubble, @"Bubble image should not be nil");
UIEdgeInsets capInsets = UIEdgeInsetsMake(1, 1, 1, 1);
JSQMessagesBubbleImageFactory *factory = [[JSQMessagesBubbleImageFactory alloc] initWithBubbleImage:bubble capInsets:capInsets];
JSQMessagesBubbleImage *bubbleImage = [factory outgoingMessagesBubbleImageWithColor:[UIColor lightGrayColor]];
XCTAssertNotNil(bubbleImage, @"Bubble image should not be nil");
XCTAssertNotNil(bubbleImage.messageBubbleImage, "Image should not be nil");
XCTAssertEqual(bubbleImage.messageBubbleImage.scale, bubble.scale, @"Image scale should equal bubble image scale");
XCTAssertEqual(bubbleImage.messageBubbleImage.imageOrientation, bubble.imageOrientation, @"Image orientation should equal bubble image orientation");
XCTAssertTrue(bubbleImage.messageBubbleImage.resizingMode == UIImageResizingModeStretch, @"Image should be stretchable");
XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(bubbleImage.messageBubbleImage.capInsets, capInsets), @"Image capInsets should be equal to capInsets");
XCTAssertNotNil(bubbleImage.messageBubbleHighlightedImage, @"Highlighted image should not be nil");
XCTAssertEqual(bubbleImage.messageBubbleHighlightedImage.scale, bubble.scale, @"HighlightedImage scale should equal bubble image scale");
XCTAssertEqual(bubbleImage.messageBubbleHighlightedImage.imageOrientation, bubble.imageOrientation, @"HighlightedImage orientation should equal bubble image orientation");
XCTAssertTrue(bubbleImage.messageBubbleHighlightedImage.resizingMode == UIImageResizingModeStretch, @"HighlightedImage should be stretchable");
XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(bubbleImage.messageBubbleHighlightedImage.capInsets, capInsets), @"HighlightedImage capInsets should be equal to capInsets");
}
- (void)testCustomIncomingMessageBubbleImageView
{
UIImage *bubble = [UIImage jsq_bubbleRegularStrokedTaillessImage];
XCTAssertNotNil(bubble, @"Bubble image should not be nil");
UIEdgeInsets capInsets = UIEdgeInsetsMake(1, 1, 1, 1);
JSQMessagesBubbleImageFactory *factory = [[JSQMessagesBubbleImageFactory alloc] initWithBubbleImage:bubble capInsets:capInsets];
JSQMessagesBubbleImage *bubbleImage = [factory incomingMessagesBubbleImageWithColor:[UIColor lightGrayColor]];
XCTAssertNotNil(bubbleImage, @"Bubble image should not be nil");
XCTAssertNotNil(bubbleImage.messageBubbleImage, "Image should not be nil");
XCTAssertEqual(bubbleImage.messageBubbleImage.scale, bubble.scale, @"Image scale should equal bubble image scale");
XCTAssertEqual(bubbleImage.messageBubbleImage.imageOrientation, UIImageOrientationUpMirrored, @"Image orientation should be flipped");
XCTAssertTrue(bubbleImage.messageBubbleImage.resizingMode == UIImageResizingModeStretch, @"Image should be stretchable");
XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(bubbleImage.messageBubbleImage.capInsets, capInsets), @"Image capInsets should be equal to capInsets");
XCTAssertNotNil(bubbleImage.messageBubbleHighlightedImage, @"Highlighted image should not be nil");
XCTAssertEqual(bubbleImage.messageBubbleHighlightedImage.scale, bubble.scale, @"HighlightedImage scale should equal bubble image scale");
XCTAssertEqual(bubbleImage.messageBubbleHighlightedImage.imageOrientation, UIImageOrientationUpMirrored, @"Image orientation should be flipped");
XCTAssertTrue(bubbleImage.messageBubbleHighlightedImage.resizingMode == UIImageResizingModeStretch, @"HighlightedImage should be stretchable");
XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(bubbleImage.messageBubbleHighlightedImage.capInsets, capInsets), @"HighlightedImage capInsets should be equal to capInsets");
}
@end

View File

@ -1,37 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "JSQMessagesMediaViewBubbleImageMasker.h"
@interface JSQMessagesMediaViewBubbleImageMaskerTests : XCTestCase
@end
@implementation JSQMessagesMediaViewBubbleImageMaskerTests
- (void)testMediaViewBubbleImageMasker
{
// GIVEN: a new masker object
JSQMessagesMediaViewBubbleImageMasker *masker = [[JSQMessagesMediaViewBubbleImageMasker alloc] init];
XCTAssertNotNil(masker);
// WHEN: we apply a mask to a view
UIView *view1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
UIView *view2 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
// THEN: it succeeds without an error
XCTAssertNoThrow([masker applyOutgoingBubbleImageMaskToMediaView:view1]);
XCTAssertNoThrow([masker applyIncomingBubbleImageMaskToMediaView:view2]);
}
@end

View File

@ -1,104 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "JSQMessagesTimestampFormatter.h"
@interface JSQMessagesTimestampFormatterTests : XCTestCase
@end
@implementation JSQMessagesTimestampFormatterTests
- (void)setUp
{
[super setUp];
}
- (void)tearDown
{
[super tearDown];
}
- (void)testTimestampFormatterInit
{
JSQMessagesTimestampFormatter *formatter = [JSQMessagesTimestampFormatter sharedFormatter];
XCTAssertNotNil(formatter, @"Formatter should not be nil");
XCTAssertEqualObjects(formatter, [JSQMessagesTimestampFormatter sharedFormatter], @"Shared formatter should return the same instance");
UIColor *color = [UIColor lightGrayColor];
NSMutableParagraphStyle *paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
paragraphStyle.alignment = NSTextAlignmentCenter;
NSDictionary *dateAttrs = @{ NSFontAttributeName : [UIFont boldSystemFontOfSize:12.0f],
NSForegroundColorAttributeName : color,
NSParagraphStyleAttributeName : paragraphStyle };
NSDictionary *timeAttrs = @{ NSFontAttributeName : [UIFont systemFontOfSize:12.0f],
NSForegroundColorAttributeName : color,
NSParagraphStyleAttributeName : paragraphStyle };
XCTAssertEqualObjects(formatter.dateTextAttributes, dateAttrs, @"Date attributes should be equal to default values");
XCTAssertEqualObjects(formatter.timeTextAttributes, timeAttrs, @"Time attributes should be equal to default values");
XCTAssertNotNil(formatter.dateFormatter, @"Property should not be nil");
}
- (void)testTimestampForDate
{
NSDateComponents *components = [[NSDateComponents alloc] init];
[components setCalendar:[NSCalendar currentCalendar]];
[components setYear:2013];
[components setMonth:6];
[components setDay:6];
[components setHour:19];
[components setMinute:6];
[components setSecond:0];
NSDate *date = [components date];
NSString *timestampString = [[JSQMessagesTimestampFormatter sharedFormatter] timestampForDate:date];
XCTAssertEqualObjects(timestampString, @"Jun 6, 2013, 7:06 PM", @"Timestamp string should return expected value");
NSAttributedString *timestampAttributedString = [[JSQMessagesTimestampFormatter sharedFormatter] attributedTimestampForDate:date];
XCTAssertEqualObjects([timestampAttributedString string], @"Jun 6, 2013 7:06 PM", @"Attributed timestamp string should return expected value");
}
- (void)testTimeForDate
{
NSDateComponents *components = [[NSDateComponents alloc] init];
[components setCalendar:[NSCalendar currentCalendar]];
[components setHour:7];
[components setMinute:6];
[components setSecond:0];
NSDate *date = [components date];
NSString *timeForDateString = [[JSQMessagesTimestampFormatter sharedFormatter] timeForDate:date];
XCTAssertEqualObjects(timeForDateString, @"7:06 AM", @"Time string should return expected value");
}
- (void)testRelativeDataForDate
{
NSDate *date = [NSDate date];
NSString *relativeDateString = [[JSQMessagesTimestampFormatter sharedFormatter] relativeDateForDate:date];
XCTAssertEqualObjects(relativeDateString, @"Today", @"Relative date string shoudl return expected value");
}
@end

View File

@ -1,37 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "JSQMessagesToolbarButtonFactory.h"
#import "UIColor+JSQMessages.h"
@interface JSQMessagesToolbarButtonFactoryTests : XCTestCase
@end
@implementation JSQMessagesToolbarButtonFactoryTests
- (void)testDefaultSendButtonItem
{
UIButton *button = [JSQMessagesToolbarButtonFactory defaultSendButtonItem];
XCTAssertNotNil(button, @"Button should not be nil");
}
- (void)testDefaultAccessoryButtonItem
{
UIButton *button = [JSQMessagesToolbarButtonFactory defaultAccessoryButtonItem];
XCTAssertNotNil(button, @"Button should not be nil");
}
@end

View File

@ -1,24 +0,0 @@
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.hexedbits.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@ -1,38 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "JSQMessagesCollectionViewFlowLayout.h"
@interface JSQMessagesCollectionViewFlowLayoutTests : XCTestCase
@end
@implementation JSQMessagesCollectionViewFlowLayoutTests
- (void)setUp
{
[super setUp];
}
- (void)tearDown
{
[super tearDown];
}
- (void)testFlowLayoutInit
{
JSQMessagesCollectionViewFlowLayout *layout = [[JSQMessagesCollectionViewFlowLayout alloc] init];
XCTAssertNotNil(layout, @"Layout should not be nil");
}
@end

View File

@ -1,52 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "JSQMessagesCollectionViewLayoutAttributes.h"
@interface JSQMessagesCollectionViewLayoutAttributesTests : XCTestCase
@end
@implementation JSQMessagesCollectionViewLayoutAttributesTests
- (void)setUp
{
[super setUp];
}
- (void)tearDown
{
[super tearDown];
}
- (void)testLayoutAttributesInitAndIsEqual
{
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:0 inSection:0];
JSQMessagesCollectionViewLayoutAttributes *attrs = [JSQMessagesCollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath];
attrs.messageBubbleFont = [UIFont systemFontOfSize:15.0f];
attrs.messageBubbleContainerViewWidth = 40.0f;
attrs.textViewTextContainerInsets = UIEdgeInsetsMake(10.0f, 8.0f, 10.0f, 8.0f);
attrs.textViewFrameInsets = UIEdgeInsetsMake(0.0f, 0.0f, 0.0f, 6.0f);
attrs.incomingAvatarViewSize = CGSizeMake(34.0f, 34.0f);
attrs.outgoingAvatarViewSize = CGSizeZero;
attrs.cellTopLabelHeight = 20.0f;
attrs.messageBubbleTopLabelHeight = 10.0f;
attrs.cellBottomLabelHeight = 15.0f;
XCTAssertNotNil(attrs, @"Layout attributes should not be nil");
JSQMessagesCollectionViewLayoutAttributes *copy = [attrs copy];
XCTAssertEqualObjects(attrs, copy, @"Copied attributes should be equal");
XCTAssertEqual([attrs hash], [copy hash], @"Copied attributes hashes should be equal");
}
@end

View File

@ -1,64 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "JSQLocationMediaItem.h"
@interface JSQLocationMediaItemTests : XCTestCase
@property (strong, nonatomic) CLLocation *location;
@end
@implementation JSQLocationMediaItemTests
- (void)setUp
{
[super setUp];
self.location = [[CLLocation alloc] initWithLatitude:37.795313 longitude:-122.393757];
}
- (void)tearDown
{
self.location = nil;
[super tearDown];
}
- (void)testLocationItemInit
{
JSQLocationMediaItem *item = [[JSQLocationMediaItem alloc] initWithLocation:self.location];
XCTAssertNotNil(item);
}
- (void)testMediaDataProtocol
{
JSQLocationMediaItem *item = [[JSQLocationMediaItem alloc] init];
XCTAssertTrue(!CGSizeEqualToSize([item mediaViewDisplaySize], CGSizeZero));
XCTAssertNotNil([item mediaPlaceholderView]);
XCTAssertNil([item mediaView], @"Media view should be nil if location is nil");
XCTestExpectation *expectation = [self expectationWithDescription:[NSString stringWithFormat:@"%s", __PRETTY_FUNCTION__]];
[item setLocation:self.location withCompletionHandler:^{
[expectation fulfill];
}];
[self waitForExpectationsWithTimeout:5 handler:^(NSError *error) {
XCTAssertNil(error, @"Expectation should not error");
}];
XCTAssertNotNil([item mediaView], @"Media view should NOT be nil once item has media data");
}
@end

View File

@ -1,112 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import <OCMock/OCMock.h>
#import "JSQMessage.h"
// Fake media object for testing
@interface FakeMedia : NSObject <JSQMessageMediaData, NSCoding>
@end
@implementation FakeMedia
- (UIView *)mediaView { return [UIView new]; }
- (UIView *)mediaPlaceholderView { return [self mediaView]; }
- (CGSize)mediaViewDisplaySize { return CGSizeMake(50, 50); }
- (void)encodeWithCoder:(NSCoder *)aCoder { }
- (id)initWithCoder:(NSCoder *)aDecoder { return [self init]; }
- (BOOL)isEqual:(id)object { return YES; }
@end
@interface JSQMessageMediaTests : XCTestCase
@property (strong, nonatomic) NSString *senderId;
@property (strong, nonatomic) NSString *senderDisplayName;
@property (strong, nonatomic) NSDate *date;
@property (strong, nonatomic) id<JSQMessageMediaData> mockMediaData;
@end
@implementation JSQMessageMediaTests
- (void)setUp
{
[super setUp];
self.senderId = @"324543-43556-212343";
self.senderDisplayName = @"Jesse Squires";
self.date = [NSDate date];
self.mockMediaData = [OCMockObject mockForProtocol:@protocol(JSQMessageMediaData)];
}
- (void)tearDown
{
self.senderId = nil;
self.senderDisplayName = nil;
self.date = nil;
self.mockMediaData = nil;
[super tearDown];
}
- (void)testMediaMessageInit
{
JSQMessage *msg = [[JSQMessage alloc] initWithSenderId:self.senderId
senderDisplayName:self.senderDisplayName
date:self.date
media:self.mockMediaData];
XCTAssertNotNil(msg, @"Message should not be nil");
}
- (void)testMediaMessageInvalidInit
{
XCTAssertThrows([[JSQMessage alloc] init], @"Invalid init should throw");
XCTAssertThrows([[JSQMessage alloc] initWithSenderId:nil senderDisplayName:nil date:nil media:nil], @"Invalid init should throw");
}
- (void)testMediaMessageIsEqual
{
JSQMessage *msg = [[JSQMessage alloc] initWithSenderId:self.senderId
senderDisplayName:self.senderDisplayName
date:self.date
media:self.mockMediaData];
JSQMessage *copy = [msg copy];
XCTAssertEqualObjects(msg, copy, @"Copied messages should be equal");
XCTAssertEqual([msg hash], [copy hash], @"Copied messages hashes should be equal");
XCTAssertEqualObjects(msg, msg, @"Messages should be equal to itself");
}
- (void)testMediaMessageArchiving
{
JSQMessage *msg = [[JSQMessage alloc] initWithSenderId:self.senderId
senderDisplayName:self.senderDisplayName
date:self.date
media:[FakeMedia new]];
NSData *msgData = [NSKeyedArchiver archivedDataWithRootObject:msg];
JSQMessage *unarchivedMsg = [NSKeyedUnarchiver unarchiveObjectWithData:msgData];
XCTAssertEqualObjects(msg, unarchivedMsg, @"Message should be equal");
}
@end

View File

@ -1,95 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "JSQMessage.h"
@interface JSQMessageTextTests : XCTestCase
@property (strong, nonatomic) NSString *senderId;
@property (strong, nonatomic) NSString *senderDisplayName;
@property (strong, nonatomic) NSDate *date;
@property (strong, nonatomic) NSString *text;
@end
@implementation JSQMessageTextTests
- (void)setUp
{
[super setUp];
self.senderId = @"324543-43556-212343";
self.senderDisplayName = @"Jesse Squires";
self.date = [NSDate date];
self.text = @"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque"
@"laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi"
@"architecto beatae vitae dicta sunt explicabo.";
}
- (void)tearDown
{
self.senderId = nil;
self.senderDisplayName = nil;
self.date = nil;
self.text = nil;
[super tearDown];
}
#pragma mark - Text messages
- (void)testTextMessageInit
{
JSQMessage *msg = [[JSQMessage alloc] initWithSenderId:self.senderId
senderDisplayName:self.senderDisplayName
date:self.date
text:self.text];
XCTAssertNotNil(msg, @"Message should not be nil");
}
- (void)testTextMessageInvalidInit
{
XCTAssertThrows([[JSQMessage alloc] init], @"Invalid init should throw");
XCTAssertThrows([[JSQMessage alloc] initWithSenderId:nil senderDisplayName:nil date:nil text:nil], @"Invalid init should throw");
}
- (void)testTextMessageIsEqual
{
JSQMessage *msg = [[JSQMessage alloc] initWithSenderId:self.senderId
senderDisplayName:self.senderDisplayName
date:self.date
text:self.text];
JSQMessage *copy = [msg copy];
XCTAssertEqualObjects(msg, copy, @"Copied messages should be equal");
XCTAssertEqual([msg hash], [copy hash], @"Copied messages hashes should be equal");
XCTAssertEqualObjects(msg, msg, @"Messages should be equal to itself");
}
- (void)testTextMessageArchiving
{
JSQMessage *msg = [[JSQMessage alloc] initWithSenderId:self.senderId
senderDisplayName:self.senderDisplayName
date:self.date
text:self.text];
NSData *msgData = [NSKeyedArchiver archivedDataWithRootObject:msg];
JSQMessage *unarchivedMsg = [NSKeyedUnarchiver unarchiveObjectWithData:msgData];
XCTAssertEqualObjects(msg, unarchivedMsg, @"Message should be equal");
}
@end

View File

@ -1,75 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "JSQMessagesAvatarImage.h"
@interface JSQMessagesAvatarImageTests : XCTestCase
@end
@implementation JSQMessagesAvatarImageTests
- (void)setUp
{
[super setUp];
}
- (void)tearDown
{
[super tearDown];
}
- (void)testInitInvalid
{
XCTAssertThrows([[JSQMessagesAvatarImage alloc] init], @"Invalid init should throw");
XCTAssertThrows([JSQMessagesAvatarImage avatarImageWithPlaceholder:nil], @"Invalid init should throw");
XCTAssertThrows([[JSQMessagesAvatarImage alloc] initWithAvatarImage:nil highlightedImage:nil placeholderImage:nil], @"Invalid init should throw");
}
- (void)testInitValid
{
UIImage *mockImage = [UIImage imageNamed:@"demo_avatar_jobs"];
JSQMessagesAvatarImage *avatar = [JSQMessagesAvatarImage avatarImageWithPlaceholder:mockImage];
XCTAssertNotNil(avatar, @"Valid init should succeed");
JSQMessagesAvatarImage *avatar2 = [JSQMessagesAvatarImage avatarWithImage:mockImage];
XCTAssertNotNil(avatar2, @"Valid init should succeed");
XCTAssertEqualObjects(avatar2.avatarImage, avatar2.avatarHighlightedImage);
XCTAssertEqualObjects(avatar2.avatarHighlightedImage, avatar2.avatarPlaceholderImage);
}
- (void)testCopy
{
UIImage *mockImage = [UIImage imageNamed:@"demo_avatar_jobs"];
JSQMessagesAvatarImage *avatar = [[JSQMessagesAvatarImage alloc] initWithAvatarImage:mockImage
highlightedImage:mockImage
placeholderImage:mockImage];
JSQMessagesAvatarImage *copy = [avatar copy];
XCTAssertNotNil(copy, @"Copy should succeed");
XCTAssertFalse(avatar == copy, @"Copy should return new, distinct instance");
XCTAssertNotEqualObjects(avatar.avatarImage, copy.avatarImage, @"Images should not be equal");
XCTAssertNotEqual(avatar.avatarImage, copy.avatarImage, @"Images should not be equal");
XCTAssertNotEqualObjects(avatar.avatarHighlightedImage, copy.avatarHighlightedImage, @"Images should not be equal");
XCTAssertNotEqual(avatar.avatarHighlightedImage, copy.avatarHighlightedImage, @"Images should not be equal");
XCTAssertNotEqualObjects(avatar.avatarPlaceholderImage, copy.avatarPlaceholderImage, @"Images should not be equal");
XCTAssertNotEqual(avatar.avatarPlaceholderImage, copy.avatarPlaceholderImage, @"Images should not be equal");
}
@end

View File

@ -1,65 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "JSQMessagesBubbleImage.h"
#import "UIImage+JSQMessages.h"
@interface JSQMessagesBubbleImageTests : XCTestCase
@end
@implementation JSQMessagesBubbleImageTests
- (void)setUp
{
[super setUp];
}
- (void)tearDown
{
[super tearDown];
}
- (void)testInitInvalid
{
XCTAssertThrows([[JSQMessagesBubbleImage alloc] init], @"Invalid init should throw");
XCTAssertThrows([[JSQMessagesBubbleImage alloc] initWithMessageBubbleImage:nil highlightedImage:nil], @"Invalid init should throw");
}
- (void)testInitValid
{
UIImage *mockImage = [UIImage jsq_bubbleCompactImage];
JSQMessagesBubbleImage *bubbleImage = [[JSQMessagesBubbleImage alloc] initWithMessageBubbleImage:mockImage highlightedImage:mockImage];
XCTAssertNotNil(bubbleImage, @"Valid init should succeed");
}
- (void)testCopy
{
UIImage *mockImage = [UIImage jsq_bubbleCompactImage];
JSQMessagesBubbleImage *bubbleImage = [[JSQMessagesBubbleImage alloc] initWithMessageBubbleImage:mockImage highlightedImage:mockImage];
JSQMessagesBubbleImage *copy = [bubbleImage copy];
XCTAssertNotNil(copy, @"Copy should succeed");
XCTAssertFalse(bubbleImage == copy, @"Copy should return new, distinct instance");
XCTAssertNotEqualObjects(bubbleImage.messageBubbleImage, copy.messageBubbleImage, @"Images should not be equal");
XCTAssertNotEqual(bubbleImage.messageBubbleImage, copy.messageBubbleImage, @"Images should not be equal");
XCTAssertNotEqualObjects(bubbleImage.messageBubbleHighlightedImage, copy.messageBubbleHighlightedImage, @"Images should not be equal");
XCTAssertNotEqual(bubbleImage.messageBubbleHighlightedImage, copy.messageBubbleHighlightedImage, @"Images should not be equal");
}
@end

View File

@ -1,76 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "JSQPhotoMediaItem.h"
@interface JSQPhotoMediaItemTests : XCTestCase
@end
@implementation JSQPhotoMediaItemTests
- (void)setUp
{
[super setUp];
}
- (void)tearDown
{
[super tearDown];
}
- (void)testPhotoItemInit
{
JSQPhotoMediaItem *item = [[JSQPhotoMediaItem alloc] initWithImage:[UIImage new]];
XCTAssertNotNil(item);
}
- (void)testPhotoItemIsEqual
{
JSQPhotoMediaItem *item = [[JSQPhotoMediaItem alloc] initWithImage:[UIImage imageNamed:@"demo_avatar_jobs"]];
JSQPhotoMediaItem *copy = [item copy];
XCTAssertEqualObjects(item, copy, @"Copied items should be equal");
XCTAssertEqual([item hash], [copy hash], @"Copied item hashes should be equal");
XCTAssertEqualObjects(item, item, @"Item should be equal to itself");
}
- (void)testPhotoItemArchiving
{
JSQPhotoMediaItem *item = [[JSQPhotoMediaItem alloc] initWithImage:[UIImage new]];
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:item];
JSQPhotoMediaItem *unarchivedItem = [NSKeyedUnarchiver unarchiveObjectWithData:data];
XCTAssertEqualObjects(item, unarchivedItem);
}
- (void)testMediaDataProtocol
{
JSQPhotoMediaItem *item = [[JSQPhotoMediaItem alloc] initWithImage:nil];
XCTAssertTrue(!CGSizeEqualToSize([item mediaViewDisplaySize], CGSizeZero));
XCTAssertNotNil([item mediaPlaceholderView]);
XCTAssertNil([item mediaView], @"Media view should be nil if image is nil");
item.image = [UIImage imageNamed:@"demo_avatar_jobs"];
XCTAssertNotNil([item mediaView], @"Media view should NOT be nil once item has media data");
}
@end

View File

@ -1,77 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "JSQVideoMediaItem.h"
@interface JSQVideoMediaItemTests : XCTestCase
@end
@implementation JSQVideoMediaItemTests
- (void)setUp
{
[super setUp];
}
- (void)tearDown
{
[super tearDown];
}
- (void)testVideoMediaItemInit
{
JSQVideoMediaItem *item = [[JSQVideoMediaItem alloc] initWithFileURL:[NSURL URLWithString:@"file://"] isReadyToPlay:NO];
XCTAssertNotNil(item);
}
- (void)testVideoItemIsEqual
{
JSQVideoMediaItem *item = [[JSQVideoMediaItem alloc] initWithFileURL:[NSURL URLWithString:@"file://"] isReadyToPlay:YES];
JSQVideoMediaItem *copy = [item copy];
XCTAssertEqualObjects(item, copy, @"Copied items should be equal");
XCTAssertEqual([item hash], [copy hash], @"Copied item hashes should be equal");
XCTAssertEqualObjects(item, item, @"Item should be equal to itself");
}
- (void)testVideoItemArchiving
{
JSQVideoMediaItem *item = [[JSQVideoMediaItem alloc] initWithFileURL:[NSURL URLWithString:@"file://"] isReadyToPlay:YES];
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:item];
JSQVideoMediaItem *unarchivedItem = [NSKeyedUnarchiver unarchiveObjectWithData:data];
XCTAssertEqualObjects(item, unarchivedItem);
}
- (void)testMediaDataProtocol
{
JSQVideoMediaItem *item = [[JSQVideoMediaItem alloc] init];
XCTAssertTrue(!CGSizeEqualToSize([item mediaViewDisplaySize], CGSizeZero));
XCTAssertNotNil([item mediaPlaceholderView]);
XCTAssertNil([item mediaView], @"Media view should be nil if fileURL is nil, and readyToPlay is NO");
item.fileURL = [NSURL URLWithString:@"file://"];
item.isReadyToPlay = YES;
XCTAssertNotNil([item mediaView], @"Media view should NOT be nil once item has media data");
}
@end

View File

@ -1,53 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "JSQMessagesCollectionViewCellIncoming.h"
#import "JSQMessagesCollectionViewCellOutgoing.h"
@interface JSQMessagesCollectionViewCellTests : XCTestCase
@end
@implementation JSQMessagesCollectionViewCellTests
- (void)setUp
{
[super setUp];
}
- (void)tearDown
{
[super tearDown];
}
- (void)testMessagesIncomingCollectionViewCellInit
{
UINib *incomingCell = [JSQMessagesCollectionViewCellIncoming nib];
XCTAssertNotNil(incomingCell, @"Nib should not be nil");
NSString *incomingCellId = [JSQMessagesCollectionViewCellIncoming cellReuseIdentifier];
XCTAssertNotNil(incomingCellId, @"Cell identifier should not be nil");
XCTAssertEqualObjects(incomingCellId, NSStringFromClass([JSQMessagesCollectionViewCellIncoming class]));
}
- (void)testMessagesOutgoingCollectionViewCellInit
{
UINib *outgoingCell = [JSQMessagesCollectionViewCellOutgoing nib];
XCTAssertNotNil(outgoingCell, @"Nib should not be nil");
NSString *outgoingCellId = [JSQMessagesCollectionViewCellOutgoing cellReuseIdentifier];
XCTAssertNotNil(outgoingCellId, @"Cell identifier should not be nil");
XCTAssertEqualObjects(outgoingCellId, NSStringFromClass([JSQMessagesCollectionViewCellOutgoing class]));
}
@end

View File

@ -1,47 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "JSQMessagesCollectionView.h"
#import "JSQMessagesCollectionViewFlowLayout.h"
@interface JSQMessagesCollectionViewTests : XCTestCase
@end
@implementation JSQMessagesCollectionViewTests
- (void)setUp
{
[super setUp];
}
- (void)tearDown
{
[super tearDown];
}
- (void)testCollectionViewInit
{
JSQMessagesCollectionViewFlowLayout *layout = [[JSQMessagesCollectionViewFlowLayout alloc] init];
JSQMessagesCollectionView *view = [[JSQMessagesCollectionView alloc] initWithFrame:[UIScreen mainScreen].bounds
collectionViewLayout:layout];
XCTAssertNotNil(view, @"Collection view should not be nil");
XCTAssertEqualObjects(view.backgroundColor, [UIColor whiteColor], @"Property should be equal to default value");
XCTAssertEqual(view.keyboardDismissMode, UIScrollViewKeyboardDismissModeInteractive, @"Property should be equal to default value");
XCTAssertEqual(view.alwaysBounceVertical, YES, @"Property should be equal to default value");
XCTAssertEqual(view.bounces, YES, @"Property should be equal to default value");
}
@end

View File

@ -1,70 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "JSQMessagesComposerTextView.h"
@interface JSQMessagesComposerTextViewTests : XCTestCase
@property (strong, nonatomic) JSQMessagesComposerTextView *textView;
@end
@implementation JSQMessagesComposerTextViewTests
- (void)setUp
{
[super setUp];
self.textView = [[JSQMessagesComposerTextView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 300.0f, 50.0f)
textContainer:[NSTextContainer new]];
}
- (void)tearDown
{
self.textView = nil;
[super tearDown];
}
- (void)testComposerTextViewInit
{
XCTAssertNotNil(self.textView, @"Text view should not be nil");
XCTAssertNil(self.textView.text, @"Property should be equal to default value");
XCTAssertNil(self.textView.placeHolder, @"Property should be equal to default value");
XCTAssertEqualObjects(self.textView.placeHolderTextColor, [UIColor lightGrayColor], @"Property should be equal to default value");
XCTAssertEqualObjects(self.textView.backgroundColor, [UIColor whiteColor], @"Property should be equal to default value");
XCTAssertEqual(self.textView.layer.borderWidth, 0.5f, @"Property should be equal to default value");
XCTAssertEqual(self.textView.layer.borderColor, [UIColor lightGrayColor].CGColor, @"Property should be equal to default value");
XCTAssertEqual(self.textView.layer.cornerRadius, 6.0f, @"Property should be equal to default value");
XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(self.textView.scrollIndicatorInsets, UIEdgeInsetsMake(6.0f, 0.0f, 6.0f, 0.0f)), @"Property should be equal to default value");
XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(self.textView.textContainerInset, UIEdgeInsetsMake(4.0f, 2.0f, 4.0f, 2.0f)), @"Property should be equal to default value");
XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(self.textView.contentInset, UIEdgeInsetsMake(1.0f, 0.0f, 1.0f, 0.0f)), @"Property should be equal to default value");
XCTAssertEqual(self.textView.scrollEnabled, YES, @"Property should be equal to default value");
XCTAssertEqual(self.textView.scrollsToTop, NO, @"Property should be equal to default value");
XCTAssertEqual(self.textView.userInteractionEnabled, YES, @"Property should be equal to default value");
XCTAssertEqual(self.textView.contentMode, UIViewContentModeRedraw, @"Property should be equal to default value");
XCTAssertEqual(self.textView.dataDetectorTypes, UIDataDetectorTypeNone, @"Property should be equal to default value");
XCTAssertEqual(self.textView.keyboardAppearance, UIKeyboardAppearanceDefault, @"Property should be equal to default value");
XCTAssertEqual(self.textView.keyboardType, UIKeyboardTypeDefault, @"Property should be equal to default value");
XCTAssertEqual(self.textView.returnKeyType, UIReturnKeyDefault, @"Property should be equal to default value");
}
@end

View File

@ -1,44 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "JSQMessagesViewController.h"
#import "JSQMessagesInputToolbar.h"
@interface JSQMessagesInputToolbarTests : XCTestCase
@end
@implementation JSQMessagesInputToolbarTests
- (void)setUp
{
[super setUp];
}
- (void)tearDown
{
[super tearDown];
}
- (void)testInputToolbarInit
{
JSQMessagesViewController *vc = [JSQMessagesViewController messagesViewController];
[vc loadView];
JSQMessagesInputToolbar *toolbar = vc.inputToolbar;
XCTAssertNotNil(toolbar, @"Toolbar should not be nil");
XCTAssertNotNil(toolbar.contentView, @"Toolbar content view should not be nil");
XCTAssertEqual(toolbar.sendButtonOnRight, YES, @"Property should be equal to default value");
}
@end

View File

@ -1,39 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "JSQMessagesLabel.h"
@interface JSQMessagesLabelTests : XCTestCase
@end
@implementation JSQMessagesLabelTests
- (void)setUp
{
[super setUp];
}
- (void)tearDown
{
[super tearDown];
}
- (void)testMessagesLabelInit
{
JSQMessagesLabel *label = [[JSQMessagesLabel alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 200.0f, 40.0f)];
XCTAssertNotNil(label, @"Label should not be nil");
XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(label.textInsets, UIEdgeInsetsZero), @"Property should be equal to default value");
}
@end

View File

@ -1,41 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "JSQMessagesLoadEarlierHeaderView.h"
@interface JSQMessagesLoadEarlierHeaderViewTests : XCTestCase
@end
@implementation JSQMessagesLoadEarlierHeaderViewTests
- (void)setUp
{
[super setUp];
}
- (void)tearDown
{
[super tearDown];
}
- (void)testLoadEarlierHeaderViewInit
{
UINib *headerView = [JSQMessagesLoadEarlierHeaderView nib];
XCTAssertNotNil(headerView, @"Nib should not be nil");
NSString *headerId = [JSQMessagesLoadEarlierHeaderView headerReuseIdentifier];
XCTAssertNotNil(headerId, @"Header view identifier should not be nil");
}
@end

View File

@ -1,53 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "JSQMessagesToolbarContentView.h"
#import "JSQMessagesComposerTextView.h"
@interface JSQMessagesToolbarContentViewTests : XCTestCase
@property (strong, nonatomic) JSQMessagesToolbarContentView *contentView;
@end
@implementation JSQMessagesToolbarContentViewTests
- (void)setUp
{
[super setUp];
UINib *contentViewNib = [JSQMessagesToolbarContentView nib];
XCTAssertNotNil(contentViewNib, @"Nib should not be nil");
NSArray *view = [contentViewNib instantiateWithOwner:nil options:nil];
self.contentView = [view firstObject];
XCTAssertNotNil(self.contentView, @"Content view should not be nil");
}
- (void)tearDown
{
self.contentView = nil;
[super tearDown];
}
- (void)testToolbarContentViewInit
{
XCTAssertTrue(CGRectEqualToRect(self.contentView.frame, CGRectMake(0.0f, 0.0f, 320.0f, 44.0f)), @"Frame should be equal to default value");
XCTAssertNotNil(self.contentView.textView, @"Text view should not be nil");
XCTAssertTrue([self.contentView.textView isKindOfClass:[JSQMessagesComposerTextView class]], @"Text view should be a %@", [JSQMessagesComposerTextView class]);
XCTAssertNil(self.contentView.leftBarButtonItem, @"Property should be equal to default value");
XCTAssertNil(self.contentView.rightBarButtonItem, @"Property should be equal to default value");
}
@end

View File

@ -1,41 +0,0 @@
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// MIT License
// Copyright (c) 2014 Jesse Squires
// http://opensource.org/licenses/MIT
//
#import <XCTest/XCTest.h>
#import "JSQMessagesTypingIndicatorFooterView.h"
@interface JSQMessagesTypingIndicatorFooterViewTests : XCTestCase
@end
@implementation JSQMessagesTypingIndicatorFooterViewTests
- (void)setUp
{
[super setUp];
}
- (void)tearDown
{
[super tearDown];
}
- (void)testTypingIndicatorFooterViewInit
{
UINib *footerView = [JSQMessagesTypingIndicatorFooterView nib];
XCTAssertNotNil(footerView, @"Nib should not be nil");
NSString *footerId = [JSQMessagesTypingIndicatorFooterView footerReuseIdentifier];
XCTAssertNotNil(footerId, @"Footer view identifier should not be nil");
}
@end

View File

@ -1,21 +0,0 @@
Pod::Spec.new do |s|
s.name = 'JSQMessagesViewController'
s.version = '6.1.1'
s.summary = 'An elegant messages UI library for iOS.'
s.homepage = 'http://jessesquires.github.io/JSQMessagesViewController'
s.license = 'MIT'
s.screenshots = ['https://raw.githubusercontent.com/jessesquires/JSQMessagesViewController/develop/Screenshots/screenshot0.png',
'https://raw.githubusercontent.com/jessesquires/JSQMessagesViewController/develop/Screenshots/screenshot1.png',
'https://raw.githubusercontent.com/jessesquires/JSQMessagesViewController/develop/Screenshots/screenshot2.png',
'https://raw.githubusercontent.com/jessesquires/JSQMessagesViewController/develop/Screenshots/screenshot3.png']
s.author = { 'Jesse Squires' => 'jesse.squires.developer@gmail.com' }
s.social_media_url = 'https://twitter.com/jesse_squires'
s.source = { :git => 'https://github.com/jessesquires/JSQMessagesViewController.git', :tag => s.version.to_s }
s.platform = :ios, '7.0'
s.source_files = 'JSQMessagesViewController/**/*.{h,m}'
s.resources = 'JSQMessagesViewController/Assets/JSQMessagesAssets.bundle', 'JSQMessagesViewController/Assets/Strings/*.lproj', 'JSQMessagesViewController/**/*.{xib}',
s.frameworks = 'QuartzCore', 'CoreGraphics', 'CoreLocation', 'MapKit', 'UIKit', 'Foundation'
s.requires_arc = true
s.dependency 'JSQSystemSoundPlayer', '~> 2.0.0'
end

Some files were not shown because too many files have changed in this diff Show More