Skip to content

Commit

Permalink
Merge pull request #87 from SurveyMonkey/2.0.7
Browse files Browse the repository at this point in the history
2.0.7
  • Loading branch information
johnb-surveymonkey authored Oct 6, 2020
2 parents 6289d78 + a17e33c commit 883465b
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 35 deletions.
51 changes: 30 additions & 21 deletions SimpleSurvey/Simple Survey/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//Set to Angry Birds 2 -- change to your app
#define APP_ID @"880047117"

@interface ViewController () <SMFeedbackDelegate, UIAlertViewDelegate>
@interface ViewController () <SMFeedbackDelegate>
@property (nonatomic, strong) SMFeedbackViewController * feedbackController;
@property (weak, nonatomic) IBOutlet UIButton *takeSurveyButton;
@property (weak, nonatomic) IBOutlet UILabel *statusLabel;
Expand Down Expand Up @@ -74,29 +74,38 @@ - (void)respondentDidEndSurvey:(SMRespondent *)respondent error:(NSError *) erro

}

#pragma mark - UIAlertViewDelegate
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0)
{
}
else if(buttonIndex == 1)
{
NSString *appStoreURL = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/id%@?mt=8", APP_ID];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:appStoreURL]];
}
}

- (void) showAlertWithBody:(NSString *)body hasRateButton:(BOOL)hasRateButton {
UIAlertView * alert =[[UIAlertView alloc ] initWithTitle:NSLocalizedString(@"Thanks for your feedback!", @"Heading for feedback prompt")
message:body
delegate:self
cancelButtonTitle: NSLocalizedString(@"Cancel", @"Title of cancel button on app store rating prompt")
otherButtonTitles: nil];

UIAlertController * alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Thanks for your feedback!", @"Heading for feedback prompt")
message:body
preferredStyle:UIAlertControllerStyleAlert];

UIAlertAction* cancel = [UIAlertAction
actionWithTitle:NSLocalizedString(@"Cancel", @"Title of cancel button on app store rating prompt")
style:UIAlertActionStyleCancel
handler:^(UIAlertAction * action)
{
// Respond to cancel button press.
}];

UIAlertAction* rate = [UIAlertAction
actionWithTitle:NSLocalizedString(@"Rate Us", @"Title of rate us button on app store rating prompt")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
// Respond to rate button press.
// (Note: This url will not open on a simulator. It must be run on a physical device.)
NSString *appStoreURL = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/apple-store/id%@", APP_ID];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:appStoreURL] options:@{} completionHandler:nil];
}];

[alertController addAction: cancel];

if (hasRateButton) {
[alert addButtonWithTitle:NSLocalizedString(@"Rate Us", @"Title of rate us button on app store rating prompt")];
[alertController addAction: rate];
}
[alert show];

[self presentViewController:alertController animated:YES completion:nil];
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#import <UIKit/UIKit.h>
#import <WebKit/WebKit.h>
#import "SMRespondent.h"
#define GIVE_FEEDBACK NSLocalizedString(@"Give Feedback", @"Title for primary action button for intercept UIAlertView")
#define NOT_NOW NSLocalizedString(@"Not Now", @"Title for negative action button for intercept UIAlertView")
#define DEFAULT_ALERT_TITLE NSLocalizedString(@"Enjoying the %@ app?", @"Title for intercept UIAlertView")
#define DEFAULT_ALERT_BODY NSLocalizedString(@"Take our quick feedback survey and let us know how we're doing.", @"Body for intercept UIAlertView")
#define GIVE_FEEDBACK NSLocalizedString(@"Give Feedback", @"Title for primary action button for intercept UIAlertController")
#define NOT_NOW NSLocalizedString(@"Not Now", @"Title for negative action button for intercept UIAlertController")
#define DEFAULT_ALERT_TITLE NSLocalizedString(@"Enjoying the %@ app?", @"Title for intercept UIAlertController")
#define DEFAULT_ALERT_BODY NSLocalizedString(@"Take our quick feedback survey and let us know how we're doing.", @"Body for intercept UIAlertController")

/**
* The FeedbackDelegate protocol defines the methods a delegate of a SMFeedbackViewController object should implement.
Expand Down Expand Up @@ -97,24 +97,24 @@
@property (nonatomic, strong) UIColor * cancelButtonTintColor;

/**
* Display the intercept UIAlertView to the user - asking them to give feedback on your app.
* By default, the UIAlertView prompt will display 3 days after app install. If the user declines to take the survey, they will be prompted again in 3 weeks.
* Display the intercept UIAlertController to the user - asking them to give feedback on your app.
* By default, the UIAlertController prompt will display 3 days after app install. If the user declines to take the survey, they will be prompted again in 3 weeks.
* If the user consents to take the survey, they'll be prompted again in 3 months.
*
* @param viewController The view controller from which to launch the SMFeedbackViewController
* @param appTitle The title of your app -- used in the title of the UIAlertView (e.g. Are you enjoying the [App Title] app?)
* @param appTitle The title of your app -- used in the title of the UIAlertController (e.g. Are you enjoying the [App Title] app?)
*/
-(void)scheduleInterceptFromViewController:(UIViewController *)viewController withAppTitle:(NSString *)appTitle;

/**
* Display the intercept UIAlertView to the user - asking them to give feedback on your app.
* Supply an alert title and body for the UIAlertView prompt, as well as time intervals (in seconds) to wait before displaying the prompt (i.e. after app install, after consents to take the survey, and after the user declines to take the survey)
* Display the intercept UIAlertController to the user - asking them to give feedback on your app.
* Supply an alert title and body for the UIAlertController prompt, as well as time intervals (in seconds) to wait before displaying the prompt (i.e. after app install, after consents to take the survey, and after the user declines to take the survey)
*
* @param viewController The view controller from which to launch the SMFeedbackViewController
* @param alertTitle The title of the UIAlertView prompt
* @param alertBody The body of the UIAlertView prompt
* @param positiveActionTitle The title of the positive action button on the UIAlertView prompt
* @param cancelTitle The title of the cancel button on the UIAlertView prompt
* @param alertTitle The title of the UIAlertController prompt
* @param alertBody The body of the UIAlertController prompt
* @param positiveActionTitle The title of the positive action button on the UIAlertController prompt
* @param cancelTitle The title of the cancel button on the UIAlertController prompt
* @param afterInstallInterval The amount of time (in seconds) to delay before first prompting the user to give feedback after they install your app.
* @param afterAcceptInterval The amount of time (in seconds) to wait before prompting the user to give feedback again after they consent to take your survey.
* @param afterDeclineInterval The amount of time (in seconds) to wait before prompting the user to give feedback again after they decline to take your survey.
Expand Down
Binary file modified SurveyMonkeyiOSSDK.framework/Versions/A/SurveyMonkeyiOSSDK
Binary file not shown.
2 changes: 1 addition & 1 deletion surveymonkey-ios-sdk.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "surveymonkey-ios-sdk"
s.version = "2.0.6"
s.version = "2.0.7"
s.summary = "The SurveyMonkey Mobile Feedback SDK for iOS"
s.homepage = "https://github.com/SurveyMonkey/surveymonkey-ios-sdk"
s.license = 'MIT'
Expand Down

0 comments on commit 883465b

Please sign in to comment.