Skip to content

Commit

Permalink
Merge pull request #5 from tlax/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
vicegax authored Mar 4, 2017
2 parents ea57a91 + 8e2e3f2 commit 256af56
Show file tree
Hide file tree
Showing 586 changed files with 460,269 additions and 172 deletions.
341 changes: 319 additions & 22 deletions GaussSquad.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions GaussSquad.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

159 changes: 159 additions & 0 deletions GaussSquad/Analytics/AnalyticsManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
import Foundation
import Google
import FirebaseAnalytics

class AnalyticsManager
{
enum FroobAction:String
{
case plusClose = "Plus/Close"
case plusStore = "Plus/Store"
}

enum StoreAction:String
{
case purchase = "Purchase"
case restore = "Restore"
}

enum ShareAction:String
{
case solutionImageComplete = "Solution/Image/Complete"
case solutionImageStep = "Solution/Image/Step"
case solutionTextComplete = "Solution/Text/Complete"
case solutionTextStep = "Solution/Text/Step"
case plot = "Plot"
case app = "App"
}

static let sharedInstance:AnalyticsManager? = AnalyticsManager()
private let kEventShare:String = "Share"
private let kEventFroob:String = "Froob"
private let kEventStore:String = "Store"
private let kEventValue:NSNumber = 1
private let kDispatchInterval:TimeInterval = 30

private init?()
{
var configurationError:NSError?

GGLContext.sharedInstance().configureWithError(&configurationError)

if let configurationError:NSError = configurationError
{
print(configurationError.localizedDescription)

return nil
}
}

//MARK: public

func startAnalytics()
{
guard

let gai:GAI = GAI.sharedInstance()

else
{
return
}

#if DEBUG

gai.dryRun = true

#endif

gai.trackUncaughtExceptions = true
gai.logger.logLevel = GAILogLevel.none
gai.dispatchInterval = kDispatchInterval
}

func trackScreen(screen:UIViewController)
{
DispatchQueue.global(qos:DispatchQoS.QoSClass.background).async
{
guard

let tracker:GAITracker = GAI.sharedInstance().defaultTracker

else
{
return
}

let screenName:String = String(describing:type(of:screen))
tracker.set(kGAIScreenName, value:screenName)
let screenBuild:[NSObject:AnyObject] = GAIDictionaryBuilder.createScreenView().build() as [NSObject:AnyObject]
tracker.send(screenBuild)
}
}

func trackShare(action:ShareAction)
{
DispatchQueue.global(qos:DispatchQoS.QoSClass.background).async
{
guard

let tracker:GAITracker = GAI.sharedInstance().defaultTracker

else
{
return
}

let eventBuild:[NSObject:AnyObject] = GAIDictionaryBuilder.createEvent(
withCategory:self.kEventShare,
action:action.rawValue,
label:nil,
value:self.kEventValue).build() as [NSObject:AnyObject]
tracker.send(eventBuild)
}
}

func trackFroob(action:FroobAction)
{
DispatchQueue.global(qos:DispatchQoS.QoSClass.background).async
{
guard

let tracker:GAITracker = GAI.sharedInstance().defaultTracker

else
{
return
}

let eventBuild:[NSObject:AnyObject] = GAIDictionaryBuilder.createEvent(
withCategory:self.kEventFroob,
action:action.rawValue,
label:nil,
value:self.kEventValue).build() as [NSObject:AnyObject]
tracker.send(eventBuild)
}
}

func trackStore(action:StoreAction, purchase:String?)
{
DispatchQueue.global(qos:DispatchQoS.QoSClass.background).async
{
guard

let tracker:GAITracker = GAI.sharedInstance().defaultTracker

else
{
return
}

let eventBuild:[NSObject:AnyObject] = GAIDictionaryBuilder.createEvent(
withCategory:self.kEventStore,
action:action.rawValue,
label:purchase,
value:self.kEventValue).build() as [NSObject:AnyObject]
tracker.send(eventBuild)
}
}
}
26 changes: 26 additions & 0 deletions GaussSquad/Analytics/GoogleService-Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>TRACKING_ID</key>
<string>UA-72037850-13</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>iturbide.GaussSquad</string>
<key>PROJECT_ID</key>
<string>gausssquad</string>
<key>IS_ADS_ENABLED</key>
<false/>
<key>IS_ANALYTICS_ENABLED</key>
<true/>
<key>IS_APPINVITE_ENABLED</key>
<false/>
<key>IS_GCM_ENABLED</key>
<false/>
<key>IS_SIGNIN_ENABLED</key>
<false/>
<key>GOOGLE_APP_ID</key>
<string>1:966306692171:ios:73b8f0ab078eff11</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "assetGenericBackWhite.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "assetGenericBackWhite@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "assetGenericBackWhite@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "assetGenericImportCalculator.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "assetGenericImportCalculator@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "assetGenericImportCalculator@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "assetGenericScanner.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "assetGenericScanner@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "assetGenericScanner@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "assetGenericShoot.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "assetGenericShoot@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "assetGenericShoot@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "assetGenericThumb.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "assetGenericThumb@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "assetGenericThumb@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "assetGenericThumbSelected.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "assetGenericThumbSelected@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "assetGenericThumbSelected@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "assetGenericTuring.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "assetGenericTuring@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "assetGenericTuring@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "assetGenericUndoWhite.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "assetGenericUndoWhite@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "assetGenericUndoWhite@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 256af56

Please sign in to comment.