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

Cool stuff #6

Merged
merged 18 commits into from
Nov 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Demo/WhisperDemo/WhisperDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
objects = {

/* Begin PBXBuildFile section */
2977865E1BC30BEF0050D397 /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2977865D1BC30BEF0050D397 /* DetailViewController.swift */; settings = {ASSET_TAGS = (); }; };
29AD429E1BBC2BD2004292F1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29AD429D1BBC2BD2004292F1 /* AppDelegate.swift */; };
29AD42A01BBC2BD2004292F1 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29AD429F1BBC2BD2004292F1 /* ViewController.swift */; };
29AD42A51BBC2BD2004292F1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 29AD42A41BBC2BD2004292F1 /* Assets.xcassets */; };
Expand All @@ -16,7 +15,6 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
2977865D1BC30BEF0050D397 /* DetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = "<group>"; };
29AD429A1BBC2BD2004292F1 /* WhisperDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WhisperDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
29AD429D1BBC2BD2004292F1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
29AD429F1BBC2BD2004292F1 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -71,7 +69,6 @@
children = (
29AD429D1BBC2BD2004292F1 /* AppDelegate.swift */,
29AD429F1BBC2BD2004292F1 /* ViewController.swift */,
2977865D1BC30BEF0050D397 /* DetailViewController.swift */,
29AD42A41BBC2BD2004292F1 /* Assets.xcassets */,
29AD42A61BBC2BD2004292F1 /* LaunchScreen.storyboard */,
29AD42A91BBC2BD2004292F1 /* Info.plist */,
Expand Down Expand Up @@ -208,7 +205,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2977865E1BC30BEF0050D397 /* DetailViewController.swift in Sources */,
29AD42A01BBC2BD2004292F1 /* ViewController.swift in Sources */,
29AD429E1BBC2BD2004292F1 /* AppDelegate.swift in Sources */,
);
Expand Down
Binary file not shown.
6 changes: 6 additions & 0 deletions Demo/WhisperDemo/WhisperDemo/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "avatar.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 0 additions & 31 deletions Demo/WhisperDemo/WhisperDemo/DetailViewController.swift

This file was deleted.

2 changes: 0 additions & 2 deletions Demo/WhisperDemo/WhisperDemo/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
Expand Down
33 changes: 14 additions & 19 deletions Demo/WhisperDemo/WhisperDemo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ class ViewController: UIViewController {
return button
}()

lazy var newControllerButton: UIBarButtonItem = { [unowned self] in
let button = UIBarButtonItem()
button.title = "Next"
button.target = self
button.action = "nextButtonDidPress"
lazy var notificationButton: UIButton = { [unowned self] in
let button = UIButton()
button.addTarget(self, action: "presentNotificationDidPress:", forControlEvents: .TouchUpInside)
button.setTitle("Notification", forState: .Normal)

return button
}()
Expand All @@ -68,13 +67,10 @@ class ViewController: UIViewController {

view.backgroundColor = UIColor.whiteColor()

navigationItem.rightBarButtonItem = newControllerButton
navigationItem.backBarButtonItem = UIBarButtonItem(title: nil, style: .Plain, target: nil, action: nil)

view.addSubview(scrollView)
for subview in [icon, titleLabel, presentButton, showButton, presentPermanentButton] { scrollView.addSubview(subview) }
for subview in [icon, titleLabel, presentButton, showButton, presentPermanentButton, notificationButton] { scrollView.addSubview(subview) }

for button in [presentButton, showButton, presentPermanentButton] {
for button in [presentButton, showButton, presentPermanentButton, notificationButton] {
button.setTitleColor(UIColor.grayColor(), forState: .Normal)
button.layer.borderColor = UIColor.grayColor().CGColor
button.layer.borderWidth = 1.5
Expand All @@ -86,7 +82,7 @@ class ViewController: UIViewController {
navigationController.navigationBar.addSubview(containerView)
containerView.frame = CGRect(x: 0,
y: navigationController.navigationBar.frame.maxY - UIApplication.sharedApplication().statusBarFrame.height,
width: UIScreen.mainScreen().bounds.width, height: 75)
width: UIScreen.mainScreen().bounds.width, height: 0)
}

override func viewWillAppear(animated: Bool) {
Expand Down Expand Up @@ -123,24 +119,23 @@ class ViewController: UIViewController {
Whisper(message, to: navigationController, action: .Present)
}

func nextButtonDidPress() {
let controller = DetailViewController()
title = ""
navigationController?.pushViewController(controller, animated: true)
func presentNotificationDidPress(button: UIButton) {
let announcement = Announcement(title: "Ramon Gilabert", subtitle: "Vadym Markov just commented your post", image: UIImage(named: "avatar"))

Shout(announcement, to: self)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be lowercase?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whisper and Silent are uppercase, I think it makes more sense, it's like something big! We decided to do it like that before...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We did? In Krakow?

}

// MARK - Configuration

func setupFrames() {
guard let navigationHeight = navigationController?.navigationBar.frame.height else { return }
let totalSize = UIScreen.mainScreen().bounds
let originY = navigationHeight + UIApplication.sharedApplication().statusBarFrame.height

scrollView.frame = CGRect(x: 0, y: originY, width: totalSize.width, height: totalSize.height - originY)
titleLabel.frame.origin = CGPoint(x: (totalSize.width - titleLabel.frame.width) / 2, y: totalSize.height / 2 - 200)
scrollView.frame = CGRect(x: 0, y: 0, width: totalSize.width, height: totalSize.height)
titleLabel.frame.origin = CGPoint(x: (totalSize.width - titleLabel.frame.width) / 2, y: totalSize.height / 2 - 250)
presentButton.frame = CGRect(x: 50, y: titleLabel.frame.maxY + 75, width: totalSize.width - 100, height: 50)
showButton.frame = CGRect(x: 50, y: presentButton.frame.maxY + 15, width: totalSize.width - 100, height: 50)
presentPermanentButton.frame = CGRect(x: 50, y: showButton.frame.maxY + 15, width: totalSize.width - 100, height: 50)
notificationButton.frame = CGRect(x: 50, y: presentPermanentButton.frame.maxY + 15, width: totalSize.width - 100, height: 50)
}
}

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Whisper :dash:

[![CI Status](http://img.shields.io/travis/hyperoslo/Whisper.svg?style=flat)](https://travis-ci.org/hyperoslo/Whisper)
[![Version](https://img.shields.io/cocoapods/v/Whisper.svg?style=flat)](http://cocoadocs.org/docsets/Whisper)
[![License](https://img.shields.io/cocoapods/l/Whisper.svg?style=flat)](http://cocoadocs.org/docsets/Whisper)
[![Platform](https://img.shields.io/cocoapods/p/Whisper.svg?style=flat)](http://cocoadocs.org/docsets/Whisper)
Expand All @@ -26,4 +25,4 @@ Hyper Interaktiv AS, [email protected]

## License

**Whisper** is available under the MIT license. See the LICENSE file for more info.
**Whisper** is available under the MIT license. See the LICENSE file for more information.
12 changes: 12 additions & 0 deletions Source/Configuration/ColorList.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import UIKit

public struct ColorList {

public struct Shout {

public static var background = UIColor.whiteColor()
public static var dragIndicator = UIColor(red:0.90, green:0.90, blue:0.90, alpha:1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drugIndicator

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool story.

public static var title = UIColor.blackColor()
public static var subtitle = UIColor.blackColor()
}
}
10 changes: 10 additions & 0 deletions Source/Configuration/FontList.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import UIKit

public struct FontList {

public struct Shout {

public static let title = UIFont.boldSystemFontOfSize(15)
public static let subtitle = UIFont.systemFontOfSize(13)
}
}
19 changes: 18 additions & 1 deletion Source/Message.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,21 @@ public struct Message {
self.color = color
self.images = images
}
}
}

public struct Announcement {

public var title: String
public var subtitle: String?
public var image: UIImage?
public var duration: NSTimeInterval
public var action: (() -> Void)?

public init(title: String, subtitle: String? = nil, image: UIImage? = nil, duration: NSTimeInterval = 2, action: (() -> Void)? = nil) {
self.title = title
self.subtitle = subtitle
self.image = image
self.duration = duration
self.action = action
}
}
Loading