Skip to content

Commit dead558

Browse files
committed
- Added French Localization
- Cleaned up Evernote Sharer - Added error handling to Evernote Sharer - Fixed bug where Mail would not dimiss after opening address book - Fixed cancelation notification not sending for Twitter - Updated obj-class import - Fixed logic error missing attachments when body is set - Fixed mail showing empty view when mail is not configured - Cleaned up text message sharer
1 parent 512321f commit dead558

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+53409
-245
lines changed

Classes/ShareKit/Core/Base Sharer Classes/SHKSharer.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ typedef enum
8080
#pragma mark -
8181
#pragma mark Configuration : Service Defination
8282

83-
- (void)shortenURL;
84-
- (void)shortenURLFinished:(SHKRequest *)aRequest;
85-
8683
+ (NSString *)sharerTitle;
8784
- (NSString *)sharerTitle;
8885
+ (NSString *)sharerId;

Classes/ShareKit/Core/Base Sharer Classes/SHKSharer.m

Lines changed: 6 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ + (BOOL)canShareType:(SHKShareType)type
127127
case SHKShareTypeFile:
128128
return [self canShareFile];
129129
break;
130+
131+
default:
132+
return NO;
130133
}
131134
return NO;
132135
}
@@ -254,56 +257,6 @@ + (id)shareFile:(NSData *)file filename:(NSString *)filename mimeType:(NSString
254257
}
255258

256259

257-
#pragma mark -
258-
#pragma mark shorten with bitly
259-
260-
261-
262-
- (void)shortenURL {
263-
if (!quiet)
264-
[[SHKActivityIndicator currentIndicator] displayActivity:SHKLocalizedString(@"Shortening URL...")];
265-
266-
self.request = [[[SHKRequest alloc] initWithURL:[NSURL URLWithString:[NSMutableString stringWithFormat:@"http://api.bit.ly/v3/shorten?login=%@&apikey=%@&longUrl=%@&format=txt",
267-
SHKBitLyLogin,
268-
SHKBitLyKey,
269-
SHKEncodeURL(item.URL)
270-
]]
271-
params:nil
272-
delegate:self
273-
isFinishedSelector:@selector(shortenURLFinished:)
274-
method:@"GET"
275-
autostart:YES] autorelease];
276-
}
277-
278-
279-
- (void)shortenURLFinished:(SHKRequest *)aRequest
280-
{
281-
[[SHKActivityIndicator currentIndicator] hide];
282-
283-
NSString *result = [[aRequest getResult] stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]];
284-
285-
if (result == nil || [NSURL URLWithString:result] == nil)
286-
{
287-
// TODO - better error message
288-
[[[[UIAlertView alloc] initWithTitle:SHKLocalizedString(@"Shorten URL Error")
289-
message:SHKLocalizedString(@"We could not shorten the URL.")
290-
delegate:nil
291-
cancelButtonTitle:SHKLocalizedString(@"Continue")
292-
otherButtonTitles:nil] autorelease] show];
293-
294-
[item setCustomValue:[NSString stringWithFormat:@"%@ %@", item.text ? item.text : item.title, [item.URL.absoluteString stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] forKey:@"status"];
295-
}
296-
297-
else
298-
{
299-
///if already a bitly login, use url instead
300-
if ([result isEqualToString:@"ALREADY_A_BITLY_LINK"])
301-
result = [item.URL.absoluteString stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
302-
else
303-
[item setCustomValue:result forKey:@"shortenURL"];
304-
}
305-
}
306-
307260
#pragma mark -
308261
#pragma mark Commit Share
309262

@@ -705,6 +658,9 @@ - (void)tryPendingAction
705658
case SHKPendingShare:
706659
[self share];
707660
break;
661+
default:
662+
break;
663+
708664
}
709665
}
710666

Classes/ShareKit/Core/Helpers/SHKRequest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
@property (retain) NSDictionary *headers;
6363

6464
@property (retain) NSMutableData *data;
65-
@property (retain, getter=getResult) NSString *result;
65+
@property (nonatomic, retain, getter=getResult) NSString *result;
6666
@property (nonatomic) BOOL success;
6767

6868
- (id)initWithURL:(NSURL *)u params:(NSString *)p delegate:(id)d isFinishedSelector:(SEL)s method:(NSString *)m autostart:(BOOL)autostart;

Classes/ShareKit/Core/SHK.m

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
#import "SHKOfflineSharer.h"
3333
#import "SFHFKeychainUtils.h"
3434
#import "Reachability.h"
35-
#import </usr/include/objc/objc-class.h>
35+
#import <objc/runtime.h>
36+
#import <objc/message.h>
3637
#import <MessageUI/MessageUI.h>
3738

3839

@@ -60,7 +61,11 @@ + (void)initialize
6061

6162
if (!SHKinit)
6263
{
63-
SHKSwizzle([MFMailComposeViewController class], @selector(viewDidDisappear:), @selector(SHKviewDidDisappear:));
64+
SHKSwizzle([MFMailComposeViewController class], @selector(viewDidDisappear:), @selector(SHKviewDidDisappear:));
65+
66+
if (NSClassFromString(@"MFMessageComposeViewController") != nil)
67+
SHKSwizzle([MFMessageComposeViewController class], @selector(viewDidDisappear:), @selector(SHKviewDidDisappear:));
68+
6469
SHKinit = YES;
6570
}
6671
}
@@ -285,12 +290,15 @@ + (NSArray *)favoriteSharersForType:(SHKShareType)type
285290
break;
286291

287292
case SHKShareTypeText:
288-
favoriteSharers = [NSArray arrayWithObjects:@"SHKMail",@"SHKTwitter",@"SHKFacebook", nil];
293+
favoriteSharers = [NSArray arrayWithObjects:@"SHKMail",@"SHKTwitter",@"SHKFacebook",nil];
289294
break;
290295

291296
case SHKShareTypeFile:
292-
favoriteSharers = [NSArray arrayWithObjects:@"SHKMail", nil];
297+
favoriteSharers = [NSArray arrayWithObjects:@"SHKMail",@"SHKEvernote",nil];
293298
break;
299+
300+
default:
301+
favoriteSharers = [NSArray array];
294302
}
295303

296304
// Save defaults to prefs

Classes/ShareKit/Core/SHKSharers.plist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<string>SHKCopy</string>
99
<string>SHKMail</string>
1010
<string>SHKSafari</string>
11+
<string>SHKTextMessage</string>
1112
</array>
1213
<key>services</key>
1314
<array>
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
"Email" = "E-mail";
2+
"Username" = "Nom d'utilisateur";
3+
"Password" = "Mot de passe";
4+
"Follow %@" = "S'abonner à %@";
5+
"Continue" = "Continuer";
6+
"Share" = "Partager";
7+
"More..." = "+";
8+
"Cancel" = "Annuler";
9+
"Slug" = "Description";
10+
"Private" = "Privé";
11+
"Public" = "Public";
12+
"Caption" = "Titre";
13+
"Title" = "Titre";
14+
"Tags" = "Tags";
15+
"Close" = "Fermer";
16+
"Notes" = "Notes";
17+
"Note" = "Note";
18+
"Share" = "Partage";
19+
"Shared" = "Partagé";
20+
"Edit" = "Modifier";
21+
"Actions" = "Actions";
22+
"Services" = "Services";
23+
"Send to %@" = "Envoyer à %@";
24+
"Copy" = "Copier";
25+
"Copied!" = "Copié!";
26+
"Saving to %@" = "Sauvegarde en cours sous %@";
27+
"Saved!" = "Enregistré!";
28+
"Offline" = "Hors ligne";
29+
"Error" = "Erreur";
30+
"Login" = "Connexion";
31+
"Logging In..." = "En cours de connexion...";
32+
"Login Error" = "Erreur de connexion";
33+
"Connecting..." = "En cours de connexion...";
34+
35+
"Shortening URL..." = "URL acourtée...";
36+
"Shorten URL Error" = "Erreur d'URL accourtée";
37+
"We could not shorten the URL." = "L'URL n'a pu être accourtée.";
38+
39+
"Create a free account at %@" = "Créer un compte gratuitement sur %@";
40+
"Create an account at %@" = "Créer un compte sur %@";
41+
42+
"Send to Twitter" = "Envoyer sur Twitter";
43+
44+
"Message is too long" = "Message trop long";
45+
"Twitter posts can only be 140 characters in length." = "Les messages Twitter ne peuvent dépasser 140 caractères.";
46+
"Message is empty" = "Message is empty";
47+
"You must enter a message in order to post." = "Veuillez taper un message afin de l'envoyer.";
48+
49+
"Enter your message:" = "Tapez votre message:";
50+
51+
"Invalid email or password." = "E-mail ou mot de passe incorrect";
52+
"The service encountered an error. Please try again later." = "Ce service n'est pas disponible actuellement. Veuillez réessayer ultérieurement.";
53+
"There was a sending your post to Tumblr." = "Votre message n'a pas pu être envoyer sur Tumblr.";
54+
55+
"There was an error saving to Pinboard" = "Une erreur a empêcher la sauvegarde sur Pinboard";
56+
57+
"Sorry, Instapaper did not accept your credentials. Please try again." = "Désolé, Instapaper n'a pas accepté vos informations de connexion. Veuillez réessayer .";
58+
"Sorry, Instapaper encountered an error. Please try again." = "Désolé, une erreur est survenue sur Instapaper. Veuillez réessayer ultérieurement.";
59+
"There was a problem saving to Instapaper." = "Une erreur a empêcher la sauvegarde sur Instapaper.";
60+
61+
"Incorrect username and password" = "Nom d'utilisateur ou mot de passe incorrect";
62+
"There was an error logging into Google Reader" = "Une erreur est survenue lors de la connexion à votre compte Google Reader";
63+
"There was a problem authenticating your account." = "Votre compte n'a pas pu être identifié.";
64+
"There was a problem saving your note." = "Votre note n'a pas pu être sauvegardée.";
65+
66+
"There was a problem saving to Delicious." = "Une erreur a empêcher la sauvegarde sur Delicious.";
67+
68+
"Open in Safari" = "Ouvrir sous Safari";
69+
"Attached: %@" = "Pièce jointe: %@";
70+
71+
"You must be online to login to %@" = "Vous devez être connecter à internet pour vous connecter sur %@";
72+
73+
"Auto Share" = "Partage Auto";
74+
"Enable auto share to skip this step in the future." = "Habiliter le Partage Auto afin de sauter cette étape la prochaine fois.";
75+
76+
"You must be online in order to share with %@" = "Vous devez être connecter à internet pour partager with %@";
77+
"There was an error while sharing" = "There was an error while sharing";
78+
79+
"Could not authenticate you. Please relogin." = "Votre compte n'a pas pu être identifié.";
80+
"There was a problem requesting authorization from %@" = "Un problème a surgi lors de la demande d'autorisation sur %@";
81+
"Request Error" = "Request Error";
82+
"There was an error while sharing" = "Une erreur est survenue lors du partage";
83+
84+
"Authorize Error" = "Erreur d'autorisation";
85+
"There was an error while authorizing" = "Une erreur est survenue lors de l'autorisation.";
86+
87+
"Authenticating..." = "Authenticating...";
88+
"There was a problem requesting access from %@" = "Une erreur est survenue lors de la demande d'accès sur %@";
89+
90+
"Access Error" = "Erreur d'accès";
91+
"There was an error while sharing" = "Une erreur est survenue lors du partage";
92+
93+
"Sharing a Link" = "Partager un lien";
94+
"Sharing an Image" = "Partager une image";
95+
"Sharing Text" = "Partager un texte";
96+
"Sharing a File" = "Partager un fichier";
97+
"Logout of All Services" = "Déconnexion de tous les services";

Classes/ShareKit/Sharers/Actions/Copy/SHKCopy.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,4 @@
3333

3434
}
3535

36-
- (void)copyToPasteboard:(NSString *)urlStr;
37-
3836
@end

Classes/ShareKit/Sharers/Actions/Copy/SHKCopy.m

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -71,35 +71,22 @@ - (BOOL)shouldAutoShare
7171
#pragma mark -
7272
#pragma mark Share API Methods
7373

74-
- (BOOL)send {
74+
- (BOOL)send
75+
{
76+
if (item.shareType == SHKShareTypeURL)
77+
[[UIPasteboard generalPasteboard] setString:item.URL.absoluteString];
7578

76-
if (item.shareType == SHKShareTypeURL) {
77-
if(kSHKCopyShouldShortenURLs)
78-
[self shortenURL];
79-
else
80-
[self copyToPasteboard:item.URL.absoluteString];
81-
}
82-
else {
79+
else
8380
[[UIPasteboard generalPasteboard] setImage:item.image];
84-
[[SHKActivityIndicator currentIndicator] displayCompleted:SHKLocalizedString(@"Copied!")];
85-
}
86-
return YES;
87-
}
88-
89-
- (void)shortenURLFinished:(SHKRequest *)aRequest {
90-
[super shortenURLFinished:aRequest];
9181

92-
NSString *urlStr = [item customValueForKey:@"shortenURL"];
93-
if(urlStr==nil||urlStr.length==0)
94-
urlStr = item.URL.absoluteString;
95-
[self copyToPasteboard:urlStr];
96-
}
97-
98-
- (void)copyToPasteboard:(NSString *)urlStr {
99-
[[UIPasteboard generalPasteboard] setString:urlStr];
82+
// Notify user
10083
[[SHKActivityIndicator currentIndicator] displayCompleted:SHKLocalizedString(@"Copied!")];
84+
85+
// Notify delegate, but quietly
86+
self.quiet = YES;
87+
[self sendDidFinish];
88+
89+
return YES;
10190
}
10291

103-
104-
10592
@end

0 commit comments

Comments
 (0)