Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core data #4

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
9b79a32
Model with Core Data
inescasadei Dec 11, 2014
bbb025b
Added telegram account and some contacts associated
inescasadei Dec 15, 2014
43d8e46
Added class methods to create account and contacts
inescasadei Dec 15, 2014
cfaaa11
Mocked Data
inescasadei Dec 18, 2014
fca43af
Added group chat
inescasadei Dec 19, 2014
e195894
Date formatted
inescasadei Dec 19, 2014
4dcca4e
Displaying conversation titles
inescasadei Dec 22, 2014
0188230
Messages in ChatViewController
inescasadei Dec 30, 2014
80fbfbe
Changes in ChatViewController
inescasadei Jan 2, 2015
9914a2b
Navigation between controllers
inescasadei Jan 5, 2015
7be650e
Type, send and clear a message
inescasadei Jan 5, 2015
a9db135
Predicates and sort descriptors added
inescasadei Jan 16, 2015
3283959
Ordered chats
inescasadei Jan 20, 2015
cb99860
Optional chat title. Changes in chat vc
inescasadei Jan 22, 2015
75d145f
Default user image
inescasadei Jan 23, 2015
d77285d
Date info
inescasadei Jan 23, 2015
257be65
Custom cell for chat view
inescasadei Jan 26, 2015
b7b61a6
Assigned random colors to each new contact and saved in core data
inescasadei Jan 28, 2015
554032e
Scrolling chat table to the bottom of the conversation. Image colored…
inescasadei Jan 30, 2015
b5f5ea1
Dynamic type adoption and constraints fixed
inescasadei Feb 3, 2015
2ae60d5
Dynamic row size
inescasadei Feb 3, 2015
48ed3a5
Fixed problem when scroolling
inescasadei Feb 3, 2015
e43da89
Refactor
inescasadei Feb 4, 2015
a650b7f
Update UI after rotation
inescasadei Feb 19, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 95 additions & 22 deletions EyeTypeChat.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions EyeTypeChat/Base.lproj/LaunchScreen.xib
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<objects>
Expand Down
91 changes: 77 additions & 14 deletions EyeTypeChat/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6254" systemVersion="14C109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
<capability name="Alignment constraints to the first baseline" minToolsVersion="6.0"/>
<capability name="Alignment constraints with different attributes" minToolsVersion="5.1"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
Expand Down Expand Up @@ -93,7 +94,7 @@
<rect key="frame" x="336" y="0.0" width="248" height="461"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<connections>
<segue destination="hS7-NC-uMY" kind="embed" identifier="conversation" id="Cvj-za-k4H"/>
<segue destination="hS7-NC-uMY" kind="embed" identifier="chatSegue" id="Cvj-za-k4H"/>
</connections>
</containerView>
</subviews>
Expand Down Expand Up @@ -140,20 +141,67 @@
</objects>
<point key="canvasLocation" x="189" y="165"/>
</scene>
<!--Root View Controller-->
<!--Chat View Controller-->
<scene sceneID="SP6-8M-JJ2">
<objects>
<tableViewController id="0ko-00-bdu" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="UCJ-dq-pp7">
<tableViewController storyboardIdentifier="chat" id="0ko-00-bdu" customClass="ChatViewController" customModule="EyeTypeChat" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="60" sectionHeaderHeight="40" sectionFooterHeight="1" id="UCJ-dq-pp7">
<rect key="frame" x="0.0" y="0.0" width="248" height="461"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="LD3-Kw-qJX">
<tableViewCell clipsSubviews="YES" contentMode="center" horizontalHuggingPriority="1000" verticalHuggingPriority="1000" selectionStyle="none" indentationWidth="0.0" reuseIdentifier="chatCell" id="LD3-Kw-qJX" customClass="ChatTableViewCell" customModule="EyeTypeChat" customModuleProvider="target">
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="LD3-Kw-qJX" id="S7A-w8-qH5">
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleAspectFit" tableViewCell="LD3-Kw-qJX" id="S7A-w8-qH5">
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="from" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="n2g-Mr-9M9">
<rect key="frame" x="43" y="5" width="78" height="19.5"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="hB4-vX-WC4">
<rect key="frame" x="8" y="4" width="27" height="20.5"/>
</imageView>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" verticalHuggingPriority="249" text="message" lineBreakMode="characterWrap" numberOfLines="0" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0hU-aB-Nzy">
<rect key="frame" x="43" y="26" width="58" height="25.5"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" horizontalHuggingPriority="249" text="sentDate" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="n0P-GN-dy5">
<rect key="frame" x="129" y="4" width="111" height="19"/>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" red="0.60000002384185791" green="0.60000002384185791" blue="0.60000002384185791" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="0hU-aB-Nzy" firstAttribute="top" secondItem="n2g-Mr-9M9" secondAttribute="bottom" constant="1.5" id="1DG-69-TsV"/>
<constraint firstItem="n2g-Mr-9M9" firstAttribute="top" secondItem="hB4-vX-WC4" secondAttribute="top" constant="1" id="7N5-D1-Z4c"/>
<constraint firstItem="n2g-Mr-9M9" firstAttribute="bottom" secondItem="hB4-vX-WC4" secondAttribute="bottom" id="83K-qk-C4h"/>
<constraint firstItem="n0P-GN-dy5" firstAttribute="baseline" secondItem="n2g-Mr-9M9" secondAttribute="firstBaseline" id="EDY-1S-UPy"/>
<constraint firstItem="n0P-GN-dy5" firstAttribute="leading" secondItem="hB4-vX-WC4" secondAttribute="trailing" constant="94" id="EuI-O0-QvC"/>
<constraint firstItem="0hU-aB-Nzy" firstAttribute="bottom" secondItem="S7A-w8-qH5" secondAttribute="bottomMargin" id="JNx-gY-oCx"/>
<constraint firstAttribute="trailingMargin" secondItem="0hU-aB-Nzy" secondAttribute="trailing" constant="139" id="cgF-gb-mas"/>
<constraint firstItem="n2g-Mr-9M9" firstAttribute="leading" secondItem="hB4-vX-WC4" secondAttribute="trailing" constant="8" symbolic="YES" id="d2p-ft-qgo"/>
<constraint firstItem="0hU-aB-Nzy" firstAttribute="leading" secondItem="hB4-vX-WC4" secondAttribute="trailing" constant="8" symbolic="YES" id="dla-R8-I5G"/>
<constraint firstItem="n0P-GN-dy5" firstAttribute="leading" secondItem="hB4-vX-WC4" secondAttribute="trailing" constant="94" id="lhG-KC-5iG"/>
<constraint firstItem="n2g-Mr-9M9" firstAttribute="centerX" secondItem="0hU-aB-Nzy" secondAttribute="centerX" constant="10" id="p1e-JG-pPw"/>
<constraint firstItem="n2g-Mr-9M9" firstAttribute="leading" secondItem="0hU-aB-Nzy" secondAttribute="leading" id="sJ3-6o-jcM"/>
<constraint firstItem="hB4-vX-WC4" firstAttribute="leading" secondItem="S7A-w8-qH5" secondAttribute="leadingMargin" id="sWa-cb-dhh"/>
<constraint firstItem="n0P-GN-dy5" firstAttribute="trailing" secondItem="S7A-w8-qH5" secondAttribute="trailingMargin" id="tDA-D5-yct"/>
<constraint firstItem="n0P-GN-dy5" firstAttribute="top" secondItem="hB4-vX-WC4" secondAttribute="top" id="vCF-sM-Hko"/>
<constraint firstItem="0hU-aB-Nzy" firstAttribute="leading" secondItem="S7A-w8-qH5" secondAttribute="leadingMargin" constant="35" id="vpn-12-TGa"/>
<constraint firstItem="n0P-GN-dy5" firstAttribute="top" secondItem="S7A-w8-qH5" secondAttribute="topMargin" constant="-4" id="yqG-15-c7o"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="fromLabel" destination="n2g-Mr-9M9" id="FO5-it-5iz"/>
<outlet property="messageLabel" destination="0hU-aB-Nzy" id="O49-sQ-ZSo"/>
<outlet property="photoView" destination="hB4-vX-WC4" id="07E-gZ-bjo"/>
<outlet property="sentDateLabel" destination="n0P-GN-dy5" id="Kir-o9-Yhx"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
Expand All @@ -171,11 +219,14 @@
</textField>
</barButtonItem>
</toolbarItems>
<navigationItem key="navigationItem" title="Root View Controller" id="q24-6Z-fWb"/>
<navigationItem key="navigationItem" title="Chat View Controller" id="q24-6Z-fWb"/>
<connections>
<outlet property="writingTextField" destination="kxv-ny-iaq" id="UJ7-RI-j2e"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="fdp-vI-Qei" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1031" y="95.5"/>
<point key="canvasLocation" x="1031" y="92.5"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="6lq-bn-IxS">
Expand Down Expand Up @@ -212,10 +263,10 @@
</objects>
<point key="canvasLocation" x="189" y="900"/>
</scene>
<!--Fixed Menu View Controller-->
<!--Conversation List View Controller-->
<scene sceneID="9c2-UI-FUL">
<objects>
<tableViewController id="pxJ-sq-pWH" customClass="FixedMenuViewController" customModule="EyeTypeChat" customModuleProvider="target" sceneMemberID="viewController">
<tableViewController id="pxJ-sq-pWH" customClass="ConversationListViewController" customModule="EyeTypeChat" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="1NT-JY-mos">
<rect key="frame" x="0.0" y="0.0" width="320" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
Expand All @@ -226,9 +277,6 @@
<outlet property="delegate" destination="pxJ-sq-pWH" id="mHf-gt-MBw"/>
</connections>
</tableView>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="menuName" value="conversation"/>
</userDefinedRuntimeAttributes>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="wd3-A7-SHH" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
Expand Down Expand Up @@ -326,5 +374,20 @@
</objects>
<point key="canvasLocation" x="1351.5" y="900"/>
</scene>
<!--Fixed Menu View Controller-->
<scene sceneID="znU-sN-Y7a">
<objects>
<viewController storyboardIdentifier="fixedMenu" id="yO6-cL-ohg" customClass="FixedMenuViewController" customModule="EyeTypeChat" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="WH8-7c-Awc">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</tableView>
<navigationItem key="navigationItem" id="HD9-aw-wdz"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="2Vu-Xi-v3D" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1996" y="900"/>
</scene>
</scenes>
</document>
18 changes: 18 additions & 0 deletions EyeTypeChat/BaseMenuViewController+Commands.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// ConversationViewController+Commands.swift
// EyeTypeChat
//
// Created by Emanuel Andrada on 9/12/14.
// Copyright (c) 2014 SCV Soft. All rights reserved.
//

import Foundation

extension BaseMenuViewController {

func showKeyboard() {
let viewController: KeyboardViewController = self.storyboard!.instantiateViewControllerWithIdentifier("keyboard") as KeyboardViewController!
viewController.chatControllable = mainViewController?
self.navigationController!.pushViewController(viewController, animated: true)
}
}
2 changes: 1 addition & 1 deletion EyeTypeChat/BaseMenuViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class BaseMenuViewController: UITableViewController, EyeControllable {
}
return cell!
}

func validRow(indexPath: NSIndexPath) -> NSIndexPath {
if (indexPath.section >= numberOfSectionsInTableView(tableView)) {
return NSIndexPath(forRow: 0, inSection: 0)
Expand Down
18 changes: 18 additions & 0 deletions EyeTypeChat/ChatControllable.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// ChatControllable.swift
// EyeTypeChat
//
// Created by Maria Ines Casadei on 1/2/15.
// Copyright (c) 2015 SCV Soft. All rights reserved.
//

import Foundation

@objc
protocol ChatControllable {

func chatWillType(letter: String)
func chatWillSend()
func chatWillClearAll()

}
35 changes: 35 additions & 0 deletions EyeTypeChat/ChatTableViewCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// ChatTableViewCell.swift
// EyeTypeChat
//
// Created by Maria Ines Casadei on 1/23/15.
// Copyright (c) 2015 SCV Soft. All rights reserved.
//

import Foundation

class ChatTableViewCell: UITableViewCell {

@IBOutlet weak var photoView: UIImageView!

@IBOutlet weak var fromLabel: UILabel!

@IBOutlet weak var messageLabel: UILabel!

@IBOutlet weak var sentDateLabel: UILabel!

func loadItem(from fromMessage: String, fromContactColor: UIColor, message: String, sentDate: NSDate, imageName: String) {

fromLabel.text = fromMessage
fromLabel.textColor = fromContactColor
fromLabel.font = UIFont .preferredFontForTextStyle(UIFontTextStyleHeadline)
messageLabel.text = message
messageLabel.font = UIFont .preferredFontForTextStyle(UIFontTextStyleBody)
messageLabel.numberOfLines = 0
sentDateLabel.text = MockedData.getFormattedDate(sentDate)
sentDateLabel.font = UIFont .preferredFontForTextStyle(UIFontTextStyleSubheadline)
let image = UIImage(named: imageName)
photoView.image = image?.colorizeWith(fromContactColor)

}
}
Loading