motion-social 0.1 → 0.2
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 -11
- data/lib/project/motion-social.rb +33 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31ab9f00d4c8c8a28d275f853cbe7b5b00f3afcf
|
4
|
+
data.tar.gz: 880d9160f7acaa72b3286851d446f18751a398c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4bbe1f05e610ab308e3130191b29913898dd20eb8bb7003b7789b2a116d94f6b46b0f19c1618fc82c514d9565f26ae7e24e8b5bde7bc9ea048d68cef78bfbcf
|
7
|
+
data.tar.gz: 25d7eb60cf52b6c46ea28e1c43a1e7e93a90d8864cb656ac5df1496479febfad50dbf3fc37042ca0ebf85ec777d7cc3eddd62a9684f316cc7b36ca2b27490df8
|
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# motion-social
|
2
2
|
|
3
|
-
|
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
|
+

|
6
|
+
|
7
|
+
 
|
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
|
-
|
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
|
-
|
32
|
+
When you want to display the sharing dialogs just use:
|
20
33
|
|
21
|
-
|
34
|
+
postToTwitter(sender)
|
35
|
+
postToFacebook(sender)
|
22
36
|
|
23
|
-
|
37
|
+
or display a dialog with Facebook and Twitter as options:
|
24
38
|
|
25
|
-
|
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
|
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
|
-
|
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
|