motion-alert 0.2.0 → 0.2.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.
- checksums.yaml +4 -4
- data/lib/project/motion_alert.rb +4 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0314c51e7a79d0a2292520a6629c8666573e74b
|
4
|
+
data.tar.gz: 2d6eb5d011961e5ceb3b490c6a5ebd2779eee8ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2760c003330e87db778be0d6ff81f640bd44698b34e50c22b39158877d09ca3d51201cefe837a1cf928a68d3140f5a6d40f33d1d3a140a9bf7fd9c9552401529
|
7
|
+
data.tar.gz: 6422ee27ae5370b24117bf7c03c170483674bb1238f4f8f192e3c76960a759af987a53405b21128b5da26189519624f4eb80a527e0b2e348d04f214e47914bd7
|
data/lib/project/motion_alert.rb
CHANGED
@@ -4,6 +4,7 @@ module Motion
|
|
4
4
|
attr_accessor :message
|
5
5
|
attr_accessor :actions
|
6
6
|
attr_accessor :type
|
7
|
+
attr_accessor :presenter
|
7
8
|
|
8
9
|
def self.instance
|
9
10
|
Dispatch.once { @instance ||= alloc.init }
|
@@ -15,6 +16,7 @@ module Motion
|
|
15
16
|
i.title = options.fetch(:title, nil)
|
16
17
|
i.message = options.fetch(:message, nil)
|
17
18
|
i.type = options.fetch(:type, :alert)
|
19
|
+
i.presenter = options.fetch(:presenter, UIApplication.sharedApplication.keyWindow.rootViewController)
|
18
20
|
i.actions = Option.new
|
19
21
|
end
|
20
22
|
end
|
@@ -34,7 +36,7 @@ module Motion
|
|
34
36
|
|
35
37
|
alert_controller.tap do |alert|
|
36
38
|
self.actions.attach_to(alert)
|
37
|
-
|
39
|
+
presenter.presentViewController(alert, animated: false, completion: nil)
|
38
40
|
end
|
39
41
|
end
|
40
42
|
|
@@ -45,7 +47,7 @@ module Motion
|
|
45
47
|
end
|
46
48
|
|
47
49
|
def show_as_action_sheet
|
48
|
-
self.actions.attach_to(action_sheet).showInView(
|
50
|
+
self.actions.attach_to(action_sheet).showInView(presenter.view)
|
49
51
|
end
|
50
52
|
|
51
53
|
def alert_controller
|
@@ -90,9 +92,5 @@ module Motion
|
|
90
92
|
def can_show_controller?
|
91
93
|
!!UIDevice.currentDevice.systemVersion.match("^8")
|
92
94
|
end
|
93
|
-
|
94
|
-
def root_controller
|
95
|
-
UIApplication.sharedApplication.keyWindow.rootViewController
|
96
|
-
end
|
97
95
|
end
|
98
96
|
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.2.
|
4
|
+
version: 0.2.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-
|
11
|
+
date: 2015-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|