         })
     }
 
+
     //MARK: Refresh control
     func addRefreshControl() {
         let refreshControl = UIRefreshControl()

            popRecognizer = InteractivePopGestureRecognizerDelegateHelper(controller: controller, minViewControllers: 2)
            controller.interactivePopGestureRecognizer?.delegate = popRecognizer
        }
    }

    override func viewWillAppear(_ animated: Bool) {
        if ParticleCloud.sharedInstance().isAuthenticated {
            self.loadDevices()
        } else {
            self.showTutorial()
        }

        SEGAnalytics.shared().track("Tinker_DeviceListScreenActivity")
        NotificationCenter.default.addObserver(self, selector: #selector(appDidBecomeActive(_:)), name: NSNotification.Name.UIApplicationDidBecomeActive, object: nil)
    }

    override func viewWillDisappear(_ animated: Bool) {
        NotificationCenter.default.removeObserver(self)
    }




    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        if segue.identifier == "deviceInspector" {
            if let vc = segue.destination as? DeviceInspectorViewController {
                let device = sender as! ParticleDevice
                vc.setup(device: device)

                ParticleLogger.logInfo(NSStringFromClass(type(of: self)), format: "Segue into device inspector - device: %@", withParameters: getVaList(["\(device)"]))
                SEGAnalytics.shared().track("Tinker_SegueToDeviceInspector", properties: ["device": device.type.description])
            }
        }
    }

    func loadDevices()
    {
        ParticleLogger.logInfo(NSStringFromClass(type(of: self)), format: "Load devices started", withParameters: getVaList([]))

        DispatchQueue.global().async {
            ParticleCloud.sharedInstance().getDevices({ (devices:[ParticleDevice]?, error:Error?) -> Void in

                self.handleGetDevicesResponse(devices, error: error)

                DispatchQueue.main.async { [weak self] () -> () in
                    if let self = self {
                        self.resume(animated: true)
                        self.showTutorial()
                    }
                }
            })
        }
    }

    func handleGetDevicesResponse(_ devices:[ParticleDevice]?, error:Error?)

    }

    @objc func refreshData(sender: UIRefreshControl) {
        if (!self.isBusy) {
            self.fadeContent(animated: true, showSpinner: false)
            self.loadDevices()
        }
    }


