motion_wechat 0.0.1

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.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in motion_wechat.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 simsicon
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # MotionWechat
2
+
3
+ This motion_wechat is a RubyMotion wrapper for Wechat(微信/Weixin) iOS sdk.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'motion_wechat'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install motion_wechat
18
+
19
+ ## Usage
20
+
21
+ 1. In your app_delegate.rb, find application(applicaiton, didFinishLaunchingWithOptions:launchOptions), add
22
+
23
+ ```ruby
24
+ @client = MotionWechat::Client.new('your_app_id')
25
+ ```
26
+
27
+ 2. Override openURL()
28
+
29
+ ```ruby
30
+ def application(application, openURL:url, sourceApplication:sourceApplication, annotation:annotation)
31
+ client.handle_openURL(url, self)
32
+ end
33
+ ```
34
+
35
+ 3.
36
+
37
+
38
+ ## Contributing
39
+
40
+ 1. Fork it
41
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
42
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
43
+ 4. Push to the branch (`git push origin my-new-feature`)
44
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+
4
+ $:.unshift("/Library/RubyMotion/Lib")
5
+ require 'motion/project'
6
+ require 'rubygems'
7
+
8
+ Bundler.setup
9
+ Bundler.require
10
+
11
+
12
+ # require 'lib/motion_wechat'
@@ -0,0 +1,18 @@
1
+ unless defined?(Motion::Project::Config)
2
+ raise "This file must be required within a RubyMotion project Rakefile."
3
+ end
4
+
5
+ Motion::Project::App.setup do |app|
6
+ Dir.glob(File.join(File.dirname(__FILE__), 'motion_wechat/*.rb')).each do |file|
7
+ app.files.unshift(file)
8
+ end
9
+
10
+ app.vendor_project(File.expand_path(File.join(File.dirname(__FILE__), '../vendor/wechat-sdk')), :static)
11
+ end
12
+
13
+ require "motion_wechat/version"
14
+ require "motion_wechat/config.rb"
15
+
16
+ module MotionWechat
17
+
18
+ end
@@ -0,0 +1,14 @@
1
+ module MotionWechat
2
+ class Client
3
+
4
+ def initialize(app_id = '')
5
+ @app_id = MotionWechat::Config.app_id if app_id.empty?
6
+ WXApi.registerApp @app_id
7
+ end
8
+
9
+ def handle_openURL(url, delegate)
10
+ WXApi.handleOpenURL(url, delegate:self)
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,21 @@
1
+ module MotionWechat
2
+ module Config
3
+
4
+ def self.app_id=(val)
5
+ @@app_id = val
6
+ end
7
+
8
+ def self.app_id
9
+ @@app_id
10
+ end
11
+
12
+ def self.app_key=(val)
13
+ @@app_key = val
14
+ end
15
+
16
+ def self.app_key
17
+ @@app_key
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,19 @@
1
+ module MotionWechat
2
+ class Delegate
3
+
4
+ def onReq
5
+ title = 'onReq'
6
+ msg = 'onReq message'
7
+ alert = UIAlertView.alloc.initWithTitle(title, message:msg, delegate:self, cancelButtonTitle:"OK", otherButtonTitles:nil)
8
+ alert.show
9
+ end
10
+
11
+ def onResp
12
+ title = "onResp"
13
+ msg = 'onResp message'
14
+ alert = UIAlertView.alloc.initWithTitle(title, message:msg, delegate:self, cancelButtonTitle:"OK", otherButtonTitles:nil)
15
+ alert.show
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,144 @@
1
+ module MotionWechat
2
+ class Interface
3
+
4
+ def send_image_content(image_path, opts = {})
5
+ sendImageContent(image_path, opts = {})
6
+ end
7
+
8
+ def send_news_content(page_url, opts = {})
9
+ sendNewsContent(page_url, opts = {})
10
+ end
11
+
12
+ def send_music_content(music_url, opts = {})
13
+ sendMusicContent(music_url, opts = {})
14
+ end
15
+
16
+ def send_video_content(video_url, opts = {})
17
+ sendVideoContent(video_url, opts = {})
18
+ end
19
+
20
+ def send_text_content(message)
21
+ sendTextContent(message)
22
+ end
23
+
24
+ def send_app_content(ext_info, url, data, opts = {})
25
+ sendAppContent(ext_info, url, data, opts = {})
26
+ end
27
+
28
+ def sendImageContent(image_path, opts = {})
29
+ message = media_message(opts)
30
+
31
+ ext = WXImageObject.object
32
+ ext.imageData = NSData.dataWithContentsOfFile(image_path)
33
+
34
+ message.mediaObject = ext
35
+
36
+ req = wrap_req(message)
37
+
38
+ WXApi.sendReq(req)
39
+ end
40
+
41
+ def sendNewsContent(page_url, opts = {})
42
+ message = media_message(opts)
43
+
44
+ ext = WXWebpageObject.object
45
+ ext.webpageUrl = page_url
46
+
47
+ message.mediaObject = ext
48
+
49
+ req = wrap_req(message)
50
+
51
+ WXApi.sendReq(req)
52
+ end
53
+
54
+ def sendMusicContent(music_url, opts = {})
55
+ message = media_message(opts)
56
+
57
+ ext = WXMusicObject.object
58
+ ext.musicUrl = music_url
59
+
60
+ message.mediaObject = ext
61
+
62
+ req = wrap_req(message)
63
+
64
+ WXApi.sendReq(req)
65
+ end
66
+
67
+ def sendVideoContent(video_url, opts = {})
68
+ message = media_message(opts)
69
+
70
+ ext = WXVideoObject.object
71
+ ext.videoUrl = video_url
72
+
73
+ message.mediaObject = ext
74
+
75
+ req = wrap_req(message)
76
+
77
+ WXApi.sendReq(req)
78
+ end
79
+
80
+ def sendTextContent(message)
81
+ req = wrap_req(message, is_text: true)
82
+
83
+ WXApi.sendReq(req)
84
+ end
85
+
86
+ def sendAppContent(ext_info, url, data, opts = {})
87
+ message = media_message
88
+
89
+ ext = WXAppExtendObject.object
90
+ ext.extInfo = ext_info
91
+ ext.url = url
92
+ ext.fileData = data
93
+
94
+ message.mediaObject = ext
95
+
96
+ req = wrap_req(message)
97
+
98
+ WXApi.sendReq(req)
99
+ end
100
+
101
+ private
102
+ def wrap_req(message, opts = {})
103
+ req = SendMessageToWXReq.alloc.init
104
+ is_text = opts[:is_text] || false
105
+ if is_text
106
+ req.bText = true
107
+ req.text = message
108
+ else
109
+ req.bText = false
110
+ req.message = message
111
+ end
112
+
113
+ #[WXSceneSession, WXSceneTimeline]
114
+ req.scene = WXSceneSession
115
+ req
116
+ end
117
+
118
+ def media_message(opts = {})
119
+ message = WXMediaMessage.message
120
+
121
+ message.title = opts[:title] || ""
122
+ message.description = opts[:description] || ""
123
+
124
+ if opts[:thumb_image]
125
+ image = UIImage.imageNamed(opts[:thumb_image])
126
+ message.setThumbImage(image)
127
+ end
128
+
129
+ if opts[:thumb_data_url]
130
+ errorPointer = Pointer.new(:object)
131
+ data = NSData.dataWithContentsOfURL(opts[:thumb_data_url], options:NSDataReadingMappedIfSafe, error:errorPointer)
132
+
133
+ if errorPointer && errorPointer[0]
134
+ raise errorPointer[0]
135
+ else
136
+ message.thumbData = data
137
+ end
138
+ end
139
+
140
+ message
141
+ end
142
+
143
+ end
144
+ end
@@ -0,0 +1,3 @@
1
+ module MotionWechat
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/motion_wechat/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["simsicon"]
6
+ gem.email = ["simsicon@gmail.com"]
7
+ gem.description = %q{A rubymotion wrapper for wechat SDK}
8
+ gem.summary = %q{A rubymotion wrapper for wechat SDK}
9
+ gem.homepage = ""
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "motion_wechat"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = MotionWechat::VERSION
17
+ end
@@ -0,0 +1,122 @@
1
+ //
2
+ // MMApi.h
3
+ // ApiClient
4
+ //
5
+ // Created by Tencent on 12-2-28.
6
+ // Copyright (c) 2012 Tencent. All rights reserved.
7
+ //
8
+
9
+ #import <Foundation/Foundation.h>
10
+
11
+ #import "WXApiObject.h"
12
+
13
+ #pragma mark -
14
+ /*! @brief Receive and process event messages from WeChat
15
+ *
16
+ * Receive and process event messages from WeChat.
17
+ * Meanwhile WeChat will switch to the third-party app.
18
+ * WXApiDelegate is used and triggered in handleOpenURL.
19
+ */
20
+ @protocol WXApiDelegate <NSObject>
21
+
22
+ @optional
23
+
24
+ /*! @brief Receive and process request from WeChat and call sendResp
25
+ *
26
+ * The third-party app receives a request from WeChat.
27
+ * After asynchronous processing of the request.
28
+ * sendResp should be called to send the result to WeChat.
29
+ * Possible requests include GetMessageFromWXReq, ShowMessageFromWXReq, etc..
30
+ * @param req Specific request contents (auto-released)
31
+ */
32
+ -(void) onReq:(BaseReq*)req;
33
+
34
+ /*! @brief Response of sendReq from WeChat
35
+ *
36
+ * The third-party app receives the result from WeChat.
37
+ * If sendReq is called, onResp will be received.
38
+ * Possible results include SendMessageToWXResp, SendAuthResp, etc..
39
+ * @param Specific response contents (auto-released)
40
+ */
41
+ -(void) onResp:(BaseResp*)resp;
42
+
43
+ @end
44
+
45
+ #pragma mark -
46
+
47
+ /*! @brief WeChat API interface functions
48
+ *
49
+ * This class envelopes all interfaces of WeChat SDK
50
+ */
51
+ @interface WXApi : NSObject
52
+
53
+ /*! @brief Member function of WXApi. It's used to register the third-party app in WeChat.
54
+ *
55
+ * It should be called whenever WeChat enables the third-party app.
56
+ * The app will appear in Available Apps in WeChat.
57
+ * @param appid WeChat Developer ID
58
+ * @return Yes (success) or No (failure)
59
+ */
60
+ +(BOOL) registerApp:(NSString *) appid;
61
+
62
+ /*! @brief Process the data transferred while WeChat enable the app through URL
63
+ *
64
+ * Call in application:openURL:sourceApplication:annotation: or application:handleOpenURL
65
+ * @param url URL used to enable the app
66
+ * @param delegate Object of WXApiDelegate. It's used to receive messages that trigger WeChat
67
+ * @return Yes (success) or No (failure)
68
+ */
69
+ +(BOOL) handleOpenURL:(NSURL *) url delegate:(id<WXApiDelegate>) delegate;
70
+
71
+ /*! @brief Check whether the user has installed WeChat
72
+ *
73
+ * @return Yes (WeChat installed) or No (WeChat not installed)
74
+ */
75
+ +(BOOL) isWXAppInstalled;
76
+
77
+ /*! @brief Check whether the current WeChat version supports OpenApi
78
+ *
79
+ * @return Yes (support) or No (do not support)
80
+ */
81
+ +(BOOL) isWXAppSupportApi;
82
+
83
+ /*! @brief Get the max API version that current WeChat support
84
+ *
85
+ * @return Return the max API version
86
+ */
87
+ +(NSString *) getWXAppSupportMaxApiVersion;
88
+
89
+ /*! @brief Get installation URL of WeChat in iTunes
90
+ *
91
+ * @return strings about installation URL of WeChat
92
+ */
93
+ +(NSString *) getWXAppInstallUrl;
94
+
95
+ /*! @brief Open WeChat
96
+ *
97
+ * @return Yes (success) or No (failure)
98
+ */
99
+ +(BOOL) openWXApp;
100
+
101
+ /*! @brief Send a request to WeChat and wait for onResp returned from WeChat
102
+ *
103
+ *The third-party app calls this function, switches to WeChat interface and
104
+ * waits for onResp returned from WeChat. WeChat must calls onResp after the
105
+ * asynchronous processing. Possible requests include SendMessageToWXReq, SendAuthReq, etc..
106
+ * @param req Specific request. It should be auto-released after calling the function.
107
+ * @return Yes (success) or No (failure)
108
+ */
109
+ +(BOOL) sendReq:(BaseReq*)req;
110
+
111
+ /*! @brief Send the response of onReq request from WeChat and go to WeChat interface
112
+ *
113
+ * When this function is called, WeChat interface is open.
114
+ * The third-party app receives onResp request from WeChat, processes this request
115
+ * asynchronously and calls this function.
116
+ * Possible requests include GetMessageFromWXResp, ShowMessageFromWXResp, etc..
117
+ * @param resp Specific response. It should be auto-released after calling the function.
118
+ * @return Yes (success) or No (failure)
119
+ */
120
+ +(BOOL) sendResp:(BaseResp*)resp;
121
+
122
+ @end
@@ -0,0 +1,352 @@
1
+ //
2
+ // MMApiObject.h
3
+ // ApiClient
4
+ //
5
+ // Created by Tencent on 12-2-28.
6
+ // Copyright (c) 2012年 Tencent. All rights reserved.
7
+ //
8
+
9
+ #import <Foundation/Foundation.h>
10
+
11
+ /////////////////////////////////////////////////////////////
12
+
13
+ enum WXErrCode {
14
+ WXSuccess = 0,
15
+ WXErrCodeCommon = -1,
16
+ WXErrCodeUserCancel = -2,
17
+ WXErrCodeSentFail = -3,
18
+ WXErrCodeAuthDeny = -4,
19
+ WXErrCodeUnsupport = -5,
20
+ };
21
+
22
+ enum WXScene {
23
+
24
+ WXSceneSession = 0,
25
+ WXSceneTimeline = 1,
26
+ };
27
+
28
+ enum WXAPISupport {
29
+
30
+ WXAPISupportSession = 0,
31
+ };
32
+
33
+ /*! @brief Basic class of all request classes of WeChat SDK
34
+ *
35
+ */
36
+ @interface BaseReq : NSObject
37
+
38
+ /** Request type */
39
+ @property (nonatomic, assign) int type;
40
+
41
+ @end
42
+
43
+ /*! @brief Basic class of all response classes of WeChat SDK
44
+ *
45
+ */
46
+ @interface BaseResp : NSObject
47
+ /** Error code */
48
+ @property (nonatomic, assign) int errCode;
49
+ /** Error notification string */
50
+ @property (nonatomic, retain) NSString *errStr;
51
+ /** Response type */
52
+ @property (nonatomic, assign) int type;
53
+
54
+ @end
55
+
56
+
57
+ @class WXMediaMessage;
58
+ /*! @brief Message structure that the third-party application uses to send message to WeChat
59
+ *
60
+ * The third-party app uses SendMessageToWXReq to send messages to WeChat.
61
+ * The message type can be text (member: text) and multi-media (member: message).
62
+ * WeChat will then return the result after processing.
63
+ * @see SendMessageToWXResp
64
+ */
65
+ @interface SendMessageToWXReq : BaseReq
66
+
67
+ /** Text contents in the message sent
68
+ * @note The size of texts should be within 0-10k.
69
+ */
70
+ @property (nonatomic, retain) NSString* text;
71
+
72
+ /** Multi-media contents in the message sent
73
+ * @see WXMediaMessage
74
+ */
75
+ @property (nonatomic, retain) WXMediaMessage* message;
76
+ /** The message type can be Text or Multi-media but not both. */
77
+ @property (nonatomic, assign) BOOL bText;
78
+ /** Target scene, you can send to contact or moments. Contact if default choice. */
79
+ @property (nonatomic, assign) int scene;
80
+
81
+ @end
82
+
83
+ /*! @brief Result of SendMessageToWXReq that WeChat returns to the third-party app
84
+ *
85
+ * Wechat uses SendMessageToWXResp to return results of SendMessageToWXReq from the third-party app.
86
+ */
87
+ @interface SendMessageToWXResp : BaseResp
88
+ @end
89
+
90
+
91
+ /*! @brief Message structure that the third-party application uses to request authorization from WeChat
92
+ *
93
+ * The third-party app requests for verification and authorization by calling sendReq member function of WXApi
94
+ * and sending an SendAuthReq message to WeChat.
95
+ * WeChat will return a result after processing.
96
+ * @see SendAuthResp
97
+ */
98
+ @interface SendAuthReq : BaseReq
99
+ /** The third-party app requests verification and authorization by calling sendReq member function of WXApi and sending an SendAuthReq message to WeChat. WeChat will return a result after processing.
100
+ * @see SendAuthResp
101
+ * @note scope string can not exceed 1k
102
+ */
103
+ @property (nonatomic, retain) NSString* scope;
104
+ /** It's the unique identifier of request from third-party application. WeChat will include it in the message returned.
105
+ * @note state string can not exceed 1k
106
+ */
107
+ @property (nonatomic, retain) NSString* state;
108
+ @end
109
+
110
+ /*! @brief Result of verification and authorization requests that WeChat returns to third-party applications
111
+ *
112
+ * The third-party requests for verification and authorization by calling sendReq member function of WXApi and sending a SendAuthReq message to WeChat. WeChat then returns the result in an SendAuthResp message.
113
+ * @see onResp
114
+ */
115
+ @interface SendAuthResp : BaseResp
116
+ /** User name */
117
+ @property (nonatomic, retain) NSString* userName;
118
+ /** Verification token */
119
+ @property (nonatomic, retain) NSString* token;
120
+ /** Expiration date of the verification */
121
+ @property (nonatomic, retain) NSDate* expireDate;
122
+ /** It's the unique identifier of request from third-party application. The third-party app inputs it while calling sendReq and WeChat will include it in the message returned.
123
+ * @note state string can not exceed 1k
124
+ */
125
+ @property (nonatomic, retain) NSString* state;
126
+ @end
127
+
128
+
129
+ /*! @brief Message structure that WeChat uses to request contents from third-party applications
130
+ *
131
+ * WeChat sends a request to a third-party application for contents with GetMessageFromWXReq message structure;
132
+ * and the third-party application needs to call sendResp to return the result with GetMessageFromWXResp message structure
133
+ */
134
+ @interface GetMessageFromWXReq : BaseReq
135
+ @end
136
+
137
+ /*! @brief Message structure that the third-party application uses to response requests from WeChat
138
+ *
139
+ * WeChat sends a request to a third-party application;
140
+ * and the third-party application calls sendResp to return the result in a GetMessageFromWXResp message.
141
+ */
142
+ @interface GetMessageFromWXResp : BaseResp
143
+ /** Text contents provided to WeChat
144
+ @note The size of texts should be within 0-10k.
145
+ */
146
+ @property (nonatomic, retain) NSString* text;
147
+ /** Multi-media contents provided to WeChat
148
+ * @see WXMediaMessage
149
+ */
150
+ @property (nonatomic, retain) WXMediaMessage* message;
151
+ /** Types of message that providing contents to WeChat. It could be text or multi-media but not both. */
152
+ @property (nonatomic, assign) BOOL bText;
153
+ @end
154
+
155
+ /*! @brief WeChat asks the third-party to show contents
156
+ *
157
+ * WeChat sends an ShowMessageFromWXReq message to ask the third-party app to show certain contents.
158
+ * And the third-party app calls sendResp to send an ShowMessageFromWXResp message to WeChat after processing.
159
+ */
160
+ @interface ShowMessageFromWXReq : BaseReq
161
+ /** WeChat asks the third-party to show contents
162
+ * @see WXMediaMessage
163
+ */
164
+ @property (nonatomic, retain) WXMediaMessage* message;
165
+ @end
166
+
167
+ /*! @brief WeChat sends an ShowMessageFromWXReq message to ask the third-party app to
168
+ * show certain contents.
169
+ * And the third-party app calls sendResp to send an ShowMessageFromWXResp message to
170
+ * WeChat after processing.
171
+ */
172
+ @interface ShowMessageFromWXResp : BaseResp
173
+ @end
174
+
175
+
176
+ #pragma mark - WXMediaMessage
177
+
178
+ /*! @brief Structure of multi-media messages
179
+ *
180
+ * It's used for multi-media contents transferred between WeChat and the third-party app.
181
+ */
182
+ @interface WXMediaMessage : NSObject
183
+
184
+ +(WXMediaMessage *) message;
185
+
186
+ /** Title
187
+ * @note contents can not exceed 512 bytes
188
+ */
189
+ @property (nonatomic, retain) NSString *title;
190
+ /** Description
191
+ * @note contents can not exceed 1k
192
+ */
193
+ @property (nonatomic, retain) NSString *description;
194
+ /** Data of the thumb
195
+ * @note contents can not exceed 32K
196
+ */
197
+ @property (nonatomic, retain) NSData *thumbData;
198
+ /** Multi-media data object, including WXWebpageObject, WXImageObject, WXMusicObject, etc.. */
199
+ @property (nonatomic, retain) id mediaObject;
200
+
201
+ /*! @brief Method used to set the thumb of image message
202
+ *
203
+ * @param image Thumb
204
+ * @note contents can not exceed 32K
205
+ */
206
+ - (void) setThumbImage:(UIImage *)image;
207
+
208
+ @end
209
+
210
+
211
+ #pragma mark -
212
+ /*! @brief Image object included in multi-media messages
213
+ *
214
+ * The image object included in the message transferred between WeChat and the third-party app
215
+ * @note imageData and imageUrl can not be left blank at the same time.
216
+ * @see WXMediaMessage
217
+ */
218
+ @interface WXImageObject : NSObject
219
+ /*! @brief Return a WXImageObject object
220
+ *
221
+ * @note The WXImageObject object returned is auto-released.
222
+ */
223
+ +(WXImageObject *) object;
224
+
225
+ /** Actual contents of the image
226
+ * @note file size can not exceed 10M.
227
+ */
228
+ @property (nonatomic, retain) NSData *imageData;
229
+ /** Image URL
230
+ * @note contents can not exceed 10K
231
+ */
232
+ @property (nonatomic, retain) NSString *imageUrl;
233
+
234
+ @end
235
+
236
+ /*! @brief Music object included in multi-media messages
237
+ *
238
+ * Music object included in the message transferred between WeChat and the third-party app
239
+ * @note musicUrl and musicLowBandUrl member can not be left blank at the same time.
240
+ * @see WXMediaMessage
241
+ */
242
+ @interface WXMusicObject : NSObject
243
+ /*! @brief Return a WXMusicObject object
244
+ *
245
+ * @note The WXMusicObject object returned is auto-released.
246
+ */
247
+ +(WXMusicObject *) object;
248
+
249
+ /** URL of music data
250
+ * @note contents can not exceed 10K
251
+ */
252
+ @property (nonatomic, retain) NSString *musicUrl;
253
+ /** URL of lowband data of the music
254
+ * @note contents can not exceed 10K
255
+ */
256
+ @property (nonatomic, retain) NSString *musicLowBandUrl;
257
+
258
+ @end
259
+
260
+ /*! @brief Video object included in multi-media messages
261
+ *
262
+ * Video object included in the message transferred between WeChat and the third-party app
263
+ * @note videoUrl and videoLowBandUrl can not be left blank at the same time.
264
+ * @see WXMediaMessage
265
+ */
266
+ @interface WXVideoObject : NSObject
267
+ /*! @brief 返回一个WXVideoObject对象
268
+ *
269
+ * @note 返回的WXVideoObject对象是自动释放的
270
+ */
271
+ +(WXVideoObject *) object;
272
+
273
+ /** URL of video data
274
+ * @note contents can not exceed 10K
275
+ */
276
+ @property (nonatomic, retain) NSString *videoUrl;
277
+ /** URL of video lowband data
278
+ * @note contents can not exceed 10K
279
+ */
280
+ @property (nonatomic, retain) NSString *videoLowBandUrl;
281
+
282
+ @end
283
+
284
+ /*! @brief Webpage object included in multi-media messages
285
+ *
286
+ * Webpage object included in the multi-media message transferred between WeChat and the third-party app
287
+ * @see WXMediaMessage
288
+ */
289
+ @interface WXWebpageObject : NSObject
290
+ /*! @brief Return a WXWebpageObject object
291
+ *
292
+ * @note The WXWebpageObject object returned is auto-released.
293
+ */
294
+ +(WXWebpageObject *) object;
295
+
296
+ /** URL of the webpage
297
+ * @note It can not be left blank and the size can not exceed 10K.
298
+ */
299
+ @property (nonatomic, retain) NSString *webpageUrl;
300
+
301
+ @end
302
+
303
+ /*! @brief App extend object included in multi-media messages
304
+ *
305
+ * The third-party app sends a multi-media message that includes WXAppExtendObject to WeChat.
306
+ * WeChat calls this app to process the multi-media contents.
307
+ * @note url, extInfo and fileData can not be left blank at the same time.
308
+ * @see WXMediaMessage
309
+ */
310
+ @interface WXAppExtendObject : NSObject
311
+ /*! @brief Return a WXAppExtendObject object
312
+ *
313
+ * @note The WXAppExtendObject object returned is auto-released.
314
+ */
315
+ +(WXAppExtendObject *) object;
316
+
317
+ /** If the third-party app does not exist, WeChat will open the download URL of the app.
318
+ * @note contents can not exceed 10K
319
+ */
320
+ @property (nonatomic, retain) NSString *url;
321
+ /** Custom data of the third-party app. WeChat will return it to the app for processing.
322
+ * @note contents can not exceed 2K
323
+ */
324
+ @property (nonatomic, retain) NSString *extInfo;
325
+ /** App file data. When this data is sent to WeChat contacts, the contact need to click to download.
326
+ * WeChat then returns it to the app for processing.
327
+ * @note file size can not exceed 10M.
328
+ */
329
+ @property (nonatomic, retain) NSData *fileData;
330
+
331
+ @end
332
+
333
+
334
+
335
+ /*
336
+ * Attach data while launching app from WeChat
337
+ */
338
+ @interface WXEmoticonObject : NSObject
339
+
340
+ /*
341
+ * WeChat launch app type, see WXAppLaunchType
342
+ */
343
+ +(WXEmoticonObject *) object;
344
+
345
+ /*
346
+ * Message content attached while launching WeChat
347
+ */
348
+ @property (nonatomic, retain) NSData *emoticonData;
349
+
350
+ @end
351
+
352
+
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: motion_wechat
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - simsicon
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-11 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: A rubymotion wrapper for wechat SDK
15
+ email:
16
+ - simsicon@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - Gemfile
23
+ - LICENSE
24
+ - README.md
25
+ - Rakefile
26
+ - lib/motion_wechat.rb
27
+ - lib/motion_wechat/client.rb
28
+ - lib/motion_wechat/config.rb
29
+ - lib/motion_wechat/delegate.rb
30
+ - lib/motion_wechat/interface.rb
31
+ - lib/motion_wechat/version.rb
32
+ - motion_wechat.gemspec
33
+ - vendor/wechat-sdk/WXApi.h
34
+ - vendor/wechat-sdk/WXApiObject.h
35
+ - vendor/wechat-sdk/libWeChatSDK_armv7_armv7s.a
36
+ homepage: ''
37
+ licenses: []
38
+ post_install_message:
39
+ rdoc_options: []
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ segments:
49
+ - 0
50
+ hash: 1516276133035387268
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ segments:
58
+ - 0
59
+ hash: 1516276133035387268
60
+ requirements: []
61
+ rubyforge_project:
62
+ rubygems_version: 1.8.24
63
+ signing_key:
64
+ specification_version: 3
65
+ summary: A rubymotion wrapper for wechat SDK
66
+ test_files: []