Commit 67e7b8ba by Olzhas Aldabergenov

doesn't request location at launch

parent 2548ba7e
...@@ -93,6 +93,7 @@ ...@@ -93,6 +93,7 @@
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 */; };
3E7A5B371FD95F4C0040F7A6 /* UITextField+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E7A5B361FD95F4C0040F7A6 /* UITextField+Extensions.swift */; };
3E8D31161FB1AA3500A650D2 /* VIPCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E8D31151FB1AA3500A650D2 /* VIPCell.swift */; }; 3E8D31161FB1AA3500A650D2 /* VIPCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E8D31151FB1AA3500A650D2 /* VIPCell.swift */; };
3EA73F081FAAE6620009731F /* ServiceCalculatorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EA73F071FAAE6620009731F /* ServiceCalculatorViewController.swift */; }; 3EA73F081FAAE6620009731F /* ServiceCalculatorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EA73F071FAAE6620009731F /* ServiceCalculatorViewController.swift */; };
3EA7F6BA1F00D1A1003F6CBF /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EA7F6B91F00D1A1003F6CBF /* MainViewController.swift */; }; 3EA7F6BA1F00D1A1003F6CBF /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EA7F6B91F00D1A1003F6CBF /* MainViewController.swift */; };
...@@ -649,6 +650,7 @@ ...@@ -649,6 +650,7 @@
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>"; };
3E7A5B361FD95F4C0040F7A6 /* UITextField+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITextField+Extensions.swift"; sourceTree = "<group>"; };
3E8D31151FB1AA3500A650D2 /* VIPCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VIPCell.swift; sourceTree = "<group>"; }; 3E8D31151FB1AA3500A650D2 /* VIPCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VIPCell.swift; sourceTree = "<group>"; };
3EA73F071FAAE6620009731F /* ServiceCalculatorViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServiceCalculatorViewController.swift; sourceTree = "<group>"; }; 3EA73F071FAAE6620009731F /* ServiceCalculatorViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServiceCalculatorViewController.swift; sourceTree = "<group>"; };
3EA7F6B91F00D1A1003F6CBF /* MainViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = "<group>"; }; 3EA7F6B91F00D1A1003F6CBF /* MainViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = "<group>"; };
...@@ -1296,6 +1298,7 @@ ...@@ -1296,6 +1298,7 @@
984DE9C61D87187100608E69 /* SpinneredAlert.swift */, 984DE9C61D87187100608E69 /* SpinneredAlert.swift */,
3E2C3E9A1EFCB17E00E553CD /* Validator.swift */, 3E2C3E9A1EFCB17E00E553CD /* Validator.swift */,
3E5CC7AD1FA84F9F00B55DF0 /* DateUtil.swift */, 3E5CC7AD1FA84F9F00B55DF0 /* DateUtil.swift */,
3E7A5B361FD95F4C0040F7A6 /* UITextField+Extensions.swift */,
); );
path = Utils; path = Utils;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2924,6 +2927,7 @@ ...@@ -2924,6 +2927,7 @@
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 */, 3E3BCC9C1FCEB692008613E2 /* Facade+NewLogin.swift in Sources */,
3E7A5B371FD95F4C0040F7A6 /* UITextField+Extensions.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 = "534166249.979557" timestampString = "534317865.476744"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "633" startingLineNumber = "634"
endingLineNumber = "633" endingLineNumber = "634"
landmarkName = "applicationWillResignActive()" landmarkName = "applicationWillResignActive()"
landmarkType = "7"> landmarkType = "7">
</BreakpointContent> </BreakpointContent>
...@@ -122,12 +122,28 @@ ...@@ -122,12 +122,28 @@
ignoreCount = "0" ignoreCount = "0"
continueAfterRunningActions = "No" continueAfterRunningActions = "No"
filePath = "kt/ViewControllers/Cabinet/Login/LoginViewController.swift" filePath = "kt/ViewControllers/Cabinet/Login/LoginViewController.swift"
timestampString = "534166249.979557" timestampString = "534317865.476744"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "311" startingLineNumber = "312"
endingLineNumber = "311" endingLineNumber = "312"
landmarkName = "textField(_:shouldChangeCharactersInRange:replacementString:)" landmarkName = "textField(textField:shouldChangeCharactersInRange:replacementString:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kt/ViewControllers/Service/ServiceVIPTableViewController.swift"
timestampString = "534249690.799642"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "305"
endingLineNumber = "305"
landmarkName = "updateTotal()"
landmarkType = "7"> landmarkType = "7">
</BreakpointContent> </BreakpointContent>
</BreakpointProxy> </BreakpointProxy>
......
...@@ -10,61 +10,60 @@ import Foundation ...@@ -10,61 +10,60 @@ import Foundation
import CoreLocation import CoreLocation
class LocationManager : NSObject, CLLocationManagerDelegate { class LocationManager : NSObject, CLLocationManagerDelegate {
private let locationManager = CLLocationManager() private let locationManager = CLLocationManager()
var needGetUserCity = false var needGetUserCity = false
internal override init() { internal override init() {
super.init() super.init()
locationManager.delegate = self locationManager.delegate = self
if #available(iOS 8.0, *) { if #available(iOS 8.0, *) {
locationManager.requestWhenInUseAuthorization() locationManager.requestWhenInUseAuthorization()
}
} locationManager.startUpdatingLocation()
locationManager.startUpdatingLocation() }
}
class func sharedInstance() -> LocationManager {
class func sharedInstance() -> LocationManager { struct Shared {
struct Shared { static let sharedInstance = LocationManager()
static let sharedInstance = LocationManager() }
} return Shared.sharedInstance
return Shared.sharedInstance }
}
var worked : Bool {
var worked : Bool { // TODO: worked method for understanding location manager
// TODO: worked method for understanding location manager return true
return true }
}
var currentCityId: Int?
var currentCityId: Int?
var currentLocation: CLLocationCoordinate2D? {
var currentLocation: CLLocationCoordinate2D? { set {
set { }
get {
if currentCityId != NSUserDefaults.standardUserDefaults().integerForKey(UserDefaultsCity) {
let newCityId = NSUserDefaults.standardUserDefaults().integerForKey(UserDefaultsCity)
self.currentCityId = newCityId
var cities = CitiesManager.sharedInstance().getCities()
var currentCity: City?
if let cityId = cities.indexOf({$0.id == newCityId}) {
currentCity = cities[cityId]
}
return currentCity?.location
}
return nil
}
}
var location : CLLocation? {
return locationManager.location
} }
get {
if currentCityId != NSUserDefaults.standardUserDefaults().integerForKey(UserDefaultsCity) { func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let newCityId = NSUserDefaults.standardUserDefaults().integerForKey(UserDefaultsCity) if needGetUserCity {
self.currentCityId = newCityId Facade.sharedInstance().getUserCity()
var cities = CitiesManager.sharedInstance().getCities()
var currentCity: City?
if let cityId = cities.indexOf({$0.id == newCityId}) {
currentCity = cities[cityId]
} }
return currentCity?.location
}
return nil
} }
}
var location : CLLocation? {
return locationManager.location
}
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
if needGetUserCity {
Facade.sharedInstance().getUserCity()
}
}
} }
...@@ -77,7 +77,7 @@ class AbonentSettingsRequest { ...@@ -77,7 +77,7 @@ class AbonentSettingsRequest {
validationMessage = validationMessage == "" ? LS("service_callback.label.incorrect_email") : "\(validationMessage); \(LS("service_callback.label.incorrect_email"))" validationMessage = validationMessage == "" ? LS("service_callback.label.incorrect_email") : "\(validationMessage); \(LS("service_callback.label.incorrect_email"))"
isValid = false isValid = false
} }
if ( !isValidPassword(newPassword) ) { if ( newPassword.characters.count > 0 && !isValidPassword(newPassword) ) {
validationMessage = validationMessage == "" ? LS("service_callback.label.incorrect_password") : "\(validationMessage); \(LS("service_callback.label.incorrect_password"))" validationMessage = validationMessage == "" ? LS("service_callback.label.incorrect_password") : "\(validationMessage); \(LS("service_callback.label.incorrect_password"))"
isValid = false isValid = false
} }
......
...@@ -2,15 +2,17 @@ ...@@ -2,15 +2,17 @@
"images" : [ "images" : [
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "1onboarding_profile.png", "filename" : "1_360x640.png",
"scale" : "1x" "scale" : "1x"
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "1_720x1280.png",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "1_1080x1920.png",
"scale" : "3x" "scale" : "3x"
} }
], ],
......
...@@ -2,15 +2,17 @@ ...@@ -2,15 +2,17 @@
"images" : [ "images" : [
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "2onboarding_service.png", "filename" : "2_360x640.png",
"scale" : "1x" "scale" : "1x"
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "2_720x1280.png",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "2_1080x1920.png",
"scale" : "3x" "scale" : "3x"
} }
], ],
......
...@@ -2,15 +2,17 @@ ...@@ -2,15 +2,17 @@
"images" : [ "images" : [
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "3onboarding_payment.png", "filename" : "3_360x640.png",
"scale" : "1x" "scale" : "1x"
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "3_720x1280.png",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "3_1080x1920.png",
"scale" : "3x" "scale" : "3x"
} }
], ],
......
...@@ -706,3 +706,9 @@ ...@@ -706,3 +706,9 @@
"feed_rate_cell_title" = "Нам важно Ваше мнение"; "feed_rate_cell_title" = "Нам важно Ваше мнение";
"feed_rate_cell_description" = "5 звезд помогут улучшить нам приложение. Мы будем благодарны услышать Ваш отзыв!"; "feed_rate_cell_description" = "5 звезд помогут улучшить нам приложение. Мы будем благодарны услышать Ваш отзыв!";
"feed_rate_cell_button" = "Оценить"; "feed_rate_cell_button" = "Оценить";
"hint_enter_city_phone" = "Номер городского телефона";
"done" = "Done";
"NSLocationWhenInUseUsageDescription" = "Your location is needed to determine services provided in your city and Wi-Fi points near you.";
...@@ -705,3 +705,9 @@ ...@@ -705,3 +705,9 @@
"feed_rate_cell_title" = "Нам важно Ваше мнение"; "feed_rate_cell_title" = "Нам важно Ваше мнение";
"feed_rate_cell_description" = "5 звезд помогут улучшить нам приложение. Мы будем благодарны услышать Ваш отзыв!"; "feed_rate_cell_description" = "5 звезд помогут улучшить нам приложение. Мы будем благодарны услышать Ваш отзыв!";
"feed_rate_cell_button" = "Оценить"; "feed_rate_cell_button" = "Оценить";
"hint_enter_city_phone" = "Номер городского телефона";
"done" = "Готово";
"NSLocationWhenInUseUsageDescription" = "Требуется Ваша геолокация для определения Wi-Fi точек рядом с Вами и услуг в Вашем городе";
...@@ -708,3 +708,9 @@ ...@@ -708,3 +708,9 @@
"feed_rate_cell_title" = "Нам важно Ваше мнение"; "feed_rate_cell_title" = "Нам важно Ваше мнение";
"feed_rate_cell_description" = "5 звезд помогут улучшить нам приложение. Мы будем благодарны услышать Ваш отзыв!"; "feed_rate_cell_description" = "5 звезд помогут улучшить нам приложение. Мы будем благодарны услышать Ваш отзыв!";
"feed_rate_cell_button" = "Оценить"; "feed_rate_cell_button" = "Оценить";
"hint_enter_city_phone" = "Номер городского телефона";
"done" = "Готово";
"NSLocationWhenInUseUsageDescription" = "Требуется Ваша геолокация для определения Wi-Fi точек рядом с Вами и услуг в Вашем городе";
...@@ -63,15 +63,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate, MFMailComposeViewControll ...@@ -63,15 +63,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate, MFMailComposeViewControll
// let vc = LoginViewController(nibName: nil, bundle: nil) // let vc = LoginViewController(nibName: nil, bundle: nil)
if UIDevice.currentDevice().userInterfaceIdiom == .Phone { //if UIDevice.currentDevice().userInterfaceIdiom == .Phone {
// window?.rootViewController = vc // window?.rootViewController = vc
window?.rootViewController = storyboard.instantiateViewControllerWithIdentifier("iPhoneRootViewController") window?.rootViewController = storyboard.instantiateViewControllerWithIdentifier("iPhoneRootViewController")
} else { // } else {
let vc = storyboard.instantiateViewControllerWithIdentifier("iPadRootViewController") as? UISplitViewController // let vc = storyboard.instantiateViewControllerWithIdentifier("iPadRootViewController") as? UISplitViewController
vc?.presentsWithGesture = false // vc?.presentsWithGesture = false
// vc?.delegate = splitDelegate // // vc?.delegate = splitDelegate
window?.rootViewController = vc // window?.rootViewController = vc
} // }
window?.makeKeyAndVisible() window?.makeKeyAndVisible()
debugPrint("willFinishLaunchingWithOptions end") debugPrint("willFinishLaunchingWithOptions end")
...@@ -325,7 +325,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, MFMailComposeViewControll ...@@ -325,7 +325,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, MFMailComposeViewControll
} }
func projectSettings() { func projectSettings() {
let locationManager = LocationManager.sharedInstance() // let locationManager = LocationManager.sharedInstance()
if NSUserDefaults.standardUserDefaults().valueForKey("first_opened") == nil { if NSUserDefaults.standardUserDefaults().valueForKey("first_opened") == nil {
NSUserDefaults.standardUserDefaults().setBool(true, forKey: "first_opened") NSUserDefaults.standardUserDefaults().setBool(true, forKey: "first_opened")
} }
...@@ -334,7 +334,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, MFMailComposeViewControll ...@@ -334,7 +334,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, MFMailComposeViewControll
if NSUserDefaults.standardUserDefaults().objectForKey(UserDefaultsCity) == nil { if NSUserDefaults.standardUserDefaults().objectForKey(UserDefaultsCity) == nil {
NSUserDefaults.standardUserDefaults().setInteger(1, forKey: UserDefaultsCity) NSUserDefaults.standardUserDefaults().setInteger(1, forKey: UserDefaultsCity)
//TODO: uncomment when api fix //TODO: uncomment when api fix
locationManager.needGetUserCity = true //locationManager.needGetUserCity = true
} }
var path = NSSearchPathForDirectoriesInDomains( var path = NSSearchPathForDirectoriesInDomains(
......
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.0</string> <string>1.0.2</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>74</string> <string>80</string>
<key>Fabric</key> <key>Fabric</key>
<dict> <dict>
<key>APIKey</key> <key>APIKey</key>
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
</dict> </dict>
</dict> </dict>
<key>NSLocationWhenInUseUsageDescription</key> <key>NSLocationWhenInUseUsageDescription</key>
<string>App would like to use your location.</string> <string>Требуется Ваша геолокация для определения Wi-Fi точек рядом с Вами и услуг в Вашем городе</string>
<key>NSMicrophoneUsageDescription</key> <key>NSMicrophoneUsageDescription</key>
<string>Хотите разрешить включить микрофон?</string> <string>Хотите разрешить включить микрофон?</string>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>
......
//
// UITextField+Extensions.swift
// kt
//
// Created by neox on 07.12.17.
// Copyright © 2017 SimpleCode. All rights reserved.
//
import Foundation
import UIKit
extension UITextField {
@IBInspectable var doneAccessory: Bool{
get{
return self.doneAccessory
}
set (hasDone) {
if hasDone{
addDoneButtonOnKeyboard()
}
}
}
func addDoneButtonOnKeyboard()
{
let doneToolbar: UIToolbar = UIToolbar(frame: CGRect.init(x: 0, y: 0, width: UIScreen.mainScreen().bounds.width, height: 50))
doneToolbar.barStyle = UIBarStyle.Default
let flexSpace = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.FlexibleSpace, target: nil, action: nil)
let done: UIBarButtonItem = UIBarButtonItem(title: LS("done"), style: UIBarButtonItemStyle.Done, target: self, action: #selector(self.doneButtonAction))
let items = [flexSpace, done]
doneToolbar.items = items
doneToolbar.sizeToFit()
self.inputAccessoryView = doneToolbar
}
func doneButtonAction() {
self.resignFirstResponder()
}
}
...@@ -669,15 +669,18 @@ extension LKSettingsViewController { ...@@ -669,15 +669,18 @@ extension LKSettingsViewController {
print(field.text) 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().doneAccessory = true
//cell.getTextField().addTarget(self, action: #selector(textFieldDidChange(_:)), forControlEvents: UIControlEvents.ValueChanged) //cell.getTextField().addTarget(self, action: #selector(textFieldDidChange(_:)), forControlEvents: UIControlEvents.ValueChanged)
//cell.getTextField().addTarget(self, action: #selector(textFieldDidChange(_:)), forControlEvents: UIControlEvents.EditingChanged) //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)
cell.getTextField().doneAccessory = false
} }
} else {
cell.getTextField().doneAccessory = false
} }
} else if let cell = cell as? SettingButtonTableViewCell, let field = _fields[indexPath.section][indexPath.row] as? TextField { } else if let cell = cell as? SettingButtonTableViewCell, let field = _fields[indexPath.section][indexPath.row] as? TextField {
cell.fillCell(self) cell.fillCell(self)
field.withButton = true field.withButton = true
......
...@@ -19,6 +19,7 @@ class LoginViewController: ScrolledViewController, UIViewControllerTransitioning ...@@ -19,6 +19,7 @@ class LoginViewController: ScrolledViewController, UIViewControllerTransitioning
@IBOutlet weak var lblOrMode: UILabel! @IBOutlet weak var lblOrMode: UILabel!
@IBOutlet weak var showPasswordIcon: UIImageView! @IBOutlet weak var showPasswordIcon: UIImageView!
@IBOutlet weak var loginSwitch: UISegmentedControl! @IBOutlet weak var loginSwitch: UISegmentedControl!
@IBOutlet weak var phoneHint: UILabel!
var isShowedAlert : Bool = false var isShowedAlert : Bool = false
let defaults = NSUserDefaults.standardUserDefaults() let defaults = NSUserDefaults.standardUserDefaults()
...@@ -93,7 +94,7 @@ class LoginViewController: ScrolledViewController, UIViewControllerTransitioning ...@@ -93,7 +94,7 @@ class LoginViewController: ScrolledViewController, UIViewControllerTransitioning
showPasswordIcon.userInteractionEnabled = true showPasswordIcon.userInteractionEnabled = true
showPasswordIcon.addGestureRecognizer(showPasswordGesture) showPasswordIcon.addGestureRecognizer(showPasswordGesture)
phoneHint.text = LS("hint_enter_city_phone")
_loginTextField.addTarget(self, action: #selector(LoginViewController.textFieldDidChange(_:)), forControlEvents: UIControlEvents.EditingChanged) _loginTextField.addTarget(self, action: #selector(LoginViewController.textFieldDidChange(_:)), forControlEvents: UIControlEvents.EditingChanged)
...@@ -380,13 +381,13 @@ class LoginViewController: ScrolledViewController, UIViewControllerTransitioning ...@@ -380,13 +381,13 @@ class LoginViewController: ScrolledViewController, UIViewControllerTransitioning
} }
func processingLoggedInComplete() { func processingLoggedInComplete() {
if UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Phone { // if UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Phone {
let mapViewControllerObj = self.storyboard?.instantiateViewControllerWithIdentifier("RootVC") as? RootVC let mapViewControllerObj = self.storyboard?.instantiateViewControllerWithIdentifier("RootVC") as? RootVC
self.navigationController?.pushViewController(mapViewControllerObj!, animated: true) self.navigationController?.pushViewController(mapViewControllerObj!, animated: true)
self.processRequest(false) self.processRequest(false)
} else if UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad { // } else if UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad {
AbonentInfoManager.sharedInstance.updateUserInfo() // AbonentInfoManager.sharedInstance.updateUserInfo()
} // }
} }
func processingLoggedInError(error : NSError) { func processingLoggedInError(error : NSError) {
...@@ -649,15 +650,20 @@ class LoginViewController: ScrolledViewController, UIViewControllerTransitioning ...@@ -649,15 +650,20 @@ class LoginViewController: ScrolledViewController, UIViewControllerTransitioning
_loginTextField.keyboardType = UIKeyboardType.NumberPad _loginTextField.keyboardType = UIKeyboardType.NumberPad
_loginTextField.text = "+7 " _loginTextField.text = "+7 "
phoneHint.hidden = false
// _loginTextField.text = ""//"7172682610" // ntcnjdsq 7278177224 self.view.endEditing(true)
// _passwordTextField.text = ""//"NewPassword1" _loginTextField.text = "+7 727 817-7224"//"7172682610" // ntcnjdsq 7278177224
_passwordTextField.text = "123456789"//"NewPassword1"
} }
func loginSwitchLoginSelected() { func loginSwitchLoginSelected() {
_loginTextField.placeholder = LS("login.type_login") _loginTextField.placeholder = LS("login.type_login")
_loginTextField.keyboardType = UIKeyboardType.Default _loginTextField.keyboardType = UIKeyboardType.Default
_loginTextField.text = "" _loginTextField.text = ""
phoneHint.hidden = true
self.view.endEditing(true)
} }
func textFieldDidChange(textField: UITextField) { func textFieldDidChange(textField: UITextField) {
...@@ -671,4 +677,8 @@ class LoginViewController: ScrolledViewController, UIViewControllerTransitioning ...@@ -671,4 +677,8 @@ class LoginViewController: ScrolledViewController, UIViewControllerTransitioning
return loginSwitch.selectedSegmentIndex == 0 return loginSwitch.selectedSegmentIndex == 0
} }
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
self.view.endEditing(true)
}
} }
...@@ -81,6 +81,10 @@ class UICreateFastPayViewController : UIViewController, UITableViewDelegate, UIT ...@@ -81,6 +81,10 @@ class UICreateFastPayViewController : UIViewController, UITableViewDelegate, UIT
} }
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
self.view.endEditing(true)
}
func loadPhoneView() { func loadPhoneView() {
toggle.selectedSegmentIndex = 0 toggle.selectedSegmentIndex = 0
labelPickRegion.hidden = true labelPickRegion.hidden = true
...@@ -347,6 +351,8 @@ class UICreateFastPayViewController : UIViewController, UITableViewDelegate, UIT ...@@ -347,6 +351,8 @@ class UICreateFastPayViewController : UIViewController, UITableViewDelegate, UIT
} }
} }
} }
func getGuidWithoutDash(input: String ) -> String { func getGuidWithoutDash(input: String ) -> String {
var guid = input var guid = input
......
...@@ -81,8 +81,10 @@ class PromoViewController: UIViewController, UIScrollViewDelegate { ...@@ -81,8 +81,10 @@ class PromoViewController: UIViewController, UIScrollViewDelegate {
let newFrame2 = CGRect(origin: CGPoint(x: self.bottomScrollView.frame.size.width * CGFloat(index), y: 0), size: self.bottomScrollView.frame.size) let newFrame2 = CGRect(origin: CGPoint(x: self.bottomScrollView.frame.size.width * CGFloat(index), y: 0), size: self.bottomScrollView.frame.size)
let descriptionView = PromoDescriptionView.instanceFromNib() let descriptionView = PromoDescriptionView.instanceFromNib()
descriptionView.frame = newFrame2 descriptionView.frame = newFrame2
descriptionView.titleLabel.setTextAndSizeToFit(LS("promo.title_\(index)")) descriptionView.titleLabel.setTextAndSizeToFit("")
descriptionView.descriptionLabel.setTextAndSizeToFit(LS("promo.description_\(index)")) descriptionView.descriptionLabel.setTextAndSizeToFit("")
//descriptionView.titleLabel.setTextAndSizeToFit(LS("promo.title_\(index)"))
//descriptionView.descriptionLabel.setTextAndSizeToFit(LS("promo.description_\(index)"))
self.bottomScrollView.pagingEnabled = true self.bottomScrollView.pagingEnabled = true
self.bottomScrollView.addSubview(descriptionView) self.bottomScrollView.addSubview(descriptionView)
} }
......
...@@ -55,6 +55,10 @@ class CallbackViewController: KeyboardedViewController, UIPickerViewDataSource, ...@@ -55,6 +55,10 @@ class CallbackViewController: KeyboardedViewController, UIPickerViewDataSource,
phoneField.tag = 101 phoneField.tag = 101
emailField.keyboardType = UIKeyboardType.EmailAddress
phoneField.doneAccessory = true
phoneField.keyboardType = UIKeyboardType.PhonePad
// Facade.sharedInstance().getListServerId({ (serverItems) in // Facade.sharedInstance().getListServerId({ (serverItems) in
// //
// self.serverItems = serverItems // self.serverItems = serverItems
......
...@@ -273,14 +273,17 @@ extension ServiceVIPTableViewController { ...@@ -273,14 +273,17 @@ extension ServiceVIPTableViewController {
totalPrice = 0 totalPrice = 0
serviceTotal = "" serviceTotal = ""
for index in 0...numberOfRows()-1 { for index in 0...numberOfRows()-1 {
if ( index == 5 && selection[index] && optionTVPackageNastroiKino ) { if ( index == 5 && selection[index] && optionTVPackageNastroiKino && selection[1] ) {
// skip // skip
print("nastroi kino - true")
} }
else if ( index == 7 && selection[index] && optionRussianPhone ) { else if ( index == 7 && selection[index] && optionRussianPhone ) {
// skip // skip
print("russian phone - true")
} }
else if ( selection[4] && 5 <= index && index <= 9 && (selection[5] || selection[6] || selection[7] || selection[8] || selection[9] )) { else if ( selection[4] && 5 <= index && index <= 9 && (selection[5] || selection[6] || selection[7] || selection[8] || selection[9] )) {
// if vip max is selected, then skip additionals // if vip max is selected, then skip additionals
print("vip max - true")
} }
else if ( selection[index] ) { else if ( selection[index] ) {
totalPrice += prices[index] * amounts[index] totalPrice += prices[index] * amounts[index]
......
...@@ -60,6 +60,9 @@ class WiFiPointsViewController : ViewControllerWithMenu { ...@@ -60,6 +60,9 @@ class WiFiPointsViewController : ViewControllerWithMenu {
registerForWiFiPoints() registerForWiFiPoints()
facade.getWiFiPointsForCity(CitiesManager.sharedInstance().userCity()) facade.getWiFiPointsForCity(CitiesManager.sharedInstance().userCity())
wifiMapView.mapType = .Standard wifiMapView.mapType = .Standard
LocationManager.sharedInstance();
LocationManager.sharedInstance().needGetUserCity = true
} }
override func configureBlueNavbar() { override func configureBlueNavbar() {
......
...@@ -52,6 +52,7 @@ class WiFiTableViewController: ViewControllerWithCustomTitle { ...@@ -52,6 +52,7 @@ class WiFiTableViewController: ViewControllerWithCustomTitle {
self.navigationController?.WhiteLabel() self.navigationController?.WhiteLabel()
navigationItem.leftBarButtonItem = UIBarButtonItem(customView: backButton) navigationItem.leftBarButtonItem = UIBarButtonItem(customView: backButton)
} }
override func configureBlueNavbar() { override func configureBlueNavbar() {
......
...@@ -37,11 +37,14 @@ class OnlinePaymentFieldCell : UITableViewCell { ...@@ -37,11 +37,14 @@ class OnlinePaymentFieldCell : UITableViewCell {
titleLabel.text = LS("online_payment.email") titleLabel.text = LS("online_payment.email")
textField.placeholder = "Email" textField.placeholder = "Email"
textField.text = OnlinePaymentViewController.email != nil ? OnlinePaymentViewController.email! : abonentInfo != nil ? abonentInfo!.email : "" textField.text = OnlinePaymentViewController.email != nil ? OnlinePaymentViewController.email! : abonentInfo != nil ? abonentInfo!.email : ""
textField.keyboardType = UIKeyboardType.EmailAddress
break break
case "payment_summ": case "payment_summ":
titleLabel.text = LS("online_payment.payment_sum") titleLabel.text = LS("online_payment.payment_sum")
textField.placeholder = "" textField.placeholder = ""
textField.text = OnlinePaymentViewController.summ != nil ? OnlinePaymentViewController.summ! : abonentInfo != nil ? "\(abonentInfo!.balance == nil ? 0 : lround(ceil(0 - (abonentInfo!.balance!))))" : "" textField.text = OnlinePaymentViewController.summ != nil ? OnlinePaymentViewController.summ! : abonentInfo != nil ? "\(abonentInfo!.balance == nil ? 0 : lround(ceil(0 - (abonentInfo!.balance!))))" : ""
textField.doneAccessory = true
textField.keyboardType = UIKeyboardType.NumberPad
break break
default: break default: break
} }
......
...@@ -25,7 +25,8 @@ class PublishedCashPayCell : UITableViewCell { ...@@ -25,7 +25,8 @@ class PublishedCashPayCell : UITableViewCell {
func fillCell(bill: Bill) { func fillCell(bill: Bill) {
localizeSubviews() localizeSubviews()
rightResultLabel.text = "\(bill.outMoney ?? "0")" rightResultLabel.text = "\(bill.outMoney ?? "0")"
paymentButton.setTitle("\(LS("published_cashes.pay_by_cash")) \(bill.outMoney ?? "0")", forState: .Normal) //paymentButton.setTitle("\(LS("published_cashes.pay_by_cash")) \(bill.outMoney ?? "0")", forState: .Normal)
paymentButton.setTitle(LS("pay"), forState: .Normal)
} }
private func localizeSubviews() { private func localizeSubviews() {
......
...@@ -88,6 +88,17 @@ class ButtonedCell: UITableViewCell, UITextFieldDelegate { ...@@ -88,6 +88,17 @@ class ButtonedCell: UITableViewCell, UITextFieldDelegate {
alertVC.addButtonHandlers({ (button) -> Void in alertVC.addButtonHandlers({ (button) -> Void in
// todo: fix error // todo: fix error
}, rightButtonHandler: { (button) -> Void in }, rightButtonHandler: { (button) -> Void in
//let limit: Int? = Int(alertVC.textFields[0].text!)
if (alertVC.textFields[0].text!.characters.count > 7 ) {
let alert = UIAlertController(title: "Внимание", message: "Введите меньшее число", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
// self.vc.presentViewController(alert, animated: <#T##Bool#>, completion: <#T##(() -> Void)?##(() -> Void)?##() -> Void#>) .present(alert, animated: true, completion: nil)
self.vc.presentViewController(alert, animated: true, completion: nil)
return
}
let request = ChangeCreditLimitRequest(accessToken: Facade.accessToken!, clientId: Facade.clientId!, serverId: Facade.serverId!, abonentId: "\(Facade.accountId!)", limit: alertVC.textFields[0].text, inAccountUserId: self.vc.deviceSettings!.accountUserId) let request = ChangeCreditLimitRequest(accessToken: Facade.accessToken!, clientId: Facade.clientId!, serverId: Facade.serverId!, abonentId: "\(Facade.accountId!)", limit: alertVC.textFields[0].text, inAccountUserId: self.vc.deviceSettings!.accountUserId)
guard request.validateFields() else { AlertViewUtil.showAlert(LS("incorrect_value")); return } guard request.validateFields() else { AlertViewUtil.showAlert(LS("incorrect_value")); return }
PKNotification.loading(true) PKNotification.loading(true)
......
...@@ -24,9 +24,9 @@ class FeedCollectionViewCell: UICollectionViewCell { ...@@ -24,9 +24,9 @@ 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)) // let tap2 = UITapGestureRecognizer(target: self, action: #selector(FeedCollectionViewCell.tapFunction))
// image.userInteractionEnabled = true // image.userInteractionEnabled = true
// image.addGestureRecognizer(tap2) // image.addGestureRecognizer(tap2)
......
...@@ -46,7 +46,7 @@ class UITextBoxTableViewCell : UIBaseTableViewCell, UITextFieldDelegate { ...@@ -46,7 +46,7 @@ class UITextBoxTableViewCell : UIBaseTableViewCell, UITextFieldDelegate {
override func awakeFromNib() { override func awakeFromNib() {
super.awakeFromNib() super.awakeFromNib()
textField.applyUITextFieldStyle() textField.applyUITextFieldStyle()
} }
override func fillWithCellData(cellData: CellData) { override func fillWithCellData(cellData: CellData) {
...@@ -69,6 +69,8 @@ class UITextBoxTableViewCell : UIBaseTableViewCell, UITextFieldDelegate { ...@@ -69,6 +69,8 @@ class UITextBoxTableViewCell : UIBaseTableViewCell, UITextFieldDelegate {
cellData.addObserver("valueText") { (currentValue) in cellData.addObserver("valueText") { (currentValue) in
self.textField.text = currentValue self.textField.text = currentValue
} }
textField.doneAccessory = true
} }
internal func RenderPrefix() { internal func RenderPrefix() {
......
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