//
//  EditRoomsController.swift
//  Home
//
//  Created by Richard Kuckovsky on 24.4.17.
//  Copyright © 2017 Richard Kuckovsky. All rights reserved.
//

import UIKit

class EditRoomsController: UIViewController {

    @IBOutlet weak var txt_room_name: UITextField!
    @IBAction func btn_done_action(_ sender: Any) {
        print("click")
        let myGroup = DispatchGroup()
        myGroup.enter()
        SocketIOManager.sharedInstance.addRoom(room_name: txt_room_name.text!) { (new_room_id) in
            rooms.append(roomsType(id: new_room_id, name: self.txt_room_name.text!))
            myGroup.leave()
        }
        myGroup.notify(queue: .main) {
            self.dismiss(animated: true)
        }
        
    }
    
    @IBAction func btn_cancel_action(_ sender: Any) {
        self.dismiss(animated: true)
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
