motion-social 0.2 → 0.3
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/README.md +21 -13
- data/lib/project/motion-social.rb +13 -14
- 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: b1550ee6a00082b53ef47404f421c0cd05a28292
|
4
|
+
data.tar.gz: 66666898018a5c9cf1eebcdad4ce35378f5102ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9d358b0a70da66a25d1014a6f176422c239e4e0805ae949f82f77d75bc383180cd92a269bd8ac504fb6099b583a1f59a90a39b1fd5ee5929663d5ab30da3861
|
7
|
+
data.tar.gz: 6b1d31e4aa31d33e44d5a4415d4303502b584e93d172fae0653edbe6cec0cf67eb6745af7ca93c89b11a731d612786342b25d4afda92595c2081f391ac5de12d
|
data/README.md
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
# motion-social
|
2
2
|
|
3
|
-
This gem allows you to easily share content on Twitter and Facebook. One image is worth a thousand words
|
4
|
-
|
5
|
-

|
6
|
-
|
7
|
-
 
|
3
|
+
This gem allows you to easily share content on Twitter and Facebook. One image is worth a thousand words and at the end of this readme we have 3.
|
8
4
|
|
9
5
|
## Installation
|
10
6
|
|
@@ -19,21 +15,33 @@ And then execute:
|
|
19
15
|
|
20
16
|
## Usage:
|
21
17
|
|
22
|
-
|
18
|
+
class MyAwesomeViewController < UIViewController
|
19
|
+
|
20
|
+
include MotionSocial::Sharing
|
23
21
|
|
24
|
-
|
22
|
+
def sharing_message
|
23
|
+
"I am using Motion-Social"
|
24
|
+
end
|
25
25
|
|
26
|
-
|
26
|
+
def sharing_url
|
27
|
+
"http://www.rubymotion.com"
|
28
|
+
end
|
27
29
|
|
28
|
-
|
29
|
-
|
30
|
-
|
30
|
+
def controller
|
31
|
+
self # This is so that we can present the dialogs.
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
31
35
|
|
32
36
|
When you want to display the sharing dialogs just use:
|
33
37
|
|
34
|
-
|
35
|
-
|
38
|
+
post_to_twitter
|
39
|
+
post_to_facebook
|
40
|
+
|
41
|
+
 
|
36
42
|
|
37
43
|
or display a dialog with Facebook and Twitter as options:
|
38
44
|
|
39
45
|
display_share_dialog
|
46
|
+
|
47
|
+

|
@@ -18,7 +18,7 @@ module MotionSocial
|
|
18
18
|
#
|
19
19
|
# display_share_dialog
|
20
20
|
#
|
21
|
-
def
|
21
|
+
def post_to_twitter
|
22
22
|
if SLComposeViewController.isAvailableForServiceType(SLServiceTypeTwitter)
|
23
23
|
tweetSheet = SLComposeViewController.composeViewControllerForServiceType(SLServiceTypeTwitter)
|
24
24
|
tweetSheet.setInitialText(sharing_message)
|
@@ -30,7 +30,7 @@ module MotionSocial
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
33
|
+
def post_to_facebook
|
34
34
|
if SLComposeViewController.isAvailableForServiceType(SLServiceTypeFacebook)
|
35
35
|
sheet = SLComposeViewController.composeViewControllerForServiceType(SLServiceTypeFacebook)
|
36
36
|
sheet.setInitialText(sharing_message)
|
@@ -50,21 +50,20 @@ module MotionSocial
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def display_share_dialog(sender=nil)
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
actionSheet.addButtonWithTitle("Facebook")
|
60
|
-
actionSheet.showInView(self.controller.view)
|
53
|
+
action_sheet = UIActionSheet.alloc.init
|
54
|
+
action_sheet.delegate = self
|
55
|
+
action_sheet.addButtonWithTitle "Twitter"
|
56
|
+
action_sheet.addButtonWithTitle "Facebook"
|
57
|
+
action_sheet.cancelButtonIndex = action_sheet.addButtonWithTitle("Cancel")
|
58
|
+
action_sheet.showInView(self.controller.view)
|
61
59
|
end
|
62
60
|
|
63
61
|
def actionSheet(actionSheet, clickedButtonAtIndex:buttonIndex)
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
62
|
+
puts buttonIndex
|
63
|
+
if buttonIndex == 1
|
64
|
+
post_to_facebook
|
65
|
+
elsif buttonIndex == 0
|
66
|
+
post_to_twitter
|
68
67
|
end
|
69
68
|
end
|
70
69
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-social
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Acosta-Rubio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|