-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix media upgrade dialog configuration
After adding AlertManager class configuring alert dialogs was broken. As a result for Audio, 1-way Video, 2-way Video offers the SDK always showed 2-way Video media upgrade dialog. That was only UI configuration issue, accepting the offer resulted in establishing right media type. This commit fixes alert configuration issue. MOB-3768
- Loading branch information
Showing
13 changed files
with
104 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
GliaWidgets/Sources/Component/MediaUpgrade/MediaUpgradeActionStyle.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
GliaWidgets/Sources/Theme/Alert/ConfirmationAlertConfiguration.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
GliaWidgets/Sources/Theme/Alert/MessageAlertConfiguration.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
GliaWidgets/Sources/Theme/Alert/MultipleMediaUpgradeAlertConfiguration.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
GliaWidgets/Sources/Theme/Alert/ScreenShareOfferAlertConfiguration.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
GliaWidgets/Sources/Theme/Alert/SettingsAlertConfiguration.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
GliaWidgets/Sources/Theme/Alert/SingleActionAlertConfiguration.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
GliaWidgets/Sources/Theme/Alert/SingleMediaUpgradeAlertConfiguration.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
GliaWidgetsTests/Sources/AlertManager/AlertTypeComposerTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
@testable import GliaWidgets | ||
import UIKit | ||
import XCTest | ||
|
||
final class AlertTypeComposerTests: XCTestCase { | ||
var composer: AlertManager.AlertTypeComposer! | ||
|
||
override func setUp() { | ||
super.setUp() | ||
|
||
composer = .init( | ||
environment: .create(with: .mock()), | ||
theme: .mock() | ||
) | ||
} | ||
|
||
func testComposeAlertWithAudioMediaUpgradeInput() throws { | ||
let operatorName = "Mock" | ||
let offer = try CoreSdkClient.MediaUpgradeOffer(type: .audio, direction: .twoWay) | ||
let input: AlertInputType = .mediaUpgrade( | ||
operators: operatorName, | ||
offer: offer, | ||
accepted: nil, | ||
declined: nil, | ||
answer: { _, _ in } | ||
) | ||
let alertType = try composer.composeAlert(input: input) | ||
|
||
switch alertType { | ||
case let .singleMediaUpgrade(configuration, _, _): | ||
let expected = Theme().alertConfiguration.audioUpgrade.withOperatorName(operatorName) | ||
XCTAssertEqual(configuration, expected) | ||
default: | ||
XCTFail("alertType should be singleMediaUpgrade") | ||
} | ||
} | ||
|
||
func testComposeAlertWithOneWayVideoMediaUpgradeInput() throws { | ||
let operatorName = "Mock" | ||
let offer = try CoreSdkClient.MediaUpgradeOffer(type: .video, direction: .oneWay) | ||
let input: AlertInputType = .mediaUpgrade( | ||
operators: operatorName, | ||
offer: offer, | ||
accepted: nil, | ||
declined: nil, | ||
answer: { _, _ in } | ||
) | ||
let alertType = try composer.composeAlert(input: input) | ||
|
||
switch alertType { | ||
case let .singleMediaUpgrade(configuration, _, _): | ||
let expected = Theme().alertConfiguration.oneWayVideoUpgrade.withOperatorName(operatorName) | ||
XCTAssertEqual(configuration, expected) | ||
default: | ||
XCTFail("alertType should be singleMediaUpgrade") | ||
} | ||
} | ||
|
||
func testComposeAlertWithTwoWayVideoMediaUpgradeInput() throws { | ||
let operatorName = "Mock" | ||
let offer = try CoreSdkClient.MediaUpgradeOffer(type: .video, direction: .twoWay) | ||
let input: AlertInputType = .mediaUpgrade( | ||
operators: operatorName, | ||
offer: offer, | ||
accepted: nil, | ||
declined: nil, | ||
answer: { _, _ in } | ||
) | ||
let alertType = try composer.composeAlert(input: input) | ||
|
||
switch alertType { | ||
case let .singleMediaUpgrade(configuration, _, _): | ||
let expected = Theme().alertConfiguration.twoWayVideoUpgrade.withOperatorName(operatorName) | ||
XCTAssertEqual(configuration, expected) | ||
default: | ||
XCTFail("alertType should be singleMediaUpgrade") | ||
} | ||
} | ||
} |