motion-alert 0.1 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -8
  3. data/lib/project/motion_alert.rb +19 -20
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 08192542ba3a4918ff117da677754fae35e5733b
4
- data.tar.gz: 2cb7598d4cc0d77d53bced4f59e2c85485ccd29c
3
+ metadata.gz: 22b3d7db8129c6b046fdd95ffd4c36a73521f141
4
+ data.tar.gz: 963319f14db7c36da75d2c413e9927cc2679934b
5
5
  SHA512:
6
- metadata.gz: 4beea57aa0b877af17121e40c649ba0e1d68a8a6716106b27efa7388935b5da472a0f8ff1f63724d04c91de332c21657185a0512702445d49ee8088734dcd922
7
- data.tar.gz: 07bd448362f56df58ddfa93f8716e8ab5ef1f177c406ff38e73fa6d5dea4ac1cb62903cbc410448b6eafa01b43df1aaea386740e2854066f56792759f2a02002
6
+ metadata.gz: 5e7a56b0a7d1d95e0b089f116e5e06e9a5ba3dcd5247cdc5ed4cfe1a1b98a46e3ca937fa5a8bb530332319866cc337bfe1fc4c2f93bb3d96f7a62d850b8953dd
7
+ data.tar.gz: bb8d90f0964e80037a71b94b24869a0960f0908e34a9c83f62c0ca4be79901e983d40948afa013cb07d15a7eb77fecdb4275f8b700f9bf7678c91c15c7e79566
data/README.md CHANGED
@@ -1,9 +1,13 @@
1
- Motion-Alert
1
+ # Motion-Alert
2
+ [![Build Status](https://travis-ci.org/squidpunch/motion-alert.svg?branch=master)](https://travis-ci.org/squidpunch/motion-alert)
3
+ [![Gem Version](https://badge.fury.io/rb/motion-alert.svg)](http://badge.fury.io/rb/motion-alert)
2
4
 
3
5
  Want to just show an alert to your no matter what version of iOS you are on?
4
6
  Motion-alert is for you. Did you know `UIAlert` is deprecated in iOS 8? You
5
7
  should be using `UIAlertController` but if you use that controller on a prior
6
- iOS version, you're bound to have a bad time.
8
+ iOS version, you're bound to have a bad time. **Motion Alert** manages this for
9
+ you, you just say you want an alert, buttons to show and the actions on those
10
+ buttons and Motion Alert handles the rest.
7
11
 
8
12
  ## Installation
9
13
 
@@ -21,13 +25,13 @@ Or install it yourself as:
21
25
 
22
26
  ## Usage
23
27
 
24
- def show_alert
25
- Motion::Alert.new({title: "Alert!", message:"message"}).tap do |a|
26
- a.add_action("OK", Proc.new { puts 'OK!' })
27
- a.add_action("Cancel", Proc.new { puts 'Cancel!' })
28
- a.show
28
+ def show_alert
29
+ Motion::Alert.new({title: "Alert!", message:"message"}).tap do |a|
30
+ a.add_action("OK", Proc.new { puts 'OK!' })
31
+ a.add_action("Cancel", Proc.new { puts 'Cancel!' })
32
+ a.show
33
+ end
29
34
  end
30
- end
31
35
 
32
36
  ## Contributing
33
37
 
@@ -30,6 +30,14 @@ module Motion
30
30
  end
31
31
  end
32
32
 
33
+ def selected(index)
34
+ if action = self.actions[index].action
35
+ action.call
36
+ end
37
+ end
38
+
39
+ private
40
+
33
41
  def alert_view_controller
34
42
  alert_view_controller =
35
43
  UIAlertController.alertControllerWithTitle(
@@ -50,29 +58,21 @@ module Motion
50
58
  end
51
59
 
52
60
  def alert_view
53
- unless @alert_view
54
- @alert_view = UIAlertView.alloc.initWithTitle(
55
- title,
56
- message: message,
57
- delegate: UIApplication.sharedApplication.delegate,
58
- cancelButtonTitle: nil,
59
- otherButtonTitles:
60
- nil
61
- )
62
- self.actions.each do |a|
63
- @alert_view.addButtonWithTitle(a.title)
64
- end
61
+ alert_view = UIAlertView.alloc.initWithTitle(
62
+ title,
63
+ message: message,
64
+ delegate: UIApplication.sharedApplication.delegate,
65
+ cancelButtonTitle: nil,
66
+ otherButtonTitles:
67
+ nil
68
+ )
69
+ self.actions.each do |a|
70
+ alert_view.addButtonWithTitle(a.title)
65
71
  end
66
72
 
67
- @alert_view
68
- end
69
-
70
- def selected(index)
71
- self.actions[index].action.call
73
+ alert_view
72
74
  end
73
75
 
74
- private
75
-
76
76
  def can_show_controller?
77
77
  !!UIDevice.currentDevice.systemVersion.match("^8")
78
78
  end
@@ -80,6 +80,5 @@ module Motion
80
80
  def root_controller
81
81
  UIApplication.sharedApplication.keyWindow.rootViewController
82
82
  end
83
-
84
83
  end
85
84
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-alert
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Larrabee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-31 00:00:00.000000000 Z
11
+ date: 2015-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake