-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathHuntlyNavigationController.swift
48 lines (37 loc) · 1.54 KB
/
HuntlyNavigationController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// HuntlyNavigationController.swift
// My_Devoxx
//
// Created by Maxime on 06/04/16.
// Copyright © 2016 maximedavid. All rights reserved.
//
import Foundation
import UIKit
public class HuntlyNavigationController : UINavigationController {
var huntlyLeftButton:UIBarButtonItem?
var huntlyPointLbl:UILabel!
override public func viewDidLoad() {
let huntlyPointView = UIImageView(frame : CGRectMake(0, 0, 30, 30))
huntlyPointView.image = UIImage(named: "DevoxxHuntlyIntegrationIcon")
huntlyPointLbl = UILabel(frame : CGRectMake(0, 0, 30, 30))
huntlyPointLbl.text = HuntlyManagerService.sharedInstance.getHuntlyPoints()
huntlyPointLbl.font = UIFont(name: "Roboto", size: 12)
huntlyPointView.addSubview(huntlyPointLbl)
huntlyPointLbl.textAlignment = .Center
huntlyLeftButton = UIBarButtonItem(customView: huntlyPointView)
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.clickScore))
huntlyPointView.addGestureRecognizer(tapGesture)
}
public override func viewWillAppear(animated: Bool) {
HuntlyManagerService.sharedInstance.feedEventId(updateScore, callbackFailure: updateScore)
}
func updateScore() {
HuntlyManagerService.sharedInstance.updateScore(refreshScore)
}
func refreshScore() {
huntlyPointLbl.text = HuntlyManagerService.sharedInstance.getHuntlyPoints()
}
func clickScore() {
HuntlyManagerService.sharedInstance.goDeepLink()
}
}