Skip to content

Commit 287a3e4

Browse files
committed
Remove register button
1 parent 9354417 commit 287a3e4

File tree

2 files changed

+8
-44
lines changed

2 files changed

+8
-44
lines changed

VPN.HT/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</dict>
2929
</array>
3030
<key>CFBundleVersion</key>
31-
<string>6</string>
31+
<string>7</string>
3232
<key>LSRequiresIPhoneOS</key>
3333
<true/>
3434
<key>NSAppTransportSecurity</key>

VPN.HT/LoginViewController.swift

+7-43
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ class LoginViewController: UIViewController, UITextFieldDelegate {
1616
var username = UITextField()
1717
var password = UITextField()
1818
var login = UIButton()
19-
var register = UIButton()
20-
19+
2120
var backgroundBlurView = UIView()
2221
var loadingView = UIActivityIndicatorView()
2322

@@ -68,14 +67,7 @@ class LoginViewController: UIViewController, UITextFieldDelegate {
6867
login.addTarget(self, action: "login:", forControlEvents: UIControlEvents.TouchUpInside)
6968
login.tintColor = StaticVar.greenBackgroundColor
7069
login.backgroundColor = StaticVar.greenBackgroundColor
71-
72-
register.frame = CGRectMake(25, self.login.frame.maxY + 20, self.view.frame.width - 50, 50)
73-
register.setTitle("REGISTER", forState: UIControlState.Normal)
74-
register.titleLabel?.font = UIFont(name: "Roboto-Medium", size: 20)!
75-
register.addTarget(self, action: "register:", forControlEvents: UIControlEvents.TouchUpInside)
76-
register.tintColor = UIColor.lightGrayColor()
77-
register.backgroundColor = UIColor.lightGrayColor()
78-
70+
7971
backgroundBlurView.frame = login.frame
8072
backgroundBlurView.alpha = 0
8173
backgroundBlurView.backgroundColor = UIColor(red: 230/255, green: 230/255, blue: 230/255, alpha: 0.5)
@@ -86,14 +78,13 @@ class LoginViewController: UIViewController, UITextFieldDelegate {
8678
loadingView.alpha = 0
8779
loadingView.startAnimating()
8880

89-
let offset = (self.view.frame.height/2)-(self.register.frame.maxY/2)
90-
loginView.frame = CGRect(x: 0, y: offset, width: self.view.frame.width, height: self.register.frame.maxY)
81+
let offset = (self.view.frame.height/2)-((self.login.frame.maxY + 20)/2)
82+
loginView.frame = CGRect(x: 0, y: offset, width: self.view.frame.width, height: self.login.frame.maxY + 20)
9183

9284
self.loginView.addSubview(logo)
9385
self.loginView.addSubview(username)
9486
self.loginView.addSubview(password)
9587
self.loginView.addSubview(login)
96-
self.loginView.addSubview(register)
9788
self.loginView.addSubview(backgroundBlurView)
9889
self.loginView.addSubview(loadingView)
9990

@@ -124,13 +115,6 @@ class LoginViewController: UIViewController, UITextFieldDelegate {
124115
}
125116
}
126117

127-
func register(sender: UIButton) {
128-
let registerWebView = registerWebViewController()
129-
registerWebView.navigationController?.navigationBar.barTintColor = StaticVar.darkBackgroundColor
130-
let registerView = UINavigationController(rootViewController: registerWebView)
131-
self.presentViewController(registerView, animated: true, completion: nil)
132-
}
133-
134118
func checkLogin() {
135119
let session = NSURLSession.sharedSession()
136120
let username = self.username.text!
@@ -273,16 +257,16 @@ class LoginViewController: UIViewController, UITextFieldDelegate {
273257
let keyboardFrame: CGRect = (info[UIKeyboardFrameEndUserInfoKey] as! NSValue).CGRectValue()
274258

275259
UIView.animateWithDuration(0.1, animations: { () -> Void in
276-
self.loginView.frame = CGRect(x: 0, y: keyboardFrame.minY - self.register.frame.maxY - 5, width: self.view.frame.width, height: self.register.frame.maxY)
260+
self.loginView.frame = CGRect(x: 0, y: keyboardFrame.minY - (self.login.frame.maxY + 20) - 5, width: self.view.frame.width, height: self.login.frame.maxY + 20)
277261
})
278262
}
279263

280264
func keyboardWillHide(notification: NSNotification) {
281265
print("Hide Keyboard")
282266

283267
UIView.animateWithDuration(0.1, animations: { () -> Void in
284-
let offset = (self.view.frame.height/2)-(self.register.frame.maxY/2)
285-
self.loginView.frame = CGRect(x: 0, y: offset, width: self.view.frame.width, height: self.register.frame.maxY)
268+
let offset = (self.view.frame.height/2)-((self.login.frame.maxY + 20)/2)
269+
self.loginView.frame = CGRect(x: 0, y: offset, width: self.view.frame.width, height: (self.login.frame.maxY + 20))
286270
})
287271
}
288272

@@ -299,23 +283,3 @@ class LoginViewController: UIViewController, UITextFieldDelegate {
299283
return false
300284
}
301285
}
302-
303-
class registerWebViewController: UIViewController {
304-
305-
override func viewDidLoad() {
306-
self.navigationController?.navigationBar.barTintColor = StaticVar.darkBackgroundColor
307-
let doneButton = UIBarButtonItem(title: "Close", style: UIBarButtonItemStyle.Plain, target: self, action: "hideRegisterWebView:")
308-
doneButton.tintColor = StaticVar.lightBackgroundColor
309-
self.navigationItem.setRightBarButtonItem(doneButton, animated: false)
310-
self.navigationController?.navigationBar.barTintColor = StaticVar.darkBackgroundColor
311-
self.view.backgroundColor = StaticVar.darkBackgroundColor
312-
313-
let webView = SMWebView.loadURL(NSURL(string: "https://vpn.ht/buy-vpn?_ref=ios")!)
314-
webView.frame = UIScreen.mainScreen().bounds
315-
self.view.addSubview(webView)
316-
}
317-
318-
func hideRegisterWebView(sender: UIBarButtonItem) {
319-
self.dismissViewControllerAnimated(true, completion: nil)
320-
}
321-
}

0 commit comments

Comments
 (0)