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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +21 -13
  3. data/lib/project/motion-social.rb +13 -14
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 31ab9f00d4c8c8a28d275f853cbe7b5b00f3afcf
4
- data.tar.gz: 880d9160f7acaa72b3286851d446f18751a398c8
3
+ metadata.gz: b1550ee6a00082b53ef47404f421c0cd05a28292
4
+ data.tar.gz: 66666898018a5c9cf1eebcdad4ce35378f5102ba
5
5
  SHA512:
6
- metadata.gz: c4bbe1f05e610ab308e3130191b29913898dd20eb8bb7003b7789b2a116d94f6b46b0f19c1618fc82c514d9565f26ae7e24e8b5bde7bc9ea048d68cef78bfbcf
7
- data.tar.gz: 25d7eb60cf52b6c46ea28e1c43a1e7e93a90d8864cb656ac5df1496479febfad50dbf3fc37042ca0ebf85ec777d7cc3eddd62a9684f316cc7b36ca2b27490df8
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. Let's have 3:
4
-
5
- ![share dialog](https://raw.github.com/ivanacostarubio/motion-social/master/resources/share_dialog.png)
6
-
7
- ![twitter](https://raw.github.com/ivanacostarubio/motion-social/master/resources/twitter.png) ![facebook](https://raw.github.com/ivanacostarubio/motion-social/master/resources/facebook.png)
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
- In your UIViewController
18
+ class MyAwesomeViewController < UIViewController
19
+
20
+ include MotionSocial::Sharing
23
21
 
24
- include MotionSocial::Sharing
22
+ def sharing_message
23
+ "I am using Motion-Social"
24
+ end
25
25
 
26
- Define the following methods:
26
+ def sharing_url
27
+ "http://www.rubymotion.com"
28
+ end
27
29
 
28
- def sharing_message
29
- def sharing_url
30
- def controller
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
- postToTwitter(sender)
35
- postToFacebook(sender)
38
+ post_to_twitter
39
+ post_to_facebook
40
+
41
+ ![twitter](https://raw.github.com/ivanacostarubio/motion-social/master/resources/twitter.png) ![facebook](https://raw.github.com/ivanacostarubio/motion-social/master/resources/facebook.png)
36
42
 
37
43
  or display a dialog with Facebook and Twitter as options:
38
44
 
39
45
  display_share_dialog
46
+
47
+ ![share dialog](https://raw.github.com/ivanacostarubio/motion-social/master/resources/share_dialog.png)
@@ -18,7 +18,7 @@ module MotionSocial
18
18
  #
19
19
  # display_share_dialog
20
20
  #
21
- def postToTwitter(sender)
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 postToFacebook(sender)
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
- cancelTitle = "Not now"
54
- actionSheet = UIActionSheet.alloc.initWithTitle(nil,delegate:self,
55
- cancelButtonTitle:"Cancel",
56
- destructiveButtonTitle:nil,
57
- otherButtonTitles: nil)
58
- actionSheet.addButtonWithTitle("Twitter")
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
- if buttonIndex == 2
65
- postToFacebook(nil)
66
- elsif buttonIndex == 1
67
- postToTwitter(nil)
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.2'
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-09-26 00:00:00.000000000 Z
11
+ date: 2013-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake