This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SNFirebase.m | |
// SharedNotes | |
// | |
// Created by Zane Claes on 4/12/14. | |
// Copyright (c) 2014 inZania LLC. All rights reserved. | |
// | |
#import "SNFirebase.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SNFirebase.m | |
// SharedNotes | |
// | |
// Created by Zane Claes on 4/12/14. | |
// Copyright (c) 2014 inZania LLC. All rights reserved. | |
// | |
#import "SNFirebase.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SNFirebase.h | |
// SharedNotes | |
// | |
// Created by Zane Claes on 4/12/14. | |
// Copyright (c) 2014 inZania LLC. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
#import <Firebase/Firebase.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__weak typeof (self) wself = self; | |
[self runRequest:request handler:^(NSError *err) { | |
__strong typeof (wself) sself = wself; | |
__weak typeof(sself) wself2 = sself; | |
[sself runSecondRequest:data handler:^(NSError *err) { | |
__strong typeof (wself2) sself2 = wself2; | |
[sself2 doStuff]; | |
}]; | |
}]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Detect's the user's mobile client | |
// If it is a matched client, creates a referral item in parse and returns a redirect URL for the AppStore | |
// | |
function createReferral($params = array()) { | |
require_once '../cms/Mobile_Detect.php'; | |
$detect = new Mobile_Detect; | |
$ios_url = 'https://itunes.apple.com/us/app/aftermath-pvp-guilds-strategy/id702615597?ls=1&mt=8'; | |
$clients = array('iPhone'=>$ios_url, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Detect's the user's mobile client | |
// If it is a matched client, creates a referral item in parse and returns a redirect URL for the AppStore | |
// | |
function createReferral($params = array()) { | |
require_once '../cms/Mobile_Detect.php'; | |
$detect = new Mobile_Detect; | |
$ios_url = 'https://itunes.apple.com/us/app/aftermath-pvp-guilds-strategy/id702615597?ls=1&mt=8'; | |
$clients = array('iPhone'=>$ios_url, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Detect's the user's mobile client | |
// If it is a matched client, creates a referral item in parse and returns a redirect URL for the AppStore | |
// | |
function createReferral($params = array()) { | |
require_once '../cms/Mobile_Detect.php'; | |
$detect = new Mobile_Detect; | |
$ios_url = 'https://itunes.apple.com/us/app/aftermath-pvp-guilds-strategy/id702615597?ls=1&mt=8'; | |
$clients = array('iPhone'=>$ios_url, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static NSString * const kKeyHasAttributedReferral = @"hasAttributedReferral"; | |
- (void)attributeReferral { | |
if([[NSUserDefaults standardUserDefaults] boolForKey:kKeyHasAttributedReferral]) { | |
return; | |
} | |
// Attribute referrals | |
NSMutableDictionary *params = [NSMutableDictionary dictionary]; | |
params[@"device"] = [[UIDevice currentDevice].model componentsSeparatedByString:@" "].firstObject; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(!isset($_POST['device']) || !isset($_POST['os_version'])) { | |
die('missing params'); | |
} | |
$params = $_POST; | |
$params['ip'] = $_SERVER['REMOTE_ADDR']; | |
// Now we'd query the database for a Referral object match on device, os_version, and ip | |
// We could also restrict our query to recently created Referral objects and/or objects | |
// which have not been "Claimed." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(!isset($_POST['device']) || !isset($_POST['os_version'])) { | |
die('missing params'); | |
} | |
$params = $_POST; | |
$params['ip'] = sha1($_SERVER['REMOTE_ADDR']); | |
// Now we'd query the database for a Referral object match on device, os_version, and ip | |
// We could also restrict our query to recently created Referral objects and/or objects |