Skip to content

Commit

Permalink
Merge pull request #993 from mixpanel/jared-remove-survey
Browse files Browse the repository at this point in the history
remove survey
  • Loading branch information
jaredmixpanel authored May 20, 2022
2 parents fc15ffa + aae6022 commit 282be41
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
18 changes: 0 additions & 18 deletions Sources/Mixpanel.m
Original file line number Diff line number Diff line change
Expand Up @@ -208,30 +208,12 @@ - (void)didDebugInit:(NSString *)distinctId
if (distinctId.length == 32) {
NSInteger debugInitCount = [[NSUserDefaults standardUserDefaults] integerForKey:MPDebugInitCountKey] + 1;
[self sendHttpEvent:@"SDK Debug Launch" apiToken:@"metrics-1" distinctId:distinctId properties:@{@"Debug Launch Count": @(debugInitCount)}];
[self checkForSurvey:distinctId debugInitCount: debugInitCount];
[self checkIfImplemented:distinctId debugInitCount: debugInitCount];
[[NSUserDefaults standardUserDefaults] setInteger:debugInitCount forKey:MPDebugInitCountKey];
[[NSUserDefaults standardUserDefaults] synchronize];
}
}

- (void)checkForSurvey:(NSString *)distinctId
debugInitCount:(NSInteger)debugInitCount
{
NSDate *surveyShownDate = [[NSUserDefaults standardUserDefaults] objectForKey:MPSurveyShownDateKey];
if (!surveyShownDate || [surveyShownDate timeIntervalSinceNow] < -86400) { // only show once per day
NSString *waveHand = @"\U0001f44b";
NSString *thumbsUp = @"\U0001f44d";
NSString *thumbsDown = @"\U0001f44e";
NSString *logString = [NSString stringWithFormat:@"%@%@ Zihe & Jared here, tell us about the Mixpanel developer experience! https://www.mixpanel.com/devnps %@%@", waveHand, waveHand, thumbsUp, thumbsDown];
NSLog(@"%@", logString);
[[NSUserDefaults standardUserDefaults] setObject:[NSDate date] forKey:MPSurveyShownDateKey];
NSInteger surveyShownCount = [[NSUserDefaults standardUserDefaults] integerForKey:MPSurveyShownCountKey] + 1;
[[NSUserDefaults standardUserDefaults] setInteger:surveyShownCount forKey:MPSurveyShownCountKey];
[self sendHttpEvent:@"Dev NPS Survey Logged" apiToken:@"metrics-1" distinctId:distinctId properties:@{@"Survey Shown Count": @(surveyShownCount), @"Debug Launch Count": @(debugInitCount)}];
}
}

- (void)checkIfImplemented:(NSString *)distinctId
debugInitCount:(NSInteger)debugInitCount
{
Expand Down
2 changes: 0 additions & 2 deletions Sources/MixpanelPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,10 @@ static BOOL IdentifiedFlag = NO;
// Internal Standard UserDefaults Keys
static NSString *const MPDebugTrackedKey = @"MPDebugTrackedKey";
static NSString *const MPDebugInitCountKey = @"MPDebugInitCountKey";
static NSString *const MPSurveyShownDateKey = @"MPSurveyShownDateKey";
static NSString *const MPDebugImplementedKey = @"MPDebugImplementedKey";
static NSString *const MPDebugIdentifiedKey = @"MPDebugIdentifiedKey";
static NSString *const MPDebugAliasedKey = @"MPDebugAliasedKey";
static NSString *const MPDebugUsedPeopleKey = @"MPDebugUsedPeopleKey";
static NSString *const MPSurveyShownCountKey = @"MPSurveyShownCountKey";

#if defined(MIXPANEL_NO_AUTOMATIC_EVENTS_SUPPORT)
@interface Mixpanel ()
Expand Down

0 comments on commit 282be41

Please sign in to comment.