Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kstenerud committed Apr 15, 2011
0 parents commit 5cee25f
Show file tree
Hide file tree
Showing 75 changed files with 8,793 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
@@ -0,0 +1,12 @@
*.mode1v3
*.pbxuser
*.perspectivev3
*.xcworkspacedata
*.xcuserstate
*.mergesave
*.bak
.~*
.DS_Store
xcuserdata
Thumbs.db
build
860 changes: 860 additions & 0 deletions Objective-Gems.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

62 changes: 62 additions & 0 deletions Objective-Gems/KSITunesLinks.h
@@ -0,0 +1,62 @@
//
// KSITunesLinks.h
// Objective-Gems
//
// Created by Karl Stenerud on 10-04-09.
//
// Copyright 2010 Karl Stenerud
//
// 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 remain in place
// in this source code.
//
// 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.
//


/**
* Generates links, or opens links to the iTunes store.
*/
@interface KSITunesLinks : NSObject
{
}

/** Get the URL for an application's rating page.
*
* @param appId The application id to get the page for.
* @return The URL of the page.
*/
+ (NSURL*) ratingPageUrlForAppId:(NSString*) appId;

/** Open the URL for an application's rating page.
*
* @param appId The application id to open the page for.
*/
+ (void) openRatingPageForAppId:(NSString*) appId;

/** Get the URL for an application's main page.
*
* @param appId The application id to get the page for.
* @return The URL of the page.
*/
+ (NSURL*) applicationPageUrlForAppId:(NSString*) appId;

/** Open the URL for an application's main page.
*
* @param appId The application id to open the page for.
*/
+ (void) openApplicationPageForAppId:(NSString*) appId;

@end
56 changes: 56 additions & 0 deletions Objective-Gems/KSITunesLinks.m
@@ -0,0 +1,56 @@
//
// KSITunesLinks.m
// Objective-Gems
//
// Created by Karl Stenerud on 10-04-09.
//
// Copyright 2009 Karl Stenerud
//
// 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 remain in place
// in this source code.
//
// 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 "KSITunesLinks.h"
#import <UIKit/UIKit.h>


@implementation KSITunesLinks

+ (NSURL*) ratingPageUrlForAppId:(NSString*) appId
{
NSString* url = [NSString stringWithFormat:@"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%@", appId];
return [NSURL URLWithString:url];
}

+ (void) openRatingPageForAppId:(NSString*) appId
{
[[UIApplication sharedApplication] openURL:[self ratingPageUrlForAppId:appId]];
}

+ (NSURL*) applicationPageUrlForAppId:(NSString*) appId
{
NSString* url = [NSString stringWithFormat:@"http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=%@&mt=8", appId];
return [NSURL URLWithString:url];
}

+ (void) openApplicationPageForAppId:(NSString*) appId
{
[[UIApplication sharedApplication] openURL:[self applicationPageUrlForAppId:appId]];
}

@end
153 changes: 153 additions & 0 deletions Objective-Gems/KSMessageSender.h
@@ -0,0 +1,153 @@
//
// KSMessageSender.h
// Objective-Gems
//
// Created by Karl Stenerud on 10-01-19.
//
// Copyright 2010 Karl Stenerud
//
// 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 remain in place
// in this source code.
//
// 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 <MessageUI/MessageUI.h>
#import "SynthesizeSingleton.h"

// Requires:
// - MessageUI.framework


/**
* Opens the iPhone's built-in mailer to send an email message.
*
* The developer may optionally specify a delegate to inform of the result
* of the mailing operation (successful or not, the user cancelled, etc).
*/
@interface KSMessageSender : NSObject
{
/** TRUE only if the current device has iOS 4.0 or higher. */
bool supportsSms_;

/** List of presenters that are currently active. */
NSMutableArray* presenters_;
}

SYNTHESIZE_SINGLETON_FOR_CLASS_HEADER(KSMessageSender);

/** Returns YES if the operating system supports sending SMS messages
* via MFMessageComposeViewController (iOS 4.0+).
*
* @return YES if the OS supports sending SMS.
*/
@property(readonly) bool supportsSms;

/** Returns YES if the current device is capable of sending text messages.
*
* A device may be unable to send messages if it does not support text messaging
* or if it is not currently configured to send messages.
*/
@property(readonly) bool canSendSMS;

/** Open an SMS send view with the specified information.
* Upon completion, the target will have the specified selector invoked with
* a MessageResult object.
*
* @param recipient The recipient's phone number (can be nil).
* @param message The message body (can be nil).
*/
- (void) sendSMSTo:(NSString*) number
message:(NSString*) message;

/** Open an SMS send view with the specified information.
* Upon completion, the target will have the specified selector invoked.
* The selector must have the format:
* - (void) onSmsSendComplete:(MessageComposeResult) result
*
* @param recipient The recipient's phone number (can be nil).
* @param message The message body (can be nil).
* @param resultTarget The target to inform if the result (can be nil).
* @param selector The selector to invoke on the target (can be nil if target is nil).
*/
- (void) sendSMSTo:(NSString*) number
message:(NSString*) message
resultTarget:(id) target
selector:(SEL) selector;

/** Open an email send view with the specified information.
*
* @param recipient The recipient's email address (can be nil).
* @param subject The subject of the message (can be nil).
* @param message The message body (can be nil).
* @param isHtml If YES, the message body is to be interpreted as HTML.
*/
- (void) sendMailTo:(NSString*) recipient
subject:(NSString*) subject
message:(NSString*) message
isHtml:(bool) isHtml;

/** Open an email send view with the specified information.
* Upon completion, the target will have the specified selector invoked.
* The selector must have the format:
* - (void) onMailSendComplete:(MFMailComposeResult) result error:(NSError*) error
*
* @param recipient The recipient's email address (can be nil).
* @param subject The subject of the message (can be nil).
* @param message The message body (can be nil).
* @param isHtml If YES, the message body is to be interpreted as HTML.
* @param resultTarget The target to inform if the result (can be nil).
* @param selector The selector to invoke on the target (can be nil if target is nil).
*/
- (void) sendMailTo:(NSString*) recipient
subject:(NSString*) subject
message:(NSString*) message
isHtml:(bool) isHtml
resultTarget:(id) target
selector:(SEL) selector;

/** Open an email send view with the specified information.
*
* @param recipients The recipients' email addresses (can be nil).
* @param subject The subject of the message (can be nil).
* @param message The message body (can be nil).
* @param isHtml If YES, the message body is to be interpreted as HTML.
*/
- (void) sendMailToRecipients:(NSArray*) recipients
subject:(NSString*) subject
message:(NSString*) message
isHtml:(bool) isHtml;

/** Open an email send view with the specified information.
* Upon completion, the target will have the specified selector invoked.
* The selector must have the format:
* - (void) onMailSendComplete:(MFMailComposeResult) result error:(NSError*) error
*
* @param recipients The recipients' email addresses (can be nil).
* @param subject The subject of the message (can be nil).
* @param message The message body (can be nil).
* @param isHtml If YES, the message body is to be interpreted as HTML.
* @param resultTarget The target to inform if the result (can be nil).
* @param selector The selector to invoke on the target (can be nil if target is nil).
*/
- (void) sendMailToRecipients:(NSArray*) recipients
subject:(NSString*) subject
message:(NSString*) message
isHtml:(bool) isHtml
resultTarget:(id) target
selector:(SEL) selector;

@end

0 comments on commit 5cee25f

Please sign in to comment.