Commit bf925785 by Olzhas Aldabergenov

fixing chat screen. simplified service view

parent aa50502f
......@@ -83,7 +83,6 @@
3E197E611F44454A000BC88D /* FeedPackagesXIBView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E197E601F44454A000BC88D /* FeedPackagesXIBView.swift */; };
3E197E651F4563BB000BC88D /* FeedCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E197E641F4563BB000BC88D /* FeedCollectionViewCell.swift */; };
3E197E781F4D2C87000BC88D /* MainHelpViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E197E771F4D2C87000BC88D /* MainHelpViewController.swift */; };
3E1D32241F9F54CA00373ADA /* XCGLogger.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 984CED471D7F0AC20096B2BF /* XCGLogger.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
3E2C3E8E1EFA482D00E553CD /* GetCodeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E2C3E8D1EFA482D00E553CD /* GetCodeViewController.swift */; };
3E2C3E9B1EFCB17E00E553CD /* Validator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E2C3E9A1EFCB17E00E553CD /* Validator.swift */; };
3E2E1E821F84DB0100DC0FE5 /* LKSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E2E1E811F84DB0100DC0FE5 /* LKSettingsViewController.swift */; };
......@@ -526,16 +525,6 @@
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
3E1D32221F9F546700373ADA /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
3E1D32241F9F54CA00373ADA /* XCGLogger.framework in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
984CED8A1D7F15B80096B2BF /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
......@@ -2317,7 +2306,6 @@
984CED8A1D7F15B80096B2BF /* Embed Frameworks */,
50FC3F9466E4A5C981E595DE /* [CP] Embed Pods Frameworks */,
EEFCC45EB3F16D936889FAAA /* [CP] Copy Pods Resources */,
3E1D32221F9F546700373ADA /* CopyFiles */,
);
buildRules = (
);
......
......@@ -90,11 +90,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kt/ViewControllers/Cabinet/Login/LoginViewController.swift"
timestampString = "530690727.240538"
timestampString = "530792686.165663"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "601"
endingLineNumber = "601"
startingLineNumber = "595"
endingLineNumber = "595"
landmarkName = "applicationWillResignActive()"
landmarkType = "7">
</BreakpointContent>
......@@ -106,11 +106,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kt/ViewControllers/Cabinet/Login/LoginViewController.swift"
timestampString = "530690727.240538"
timestampString = "530792686.165663"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "601"
endingLineNumber = "601"
startingLineNumber = "595"
endingLineNumber = "595"
landmarkName = "applicationWillResignActive()"
landmarkType = "7">
</BreakpointContent>
......@@ -122,11 +122,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kt/ViewControllers/Cabinet/Login/LoginViewController.swift"
timestampString = "530690727.240538"
timestampString = "530792686.165663"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "571"
endingLineNumber = "571"
startingLineNumber = "565"
endingLineNumber = "565"
landmarkName = "showHelpAlert()"
landmarkType = "7">
</BreakpointContent>
......@@ -138,11 +138,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kt/ViewControllers/Cabinet/Login/LoginViewController.swift"
timestampString = "530690727.240538"
timestampString = "530792686.165663"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "576"
endingLineNumber = "576"
startingLineNumber = "570"
endingLineNumber = "570"
landmarkName = "showHelpAlert()"
landmarkType = "7">
</BreakpointContent>
......@@ -186,11 +186,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kt/ViewControllers/Service/ServiceItemScrollViewController.swift"
timestampString = "530712033.421239"
timestampString = "530767730.950769"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "280"
endingLineNumber = "280"
startingLineNumber = "287"
endingLineNumber = "287"
landmarkName = "prepareForSegue(segue:sender:)"
landmarkType = "7">
</BreakpointContent>
......@@ -198,22 +198,6 @@
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kt/ViewControllers/Service/ServiceItemScrollViewController.swift"
timestampString = "530713210.852928"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "286"
endingLineNumber = "286"
landmarkName = "prepareForSegue(_:sender:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
......
......@@ -19,7 +19,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>57</string>
<string>58</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
......
......@@ -14,6 +14,8 @@ class BotViewController: UIViewController {
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var circleButton: UIView!
@IBOutlet weak var textFieldConstraint: NSLayoutConstraint!
weak var activeField: UITextField?
var messagesList : [BotResult] = []
......@@ -28,20 +30,46 @@ class BotViewController: UIViewController {
let tap = UITapGestureRecognizer(target: self, action: #selector(BotViewController.sendButtonTap))
self.circleButton.userInteractionEnabled = true
self.circleButton.addGestureRecognizer(tap)
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(BotViewController.keyboardWillShow(_:)), name: UIKeyboardWillShowNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(BotViewController.keyboardWillHide(_:)), name: UIKeyboardWillHideNotification, object: nil)
addMessage("Здравствуйте! Я Ваш помощник на сайте Казахтелеком. Постараюсь ответить на большинство Ваших вопросов.", type: 0)
}
func keyboardWillShow(notification: NSNotification) {
if let keyboardSize = (notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.CGRectValue() {
self.view.frame.origin.y -= keyboardSize.height
}
}
func keyboardWillHide(notification: NSNotification) {
if let keyboardSize = (notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.CGRectValue() {
self.view.frame.origin.y += keyboardSize.height
NSNotificationCenter.defaultCenter().addObserver(self,
selector: #selector(self.keyboardNotification(_:)),
name: UIKeyboardWillChangeFrameNotification,
object: nil)
initializeTap()
}
func initializeTap() {
let tap: UITapGestureRecognizer = UITapGestureRecognizer(
target: self,
action: #selector(dismissKeyboard))
view.addGestureRecognizer(tap)
}
func dismissKeyboard() {
view.endEditing(true)
}
func keyboardNotification(notification: NSNotification) {
if let userInfo = notification.userInfo {
let endFrame = (userInfo[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.CGRectValue()
let duration:NSTimeInterval = (userInfo[UIKeyboardAnimationDurationUserInfoKey] as? NSNumber)?.doubleValue ?? 0
let animationCurveRawNSN = userInfo[UIKeyboardAnimationCurveUserInfoKey] as? NSNumber
let animationCurveRaw = animationCurveRawNSN?.unsignedLongValue ?? UIViewAnimationOptions.CurveEaseInOut.rawValue
let animationCurve:UIViewAnimationOptions = UIViewAnimationOptions(rawValue: animationCurveRaw)
if endFrame?.origin.y >= UIScreen.mainScreen().bounds.size.height {
self.textFieldConstraint?.constant = 0.0
} else {
self.textFieldConstraint?.constant = endFrame?.size.height ?? 0.0
}
UIView.animateWithDuration(duration,
delay: NSTimeInterval(0),
options: animationCurve,
animations: { self.view.layoutIfNeeded() },
completion: nil)
}
}
......@@ -132,20 +160,26 @@ class BotViewController: UIViewController {
if messageField.text?.characters.count == 0 {
return
}
addMessage(messageField.text!, type: 1)
Facade.sharedInstance().askBot(messageField.text!, onSuccess: { (botResult) in
let messageStr = messageField.text!
self.messageField.text = ""
addMessage(messageStr, type: 1)
self.tableView.scrollToBottom(true)
Facade.sharedInstance().askBot(messageStr, onSuccess: { (botResult) in
if botResult.count != 0 {
self.messagesList.append(botResult)
self.tableView.reloadData()
} else {
self.addMessage("Извините, по вашему запросу ничего не нашлось", type: 0)
}
self.messageField.text = ""
self.view.endEditing(true)
self.tableView.scrollToBottom(true)
}) { (error) in
AlertViewUtil.showErrorAlert(error, vc: self)
}
//dismissKeyboard()
}
}
......
......@@ -37,13 +37,7 @@ class LoginViewController: ScrolledViewController, UIViewControllerTransitioning
}
private func registerObservers() {
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(BotViewController.keyboardWillShow(_:)),
name: UIKeyboardWillShowNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(BotViewController.keyboardWillHide(_:)),
name: UIKeyboardWillHideNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(LoginViewController.updateUserInfoSuccess(_:)),
name: Facade.AbonentInfoNotificationNames.Success, object: nil)
......
......@@ -10,4 +10,11 @@ import Foundation
class ServiceDetailsViewController: UIViewController {
@IBOutlet weak var webView: UIWebView!
var htmlToLoad = ""
override func viewDidLoad() {
super.viewDidLoad()
webView.loadHTMLString(htmlToLoad, baseURL: nil)
}
}
......@@ -38,6 +38,7 @@ class ServiceItemScrollViewController: UIViewController, UITableViewDataSource,
var webViewHeight: NSLayoutConstraint!
@IBOutlet weak var webViewWrapperView: UIView!
var heightForRow: [Int: CGFloat] = [Int: CGFloat]()
var htmlToLoad : String?
@IBAction func connectButton(sender: AnyObject) {
......@@ -210,6 +211,9 @@ class ServiceItemScrollViewController: UIViewController, UITableViewDataSource,
self.containerHeightConstrant.constant = 80
}
self.htmlToLoad = self.observeHtml(respServiceItem.html)
self.webView.loadHTMLString(self.observeHtml(respServiceItem.html), baseURL: nil)
// let delay = 1 * Double(NSEC_PER_SEC)
......@@ -267,9 +271,6 @@ class ServiceItemScrollViewController: UIViewController, UITableViewDataSource,
vc.title = LS("service.connect")
}
break
case Segue.ShowServiceDetails:
print ("open service details")
break
default:
break
}
......@@ -280,7 +281,7 @@ class ServiceItemScrollViewController: UIViewController, UITableViewDataSource,
vc.serviceItem = serviceItemForLoading
} else if ( segue.identifier == Segue.ShowServiceDetails) {
let vc = segue.destinationViewController as! ServiceDetailsViewController
vc.htmlToLoad = self.htmlToLoad!
} else {
let vc = segue.destinationViewController as! ServiceCallbackController
vc.serviceItem = serviceItemForLoading
......
......@@ -27,7 +27,11 @@ class ServiceCell: UITableViewCell {
if ( servicesItem.imageUrl != nil ) {
ImageLoader.sharedLoader.imageForUrl(servicesItem.imageUrl!) { (image, url) in
self.backgroundImage.image = image?.imageWithRenderingMode(.AlwaysOriginal)
if ( image != nil ) {
self.backgroundImage.image = image?.imageWithRenderingMode(.AlwaysOriginal)
} else {
self.backgroundImage.backgroundColor = UIColor.lightGrayColor()
}
}
self.iconView.alpha = 0.0
self.nameLabel.textColor = UIColor.blackColor()
......
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