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

Image multiselection and picker customization #137

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
4eb5bd5
more brief rect constant
Apr 24, 2017
9a65c71
[128] custom nib for bottom bar
Apr 24, 2017
f910a51
[115] avatar on top of bubble
Apr 24, 2017
40b541e
[122] keyboard in TabBar fix
Apr 24, 2017
3ac432f
minor refactoring
Apr 24, 2017
78ba439
minor refactoring
Apr 24, 2017
8dd6195
[image multiselect] added a protocol for image picker VC
May 17, 2017
ad4b2f6
[image multiselect] added methods to override for multiselection hand…
May 17, 2017
18dd3f2
[image multiselect] replaced inline sendText() instructions with dele…
May 17, 2017
53f360f
[image multiselect] made `cameraAuthStatus` and `photoLibAuthStatus` …
May 18, 2017
00dd63f
[multiselect] added images for multiselection and camera button
May 19, 2017
0450bd8
added a missing include
May 19, 2017
4c9103d
[multiselect] added custom picker based on UICollectionView
May 19, 2017
655ed35
[multiselect] encapsulated push/pop for image picker
May 19, 2017
f8cbc1b
Minor refactoring. Also added a todo about localization.
May 19, 2017
233308b
[multiselect] separate directory for picker
May 19, 2017
6d40c20
[multiselect] added camera image
May 22, 2017
479e53e
[multiselect] extracted "image from picker response" helper class
May 22, 2017
df1b58b
[multiselect] added live camera cell
May 22, 2017
e86a83b
[multiselect] saving newly shot image in camera roll
May 22, 2017
7fa86f6
[multiselect] extended customization options
May 22, 2017
957b39d
[multiselect] added some properties to accomplish the feature
May 22, 2017
90e30b6
[image multiselection] applied lazy to PHCachingImageManager to avoid…
Jun 12, 2017
73109d9
[crash] fixed photo capture issue by replacing force unwrap with `if …
Jul 20, 2017
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
312 changes: 305 additions & 7 deletions nMessenger.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Binary file added nMessenger/Source/Images/Checkmark-green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added nMessenger/Source/Images/Icon_add_photo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added nMessenger/Source/Images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added nMessenger/Source/Images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added nMessenger/Source/Images/photo-camera-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ open class GeneralMessengerCell: ASCellNode {

// MARK: Public Variables
/** UIEdgeInsets for cell*/
open var cellPadding: UIEdgeInsets = UIEdgeInsetsMake(0.0, 0.0, 0.0, 0.0)
open var cellPadding: UIEdgeInsets = UIEdgeInsets.zero

/** UIViewController that holds the cell. Allows the cell the present View Controllers*/
open weak var currentViewController: UIViewController?
/** The current table in which this node resides*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ open class SpinnerNode: ASDisplayNode {
}

public override init() {
super.init(viewBlock: { UIActivityIndicatorView(activityIndicatorStyle: .gray) }, didLoad: nil)
super.init()
self.setViewBlock({ UIActivityIndicatorView(activityIndicatorStyle: .gray) })
// super.init(viewBlock: { UIActivityIndicatorView(activityIndicatorStyle: .gray) }, didLoad: nil)
self.style.preferredSize.height = 32
}

Expand Down
45 changes: 42 additions & 3 deletions nMessenger/Source/MessageNodes/MessageCell/MessageNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,33 @@ import AsyncDisplayKit
*/
open class MessageNode: GeneralMessengerCell {

public enum AvatarPosition
{
case top
case bottom

internal func mapToStackLayoutAlignment() -> ASStackLayoutAlignItems
{
switch self
{
case .top:
return .start

case .bottom:
return .end
}
}
}

open var avatarPosition: AvatarPosition = .top // relevant value for our app
// .bottom // Legacy value of NMessenger
{
didSet
{
self.setNeedsLayout()
}
}

// MARK: Public Variables
open weak var delegate: MessageCellProtocol?

Expand Down Expand Up @@ -52,8 +79,14 @@ open class MessageNode: GeneralMessengerCell {
/**
Spacing around the avatar. Defaults to UIEdgeInsetsMake(0, 0, 0, 10)
*/
open var avatarInsets: UIEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 10) {
didSet {
open var avatarInsets: UIEdgeInsets =
UIEdgeInsets(top: 0,
left: 0,
bottom: 0,
right: 10)
{
didSet
{
self.setNeedsLayout()
}
}
Expand Down Expand Up @@ -177,7 +210,13 @@ open class MessageNode: GeneralMessengerCell {

let cellOrientation = isIncomingMessage ? [ins, contentSizeLayout] : [contentSizeLayout,ins]

layoutSpecs = ASStackLayoutSpec(direction: .horizontal, spacing: 0, justifyContent: justifyLocation, alignItems: .end, children: cellOrientation)

let alignment = self.avatarPosition.mapToStackLayoutAlignment()
layoutSpecs = ASStackLayoutSpec(direction: .horizontal,
spacing: 0,
justifyContent: justifyLocation,
alignItems: alignment,
children: cellOrientation)
contentSizeLayout.style.flexShrink = 1
} else {
let width = constrainedSize.max.width - self.cellPadding.left - self.cellPadding.right - self.messageOffset
Expand Down
Loading