Skip to content

Commit

Permalink
Merge pull request #691 from salemove/release/2.0.3
Browse files Browse the repository at this point in the history
Release 2.0.3
  • Loading branch information
yurii-glia authored Jul 20, 2023
2 parents 6838b85 + d3ccde9 commit 491eaa0
Show file tree
Hide file tree
Showing 18 changed files with 78 additions and 50 deletions.
2 changes: 1 addition & 1 deletion GliaWidgets.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'GliaWidgets'
s.version = '2.0.2'
s.version = '2.0.3'
s.summary = 'The Glia iOS Widgets library'
s.description = 'The Glia Widgets library allows to integrate easily a UI/UX for Glia\'s Digital Customer Service platform'
s.homepage = 'https://github.com/salemove/ios-sdk-widgets'
Expand Down
2 changes: 1 addition & 1 deletion GliaWidgets/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>2.0.2</string>
<string>2.0.3</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
</dict>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ extension CallVisualizer {
viewFactory: environment.viewFactory
)
mediaUpgradeViewController = alert
environment
.presenter
.getInstance()?
.present(alert, animated: true)
presentAlert(alert)
}

func offerMediaUpgrade(
Expand All @@ -103,10 +100,7 @@ extension CallVisualizer {
viewFactory: environment.viewFactory
)
mediaUpgradeViewController = alert
environment
.presenter
.getInstance()?
.present(alert, animated: true)
presentAlert(alert)
}

func handleAcceptedUpgrade() {
Expand Down Expand Up @@ -181,7 +175,7 @@ extension CallVisualizer {
}()
private var visitorCodeCoordinator: VisitorCodeCoordinator?
private var screenSharingCoordinator: ScreenSharingCoordinator?
private var videoCallCoordinator: VideoCallCoodinator?
private var videoCallCoordinator: VideoCallCoordinator?
private var mediaUpgradeViewController: AlertViewController?

private func buildScreenSharingViewController(uiConfig: RemoteConfiguration? = nil) -> UIViewController {
Expand All @@ -206,7 +200,7 @@ extension CallVisualizer {
}

private func buildVideoCallViewController() -> UIViewController {
let coordinator = VideoCallCoodinator(
let coordinator = VideoCallCoordinator(
environment: .init(
data: environment.data,
uuid: environment.uuid,
Expand Down Expand Up @@ -360,6 +354,23 @@ private extension CallVisualizer.Coordinator {
centerY = superview.frame.height - bubbleView.frame.height / 2 - superview.safeAreaInsets.bottom
}
}

func presentAlert(_ alert: AlertViewController) {
let topController = environment.presenter.getInstance()

// If replaceable is not nil, that means some AlertViewController is presented,
// and we need to decide whether to replace presented alert.
// Otherwise, just present requested alert.
guard let replaceable = topController as? Replaceable else {
topController?.present(alert, animated: true)
return
}
let presenting = replaceable.presentingViewController
guard replaceable.isReplaceable(with: alert) else { return }
replaceable.dismiss(animated: true) {
presenting?.present(alert, animated: true)
}
}
}

extension CallVisualizer {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import UIKit

public extension CallVisualizer {
extension CallVisualizer {
final class ScreenSharingViewController: UIViewController {
private lazy var screenSharingView = ScreenSharingView(props: props.screenSharingViewProps)
private var props: Props
Expand All @@ -18,11 +18,11 @@ public extension CallVisualizer {

// MARK: - View lifecycle

public override func loadView() {
override func loadView() {
view = screenSharingView
}

public override func viewDidLoad() {
override func viewDidLoad() {
super.viewDidLoad()
renderProps()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

extension CallVisualizer.VideoCallCoodinator {
extension CallVisualizer.VideoCallCoordinator {
enum DelegateEvent {
case close
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

extension CallVisualizer.VideoCallCoodinator {
extension CallVisualizer.VideoCallCoordinator {
struct Environment {
var data: FoundationBased.Data
var uuid: () -> UUID
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import UIKit

extension CallVisualizer {
final class VideoCallCoodinator: FlowCoordinator {
final class VideoCallCoordinator: FlowCoordinator {
typealias ViewController = UIViewController

var delegate: ((DelegateEvent) -> Void)?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import UIKit

public extension CallVisualizer {
extension CallVisualizer {
final class VideoCallViewController: UIViewController {
private let videoCallView: VideoCallView
private let environment: Environment
Expand Down Expand Up @@ -36,11 +36,11 @@ public extension CallVisualizer {

// MARK: - Override

public override func loadView() {
override func loadView() {
view = videoCallView
}

public override func viewDidLoad() {
override func viewDidLoad() {
super.viewDidLoad()
proximityManager = .init(
view: self.view,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ extension CallVisualizer {
title = L10n.Call.Video.title
callDuration = ""
topLabelHidden = false
endScreenShareButtonHidden = true
endScreenShareButtonHidden = environment.screenShareHandler.status().value == .stopped
statusStyle = style.connect.connecting

self.call.kind.addObserver(self) { [weak self] kind, _ in
Expand Down Expand Up @@ -456,12 +456,6 @@ private extension CallVisualizer.VideoCallViewModel {
}

func showConnected() {
switch environment.screenShareHandler.status().value {
case .started:
endScreenShareButtonHidden = false
case .stopped:
break
}
let engagedOperator = environment.engagedOperator()
setConnectViewState(.connected(name: engagedOperator?.firstName, imageUrl: engagedOperator?.picture?.url), animated: true)
connectOperatorSize = .init(size: .large, animated: true)
Expand Down
2 changes: 0 additions & 2 deletions GliaWidgets/Sources/View/Chat/ChatView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,6 @@ extension ChatView {
)

tapGesture.cancelsTouchesInView = false

tableView.addGestureRecognizer(tapGesture)
}

@objc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ class ChatMessageEntryView: BaseView {

var isChoiceCardModeEnabled: Bool {
didSet {
isEnabled = !isChoiceCardModeEnabled
if isChoiceCardModeEnabled {
textView.resignFirstResponder()
}

updatePickMediaButtonVisibility(mediaPickerButtonVisibility)
updatePlaceholderText()
}
Expand Down
19 changes: 11 additions & 8 deletions GliaWidgets/Sources/ViewModel/Call/Data/Call.swift
Original file line number Diff line number Diff line change
Expand Up @@ -234,27 +234,30 @@ class Call {
private func updateMediaStream<Streamable>(_ mediaStream: ObservableValue<MediaStream<Streamable>>,
with stream: Streamable,
isRemote: Bool) {
let mediaStreamValue: MediaStream<Streamable>
defer {
mediaStream.value = mediaStreamValue
updateStarted()
}
if isRemote {
switch mediaStream.value {
case .none, .remote:
mediaStream.value = .remote(stream)
mediaStreamValue = .remote(stream)
case .local(let local):
mediaStream.value = .twoWay(local: local, remote: stream)
mediaStreamValue = .twoWay(local: local, remote: stream)
case .twoWay(local: let local, remote: _):
mediaStream.value = .twoWay(local: local, remote: stream)
mediaStreamValue = .twoWay(local: local, remote: stream)
}
} else {
switch mediaStream.value {
case .none, .local:
mediaStream.value = .local(stream)
mediaStreamValue = .local(stream)
case .remote(let remote):
mediaStream.value = .twoWay(local: stream, remote: remote)
mediaStreamValue = .twoWay(local: stream, remote: remote)
case .twoWay(local: _, remote: let remote):
mediaStream.value = .twoWay(local: stream, remote: remote)
mediaStreamValue = .twoWay(local: stream, remote: remote)
}
}

updateStarted()
}

private func updateStarted() {
Expand Down
2 changes: 1 addition & 1 deletion GliaWidgets/StaticValues.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ final class StaticValues {
/// version cannot be changed by integrators, so this ensures that our code will
/// always have the correct version regardless of what our integrators do with
/// our plist files.
static let sdkVersion = "2.0.2"
static let sdkVersion = "2.0.3"
}
27 changes: 27 additions & 0 deletions GliaWidgetsTests/CallVisualizer/VideoCall/VideoCallTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,31 @@ final class VideoCallTests: XCTestCase {
headerProps.backButton?.tap()
XCTAssertEqual(wasExecuted, true)
}

func test_endScreenSharingIsVisible() {
let viewModel = mockViewModel(with: .started)
let props = viewModel.makeProps()

XCTAssertFalse(props.videoCallViewProps.endScreenShareButtonHidden)
}

func test_endScreenSharingIsHidden() {
let viewModel = mockViewModel(with: .stopped)
let props = viewModel.makeProps()

XCTAssertTrue(props.videoCallViewProps.endScreenShareButtonHidden)
}
}

private extension VideoCallTests {
func mockViewModel(
with screenSharingStatus: ScreenSharingStatus
) -> CallVisualizer.VideoCallViewModel {
var screenShareHandlerMock = ScreenShareHandler.mock
screenShareHandlerMock.status = { .init(with: screenSharingStatus) }
var environment = CallVisualizer.VideoCallViewModel.Environment.mock
environment.screenShareHandler = screenShareHandlerMock

return .mock(environment: environment)
}
}
2 changes: 1 addition & 1 deletion GliaWidgetsTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>2.0.2</string>
<string>2.0.3</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ let package = Package(
),
.binaryTarget(
name: "GliaWidgetsXcf",
url: "https://github.com/salemove/ios-sdk-widgets/releases/download/2.0.1/GliaWidgetsXcf.xcframework.zip",
checksum: "26f6e0bc6e32f4223f635d8de8aa4877338aed7a323f2127a05980f347ac1f9a"
url: "https://github.com/salemove/ios-sdk-widgets/releases/download/2.0.3/GliaWidgetsXcf.xcframework.zip",
checksum: "23d6a8854f62e4c77e0f4e254c78be8808d1deaec308af36197160d1101979f8"
),
.target(
name: "GliaWidgets",
Expand Down
4 changes: 2 additions & 2 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PODS:
- AccessibilitySnapshot/Core
- SnapshotTesting (~> 1.0)
- GliaCoreDependency (1.2)
- GliaCoreSDK (1.0.3):
- GliaCoreSDK (1.0.5):
- GliaCoreDependency (= 1.2)
- TwilioVoice (= 6.3.1)
- WebRTC-lib (= 96.0.0)
Expand Down Expand Up @@ -37,7 +37,7 @@ SPEC REPOS:
SPEC CHECKSUMS:
AccessibilitySnapshot: a91e4a69f870188b51f43863d9fc7269d07cdd93
GliaCoreDependency: 87b3897f0d85321ecf77f1faa829211ad527e54d
GliaCoreSDK: 08b8e50f47aed46ce3f52b4a668f57b671be75ec
GliaCoreSDK: d0ea050f43cd67f467ab3362c72266accfd11373
PureLayout: 5fb5e5429519627d60d079ccb1eaa7265ce7cf88
SnapshotTesting: 6141c48b6aa76ead61431ca665c14ab9a066c53b
SwiftLint: 13280e21cdda6786ad908dc6e416afe5acd1fcb7
Expand Down
2 changes: 1 addition & 1 deletion TestingApp/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>2.0.2</string>
<string>2.0.3</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand Down

0 comments on commit 491eaa0

Please sign in to comment.