motion-social 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +21 -11
  3. data/lib/project/motion-social.rb +33 -2
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 72b225d248790ffdbf76ce77cc31e6aff5c92461
4
- data.tar.gz: 1809d424c64ef8cd3640d58e06e58d3038fcb0da
3
+ metadata.gz: 31ab9f00d4c8c8a28d275f853cbe7b5b00f3afcf
4
+ data.tar.gz: 880d9160f7acaa72b3286851d446f18751a398c8
5
5
  SHA512:
6
- metadata.gz: b45be93b4cc4ea7d5318664b74cb294efd2e05bffa44c0c645418c5aabf8d6c0bc9076d680c258c2c5ab3bc63cde46bbfa6793f02bb3e426abefda667d024961
7
- data.tar.gz: 07474f0304a4063ad1069a70bfdb4803d4d5a7d079f394097d9c11aa66d7779f87e3133872d11807f092a648ca4c88f7fcacfd7a1477175c91bdea7ade141c3b
6
+ metadata.gz: c4bbe1f05e610ab308e3130191b29913898dd20eb8bb7003b7789b2a116d94f6b46b0f19c1618fc82c514d9565f26ae7e24e8b5bde7bc9ea048d68cef78bfbcf
7
+ data.tar.gz: 25d7eb60cf52b6c46ea28e1c43a1e7e93a90d8864cb656ac5df1496479febfad50dbf3fc37042ca0ebf85ec777d7cc3eddd62a9684f316cc7b36ca2b27490df8
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # motion-social
2
2
 
3
- TODO: Write a gem description
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)
4
8
 
5
9
  ## Installation
6
10
 
@@ -12,18 +16,24 @@ And then execute:
12
16
 
13
17
  $ bundle
14
18
 
15
- Or install it yourself as:
16
19
 
17
- $ gem install motion-social
20
+ ## Usage:
21
+
22
+ In your UIViewController
23
+
24
+ include MotionSocial::Sharing
25
+
26
+ Define the following methods:
27
+
28
+ def sharing_message
29
+ def sharing_url
30
+ def controller
18
31
 
19
- ## Usage
32
+ When you want to display the sharing dialogs just use:
20
33
 
21
- TODO: Write usage instructions here
34
+ postToTwitter(sender)
35
+ postToFacebook(sender)
22
36
 
23
- ## Contributing
37
+ or display a dialog with Facebook and Twitter as options:
24
38
 
25
- 1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
39
+ display_share_dialog
@@ -1,4 +1,4 @@
1
- module MontionSocial
1
+ module MotionSocial
2
2
  module Sharing
3
3
  # Usage:
4
4
  # include MotionSocial::Sharing
@@ -9,6 +9,15 @@ module MontionSocial
9
9
  # def sharing_url
10
10
  # def controller
11
11
  #
12
+ # When you want to display the sharing dialogs just use:
13
+ #
14
+ # postToTwitter(sender)
15
+ # postToFacebook(sender)
16
+ #
17
+ # or display a dialog with Facebook and Twitter as options:
18
+ #
19
+ # display_share_dialog
20
+ #
12
21
  def postToTwitter(sender)
13
22
  if SLComposeViewController.isAvailableForServiceType(SLServiceTypeTwitter)
14
23
  tweetSheet = SLComposeViewController.composeViewControllerForServiceType(SLServiceTypeTwitter)
@@ -34,7 +43,29 @@ module MontionSocial
34
43
  end
35
44
 
36
45
  def error_message_for(service)
37
- App.alert("You don't have #{service} configured. Please go to your phone's settings and configure it.")
46
+ message = UIAlertView.alloc.initWithTitle("Something is wrong",
47
+ message:"You don't have #{service} configured. Please go to your phone's settings and configure it.",
48
+ delegate:nil, cancelButtonTitle:"OK", otherButtonTitles:nil)
49
+ message.show
50
+ end
51
+
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)
61
+ end
62
+
63
+ def actionSheet(actionSheet, clickedButtonAtIndex:buttonIndex)
64
+ if buttonIndex == 2
65
+ postToFacebook(nil)
66
+ elsif buttonIndex == 1
67
+ postToTwitter(nil)
68
+ end
38
69
  end
39
70
  end
40
71
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-social
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Acosta-Rubio