Commit e855d42c by Olzhas Aldabergenov

login vip_gamer fixed. Settings password fixed

parent bb24a1a8
...@@ -89,6 +89,7 @@ ...@@ -89,6 +89,7 @@
3E2C3E9B1EFCB17E00E553CD /* Validator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E2C3E9A1EFCB17E00E553CD /* Validator.swift */; }; 3E2C3E9B1EFCB17E00E553CD /* Validator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E2C3E9A1EFCB17E00E553CD /* Validator.swift */; };
3E2E1E821F84DB0100DC0FE5 /* LKSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E2E1E811F84DB0100DC0FE5 /* LKSettingsViewController.swift */; }; 3E2E1E821F84DB0100DC0FE5 /* LKSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E2E1E811F84DB0100DC0FE5 /* LKSettingsViewController.swift */; };
3E323D501FBEF916009C3DA8 /* FeedFeedbackCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E323D4F1FBEF916009C3DA8 /* FeedFeedbackCell.swift */; }; 3E323D501FBEF916009C3DA8 /* FeedFeedbackCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E323D4F1FBEF916009C3DA8 /* FeedFeedbackCell.swift */; };
3E3BCC9C1FCEB692008613E2 /* Facade+NewLogin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E3BCC9B1FCEB692008613E2 /* Facade+NewLogin.swift */; };
3E5CC7A51FA83F7400B55DF0 /* BotManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E5CC7A41FA83F7400B55DF0 /* BotManager.swift */; }; 3E5CC7A51FA83F7400B55DF0 /* BotManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E5CC7A41FA83F7400B55DF0 /* BotManager.swift */; };
3E5CC7AE1FA84F9F00B55DF0 /* DateUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E5CC7AD1FA84F9F00B55DF0 /* DateUtil.swift */; }; 3E5CC7AE1FA84F9F00B55DF0 /* DateUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E5CC7AD1FA84F9F00B55DF0 /* DateUtil.swift */; };
3E6969B31FA2097200032D95 /* ServiceDetailsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E6969B21FA2097200032D95 /* ServiceDetailsViewController.swift */; }; 3E6969B31FA2097200032D95 /* ServiceDetailsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E6969B21FA2097200032D95 /* ServiceDetailsViewController.swift */; };
...@@ -644,6 +645,7 @@ ...@@ -644,6 +645,7 @@
3E2C3E9A1EFCB17E00E553CD /* Validator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Validator.swift; sourceTree = "<group>"; }; 3E2C3E9A1EFCB17E00E553CD /* Validator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Validator.swift; sourceTree = "<group>"; };
3E2E1E811F84DB0100DC0FE5 /* LKSettingsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LKSettingsViewController.swift; sourceTree = "<group>"; }; 3E2E1E811F84DB0100DC0FE5 /* LKSettingsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LKSettingsViewController.swift; sourceTree = "<group>"; };
3E323D4F1FBEF916009C3DA8 /* FeedFeedbackCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FeedFeedbackCell.swift; sourceTree = "<group>"; }; 3E323D4F1FBEF916009C3DA8 /* FeedFeedbackCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FeedFeedbackCell.swift; sourceTree = "<group>"; };
3E3BCC9B1FCEB692008613E2 /* Facade+NewLogin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Facade+NewLogin.swift"; sourceTree = "<group>"; };
3E5CC7A41FA83F7400B55DF0 /* BotManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BotManager.swift; sourceTree = "<group>"; }; 3E5CC7A41FA83F7400B55DF0 /* BotManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BotManager.swift; sourceTree = "<group>"; };
3E5CC7AD1FA84F9F00B55DF0 /* DateUtil.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DateUtil.swift; sourceTree = "<group>"; }; 3E5CC7AD1FA84F9F00B55DF0 /* DateUtil.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DateUtil.swift; sourceTree = "<group>"; };
3E6969B21FA2097200032D95 /* ServiceDetailsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServiceDetailsViewController.swift; sourceTree = "<group>"; }; 3E6969B21FA2097200032D95 /* ServiceDetailsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServiceDetailsViewController.swift; sourceTree = "<group>"; };
...@@ -1115,6 +1117,7 @@ ...@@ -1115,6 +1117,7 @@
988728DE1DDCD9E900CEEBAA /* Facade+Siebel.swift */, 988728DE1DDCD9E900CEEBAA /* Facade+Siebel.swift */,
3EB108501F15E321000EAE88 /* Facade+Bot.swift */, 3EB108501F15E321000EAE88 /* Facade+Bot.swift */,
3EAFC4831F6F804D00BB07AD /* Facade+Knowedge.swift */, 3EAFC4831F6F804D00BB07AD /* Facade+Knowedge.swift */,
3E3BCC9B1FCEB692008613E2 /* Facade+NewLogin.swift */,
); );
path = Facade; path = Facade;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2920,6 +2923,7 @@ ...@@ -2920,6 +2923,7 @@
B212590DBF21D2F2C3CDF95C /* SwiftyJSON.swift in Sources */, B212590DBF21D2F2C3CDF95C /* SwiftyJSON.swift in Sources */,
986917581DE3816200FC712D /* FullDamageModalTableCell.swift in Sources */, 986917581DE3816200FC712D /* FullDamageModalTableCell.swift in Sources */,
98A335611CFB172F00F1A76C /* GetProvidersRequest.swift in Sources */, 98A335611CFB172F00F1A76C /* GetProvidersRequest.swift in Sources */,
3E3BCC9C1FCEB692008613E2 /* Facade+NewLogin.swift in Sources */,
983343FD1C71C6440008D9CA /* BlankDetailViewController.swift in Sources */, 983343FD1C71C6440008D9CA /* BlankDetailViewController.swift in Sources */,
98E3F8701CFA21B700112FB7 /* Download.swift in Sources */, 98E3F8701CFA21B700112FB7 /* Download.swift in Sources */,
987457B61CFDFA1100BB32C6 /* OffersSelectListViewController.swift in Sources */, 987457B61CFDFA1100BB32C6 /* OffersSelectListViewController.swift in Sources */,
......
...@@ -58,11 +58,11 @@ ...@@ -58,11 +58,11 @@
ignoreCount = "0" ignoreCount = "0"
continueAfterRunningActions = "No" continueAfterRunningActions = "No"
filePath = "kt/ViewControllers/Cabinet/Login/LoginViewController.swift" filePath = "kt/ViewControllers/Cabinet/Login/LoginViewController.swift"
timestampString = "532607789.350001" timestampString = "533643136.585398"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "596" startingLineNumber = "605"
endingLineNumber = "596" endingLineNumber = "605"
landmarkName = "applicationWillResignActive()" landmarkName = "applicationWillResignActive()"
landmarkType = "7"> landmarkType = "7">
</BreakpointContent> </BreakpointContent>
...@@ -74,11 +74,11 @@ ...@@ -74,11 +74,11 @@
ignoreCount = "0" ignoreCount = "0"
continueAfterRunningActions = "No" continueAfterRunningActions = "No"
filePath = "kt/ViewControllers/Cabinet/Login/LoginViewController.swift" filePath = "kt/ViewControllers/Cabinet/Login/LoginViewController.swift"
timestampString = "532607789.350001" timestampString = "533643136.585398"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "596" startingLineNumber = "605"
endingLineNumber = "596" endingLineNumber = "605"
landmarkName = "applicationWillResignActive()" landmarkName = "applicationWillResignActive()"
landmarkType = "7"> landmarkType = "7">
</BreakpointContent> </BreakpointContent>
...@@ -90,11 +90,11 @@ ...@@ -90,11 +90,11 @@
ignoreCount = "0" ignoreCount = "0"
continueAfterRunningActions = "No" continueAfterRunningActions = "No"
filePath = "kt/ViewControllers/Cabinet/Login/LoginViewController.swift" filePath = "kt/ViewControllers/Cabinet/Login/LoginViewController.swift"
timestampString = "532607789.350001" timestampString = "533643136.585398"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "566" startingLineNumber = "575"
endingLineNumber = "566" endingLineNumber = "575"
landmarkName = "showHelpAlert()" landmarkName = "showHelpAlert()"
landmarkType = "7"> landmarkType = "7">
</BreakpointContent> </BreakpointContent>
...@@ -106,11 +106,11 @@ ...@@ -106,11 +106,11 @@
ignoreCount = "0" ignoreCount = "0"
continueAfterRunningActions = "No" continueAfterRunningActions = "No"
filePath = "kt/ViewControllers/Cabinet/Login/LoginViewController.swift" filePath = "kt/ViewControllers/Cabinet/Login/LoginViewController.swift"
timestampString = "532607789.350001" timestampString = "533643136.585398"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "571" startingLineNumber = "580"
endingLineNumber = "571" endingLineNumber = "580"
landmarkName = "showHelpAlert()" landmarkName = "showHelpAlert()"
landmarkType = "7"> landmarkType = "7">
</BreakpointContent> </BreakpointContent>
...@@ -179,5 +179,197 @@ ...@@ -179,5 +179,197 @@
landmarkType = "7"> landmarkType = "7">
</BreakpointContent> </BreakpointContent>
</BreakpointProxy> </BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kt/Facade/Facade+Login.swift"
timestampString = "533638224.276248"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "74"
endingLineNumber = "74"
landmarkName = "connection(connection:didReceiveData:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kt/Facade/Facade+NewLogin.swift"
timestampString = "533717289.948236"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "142"
endingLineNumber = "142"
landmarkName = "connection(connection:didReceiveData:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kt/Facade/Facade+NewLogin.swift"
timestampString = "533711902.853936"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "40"
endingLineNumber = "40"
landmarkName = "connection(connection:didReceiveResponse:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kt/Facade/Facade+NewLogin.swift"
timestampString = "533713289.888934"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "60"
endingLineNumber = "60"
landmarkName = "connection(connection:didReceiveResponse:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kt/Facade/Facade+NewLogin.swift"
timestampString = "533714725.253721"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "66"
endingLineNumber = "66"
landmarkName = "connection(connection:didReceiveResponse:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kt/Facade/Facade+NewLogin.swift"
timestampString = "533717289.948236"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "111"
endingLineNumber = "111"
landmarkName = "connection(connection:didReceiveData:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kt/Facade/Facade+NewLogin.swift"
timestampString = "533717289.948236"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "171"
endingLineNumber = "171"
landmarkName = "connection(connection:didReceiveData:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kt/Facade/Facade+NewLogin.swift"
timestampString = "533717289.948236"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "73"
endingLineNumber = "73"
landmarkName = "connection(connection:didReceiveData:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kt/Facade/Facade+NewLogin.swift"
timestampString = "533718542.915068"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "159"
endingLineNumber = "159"
landmarkName = "connection(connection:didReceiveData:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kt/Facade/Facade+NewLogin.swift"
timestampString = "533723569.307867"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "222"
endingLineNumber = "222"
landmarkName = "loginIdPort(login:password:loginType:onSuccess:onError:onFinish:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kt/ViewControllers/Cabinet/Login/LoginViewController.swift"
timestampString = "533723657.954344"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "329"
endingLineNumber = "329"
landmarkName = "loginRequest(withTrimFirstSymbol:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kt/Utils/StringUtil.swift"
timestampString = "533724097.514757"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "24"
endingLineNumber = "24"
landmarkName = "containsLetters(checkString:)"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints> </Breakpoints>
</Bucket> </Bucket>
...@@ -29,6 +29,7 @@ extension Facade { ...@@ -29,6 +29,7 @@ extension Facade {
case .Failure(let error): case .Failure(let error):
Router.globalLog.error(error.debugDescription) Router.globalLog.error(error.debugDescription)
onError?(error) onError?(error)
break
case .Success(let json): case .Success(let json):
Router.globalLog.debug(resp.response!) Router.globalLog.debug(resp.response!)
Router.globalLog.debug(json) Router.globalLog.debug(json)
...@@ -36,6 +37,7 @@ extension Facade { ...@@ -36,6 +37,7 @@ extension Facade {
Facade.accountId = json["account_id"] as? Int Facade.accountId = json["account_id"] as? Int
Facade.guid = "\(Facade.serverId!)-\(Facade.accountId!)" Facade.guid = "\(Facade.serverId!)-\(Facade.accountId!)"
onSuccess?() onSuccess?()
break
} }
} }
} }
......
//
// Facade+NewLogin.swift
// kt
//
// Created by neox on 29.11.17.
// Copyright © 2017 SimpleCode. All rights reserved.
//
import Foundation
import XCGLogger
class LoginConnectionDelegate: NSObject, NSURLConnectionDataDelegate {
var onFinish: (() -> Void)!
var onError: ((NSError) -> Void)!
var onSuccess: (() -> Void)!
static var randomToken: String = ""
var login: String = ""
var password: String = ""
var loginType: Facade.LoginType!
static var counter = 0
override init() {
}
func connection(connection: NSURLConnection, didFailWithError error: NSError) {
// let error = NSError(domain: "kz.telecom", code: 0, userInfo: [
// NSLocalizedDescriptionKey: §"login.error.incorrect_login_or_password",
// ])
Router.globalLog.error(error.debugDescription)
self.onError(error)
}
func connection(connection: NSURLConnection, didReceiveResponse response: NSURLResponse) {
//print(response)
print("-=-=-=-=-=-=-")
Router.globalLog.debug(response)
print("-=-=-=-=-=-=-")
guard LoginConnectionDelegate.counter == 1 else { return }
self.onFinish()
if let responseUrl = response.URL where responseUrl.host == "www.google.kz" {
let params = [
Facade.LoginParamsKeys.ThirdStepClientId: LoginConnectionDelegate.randomToken
]
let r = request(.POST, Facade.LoginUrls.ThirdStep, parameters: params, encoding: .JSON)
let customDel = LoginConnectionDelegate()
customDel.onError = onError
customDel.onFinish = onFinish
customDel.onSuccess = onSuccess
customDel.login = login
customDel.password = password
customDel.loginType = loginType
LoginConnectionDelegate.counter += 1
print(r.cURLRepresentation())
let con = NSURLConnection(request: r.request!, delegate: customDel)
con!.start()
} else {
let error = NSError(domain: "kz.telecom", code: 0, userInfo: [
NSLocalizedDescriptionKey: §"login.error.incorrect_login_or_password",
])
self.onError(error)
}
}
func connection(connection: NSURLConnection, didReceiveData data: NSData) {
print(String(data: data, encoding: NSUTF8StringEncoding))
switch LoginConnectionDelegate.counter {
case 0:
onFinish()
let url = NSURL(string: Facade.LoginUrls.SecondStep)!
var mutableRequest = NSMutableURLRequest(URL: url)
mutableRequest.HTTPMethod = Method.GET.rawValue
var params = Facade.LoginParams.SecondStep
params[Facade.LoginParamsKeys.ClientIdKey] = LoginConnectionDelegate.randomToken
mutableRequest = ParameterEncoding.URL.encode(mutableRequest, parameters: params).0
var userParams = Facade.LoginParams.SecondStepBody
userParams[Facade.LoginParamsKeys.BodyAuthType] = loginType.rawValue
userParams[Facade.LoginParamsKeys.BodyUsername] = login
userParams[Facade.LoginParamsKeys.BodyPassword] = password
userParams[Facade.LoginParamsKeys.ClientIdKey] = LoginConnectionDelegate.randomToken
print(userParams)
mutableRequest.HTTPMethod = Method.POST.rawValue
mutableRequest = ParameterEncoding.URL.encode(mutableRequest, parameters: userParams).0
let r = request(mutableRequest)
let customDel = LoginConnectionDelegate()
customDel.onError = onError
customDel.onFinish = onFinish
customDel.onSuccess = onSuccess
customDel.login = login
customDel.password = password
customDel.loginType = loginType
LoginConnectionDelegate.counter += 1
print(r.cURLRepresentation())
let con = NSURLConnection(request: r.request!, delegate: customDel)
con!.start()
break
// case 1:
// self.onFinish()
// let params = [
// Facade.LoginParamsKeys.ThirdStepClientId: LoginConnectionDelegate.randomToken,
//
// Facade.LoginParamsKeys.ClientIdKey: LoginConnectionDelegate.randomToken
//
// ]
// print(params)
// let r = request(.POST, Facade.LoginUrls.ThirdStep, parameters: params, encoding: .JSON)
// let customDel = LoginConnectionDelegate()
// customDel.onError = onError
// customDel.onFinish = onFinish
// customDel.onSuccess = onSuccess
// customDel.login = login
// customDel.password = password
// customDel.loginType = loginType
// LoginConnectionDelegate.counter += 1
// let con = NSURLConnection(request: r.request!, delegate: customDel)
// con!.start()
//
// break
case 2:
self.onFinish()
let json = JSON(data: data)
print (json)
if let errorCode = json["error_code"].int {
// Success login
if errorCode == 0 {
// let access_token = json["access_token"] as! String
// let client_id = randomToken
Facade.expiresIn = json["expires_in"].doubleValue
Facade.accessToken = json["access_token"].stringValue
Facade.clientId = LoginConnectionDelegate.randomToken
// Facade.clientId = json["client_id"] as? String
// self.notificationCenter.postNotificationName(FacadeLoginSuccess, object: self)
UserManager.sharedInstance().login = self.login
UserManager.sharedInstance().password = self.password
self.onSuccess()
} else {
let error = NSError(domain: "kz.telecom", code: 0, userInfo: [
NSLocalizedDescriptionKey: json["error"].stringValue,
])
self.onError(error)
// self.notificationCenter.postNotificationName(FacadeLoginError, object: self, userInfo: [
// FacadeNotificationErrorKey: error,
// ])
}
}
// Error login or password
// CustomConnectionDelegate.counter += 1
break
default:
break
}
}
func connection(connection: NSURLConnection, canAuthenticateAgainstProtectionSpace protectionSpace: NSURLProtectionSpace) -> Bool {
return protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust
}
func connection(connection: NSURLConnection, didReceiveAuthenticationChallenge challenge: NSURLAuthenticationChallenge) {
if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust {
// if challenge.protectionSpace.host.containsString("cabinet.idport.kz") {
challenge.sender?.useCredential(NSURLCredential(forTrust: challenge.protectionSpace.serverTrust!), forAuthenticationChallenge: challenge)
challenge.sender?.continueWithoutCredentialForAuthenticationChallenge(challenge)
// }
}
}
}
extension Facade {
func loginIdPort(login: String, password: String, loginType: LoginType, onSuccess: () -> Void, onError: (error: NSError) -> Void, onFinish: () -> Void) {
LoginConnectionDelegate.counter = 0
let cookiesStorage = NSHTTPCookieStorage.sharedHTTPCookieStorage()
if let cookies = cookiesStorage.cookies where cookies.count != 0 {
for cookie in cookies {
if cookie.domain.rangeOfString("cabinet.idport.kz") != nil {
cookiesStorage.deleteCookie(cookie)
}
}
}
let uuid = NSUUID().UUIDString
let randomToken = uuid.stringByReplacingOccurrencesOfString("-", withString: "")
var params = LoginParams.FirstStep
params[LoginParamsKeys.ClientIdKey] = randomToken
// First Step: Simple .GET
let r = request(.GET, LoginUrls.FirstStep, parameters: params, encoding: .URL)
let customDel = LoginConnectionDelegate()
customDel.onError = onError
customDel.onFinish = onFinish
LoginConnectionDelegate.randomToken = randomToken
customDel.onSuccess = onSuccess
customDel.login = login
customDel.password = password
customDel.loginType = loginType
print(r.cURLRepresentation())
let con = NSURLConnection(request: r.request!, delegate: customDel)
con!.start()
Router.globalLog.debug("loginRequestStarted")
}
}
...@@ -1033,11 +1033,6 @@ ...@@ -1033,11 +1033,6 @@
<action selector="testLogin_touchUpInside:" destination="faD-wp-261" eventType="touchUpInside" id="fni-lg-ksD"/> <action selector="testLogin_touchUpInside:" destination="faD-wp-261" eventType="touchUpInside" id="fni-lg-ksD"/>
</connections> </connections>
</button> </button>
<label opaque="NO" multipleTouchEnabled="YES" userInteractionEnabled="NO" contentMode="left" text="Версия 1.0, сборка 53" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hea-SM-eVd">
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="CTQ-mM-kz7" customClass="HelpButton" customModule="telecom" customModuleProvider="target"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="CTQ-mM-kz7" customClass="HelpButton" customModule="telecom" customModuleProvider="target">
<constraints> <constraints>
<constraint firstAttribute="height" constant="44" id="sJQ-dQ-tqd"/> <constraint firstAttribute="height" constant="44" id="sJQ-dQ-tqd"/>
...@@ -1077,7 +1072,6 @@ ...@@ -1077,7 +1072,6 @@
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints> <constraints>
<constraint firstItem="mDW-lm-hs5" firstAttribute="top" secondItem="WFI-fo-Rky" secondAttribute="bottom" constant="60" id="1p7-ZJ-j63"/> <constraint firstItem="mDW-lm-hs5" firstAttribute="top" secondItem="WFI-fo-Rky" secondAttribute="bottom" constant="60" id="1p7-ZJ-j63"/>
<constraint firstItem="hea-SM-eVd" firstAttribute="trailing" secondItem="Nxe-gd-eO9" secondAttribute="trailingMargin" id="5Ii-kM-TKH"/>
<constraint firstItem="f5l-v6-3UO" firstAttribute="leading" secondItem="Nxe-gd-eO9" secondAttribute="leadingMargin" id="5Zi-Q9-20d"/> <constraint firstItem="f5l-v6-3UO" firstAttribute="leading" secondItem="Nxe-gd-eO9" secondAttribute="leadingMargin" id="5Zi-Q9-20d"/>
<constraint firstItem="f5l-v6-3UO" firstAttribute="top" secondItem="8Gg-7i-aK6" secondAttribute="bottom" constant="16" id="7Z1-42-GMu"/> <constraint firstItem="f5l-v6-3UO" firstAttribute="top" secondItem="8Gg-7i-aK6" secondAttribute="bottom" constant="16" id="7Z1-42-GMu"/>
<constraint firstItem="CTQ-mM-kz7" firstAttribute="centerX" secondItem="Nxe-gd-eO9" secondAttribute="centerX" id="8fE-qw-5P3"/> <constraint firstItem="CTQ-mM-kz7" firstAttribute="centerX" secondItem="Nxe-gd-eO9" secondAttribute="centerX" id="8fE-qw-5P3"/>
...@@ -1087,12 +1081,10 @@ ...@@ -1087,12 +1081,10 @@
<constraint firstItem="mDW-lm-hs5" firstAttribute="centerX" secondItem="Nxe-gd-eO9" secondAttribute="centerX" id="IbB-gt-eEd"/> <constraint firstItem="mDW-lm-hs5" firstAttribute="centerX" secondItem="Nxe-gd-eO9" secondAttribute="centerX" id="IbB-gt-eEd"/>
<constraint firstItem="VHN-P8-7SV" firstAttribute="leading" secondItem="Nxe-gd-eO9" secondAttribute="leadingMargin" id="Muz-YL-qDb"/> <constraint firstItem="VHN-P8-7SV" firstAttribute="leading" secondItem="Nxe-gd-eO9" secondAttribute="leadingMargin" id="Muz-YL-qDb"/>
<constraint firstItem="8Gg-7i-aK6" firstAttribute="leading" secondItem="Nxe-gd-eO9" secondAttribute="leadingMargin" id="NhW-an-LLE"/> <constraint firstItem="8Gg-7i-aK6" firstAttribute="leading" secondItem="Nxe-gd-eO9" secondAttribute="leadingMargin" id="NhW-an-LLE"/>
<constraint firstItem="hea-SM-eVd" firstAttribute="top" secondItem="VHN-P8-7SV" secondAttribute="bottom" constant="23" id="OH2-RE-iwU"/>
<constraint firstAttribute="trailingMargin" secondItem="Cwt-LS-RsF" secondAttribute="trailing" constant="16" id="QZy-7h-Hhd"/> <constraint firstAttribute="trailingMargin" secondItem="Cwt-LS-RsF" secondAttribute="trailing" constant="16" id="QZy-7h-Hhd"/>
<constraint firstItem="Bfw-9Q-UWv" firstAttribute="top" secondItem="CTQ-mM-kz7" secondAttribute="bottom" id="TsW-qp-xV6"/> <constraint firstItem="Bfw-9Q-UWv" firstAttribute="top" secondItem="CTQ-mM-kz7" secondAttribute="bottom" id="TsW-qp-xV6"/>
<constraint firstItem="VHN-P8-7SV" firstAttribute="top" secondItem="3cO-TQ-vvg" secondAttribute="bottom" constant="16" id="UMs-f4-uP3"/> <constraint firstItem="VHN-P8-7SV" firstAttribute="top" secondItem="3cO-TQ-vvg" secondAttribute="bottom" constant="16" id="UMs-f4-uP3"/>
<constraint firstItem="VHN-P8-7SV" firstAttribute="trailing" secondItem="Nxe-gd-eO9" secondAttribute="trailingMargin" id="X7u-gg-4K9"/> <constraint firstItem="VHN-P8-7SV" firstAttribute="trailing" secondItem="Nxe-gd-eO9" secondAttribute="trailingMargin" id="X7u-gg-4K9"/>
<constraint firstItem="hea-SM-eVd" firstAttribute="leading" secondItem="Nxe-gd-eO9" secondAttribute="leadingMargin" id="Zry-au-sxB"/>
<constraint firstItem="8Gg-7i-aK6" firstAttribute="top" secondItem="mDW-lm-hs5" secondAttribute="bottom" constant="34" id="o3v-iQ-VXW"/> <constraint firstItem="8Gg-7i-aK6" firstAttribute="top" secondItem="mDW-lm-hs5" secondAttribute="bottom" constant="34" id="o3v-iQ-VXW"/>
<constraint firstItem="3cO-TQ-vvg" firstAttribute="top" secondItem="f5l-v6-3UO" secondAttribute="bottom" constant="39" id="wuW-cg-fmG"/> <constraint firstItem="3cO-TQ-vvg" firstAttribute="top" secondItem="f5l-v6-3UO" secondAttribute="bottom" constant="39" id="wuW-cg-fmG"/>
<constraint firstItem="3cO-TQ-vvg" firstAttribute="trailing" secondItem="Nxe-gd-eO9" secondAttribute="trailingMargin" id="xVx-Ew-dZe"/> <constraint firstItem="3cO-TQ-vvg" firstAttribute="trailing" secondItem="Nxe-gd-eO9" secondAttribute="trailingMargin" id="xVx-Ew-dZe"/>
...@@ -1430,15 +1422,19 @@ ...@@ -1430,15 +1422,19 @@
<frame key="frameInset" width="414" height="43"/> <frame key="frameInset" width="414" height="43"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="5" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qZu-i5-IkV"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qZu-i5-IkV">
<frame key="frameInset" minX="8" minY="11" width="361" height="22"/>
<fontDescription key="fontDescription" name="PTSans-Regular" family="PT Sans" pointSize="17"/> <fontDescription key="fontDescription" name="PTSans-Regular" family="PT Sans" pointSize="17"/>
<nil key="textColor"/> <nil key="textColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
</subviews> </subviews>
<constraints>
<constraint firstItem="qZu-i5-IkV" firstAttribute="top" secondItem="zUj-fk-hK8" secondAttribute="top" constant="8" id="QVX-ls-2JC"/>
<constraint firstAttribute="bottom" secondItem="qZu-i5-IkV" secondAttribute="bottom" constant="8" id="cf0-pC-GC6"/>
</constraints>
</tableViewCellContentView> </tableViewCellContentView>
<constraints> <constraints>
<constraint firstItem="qZu-i5-IkV" firstAttribute="centerY" secondItem="SQN-x5-07i" secondAttribute="centerY" id="49g-mT-lnE"/>
<constraint firstAttribute="trailing" secondItem="qZu-i5-IkV" secondAttribute="trailing" constant="8" id="6iQ-xr-It7"/> <constraint firstAttribute="trailing" secondItem="qZu-i5-IkV" secondAttribute="trailing" constant="8" id="6iQ-xr-It7"/>
<constraint firstItem="qZu-i5-IkV" firstAttribute="leading" secondItem="SQN-x5-07i" secondAttribute="leading" constant="8" id="Isp-FJ-vrU"/> <constraint firstItem="qZu-i5-IkV" firstAttribute="leading" secondItem="SQN-x5-07i" secondAttribute="leading" constant="8" id="Isp-FJ-vrU"/>
</constraints> </constraints>
...@@ -1467,7 +1463,7 @@ ...@@ -1467,7 +1463,7 @@
</viewController> </viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="yrI-iU-iSw" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="yrI-iU-iSw" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects> </objects>
<point key="canvasLocation" x="-5154" y="3167"/> <point key="canvasLocation" x="-5154.3999999999996" y="3166.866566716642"/>
</scene> </scene>
<!--Navigation Controller--> <!--Navigation Controller-->
<scene sceneID="7pQ-gJ-z0O"> <scene sceneID="7pQ-gJ-z0O">
...@@ -5416,10 +5412,10 @@ ...@@ -5416,10 +5412,10 @@
<viewControllerLayoutGuide type="bottom" id="4K9-5I-gyS"/> <viewControllerLayoutGuide type="bottom" id="4K9-5I-gyS"/>
</layoutGuides> </layoutGuides>
<view key="view" contentMode="scaleToFill" id="RGj-b4-vyk"> <view key="view" contentMode="scaleToFill" id="RGj-b4-vyk">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <rect key="frame" x="0.0" y="0.0" width="375" height="1000"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" bounces="NO" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="ZzT-CM-q0s"> <tableView clipsSubviews="YES" contentMode="scaleToFill" bounces="NO" keyboardDismissMode="onDrag" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="ZzT-CM-q0s">
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/> <inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
<prototypes> <prototypes>
...@@ -5572,14 +5568,15 @@ ...@@ -5572,14 +5568,15 @@
<outlet property="titleLabel" destination="625-d4-Prf" id="8N7-CH-C4j"/> <outlet property="titleLabel" destination="625-d4-Prf" id="8N7-CH-C4j"/>
</connections> </connections>
</tableViewCell> </tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="buttonCell" rowHeight="90" id="vJX-hl-NQO" customClass="OnlinePaymentButtonCell" customModule="telecom" customModuleProvider="target"> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="buttonCell" rowHeight="66" id="vJX-hl-NQO" customClass="OnlinePaymentButtonCell" customModule="telecom" customModuleProvider="target">
<rect key="frame" x="0.0" y="562" width="375" height="90"/> <rect key="frame" x="0.0" y="562" width="375" height="66"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="vJX-hl-NQO" id="SRA-lI-sjQ"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" ambiguous="YES" tableViewCell="vJX-hl-NQO" id="SRA-lI-sjQ">
<frame key="frameInset" width="375" height="90"/> <frame key="frameInset" width="375" height="66"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="phS-30-t8f" customClass="UIButtonRoundedBlue" customModule="telecom" customModuleProvider="target"> <button opaque="NO" contentMode="scaleToFill" ambiguous="YES" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="phS-30-t8f" customClass="UIButtonRoundedBlue" customModule="telecom" customModuleProvider="target">
<frame key="frameInset" minX="8" minY="8" width="359" height="48"/>
<color key="backgroundColor" red="0.095081739127635956" green="0.37402468919754028" blue="0.67706954479217529" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="0.095081739127635956" green="0.37402468919754028" blue="0.67706954479217529" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="48" id="XpL-Cv-Dhy"/> <constraint firstAttribute="height" constant="48" id="XpL-Cv-Dhy"/>
...@@ -5594,12 +5591,11 @@ ...@@ -5594,12 +5591,11 @@
</button> </button>
</subviews> </subviews>
<constraints> <constraints>
<constraint firstAttribute="trailingMargin" secondItem="phS-30-t8f" secondAttribute="trailing" constant="12" id="4cC-CG-gEB"/> <constraint firstItem="phS-30-t8f" firstAttribute="top" secondItem="SRA-lI-sjQ" secondAttribute="top" constant="16" id="4NX-6b-gBm"/>
<constraint firstAttribute="bottomMargin" relation="greaterThanOrEqual" secondItem="phS-30-t8f" secondAttribute="bottom" constant="7" id="9Ue-3G-LfU"/> <constraint firstAttribute="trailing" secondItem="phS-30-t8f" secondAttribute="trailing" constant="16" id="X2i-D4-LRL"/>
<constraint firstAttribute="leadingMargin" secondItem="phS-30-t8f" secondAttribute="leading" constant="-11" id="BZd-kT-aZI"/> <constraint firstItem="phS-30-t8f" firstAttribute="leading" secondItem="SRA-lI-sjQ" secondAttribute="leading" constant="16" id="gW9-hs-gpG"/>
<constraint firstItem="phS-30-t8f" firstAttribute="leading" secondItem="SRA-lI-sjQ" secondAttribute="leadingMargin" constant="11" id="Lk1-Di-8od"/>
<constraint firstItem="phS-30-t8f" firstAttribute="top" secondItem="SRA-lI-sjQ" secondAttribute="topMargin" constant="7" id="N3a-x9-LqY"/>
<constraint firstItem="phS-30-t8f" firstAttribute="centerY" secondItem="SRA-lI-sjQ" secondAttribute="centerY" id="rFg-hG-0Nc"/> <constraint firstItem="phS-30-t8f" firstAttribute="centerY" secondItem="SRA-lI-sjQ" secondAttribute="centerY" id="rFg-hG-0Nc"/>
<constraint firstAttribute="bottom" secondItem="phS-30-t8f" secondAttribute="bottom" constant="16" id="x6o-V9-i7h"/>
</constraints> </constraints>
<variation key="default"> <variation key="default">
<mask key="constraints"> <mask key="constraints">
...@@ -5613,10 +5609,6 @@ ...@@ -5613,10 +5609,6 @@
</connections> </connections>
</tableViewCell> </tableViewCell>
</prototypes> </prototypes>
<connections>
<outlet property="dataSource" destination="Mk2-z4-0Kv" id="drz-CZ-XQf"/>
<outlet property="delegate" destination="Mk2-z4-0Kv" id="r5w-8H-HWM"/>
</connections>
</tableView> </tableView>
</subviews> </subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
...@@ -5627,14 +5619,16 @@ ...@@ -5627,14 +5619,16 @@
<constraint firstAttribute="trailing" secondItem="ZzT-CM-q0s" secondAttribute="trailing" id="wkn-Jx-q23"/> <constraint firstAttribute="trailing" secondItem="ZzT-CM-q0s" secondAttribute="trailing" id="wkn-Jx-q23"/>
</constraints> </constraints>
</view> </view>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<size key="freeformSize" width="375" height="1000"/>
<connections> <connections>
<outlet property="tableView" destination="ZzT-CM-q0s" id="48P-ma-GqU"/> <outlet property="tableView" destination="ZzT-CM-q0s" id="fXE-1T-Cv9"/>
<segue destination="6GO-eQ-XmS" kind="show" identifier="payment_form" id="koG-5n-Fpb"/> <segue destination="6GO-eQ-XmS" kind="show" identifier="payment_form" id="koG-5n-Fpb"/>
</connections> </connections>
</viewController> </viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="gCf-qO-oCs" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="gCf-qO-oCs" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects> </objects>
<point key="canvasLocation" x="-4204" y="-6917"/> <point key="canvasLocation" x="-4204" y="-6917.5412293853078"/>
</scene> </scene>
<!--Online Payment Form View Controller--> <!--Online Payment Form View Controller-->
<scene sceneID="DVA-v8-mDv"> <scene sceneID="DVA-v8-mDv">
...@@ -5645,7 +5639,7 @@ ...@@ -5645,7 +5639,7 @@
<viewControllerLayoutGuide type="bottom" id="5FN-jo-Bxq"/> <viewControllerLayoutGuide type="bottom" id="5FN-jo-Bxq"/>
</layoutGuides> </layoutGuides>
<view key="view" contentMode="scaleToFill" id="9Vc-M5-sRP"> <view key="view" contentMode="scaleToFill" id="9Vc-M5-sRP">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <rect key="frame" x="0.0" y="0.0" width="375" height="1000"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<webView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="WFf-dl-BPt"> <webView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="WFf-dl-BPt">
...@@ -11195,10 +11189,10 @@ ...@@ -11195,10 +11189,10 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<view contentMode="scaleToFill" ambiguous="YES" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cDB-uH-L8k"> <view contentMode="scaleToFill" ambiguous="YES" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cDB-uH-L8k">
<frame key="frameInset" minY="20" width="414" height="575"/> <frame key="frameInset" minY="20" width="374" height="575"/>
<subviews> <subviews>
<view contentMode="scaleToFill" ambiguous="YES" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="pmu-CW-ZEs"> <view contentMode="scaleToFill" ambiguous="YES" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="pmu-CW-ZEs">
<frame key="frameInset" width="414" height="575"/> <frame key="frameInset" width="374" height="575"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view> </view>
<tableView clipsSubviews="YES" contentMode="scaleToFill" ambiguous="YES" misplaced="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="ecy-Wc-Hfz"> <tableView clipsSubviews="YES" contentMode="scaleToFill" ambiguous="YES" misplaced="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="ecy-Wc-Hfz">
...@@ -11337,6 +11331,7 @@ ...@@ -11337,6 +11331,7 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints> <constraints>
<constraint firstItem="pmu-CW-ZEs" firstAttribute="top" secondItem="cDB-uH-L8k" secondAttribute="top" id="6op-Rr-vA9"/> <constraint firstItem="pmu-CW-ZEs" firstAttribute="top" secondItem="cDB-uH-L8k" secondAttribute="top" id="6op-Rr-vA9"/>
<constraint firstItem="pmu-CW-ZEs" firstAttribute="width" secondItem="cDB-uH-L8k" secondAttribute="width" id="ALv-K6-7rE"/>
<constraint firstAttribute="bottom" secondItem="ecy-Wc-Hfz" secondAttribute="bottom" id="Gyk-uS-0Sk"/> <constraint firstAttribute="bottom" secondItem="ecy-Wc-Hfz" secondAttribute="bottom" id="Gyk-uS-0Sk"/>
<constraint firstAttribute="trailing" secondItem="pmu-CW-ZEs" secondAttribute="trailing" id="Iv2-07-uZW"/> <constraint firstAttribute="trailing" secondItem="pmu-CW-ZEs" secondAttribute="trailing" id="Iv2-07-uZW"/>
<constraint firstItem="ecy-Wc-Hfz" firstAttribute="leading" secondItem="cDB-uH-L8k" secondAttribute="leading" id="Wg7-Jg-DoO"/> <constraint firstItem="ecy-Wc-Hfz" firstAttribute="leading" secondItem="cDB-uH-L8k" secondAttribute="leading" id="Wg7-Jg-DoO"/>
...@@ -11389,6 +11384,7 @@ ...@@ -11389,6 +11384,7 @@
<constraint firstItem="cDB-uH-L8k" firstAttribute="leading" secondItem="aNv-Xu-rfm" secondAttribute="leading" id="4ri-kd-Dba"/> <constraint firstItem="cDB-uH-L8k" firstAttribute="leading" secondItem="aNv-Xu-rfm" secondAttribute="leading" id="4ri-kd-Dba"/>
<constraint firstItem="ODV-xS-2kt" firstAttribute="top" secondItem="D1e-2d-VXz" secondAttribute="bottom" id="CBo-we-4WQ"/> <constraint firstItem="ODV-xS-2kt" firstAttribute="top" secondItem="D1e-2d-VXz" secondAttribute="bottom" id="CBo-we-4WQ"/>
<constraint firstItem="cDB-uH-L8k" firstAttribute="top" secondItem="DmU-m0-6bM" secondAttribute="bottom" id="Jdb-D0-mJJ"/> <constraint firstItem="cDB-uH-L8k" firstAttribute="top" secondItem="DmU-m0-6bM" secondAttribute="bottom" id="Jdb-D0-mJJ"/>
<constraint firstItem="cDB-uH-L8k" firstAttribute="width" secondItem="aNv-Xu-rfm" secondAttribute="width" id="Lu3-1T-2NO"/>
<constraint firstAttribute="trailing" secondItem="cDB-uH-L8k" secondAttribute="trailing" id="PUc-Ul-O5R"/> <constraint firstAttribute="trailing" secondItem="cDB-uH-L8k" secondAttribute="trailing" id="PUc-Ul-O5R"/>
<constraint firstItem="D1e-2d-VXz" firstAttribute="top" secondItem="cDB-uH-L8k" secondAttribute="bottom" id="tGv-Dv-Df9"/> <constraint firstItem="D1e-2d-VXz" firstAttribute="top" secondItem="cDB-uH-L8k" secondAttribute="bottom" id="tGv-Dv-Df9"/>
<constraint firstAttribute="trailing" secondItem="D1e-2d-VXz" secondAttribute="trailing" id="uE6-nH-q5e"/> <constraint firstAttribute="trailing" secondItem="D1e-2d-VXz" secondAttribute="trailing" id="uE6-nH-q5e"/>
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>61</string> <string>65</string>
<key>Fabric</key> <key>Fabric</key>
<dict> <dict>
<key>APIKey</key> <key>APIKey</key>
......
...@@ -9,12 +9,24 @@ ...@@ -9,12 +9,24 @@
import Foundation import Foundation
func containsLetters(checkString: String) -> Bool { func containsLetters(checkString: String) -> Bool {
let characterSet:NSCharacterSet = NSCharacterSet(charactersInString: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLKMNOPQRSTUVWXYZ") // let characterSet:NSCharacterSet = NSCharacterSet(charactersInString: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLKMNOPQRSTUVWXYZ")
let nsStringed = NSString(string: checkString) // let nsStringed = NSString(string: checkString)
if (nsStringed.rangeOfCharacterFromSet(characterSet.invertedSet).location == NSNotFound){ // if (nsStringed.rangeOfCharacterFromSet(characterSet.invertedSet).location == NSNotFound){
// return true
// }
// return false
let letters = NSCharacterSet.letterCharacterSet()
let range = checkString.rangeOfCharacterFromSet(letters)
// range will be nil if no letters is found
if range != nil {
return true return true
} }
else {
return false return false
}
} }
func containsCharacter(checkString: String, containingCharacters: String) -> Bool { func containsCharacter(checkString: String, containingCharacters: String) -> Bool {
......
...@@ -483,7 +483,6 @@ class LKSettingsViewController: ViewControllerWithCustomTitle, UITableViewDelega ...@@ -483,7 +483,6 @@ class LKSettingsViewController: ViewControllerWithCustomTitle, UITableViewDelega
func changeAbonentSettings(){ func changeAbonentSettings(){
fillVarsFromFields() fillVarsFromFields()
PKNotification.loading(true)
let abSet = AbonentSettingsRequest(abonentSettings: self.abonentSettings!, let abSet = AbonentSettingsRequest(abonentSettings: self.abonentSettings!,
email: email, email: email,
...@@ -494,7 +493,16 @@ class LKSettingsViewController: ViewControllerWithCustomTitle, UITableViewDelega ...@@ -494,7 +493,16 @@ class LKSettingsViewController: ViewControllerWithCustomTitle, UITableViewDelega
mobilePhone: Int64(mobilePhone), mobilePhone: Int64(mobilePhone),
oldPassword: oldPassword, oldPassword: oldPassword,
newPassword: newPassword) newPassword: newPassword)
guard abSet.validateFields() else { AlertViewUtil.showAlert(abSet.validationMessage); return } print (abSet)
guard abSet.validateFields()
else {
AlertViewUtil.showAlert(abSet.validationMessage);
return
}
PKNotification.loading(true)
Facade.sharedInstance().setAbonentSettings(abSet.json, Facade.sharedInstance().setAbonentSettings(abSet.json,
onError: { (error) -> Void in onError: { (error) -> Void in
PKNotification.loading(false) PKNotification.loading(false)
...@@ -629,13 +637,18 @@ extension LKSettingsViewController { ...@@ -629,13 +637,18 @@ extension LKSettingsViewController {
} }
setDataInCell(cell, forRowAtIndexPath: indexPath) setDataInCell(cell, forRowAtIndexPath: indexPath)
if ( indexPath.row == 3 ) { // if ( indexPath.row == 3 && indexPath.section == 0 ) {
if let cell = cell as? SettingTextFieldTableViewCell { // if let cell = cell as? SettingTextFieldTableViewCell {
cell.getTextField().addTarget(self, action: #selector(textFieldDidChange(_:)), forControlEvents: UIControlEvents.EditingChanged) // cell.getTextField().addTarget(self, action: #selector(textFieldDidChange(_:)), forControlEvents: UIControlEvents.EditingChanged)
cell.getTextField().keyboardType = .NumberPad // //cell.getTextField().keyboardType = .NumberPad
} // }
//
} // }
// if ( indexPath.row == 5 ) {
// if let cell = cell as? SettingTextFieldTableViewCell {
// cell.getTextField().addTarget(self, action: #selector(passwordDidChange(_:)), forControlEvents: UIControlEvents.EditingChanged)
// }
// }
return cell return cell
} }
...@@ -652,9 +665,14 @@ extension LKSettingsViewController { ...@@ -652,9 +665,14 @@ extension LKSettingsViewController {
if !settingsArr.isEmpty { if !settingsArr.isEmpty {
cell.setTitle(field.text) cell.setTitle(field.text)
cell.setPlaceholder(field.placeholder) cell.setPlaceholder(field.placeholder)
if( indexPath.row == 3 ) { if ( indexPath.row == 3 ) {
print(field.text)
cell.setMyTextField(getFormattedPhone(settingsArr[indexPath.section][indexPath.row] as! String)) cell.setMyTextField(getFormattedPhone(settingsArr[indexPath.section][indexPath.row] as! String))
cell.getTextField().keyboardType = .NumberPad cell.getTextField().keyboardType = .NumberPad
//cell.getTextField().addTarget(self, action: #selector(textFieldDidChange(_:)), forControlEvents: UIControlEvents.ValueChanged)
//cell.getTextField().addTarget(self, action: #selector(textFieldDidChange(_:)), forControlEvents: UIControlEvents.EditingChanged)
} else { } else {
cell.setMyTextField(settingsArr[indexPath.section][indexPath.row] as! String) cell.setMyTextField(settingsArr[indexPath.section][indexPath.row] as! String)
} }
...@@ -710,9 +728,19 @@ extension LKSettingsViewController { ...@@ -710,9 +728,19 @@ extension LKSettingsViewController {
} }
func textFieldDidChange(textField: UITextField) { // func textFieldDidChange(textField: UITextField) {
let phone = textField.text! as String // //if ( textField.tag == 101 ) {
textField.text = getFormattedPhone(phone) // let phone = textField.text! as String
// print("phone: " + phone)
// textField.text = getFormattedPhone(phone)
// //}
//
// print("\(textField.tag): " + textField.text!)
// }
func passwordDidChange(textField: UITextField) {
let str = textField.text! as String
print(str)
} }
private func cellIdentifierForIndexPath(indexPath: NSIndexPath) -> String { private func cellIdentifierForIndexPath(indexPath: NSIndexPath) -> String {
...@@ -725,6 +753,16 @@ extension LKSettingsViewController { ...@@ -725,6 +753,16 @@ extension LKSettingsViewController {
return _textCellIdentifier return _textCellIdentifier
} }
} }
func setParam(fieldTitle: String, newText: UITextField) {
if ( fieldTitle == "settings.mobile_phone" ) {
newText.text = getFormattedPhone(newText.text!)
params[fieldTitle] = getPhoneDigits(newText.text!)
} else {
params[fieldTitle] = newText.text!
}
}
} }
extension LKSettingsViewController { extension LKSettingsViewController {
......
...@@ -109,23 +109,23 @@ class LoginViewController: ScrolledViewController, UIViewControllerTransitioning ...@@ -109,23 +109,23 @@ class LoginViewController: ScrolledViewController, UIViewControllerTransitioning
} }
func keyboardWillShow(notification: NSNotification) { func keyboardWillShow(notification: NSNotification) {
// if (keyboardShowed) { // if (keyboardShowed) {
// return // return
// } // }
// if let keyboardSize = (notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.CGRectValue() { // if let keyboardSize = (notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.CGRectValue() {
// self.view.frame.origin.y -= (keyboardSize.height / 2) // self.view.frame.origin.y -= (keyboardSize.height / 2)
// } // }
// keyboardShowed = true // keyboardShowed = true
} }
func keyboardWillHide(notification: NSNotification) { func keyboardWillHide(notification: NSNotification) {
// if (!keyboardShowed) { // if (!keyboardShowed) {
// return // return
// } // }
// if let keyboardSize = (notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.CGRectValue() { // if let keyboardSize = (notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.CGRectValue() {
// self.view.frame.origin.y += (keyboardSize.height / 2) // self.view.frame.origin.y += (keyboardSize.height / 2)
// } // }
// keyboardShowed = false // keyboardShowed = false
} }
override func viewDidAppear(animated: Bool) { override func viewDidAppear(animated: Bool) {
...@@ -166,8 +166,8 @@ class LoginViewController: ScrolledViewController, UIViewControllerTransitioning ...@@ -166,8 +166,8 @@ class LoginViewController: ScrolledViewController, UIViewControllerTransitioning
fillFieldsWithDefaultValues() fillFieldsWithDefaultValues()
self.loginTryCount = 0 self.loginTryCount = 0
_loginTextField.text = "7172682610" // ntcnjdsq 7278177224 _loginTextField.text = ""//"7172682610" // ntcnjdsq 7278177224
_passwordTextField.text = "NewPassword1" _passwordTextField.text = ""//"NewPassword1"
let loginFieldValue = _loginTextField.text let loginFieldValue = _loginTextField.text
if containsLetters(_loginTextField.text!) { if containsLetters(_loginTextField.text!) {
...@@ -364,19 +364,27 @@ class LoginViewController: ScrolledViewController, UIViewControllerTransitioning ...@@ -364,19 +364,27 @@ class LoginViewController: ScrolledViewController, UIViewControllerTransitioning
func processingLoggedInError(error : NSError) { func processingLoggedInError(error : NSError) {
dispatch_async(dispatch_get_main_queue()) { dispatch_async(dispatch_get_main_queue()) {
if self.loginTryCount < 2 { // if self.loginTryCount < 2 {
self.loginTryCount += 1 // self.loginTryCount += 1
self.loginRequest(true) // self.loginRequest(true)
} else { // } else {
self.loginTryCount = 0 self.loginTryCount = 0
self.processRequest(false) self.processRequest(false)
AlertViewUtil.showErrorAlert(error.localizedDescription, vc: self) AlertViewUtil.showErrorAlert(error.localizedDescription, vc: self)
} // }
} }
} }
func sendRequestLogin(userName : String, password : String, loginType : Int, onSuccess: () -> Void, onError: (NSError) -> Void) { func sendRequestLogin(userName : String, password : String, loginType : Int, onSuccess: () -> Void, onError: (NSError) -> Void) {
_facade.login(userName, password: password, loginType: Facade.LoginType(rawValue: loginType)!, onSuccess: { () -> Void in // _facade.login(userName, password: password, loginType: Facade.LoginType(rawValue: loginType)!, onSuccess: { () -> Void in
// onSuccess()
// }, onError: { (error) -> Void in
// onError(error)
//
// }, onFinish: {
// })
_facade.loginIdPort(userName, password: password, loginType: Facade.LoginType(rawValue: loginType)!, onSuccess: { () -> Void in
onSuccess() onSuccess()
}, onError: { (error) -> Void in }, onError: { (error) -> Void in
onError(error) onError(error)
...@@ -384,6 +392,7 @@ class LoginViewController: ScrolledViewController, UIViewControllerTransitioning ...@@ -384,6 +392,7 @@ class LoginViewController: ScrolledViewController, UIViewControllerTransitioning
}, onFinish: { }, onFinish: {
}) })
} }
override func textFieldDidEndEditing(textField: UITextField) { override func textFieldDidEndEditing(textField: UITextField) {
...@@ -476,27 +485,27 @@ class LoginViewController: ScrolledViewController, UIViewControllerTransitioning ...@@ -476,27 +485,27 @@ class LoginViewController: ScrolledViewController, UIViewControllerTransitioning
@IBAction func webView_touchUpInside(sender: UIButton) { @IBAction func webView_touchUpInside(sender: UIButton) {
} }
@IBAction func testLogin_touchUpInside(sender: UIButton) { // @IBAction func testLogin_touchUpInside(sender: UIButton) {
//
// 7278177224 // // 7278177224
//
_facade.login("7278177224", password: "Fvbh1988", loginType: Facade.LoginType.PhoneNumber, onSuccess: { () -> Void in // _facade.login("7278177224", password: "Fvbh1988", loginType: Facade.LoginType.PhoneNumber, onSuccess: { () -> Void in
if UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Phone { // if UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Phone {
self.performSegueWithIdentifier("loggedIn", sender: nil) // self.performSegueWithIdentifier("loggedIn", sender: nil)
} else if UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad { // } else if UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad {
AbonentInfoManager.sharedInstance.updateUserInfo() // AbonentInfoManager.sharedInstance.updateUserInfo()
self.dismissViewControllerAnimated(true, completion: nil) // self.dismissViewControllerAnimated(true, completion: nil)
} // }
self.processRequest(false) // self.processRequest(false)
}, onError: { (error) -> Void in // }, onError: { (error) -> Void in
dispatch_async(dispatch_get_main_queue()) { // dispatch_async(dispatch_get_main_queue()) {
self.processRequest(false) // self.processRequest(false)
AlertViewUtil.showErrorAlert(error.localizedDescription, vc: self) // AlertViewUtil.showErrorAlert(error.localizedDescription, vc: self)
} // }
}, onFinish: { // }, onFinish: {
// self.processRequest(false) // // self.processRequest(false)
}) // })
} // }
@IBAction func sendLogs_touchUpInside(sender: UIButton) { @IBAction func sendLogs_touchUpInside(sender: UIButton) {
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
......
...@@ -20,7 +20,7 @@ class MainKnowedgeViewController: UIViewController { ...@@ -20,7 +20,7 @@ class MainKnowedgeViewController: UIViewController {
self.tableview.estimatedRowHeight = 44.0; self.tableview.estimatedRowHeight = 44.0;
self.tableview.rowHeight = UITableViewAutomaticDimension; self.tableview.rowHeight = UITableViewAutomaticDimension;
self.tableview.separatorStyle = .None //self.tableview.separatorStyle = .None
Facade.sharedInstance().getCategories({ (knowedgeList: [KnowedgeModel]) in Facade.sharedInstance().getCategories({ (knowedgeList: [KnowedgeModel]) in
self.knowedgeList = knowedgeList self.knowedgeList = knowedgeList
...@@ -41,8 +41,10 @@ class MainKnowedgeViewController: UIViewController { ...@@ -41,8 +41,10 @@ class MainKnowedgeViewController: UIViewController {
cell.label.text = knowedgeList[indexPath.row].name cell.label.text = knowedgeList[indexPath.row].name
if knowedgeList[indexPath.row].type == "category" { if knowedgeList[indexPath.row].type == "category" {
cell.backgroundColor = UIColor(red: 236.0 / 255.0, green: 236.0 / 255.0, blue: 236.0 / 255.0, alpha: 1.0) cell.backgroundColor = UIColor(red: 236.0 / 255.0, green: 236.0 / 255.0, blue: 236.0 / 255.0, alpha: 1.0)
cell.accessoryType = UITableViewCellAccessoryType.None
} else { } else {
cell.backgroundColor = UIColor.whiteColor() cell.backgroundColor = UIColor.whiteColor()
cell.accessoryType = UITableViewCellAccessoryType.DisclosureIndicator
} }
return cell return cell
} }
......
...@@ -9,8 +9,7 @@ ...@@ -9,8 +9,7 @@
import Foundation import Foundation
import UIKit import UIKit
class OnlinePaymentViewController: KeyboardedViewController, UITableViewDataSource, UITableViewDelegate { class OnlinePaymentViewController: UIViewController, UITextViewDelegate, UITableViewDataSource, UITableViewDelegate {
private static let titleCellIdentifier = "titleCell" private static let titleCellIdentifier = "titleCell"
private static let fieldCellIdentifier = "fieldCell" private static let fieldCellIdentifier = "fieldCell"
...@@ -30,24 +29,83 @@ class OnlinePaymentViewController: KeyboardedViewController, UITableViewDataSour ...@@ -30,24 +29,83 @@ class OnlinePaymentViewController: KeyboardedViewController, UITableViewDataSour
[OnlinePaymentViewController.fieldCellIdentifier, "payment_summ"], [OnlinePaymentViewController.fieldCellIdentifier, "payment_summ"],
[OnlinePaymentViewController.buttonCellIdentifier, "go_payment"]] [OnlinePaymentViewController.buttonCellIdentifier, "go_payment"]]
var keyboardAtOrigin = true
override func viewWillAppear(animated: Bool) { override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated) super.viewWillAppear(animated)
localize() localize()
configureBlueNavbar() configureBlueNavbar()
tableView.delegate = self
tableView.dataSource = self
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(OnlinePaymentViewController.keyboardWillShow(_:)), name: UIKeyboardWillShowNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(OnlinePaymentViewController.keyboardWillHide(_:)), name: UIKeyboardWillHideNotification, object: nil)
}
var initialInset: UIEdgeInsets?
func keyboardWillShow(notification: NSNotification) {
if ((notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.CGRectValue()) != nil {
//self.view.frame.origin.y -= keyboardSize.height
initialInset = tableView.contentInset
var userInfo = notification.userInfo!
var keyboardFrame:CGRect = (userInfo[UIKeyboardFrameBeginUserInfoKey] as! NSValue).CGRectValue()
keyboardFrame = self.view.convertRect(keyboardFrame, fromView: nil)
var contentInset:UIEdgeInsets = self.tableView.contentInset
contentInset.bottom = keyboardFrame.size.height + 30
self.tableView.contentInset = contentInset
//get indexpath
let indexpath = NSIndexPath(forRow: 1, inSection: 0)
self.tableView.scrollToRowAtIndexPath(indexpath, atScrollPosition: UITableViewScrollPosition.Top, animated: true)
}
}
func keyboardWillHide(notification: NSNotification) {
if ((notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.CGRectValue()) != nil {
let contentInset:UIEdgeInsets = UIEdgeInsetsZero
// self.tableView.contentInset = contentInset
self.tableView.contentInset = initialInset!
} }
}
// func keyboardWillShow(notification: NSNotification) {
// if let keyboardSize = (notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.CGRectValue() where keyboardAtOrigin {
// self.view.frame.origin.y -= keyboardSize.height
// keyboardAtOrigin = false
// }
// }
//
// func keyboardWillHide(notification: NSNotification) {
// if let keyboardSize = (notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.CGRectValue() where !keyboardAtOrigin {
// self.view.frame.origin.y += keyboardSize.height
// keyboardAtOrigin = true
// }
// }
private func registerForKeyboardAction() {
let notificationCenter = NSNotificationCenter.defaultCenter() func textFieldShouldReturn(textField: UITextField) -> Bool {
notificationCenter.addObserver(self, selector: #selector(OnlinePaymentViewController.keyboardDidShow(_:)), self.view.endEditing(true)
name:UIKeyboardWillShowNotification, object: nil) return false
notificationCenter.addObserver(self, selector: #selector(OnlinePaymentViewController.keyboardWillBeHidden(_:)),
name: UIKeyboardWillHideNotification, object: nil)
} }
// private func registerForKeyboardAction() {
// let notificationCenter = NSNotificationCenter.defaultCenter()
// notificationCenter.addObserver(self, selector: #selector(OnlinePaymentViewController.keyboardDidShow(_:)),
// name:UIKeyboardWillShowNotification, object: nil)
// notificationCenter.addObserver(self, selector: #selector(OnlinePaymentViewController.keyboardWillBeHidden(_:)),
// name: UIKeyboardWillHideNotification, object: nil)
// }
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
tableView.addGestureRecognizer(tapGestureRecognizer) //tableView.addGestureRecognizer(tapGestureRecognizer)
registerForKeyboardAction() //registerForKeyboardAction()
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(OnlinePaymentViewController.requestAbonent), NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(OnlinePaymentViewController.requestAbonent),
name: AbonentInfoManager.NotificationNames.Update, object: AbonentInfoManager.sharedInstance) name: AbonentInfoManager.NotificationNames.Update, object: AbonentInfoManager.sharedInstance)
if AbonentInfoManager.sharedInstance.abonentInfo != nil { if AbonentInfoManager.sharedInstance.abonentInfo != nil {
...@@ -62,34 +120,45 @@ class OnlinePaymentViewController: KeyboardedViewController, UITableViewDataSour ...@@ -62,34 +120,45 @@ class OnlinePaymentViewController: KeyboardedViewController, UITableViewDataSour
tableView.reloadData() tableView.reloadData()
} }
// MARK: Keyboard action // // MARK: Keyboard action
func keyboardDidShow(notification: NSNotification) { // func keyboardDidShow(notification: NSNotification) {
let info = notification.userInfo! // let info = notification.userInfo!
var kbRect = info[UIKeyboardFrameBeginUserInfoKey]!.CGRectValue // var kbRect = info[UIKeyboardFrameBeginUserInfoKey]!.CGRectValue
kbRect = view.convertRect(kbRect, fromView: nil) // kbRect = view.convertRect(kbRect, fromView: nil)
//
let contentInsets = UIEdgeInsets(top: 0.0, left: 0.0, // let contentInsets = UIEdgeInsets(top: 0.0, left: 0.0,
bottom: kbRect.height, right: 0.0) // bottom: kbRect.height, right: 0.0)
tableView.contentInset = contentInsets // tableView.contentInset = contentInsets
tableView.scrollIndicatorInsets = contentInsets // tableView.scrollIndicatorInsets = contentInsets
let aRect = view.frame // let aRect = view.frame
if let textField = activeField where !CGRectContainsPoint(aRect, textField.frame.origin) { // if let textField = activeField where !CGRectContainsPoint(aRect, textField.frame.origin) {
tableView.scrollRectToVisible(textField.frame, animated: true) // tableView.scrollRectToVisible(textField.frame, animated: true)
} // }
tapGestureRecognizer.enabled = true // //tapGestureRecognizer.enabled = true
} // }
//
func keyboardWillBeHidden(notification: NSNotification) { // func keyboardWillBeHidden(notification: NSNotification) {
let contentInsets = UIEdgeInsetsZero // let contentInsets = UIEdgeInsetsZero
tableView.contentInset = contentInsets // tableView.contentInset = contentInsets
tableView.scrollIndicatorInsets = contentInsets // tableView.scrollIndicatorInsets = contentInsets
resizeScrollViewToFitSubviews() // resizeScrollViewToFitSubviews()
tapGestureRecognizer.enabled = false // //tapGestureRecognizer.enabled = false
// }
// func resizeScrollViewToFitSubviews() {
// // OnlinePaymentViewController.textFields = [String: UITextField]()
// tableView.reloadData()
// }
func textViewShouldBeginEditing(textView: UITextView) -> Bool {
var pointInTable:CGPoint = textView.superview!.convertPoint(textView.frame.origin, toView: tableView)
var contentOffset:CGPoint = tableView.contentOffset
contentOffset.y = pointInTable.y
if let accessoryView = textView.inputAccessoryView {
contentOffset.y -= accessoryView.frame.size.height
} }
tableView.contentOffset = contentOffset
func resizeScrollViewToFitSubviews() { return true
// OnlinePaymentViewController.textFields = [String: UITextField]()
tableView.reloadData()
} }
private func configureTableView() { private func configureTableView() {
......
...@@ -340,6 +340,24 @@ extension ClaimListViewController { ...@@ -340,6 +340,24 @@ extension ClaimListViewController {
// UITableViewDataSource // UITableViewDataSource
extension ClaimListViewController { extension ClaimListViewController {
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
var numOfSections: Int = 1
if !claims.isEmpty {
tableView.separatorStyle = UITableViewCellSeparatorStyle.SingleLine
numOfSections = 1
tableView.backgroundView = nil
}
else {
let noDataLabel: UILabel = UILabel(frame: CGRect(x: 0, y: 0, width: tableView.bounds.size.width, height: tableView.bounds.size.height))
noDataLabel.text = LS("no_data")
noDataLabel.textColor = UIColor.darkGrayColor()
noDataLabel.textAlignment = NSTextAlignment.Center
tableView.backgroundView = noDataLabel
tableView.separatorStyle = UITableViewCellSeparatorStyle.None
}
return numOfSections
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return tabIndex == 0 ? cellsRepairBureauItem.count : cellsServiceStatementItem.count return tabIndex == 0 ? cellsRepairBureauItem.count : cellsServiceStatementItem.count
} }
......
...@@ -34,6 +34,9 @@ class UIListBoxViewController : UIViewController, UITableViewDelegate, UITableVi ...@@ -34,6 +34,9 @@ class UIListBoxViewController : UIViewController, UITableViewDelegate, UITableVi
super.viewWillAppear(animated) super.viewWillAppear(animated)
configureBlueNavbar() configureBlueNavbar()
addBackButtonForDefault(.whiteColor()) addBackButtonForDefault(.whiteColor())
self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.estimatedRowHeight = 44.0;
} }
override func viewDidLoad() { override func viewDidLoad() {
......
...@@ -65,9 +65,8 @@ class WiFiPointsViewController : ViewControllerWithMenu { ...@@ -65,9 +65,8 @@ class WiFiPointsViewController : ViewControllerWithMenu {
override func configureBlueNavbar() { override func configureBlueNavbar() {
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), forBarPosition: UIBarPosition.Any, barMetrics: UIBarMetrics.Default) self.navigationController?.navigationBar.setBackgroundImage(UIImage(), forBarPosition: UIBarPosition.Any, barMetrics: UIBarMetrics.Default)
self.navigationController?.navigationBar.shadowImage = UIImage() self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.barTintColor = Color.DashboardBlueColor //self.navigationController?.navigationBar.barTintColor = Color.DashboardBlueColor
self.navigationController?.navigationBar.barStyle = UIBarStyle.Black self.navigationController?.navigationBar.barStyle = UIBarStyle.Black
// self.navigationController?.navigationBar.tintColor = nil
self.navigationController?.navigationBar.tintColor = UIColor.whiteColor() self.navigationController?.navigationBar.tintColor = UIColor.whiteColor()
navigationController?.navigationBar.setBottomBorderColor(UIColor.whiteColor(), height: 0) navigationController?.navigationBar.setBottomBorderColor(UIColor.whiteColor(), height: 0)
...@@ -134,11 +133,14 @@ class WiFiPointsViewController : ViewControllerWithMenu { ...@@ -134,11 +133,14 @@ class WiFiPointsViewController : ViewControllerWithMenu {
func showListButton() { func showListButton() {
let button = UIButton(frame: CGRect(x: -10, y: 0, width: 32, height: 32)) let button = UIButton(frame: CGRect(x: -10, y: 0, width: 32, height: 32))
button.setImage(UIImage(named: "map_address_icon_highlighted"), forState: .Normal) button.tintColor = UIColor.whiteColor()
button.setImage(UIImage(named: "map_address_icon_hidhlighted" ), forState: .Normal)
// FIXME: cahnge image color // FIXME: cahnge image color
button.setImage(UIImage(named: "map_address_icon"), forState: .Highlighted) button.setImage(UIImage(named: "map_address_icon"), forState: .Highlighted)
button.addTarget(self, action: #selector(WiFiPointsViewController.showWiFiList(_:)), forControlEvents: .TouchUpInside) button.addTarget(self, action: #selector(WiFiPointsViewController.showWiFiList(_:)), forControlEvents: .TouchUpInside)
navigationItem.rightBarButtonItem = UIBarButtonItem(customView: button) navigationItem.rightBarButtonItem = UIBarButtonItem(customView: button)
} }
func showWiFiList(sender: UIButton) { func showWiFiList(sender: UIButton) {
......
...@@ -17,8 +17,10 @@ class OnlinePaymentFieldCell : UITableViewCell { ...@@ -17,8 +17,10 @@ class OnlinePaymentFieldCell : UITableViewCell {
override func awakeFromNib() { override func awakeFromNib() {
super.awakeFromNib() super.awakeFromNib()
textField.addTarget(self, action: #selector(OnlinePaymentFieldCell.textChanged(_:)), forControlEvents: UIControlEvents.EditingChanged) textField.addTarget(self, action: #selector(OnlinePaymentFieldCell.textChanged(_:)), forControlEvents: UIControlEvents.EditingChanged)
textField.applyUITextFieldStyle() textField.applyUITextFieldStyle()
} }
func textChanged(textField: UITextField) { func textChanged(textField: UITextField) {
......
...@@ -88,7 +88,7 @@ class SettingTextFieldTableViewCell: UITableViewCell { ...@@ -88,7 +88,7 @@ class SettingTextFieldTableViewCell: UITableViewCell {
func textChanged(textField: UITextField){ func textChanged(textField: UITextField){
// delegate.onChangeText(textField.text!, cell: self) // delegate.onChangeText(textField.text!, cell: self)
if textField.text!.characters.count <= textField.maxLength { if textField.text!.characters.count <= textField.maxLength {
vc.params[fieldTitle] = getPhoneDigits(textField.text!) vc.setParam(fieldTitle, newText: textField)
self.vc.isChangedSettings() self.vc.isChangedSettings()
} }
......
...@@ -24,12 +24,19 @@ class FeedCollectionViewCell: UICollectionViewCell { ...@@ -24,12 +24,19 @@ class FeedCollectionViewCell: UICollectionViewCell {
override func awakeFromNib() { override func awakeFromNib() {
super.awakeFromNib() super.awakeFromNib()
let tap = UITapGestureRecognizer(target: self, action: #selector(FeedCollectionViewCell.tapFunction)) // let tap = UITapGestureRecognizer(target: self, action: #selector(FeedCollectionViewCell.tapFunction))
payButton.addGestureRecognizer(tap) // payButton.addGestureRecognizer(tap)
//
// let tap2 = UITapGestureRecognizer(target: self, action: #selector(FeedCollectionViewCell.tapFunction))
// image.userInteractionEnabled = true
// image.addGestureRecognizer(tap2)
} }
func tapFunction(sender:UITapGestureRecognizer) { func tapFunction(sender:UITapGestureRecognizer) {
openService()
}
func openService() {
let serviceItem = ServiceItem() let serviceItem = ServiceItem()
serviceItem.id = self.id serviceItem.id = self.id
serviceItem.type = "landing" serviceItem.type = "landing"
...@@ -38,13 +45,13 @@ class FeedCollectionViewCell: UICollectionViewCell { ...@@ -38,13 +45,13 @@ class FeedCollectionViewCell: UICollectionViewCell {
let storyboard = UIStoryboard(name: "Main", bundle: nil) let storyboard = UIStoryboard(name: "Main", bundle: nil)
////this is old version ////this is old version
// let destination = storyboard.instantiateViewControllerWithIdentifier("ServiceItemScrollViewController") as! ServiceItemScrollViewController // let destination = storyboard.instantiateViewControllerWithIdentifier("ServiceItemScrollViewController") as! ServiceItemScrollViewController
// destination.serviceItemForLoading = serviceItem // destination.serviceItemForLoading = serviceItem
// navController!.pushViewController(destination, animated: true) // navController!.pushViewController(destination, animated: true)
// let destination = storyboard.instantiateViewControllerWithIdentifier("ServiceCalculatorViewController") as! ServiceCalculatorViewController // let destination = storyboard.instantiateViewControllerWithIdentifier("ServiceCalculatorViewController") as! ServiceCalculatorViewController
// destination.serviceItem = serviceItem // destination.serviceItem = serviceItem
// navController!.pushViewController(destination, animated: true) // navController!.pushViewController(destination, animated: true)
let destination = storyboard.instantiateViewControllerWithIdentifier("ServiceVIPTableViewController") as! ServiceVIPTableViewController let destination = storyboard.instantiateViewControllerWithIdentifier("ServiceVIPTableViewController") as! ServiceVIPTableViewController
destination.serviceItem = serviceItem destination.serviceItem = serviceItem
......
...@@ -32,6 +32,11 @@ class FeedPackagesCell: UITableViewCell, UICollectionViewDataSource, UICollectio ...@@ -32,6 +32,11 @@ class FeedPackagesCell: UITableViewCell, UICollectionViewDataSource, UICollectio
} }
} }
func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
let cell = collectionView.cellForItemAtIndexPath(indexPath) as! FeedCollectionViewCell
cell.openService()
}
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return feed.count return feed.count
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment