Class: Twitter::Composer
- Inherits:
-
Object
- Object
- Twitter::Composer
- Defined in:
- lib/twittermotion/composer.rb
Instance Attribute Summary collapse
-
#callback ⇒ Object
Returns the value of attribute callback.
-
#compose_controller ⇒ Object
Returns the value of attribute compose_controller.
-
#error ⇒ Object
Returns the value of attribute error.
-
#images ⇒ Object
Returns the value of attribute images.
-
#result ⇒ Object
Returns the value of attribute result.
-
#tweet ⇒ Object
Returns the value of attribute tweet.
-
#urls ⇒ Object
Returns the value of attribute urls.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#callback ⇒ Object
Returns the value of attribute callback.
25 26 27 |
# File 'lib/twittermotion/composer.rb', line 25 def callback @callback end |
#compose_controller ⇒ Object
Returns the value of attribute compose_controller.
24 25 26 |
# File 'lib/twittermotion/composer.rb', line 24 def compose_controller @compose_controller end |
#error ⇒ Object
Returns the value of attribute error.
26 27 28 |
# File 'lib/twittermotion/composer.rb', line 26 def error @error end |
#images ⇒ Object
Returns the value of attribute images.
27 28 29 |
# File 'lib/twittermotion/composer.rb', line 27 def images @images end |
#result ⇒ Object
Returns the value of attribute result.
26 27 28 |
# File 'lib/twittermotion/composer.rb', line 26 def result @result end |
#tweet ⇒ Object
Returns the value of attribute tweet.
27 28 29 |
# File 'lib/twittermotion/composer.rb', line 27 def tweet @tweet end |
#urls ⇒ Object
Returns the value of attribute urls.
27 28 29 |
# File 'lib/twittermotion/composer.rb', line 27 def urls @urls end |
Class Method Details
.available? ⇒ Boolean
15 16 17 |
# File 'lib/twittermotion/composer.rb', line 15 def self.available? TWTweetComposeViewController.canSendTweet end |
.compose(options = {}, &block) ⇒ Object
19 20 21 22 |
# File 'lib/twittermotion/composer.rb', line 19 def self.compose( = {}, &block) @composer = Composer.new @composer.compose(, &block) end |
Instance Method Details
#cancelled? ⇒ Boolean
37 38 39 |
# File 'lib/twittermotion/composer.rb', line 37 def cancelled? @result == TWTweetComposeViewControllerResultCancelled end |
#compose(options = {}, &compose_callback) ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/twittermotion/composer.rb', line 93 def compose( = {}, &compose_callback) self.error = nil self.tweet = [:tweet] || self.tweet self.images = [:images] || self.images self.urls = [:urls] || self.urls if self.error Dispatch::Queue.main.async { compose_callback.call(self) } return end [:animated] = true if !.has_key? :animated [:presenting_controller] ||= UIWindow.keyWindow.rootViewController self.callback ||= lambda { |composer| self.compose_controller.dismissModalViewControllerAnimated(true) compose_callback.call(self) } self.compose_controller.completionHandler = lambda { |result| self.result = result self.callback.call(self) } [:presenting_controller].presentModalViewController(self.compose_controller, animated: [:animated]) end |
#done? ⇒ Boolean
33 34 35 |
# File 'lib/twittermotion/composer.rb', line 33 def done? @result == TWTweetComposeViewControllerResultDone end |