These are chat archives for correa-brian/milkshake

6th
Jul 2016
Katrina
@katrinar
Jul 06 2016 17:32
 func mapView(mapView: MKMapView, annotationView view: MKAnnotationView, calloutAccessoryControlTapped control: UIControl) {
        self.selectedPlace = view.annotation as? CTPlace

        // user previously entered, do not enforce password again:
        if (self.selectedPlace?.visited == true){
            self.enterSelectedPlace()
            return
        }

        // user has to enter password
        if (CTViewController.currentUser.id == nil){
            self.showDarkOverlay()
            return
        }

            //user is an admin of place, do not need password

        let isAdmin = self.selectedPlace?.admins.contains(CTViewController.currentUser.id!)


        if (isAdmin == false){ //user has to enter password
            self.showDarkOverlay()
            return
        }

        // user is an admin of place, do not need password:
        let chatVc = CTChatViewController()
        chatVc.place = self.selectedPlace
        self.navigationController?.pushViewController(chatVc, animated: true)

    }