 class AppDelegate: UIResponder, UIApplicationDelegate {
     
     var window: UIWindow?
-    //    var condic = true
+    var idAnterior: String = ""
     var firstTime = true
     
     func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

        
        
        //        while(self.condic){
        sleep(50)
        
        var request = requestAuth.getRequest("https://api.github.com/notifications", username: "gutti95", pw: "gustgt12")
        

        
        if httpResponse.statusCode == 200 {
            let dataArr = NSJSONSerialization.JSONObjectWithData(urlData!, options: NSJSONReadingOptions.MutableContainers, error: &try) as! Array<NSDictionary>
            
            id = dataArr[0]["updated_at"] as! NSString
            
            if(!self.firstTime){
                self.idAnterior = id as! String
            }
            
            let repo = dataArr[0]["repository"] as! NSDictionary
            let subject = dataArr[0]["subject"] as! NSDictionary
            
            self.firstTime = false
            
            repositorio = repo["name"] as! String
            title = subject["title"] as! String
            
            if(!id.isEqualToString(self.idAnterior)){
                var localNotification = UILocalNotification()
                localNotification.fireDate = NSDate(timeIntervalSinceNow: 5)
                localNotification.alertBody = "Você tem notificações em \(repositorio), com o assunto \(title)"
                localNotification.timeZone = NSTimeZone.defaultTimeZone()
                localNotification.applicationIconBadgeNumber = UIApplication.sharedApplication().applicationIconBadgeNumber + 1
                
                UIApplication.sharedApplication().scheduleLocalNotification(localNotification)
                
            }
        }
        //
        //        }
