This repository has been archived by the owner on Dec 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
EdgySHKConfigurator.m
422 lines (349 loc) · 14.6 KB
/
EdgySHKConfigurator.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
//
// EdgySHKConfigurator.m
// ShareKit
//
// Created by Edward Dale on 10/16/10.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//
#import "EdgySHKConfigurator.h"
@implementation EdgySHKConfigurator
/*
App Description
---------------
These values are used by any service that shows 'shared from XYZ'
*/
- (NSString*)appName {
return @"Edgy Camera";
}
- (NSString*)appURL {
return @"http://edgy.levelview.com";
}
/*
API Keys
--------
This is the longest step to getting set up, it involves filling in API keys for the supported services.
It should be pretty painless though and should hopefully take no more than a few minutes.
Each key below as a link to a page where you can generate an api key. Fill in the key for each service below.
A note on services you don't need:
If, for example, your app only shares URLs then you probably won't need image services like Flickr.
In these cases it is safe to leave an API key blank.
However, it is STRONGLY recommended that you do your best to support all services for the types of sharing you support.
The core principle behind ShareKit is to leave the service choices up to the user. Thus, you should not remove any services,
leaving that decision up to the user.
*/
// Vkontakte
// SHKVkontakteAppID is the Application ID provided by Vkontakte
- (NSString*)vkontakteAppId {
return @"";
}
// Facebook - https://developers.facebook.com/apps
// SHKFacebookAppID is the Application ID provided by Facebook
// SHKFacebookLocalAppID is used if you need to differentiate between several iOS apps running against a single Facebook app. Useful, if you have full and lite versions of the same app,
// and wish sharing from both will appear on facebook as sharing from one main app. You have to add different suffix to each version. Do not forget to fill both suffixes on facebook developer ("URL Scheme Suffix"). Leave it blank unless you are sure of what you are doing.
// The CFBundleURLSchemes in your App-Info.plist should be "fb" + the concatenation of these two IDs.
// Example:
// SHKFacebookAppID = 555
// SHKFacebookLocalAppID = lite
//
// Your CFBundleURLSchemes entry: fb555lite
- (NSString*)facebookAppId {
return @"179677022065671"; // this is the official Edgy app ID. You will need to use your own here.
}
- (NSString*)facebookLocalAppId {
return @"";
}
//Change if your app needs some special Facebook permissions only. In most cases you can leave it as it is.
// new with the 3.1 SDK facebook wants you to request read and publish permissions separatly. If you don't
// you won't get a smooth login/auth flow. Since ShareKit does not require any read permissions.
- (NSArray*)facebookWritePermissions {
return [NSArray arrayWithObjects:@"publish_actions", nil];
}
- (NSArray*)facebookReadPermissions {
return nil; // this is the defaul value for the SDK and will afford basic read permissions
}
/*
If you want to force use of old-style, posting path that does not use the native sheet. One of the troubles
with the native sheet is that it gives IOS6 props on facebook instead of your app. This flag has no effect
on the auth path. It will try to use native auth if availible.
*/
- (NSNumber*)forcePreIOS6FacebookPosting {
return [NSNumber numberWithBool:false];
}
// Read It Later - http://readitlaterlist.com/api/signup/
- (NSString*)readItLaterKey {
return @"";
}
// Diigo - http://www.diigo.com/api_keys/new/
- (NSString*)diigoKey {
return @"";
}
// Twitter - http://dev.twitter.com/apps/new
/*
Important Twitter settings to get right:
Differences between OAuth and xAuth
--
There are two types of authentication provided for Twitter, OAuth and xAuth. OAuth is the default and will
present a web view to log the user in. xAuth presents a native entry form but requires Twitter to add xAuth to your app (you have to request it from them).
If your app has been approved for xAuth, set SHKTwitterUseXAuth to 1.
Callback URL (important to get right for OAuth users)
--
1. Open your application settings at http://dev.twitter.com/apps/
2. 'Application Type' should be set to BROWSER (not client)
3. 'Callback URL' should match whatever you enter in SHKTwitterCallbackUrl. The callback url doesn't have to be an actual existing url. The user will never get to it because ShareKit intercepts it before the user is redirected. It just needs to match.
*/
/*
If you want to force use of old-style, pre-IOS5 twitter framework, for example to ensure
twitter accounts don't end up in the devices account store, set this to true.
*/
- (NSNumber*)forcePreIOS5TwitterAccess {
return [NSNumber numberWithBool:false];
}
- (NSString*)twitterConsumerKey {
return @"";
}
- (NSString*)twitterSecret {
return @"";
}
// You need to set this if using OAuth, see note above (xAuth users can skip it)
- (NSString*)twitterCallbackUrl {
return @"";
}
// To use xAuth, set to 1
- (NSNumber*)twitterUseXAuth {
return [NSNumber numberWithInt:0];
}
// Enter your app's twitter account if you'd like to ask the user to follow it when logging in. (Only for xAuth)
- (NSString*)twitterUsername {
return @"";
}
// Evernote - http://www.evernote.com/about/developer/api/
/* You need to set to sandbox until you get approved by evernote. If you use sandbox, you can use it with special sandbox user account only. You can create it here: https://sandbox.evernote.com/Registration.action
If you already have a consumer-key and secret which have been created with the old username/password authentication system
(created before May 2012) you have to get a new consumer-key and secret, as the old one is not accepted by the new authentication
system.
// Sandbox
#define SHKEvernoteHost @"sandbox.evernote.com"
// Or production
#define SHKEvernoteHost @"www.evernote.com"
*/
- (NSString*)evernoteHost {
return @"";
}
- (NSString*)evernoteConsumerKey {
return @"";
}
- (NSString*)evernoteSecret {
return @"";
}
// Flickr - http://www.flickr.com/services/apps/create/
/*
1 - This requires the CFNetwork.framework
2 - One needs to setup the flickr app as a "web service" on the flickr authentication flow settings, and enter in your app's custom callback URL scheme.
3 - make sure you define and create the same URL scheme in your apps info.plist. It can be as simple as yourapp://flickr */
- (NSString*)flickrConsumerKey {
return @"";
}
- (NSString*)flickrSecretKey {
return @"";
}
// The user defined callback url
- (NSString*)flickrCallbackUrl{
return @"app://flickr";
}
// Bit.ly for shortening URLs in case you use original SHKTwitter sharer (pre iOS5). If you use iOS 5 builtin framework, the URL will be shortened anyway, these settings are not used in this case. http://bit.ly/account/register - after signup: http://bit.ly/a/your_api_key If you do not enter bit.ly credentials, URL will be shared unshortened.
- (NSString*)bitLyLogin {
return @"";
}
- (NSString*)bitLyKey {
return @"";
}
// LinkedIn - https://www.linkedin.com/secure/developer
- (NSString*)linkedInConsumerKey {
return @"";
}
- (NSString*)linkedInSecret {
return @"";
}
- (NSString*)linkedInCallbackUrl {
return @"";
}
// Readability - http://www.readability.com/publishers/api/
- (NSString*)readabilityConsumerKey {
return @"";
}
- (NSString*)readabilitySecret {
return @"";
}
// To use xAuth, set to 1, Currently ONLY supports XAuth
- (NSNumber*)readabilityUseXAuth {
return [NSNumber numberWithInt:1];
}
// Foursquare V2 - https://developer.foursquare.com
- (NSString*)foursquareV2ClientId {
return @"";
}
- (NSString*)foursquareV2RedirectURI {
return @"";
}
/*
UI Configuration : Basic
------------------------
These provide controls for basic UI settings. For more advanced configuration see below.
*/
// Toolbars
- (NSString*)barStyle {
return @"UIBarStyleDefault";// See: http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIKitDataTypesReference/Reference/reference.html#//apple_ref/c/econst/UIBarStyleDefault
}
- (UIColor*)barTintForView:(UIViewController*)vc {
return nil;
}
// Forms
- (UIColor *)formFontColor {
return nil;
}
- (UIColor*)formBackgroundColor {
return nil;
}
// iPad views. You can change presentation style for different sharers
- (NSString *)modalPresentationStyleForController:(UIViewController *)controller {
return @"UIModalPresentationFormSheet";// See: http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle
}
- (NSString*)modalTransitionStyle {
return @"UIModalTransitionStyleCoverVertical";// See: http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle
}
// ShareMenu Ordering
- (NSNumber*)shareMenuAlphabeticalOrder {
return [NSNumber numberWithInt:0];// Setting this to 1 will show list in Alphabetical Order, setting to 0 will follow the order in SHKShares.plist
}
/* Name of the plist file that defines the class names of the sharers to use. Usually should not be changed, but this allows you to subclass a sharer and have the subclass be used. Also helps, if you want to exclude some sharers - you can create your own plist, and add it to your project. This way you do not need to change original SHKSharers.plist, which is a part of subproject - this allows you upgrade easily as you did not change ShareKit itself
You can specify also your own bundle here, if needed. For example:
return [[[NSBundle mainBundle] pathForResource:@"Vito" ofType:@"bundle"] stringByAppendingPathComponent:@"VKRSTestSharers.plist"]
*/
- (NSString*)sharersPlistName {
return @"SHKSharers.plist";
}
// SHKActionSheet settings
- (NSNumber*)showActionSheetMoreButton {
return [NSNumber numberWithBool:true];// Setting this to true will show More... button in SHKActionSheet, setting to false will leave the button out.
}
/*
Favorite Sharers
----------------
These values are used to define the default favorite sharers appearing on ShareKit's action sheet.
*/
- (NSArray*)defaultFavoriteURLSharers {
return [NSArray arrayWithObjects:@"SHKTwitter",@"SHKFacebook", @"SHKReadItLater", nil];
}
- (NSArray*)defaultFavoriteImageSharers {
return [NSArray arrayWithObjects:@"SHKMail",@"SHKFacebook", @"SHKTwitter", nil];
}
- (NSArray*)defaultFavoriteTextSharers {
return [NSArray arrayWithObjects:@"SHKMail",@"SHKTwitter",@"SHKFacebook", nil];
}
- (NSArray*)defaultFavoriteFileSharers {
return [NSArray arrayWithObjects:@"SHKMail",@"SHKEvernote", nil];
}
//by default, user can see last used sharer on top of the SHKActionSheet. You can switch this off here, so that user is always presented the same sharers for each SHKShareType.
- (NSNumber*)autoOrderFavoriteSharers {
return [NSNumber numberWithBool:true];
}
/*
UI Configuration : Advanced
---------------------------
If you'd like to do more advanced customization of the ShareKit UI, like background images and more,
check out http://getsharekit.com/customize. To use a subclass, you can create your own, and let ShareKit know about it in your configurator, overriding one (or more) of these methods.
*/
- (Class)SHKShareMenuSubclass {
return NSClassFromString(@"SHKShareMenu");
}
- (Class)SHKShareMenuCellSubclass {
return NSClassFromString(@"UITableViewCell");
}
- (Class)SHKFormControllerSubclass {
return NSClassFromString(@"SHKFormController");
}
/*
Advanced Configuration
----------------------
These settings can be left as is. This only need to be changed for uber custom installs.
*/
- (NSNumber*)maxFavCount {
return [NSNumber numberWithInt:3];
}
- (NSString*)favsPrefixKey {
return @"SHK_FAVS_";
}
- (NSString*)authPrefix {
return @"SHK_AUTH_";
}
- (NSNumber*)allowOffline {
return [NSNumber numberWithBool:true];
}
- (NSNumber*)allowAutoShare {
return [NSNumber numberWithBool:true];
}
/*
Debugging settings
------------------
see DefaultSHKConfigurator.h
*/
/*
SHKItem sharer specific values defaults
-------------------------------------
These settings can be left as is. SHKItem is what you put your data in and inject to ShareKit to actually share. Some sharers might be instructed to share the item in specific ways, e.g. SHKPrint's print quality, SHKMail's send to specified recipients etc. Sometimes you need to change the default behaviour - you can do it here globally, or per share during share item (SHKItem) composing. Example is in the demo app - ExampleShareLink.m - share method */
/* SHKPrint */
- (NSNumber*)printOutputType {
return [NSNumber numberWithInt:UIPrintInfoOutputPhoto];
}
/* SHKMail */
//You can use this to prefill recipients. User enters them in MFMailComposeViewController by default. Should be array of NSStrings.
- (NSArray *)mailToRecipients {
return nil;
}
- (NSNumber*)isMailHTML {
return [NSNumber numberWithInt:1];
}
//used only if you share image. Values from 1.0 to 0.0 (maximum compression).
- (NSNumber*)mailJPGQuality {
return [NSNumber numberWithFloat:1];
}
// append 'Sent from <appName>' signature to Email
- (NSNumber*)sharedWithSignature {
return [NSNumber numberWithInt:0];
}
/* SHKFacebook */
//when you share URL on Facebook, FBDialog scans the page and fills picture and description automagically by default. Use these item properties to set your own.
- (NSString *)facebookURLSharePictureURI {
return nil;
}
- (NSString *)facebookURLShareDescription {
return nil;
}
/* SHKTextMessage */
//You can use this to prefill recipients. User enters them in MFMessageComposeViewController by default. Should be array of NSStrings.
- (NSArray *)textMessageToRecipients {
return nil;
}
-(NSString*) popOverSourceRect
{
return NSStringFromCGRect(CGRectZero);
}
@end