Skip to content

Commit

Permalink
Fixed quick reply button welcome template text issue
Browse files Browse the repository at this point in the history
  • Loading branch information
KartheekPa-Kore committed Aug 30, 2024
1 parent 4c58a99 commit 395627e
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 106 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,7 @@ Enable the webhook channel - This should be either true (in case of Webhook conn
* Open Examples/CocoapodsDemo/KoreBotSDKDemo.xcworkspace in Xcode.
* Run the KoreBotSDKDemo.app in xcode

## SDK V3
* Use this branch https://github.com/Koredotcom/iOS-kore-sdk/tree/SDKV3



## Integrating into your app
#### 1. Setup KoreBotSDK
###### a. Using SPM
Expand Down Expand Up @@ -173,6 +170,15 @@ Enable the webhook channel - This should be either true (in case of Webhook conn
Privacy - Photo Library Usage Description --- Allow access to photo library.
Privacy - Speech Recognition Usage Description --- Speech recognition will be used to determine which words you speak into this device's microphone.

## SDK V3
* Use this branch https://github.com/Koredotcom/iOS-kore-sdk/tree/SDKV3

## How to integrate KoreBotSDK withoutUI
* Use this branch https://github.com/Koredotcom/iOS-kore-sdk/tree/KoreLibrary

## How to enable API based (webhook channel) message communication
###### a. Change the below line in ViewController.swift
let isWebhookEnabled = true // Default it's false.

License
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ class FeedbackBubbleView: BubbleView {
floatRatingView.delegate = self
floatRatingView.contentMode = UIView.ContentMode.scaleAspectFit
floatRatingView.type = .wholeRatings
floatRatingView.emptyImage = UIImage(named: "StarEmpty")
floatRatingView.fullImage = UIImage(named: "StarFull")
floatRatingView.emptyImage = UIImage(named: "StarEmpty", in: bundle, compatibleWith: nil)
floatRatingView.fullImage = UIImage(named: "StarFull", in: bundle, compatibleWith: nil)
floatRatingView.minRating = 1
floatRatingView.maxRating = 5
floatRatingView.rating = 0
Expand All @@ -111,7 +111,7 @@ class FeedbackBubbleView: BubbleView {
self.cardView = UIView(frame:.zero)
self.cardView.translatesAutoresizingMaskIntoConstraints = false
self.addSubview(self.cardView)
cardView.backgroundColor = UIColor.white
cardView.backgroundColor = BubbleViewLeftTint
if #available(iOS 11.0, *) {
self.cardView.roundCorners([ .layerMinXMinYCorner, .layerMaxXMinYCorner, .layerMaxXMaxYCorner], radius: 15.0, borderColor: UIColor.clear, borderWidth: 1.5)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,17 @@ extension QuickReplyWelcomeBubbleView : UICollectionViewDelegate, UICollectionVi
let elements = arrayOfButtons[indexPath.row]
cell.textlabel.text = elements.title
}
cell.bgV.backgroundColor = .clear
let bgColor = (brandingShared.buttonActiveBgColor) ?? "#f3f3f5"
let textColor = (brandingShared.buttonActiveTextColor) ?? "#2881DF"
cell.bgV.backgroundColor = UIColor.init(hexString: bgColor)

cell.textlabel.font = UIFont(name: mediumCustomFont, size: 12.0)
cell.textlabel.textAlignment = .center
cell.textlabel.textColor = themeColor
cell.textlabel.textColor = UIColor.init(hexString: textColor)
cell.textlabel.numberOfLines = 2
cell.imagvWidthConstraint.constant = 0.0

cell.layer.borderColor = themeColor.cgColor
cell.layer.borderColor = UIColor.init(hexString: bgColor).cgColor
cell.layer.borderWidth = 1.5
cell.layer.cornerRadius = 5
cell.backgroundColor = .clear
Expand Down
188 changes: 94 additions & 94 deletions Sources/KoreBotSDK/Widgets/Widgets/Common/KRELocationManager.swift
Original file line number Diff line number Diff line change
@@ -1,97 +1,97 @@
////
//// KRELocationManager.swift
//// KoraSDK
////
//// Created by Srinivas Vasadi on 20/03/19.
//// Copyright © 2019 Srinivas Vasadi. All rights reserved.
////
//
// KRELocationManager.swift
// KoraSDK
//import UIKit
//import CoreLocation
//
// Created by Srinivas Vasadi on 20/03/19.
// Copyright © 2019 Srinivas Vasadi. All rights reserved.
//open class KRELocationManager: NSObject, CLLocationManagerDelegate {
// var lastKnowAccuracy: CGFloat = 0.0
// open var lastKnowRegion: KRERegion?
//
// // MARK: -
// public static let shared = KRELocationManager()
// public var locationManager: CLLocationManager?
//
// // MARK: -
// override init() {
// super.init()
// }
//
// public func setupLocationManager() {
// DispatchQueue.main.async {
// self.locationManager = CLLocationManager()
// self.locationManager?.delegate = self
// self.locationManager?.requestWhenInUseAuthorization()
// }
// }
//
// // MARK: -
// open func updateLastKnowLocation() {
// guard let locationManager = locationManager else {
// return
// }
//
// if lastKnowRegion == nil {
// lastKnowRegion = KRERegion(location: locationManager.location)
// } else {
// lastKnowRegion?.updateRegion(with: locationManager.location)
// }
// }
//
// func updateMonitoredRegions(forCurrentLocation currentLocation: KRERegion?) {
// updateLastKnowLocation()
// }
//
// // MARK: - CLLocationManagerDelegate
// public func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
// // Location Services Status
// switch status {
// case .notDetermined, .restricted, .denied:
// guard let monitoredRegions = locationManager?.monitoredRegions else {
// return
// }
//
// for region in monitoredRegions {
// locationManager?.stopMonitoring(for: region)
// }
// case .authorizedAlways:
// updateMonitoredRegions(forCurrentLocation: lastKnowRegion)
// default:
// break
// }
// }
//
// public func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
// debugPrint("KRELocationManager did failed update location : \(error)")
// }
//}
//

import UIKit
import CoreLocation

open class KRELocationManager: NSObject, CLLocationManagerDelegate {
var lastKnowAccuracy: CGFloat = 0.0
open var lastKnowRegion: KRERegion?

// MARK: -
public static let shared = KRELocationManager()
public var locationManager: CLLocationManager?

// MARK: -
override init() {
super.init()
}

public func setupLocationManager() {
DispatchQueue.main.async {
self.locationManager = CLLocationManager()
self.locationManager?.delegate = self
self.locationManager?.requestWhenInUseAuthorization()
}
}

// MARK: -
open func updateLastKnowLocation() {
guard let locationManager = locationManager else {
return
}

if lastKnowRegion == nil {
lastKnowRegion = KRERegion(location: locationManager.location)
} else {
lastKnowRegion?.updateRegion(with: locationManager.location)
}
}

func updateMonitoredRegions(forCurrentLocation currentLocation: KRERegion?) {
updateLastKnowLocation()
}

// MARK: - CLLocationManagerDelegate
public func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
// Location Services Status
switch status {
case .notDetermined, .restricted, .denied:
guard let monitoredRegions = locationManager?.monitoredRegions else {
return
}

for region in monitoredRegions {
locationManager?.stopMonitoring(for: region)
}
case .authorizedAlways:
updateMonitoredRegions(forCurrentLocation: lastKnowRegion)
default:
break
}
}

public func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
debugPrint("KRELocationManager did failed update location : \(error)")
}
}

// MARK: - KRERegion
open class KRERegion: NSObject {
public var latitude: Double = 0.0
public var longitude: Double = 0.0
public var radius: Double = 0.0
public var isOutside = false
public var accuracy: CLLocationAccuracy = 0

// MARK: -
init?(location: CLLocation?) {
super.init()
latitude = location?.coordinate.latitude ?? 0.0
longitude = location?.coordinate.longitude ?? 0.0
accuracy = location?.horizontalAccuracy ?? 0.0
radius = accuracy
}

func updateRegion(with location: CLLocation?) {
latitude = location?.coordinate.latitude ?? 0.0
longitude = location?.coordinate.longitude ?? 0.0
accuracy = location?.horizontalAccuracy ?? 0.0
radius = accuracy
}
}
//// MARK: - KRERegion
//open class KRERegion: NSObject {
// public var latitude: Double = 0.0
// public var longitude: Double = 0.0
// public var radius: Double = 0.0
// public var isOutside = false
// public var accuracy: CLLocationAccuracy = 0
//
// // MARK: -
// init?(location: CLLocation?) {
// super.init()
// latitude = location?.coordinate.latitude ?? 0.0
// longitude = location?.coordinate.longitude ?? 0.0
// accuracy = location?.horizontalAccuracy ?? 0.0
// radius = accuracy
// }
//
// func updateRegion(with location: CLLocation?) {
// latitude = location?.coordinate.latitude ?? 0.0
// longitude = location?.coordinate.longitude ?? 0.0
// accuracy = location?.horizontalAccuracy ?? 0.0
// radius = accuracy
// }
//}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class KREPanelRequestOperation: KREOperation {
block?(false)
return
}
KRELocationManager.shared.setupLocationManager()
//KRELocationManager.shared.setupLocationManager() //kk
let urlString = panelsUrl(with: userId, server: server, email: email)
let accessToken = String(format: "bearer %@", jwtAccessToken)

Expand Down Expand Up @@ -91,12 +91,14 @@ class KREPanelRequestOperation: KREOperation {

func panelsUrl(with userId: String, server: String, email: String) -> String {
let timezone = TimeZone.current.identifier
/*
KRELocationManager.shared.updateLastKnowLocation()
let lastKnownRegion = KRELocationManager.shared.lastKnowRegion
if let latitude = lastKnownRegion?.latitude, let longitude = lastKnownRegion?.longitude {
return String(format: "\(server)widgetsdk/\(userId)/panels?resolveWidgets=true&from=\(email)")
} else {
return String(format: "\(server)widgetsdk/\(userId)/panels?resolveWidgets=true&from=\(email)")
}
}*/ //kk
return String(format: "\(server)widgetsdk/\(userId)/panels?resolveWidgets=true&from=\(email)")
}
}

0 comments on commit 395627e

Please sign in to comment.