Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WidgetsSDK Release 2.2.0 #810

Merged
merged 40 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
aad3a93
Fix attachment button visibility
Sep 18, 2023
3a9d331
Add landscape snapshot testing capability
rasmustautsglia Sep 15, 2023
02b2f51
Discard delivered message by socket if it is from pending section
igorkravchenko Sep 18, 2023
941b909
Increment project version to 2.1.1
Sep 15, 2023
3fc251a
Convert ConfirmationView form UIKit to SwiftUI
rasmustautsglia Sep 13, 2023
857913d
Add missing accessibility identifier and introduce new view modifier
igorkravchenko Sep 22, 2023
d843f0d
Bump CoreSDK version to 1.1.3
Sep 22, 2023
456b847
Add landscape snapshot tests
rasmustautsglia Sep 21, 2023
8798a0a
Improve snapshot test
rasmustautsglia Sep 25, 2023
9fa59cc
Update strings in Localizable.string
gersonnoboa Aug 16, 2023
0fe8be7
Update strings in call screens
gersonnoboa Aug 16, 2023
53143b5
Update strings in secure conversations welcome screen
gersonnoboa Aug 16, 2023
8b61838
Replace old strings with new strings in some views
gersonnoboa Aug 21, 2023
fa04fc7
Replace old strings in chat, bubble, and alert functionality
gersonnoboa Aug 24, 2023
357fee6
Replace old strings in remaining views
gersonnoboa Aug 28, 2023
26f5ef3
Update strings that don't need a translation layer
gersonnoboa Sep 1, 2023
97909f9
Internalize templated strings
gersonnoboa Sep 4, 2023
b9b6bcc
Introduce string providing mechanism
gersonnoboa Sep 13, 2023
38c2961
StringProviding integration
Sep 21, 2023
f07b367
Get company name from custom locales
gersonnoboa Sep 22, 2023
a350389
Localization updates
Sep 28, 2023
38e3615
Convert ScreenSharingView to SwiftUI
rasmustautsglia Sep 26, 2023
d39c9cf
Apply Global colors to all views
rasmustautsglia Sep 20, 2023
a9389e8
Fix accessiblity identifier for confirmation button
rasmustautsglia Oct 5, 2023
b8181e5
Change accessibility identifier for check messages back
igorkravchenko Oct 6, 2023
40bb97f
Add powered by to leave queue alert
gersonnoboa Oct 11, 2023
4ad1380
Fix visitor code spinner animation
gersonnoboa Oct 11, 2023
b3ef1e6
Change priority of company name algorithm
gersonnoboa Oct 10, 2023
a4a15a2
Adding of PR template (#792)
mikktammeglia Oct 11, 2023
56b6c5f
Update GliaCoreSDK to 1.1.4 and remove GliaWidgetsXcf
igorkravchenko Oct 11, 2023
c2c7012
Connecting state issue fixes
Oct 11, 2023
a1a399b
Remove L10n usage from unit tests
gersonnoboa Oct 12, 2023
e2b1381
Fix hiding of text input for Secure Transcript flow
igorkravchenko Oct 12, 2023
051bc3e
Add support for default values in single choice questions in survey
gersonnoboa Oct 13, 2023
b874712
Fix empty string shown if company name is empty
gersonnoboa Oct 19, 2023
c774f72
Update dependencies declared in `Podfile`
gersonnoboa Oct 19, 2023
61deeaa
Fix dependency update lane
gersonnoboa Oct 19, 2023
7abceee
Increment project version to 2.2.0
Oct 19, 2023
7d07ecf
Update GliaCoreSDK version in Podfile.lock
Oct 20, 2023
522bd99
Fix crash related to force unwrapping and unowned self
gersonnoboa Oct 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
**Jira issue:**
https://glia.atlassian.net/browse/MOB-xxx

**What was solved?**

**Release notes:**

- [ ] Feature
- [ ] Ignore
- [ ] Release notes (Is it clear from the description here?)
- [ ] Migration guide (If changes are needed for integrator already using the SDK - what needs to be communicated? Add underneath please)

**Additional info:**

- [ ] Tests fixed, added? Unit, acceptance, snapshots?
- [ ] Logging necessary for future troubleshooting of customer issues added?

**Screenshots:**
4 changes: 2 additions & 2 deletions 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.1.0'
s.version = '2.2.0'
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 All @@ -19,5 +19,5 @@ Pod::Spec.new do |s|
}
s.exclude_files = ['GliaWidgets/Window/**']

s.dependency 'GliaCoreSDK', '1.1.2'
s.dependency 'GliaCoreSDK', '1.1.5'
end
248 changes: 183 additions & 65 deletions GliaWidgets.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions GliaWidgets/Color.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ enum Color {
static let baseNormal = UIColor(hex: 0x6C7683) // grey
static let baseShade = UIColor(hex: 0x6C7683, alpha: 0.5)
static let baseDark = UIColor(hex: 0x2C0735) // purple
static let lightGrey = UIColor(hex: 0xF3F3F3) // light gray
static let grey = UIColor(hex: 0x999999) // gray
static let background: UIColor = .white
static let baseNeutral = UIColor(hex: 0xF3F3F3) // light gray
}
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.1.0</string>
<string>2.2.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
</dict>
Expand Down
22 changes: 22 additions & 0 deletions GliaWidgets/Localization+StringProviding.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Foundation

extension Localization {
static func tr(
_ table: String,
_ key: String,
_ args: CVarArg...,
fallback value: String,
stringProviding: StringProviding? = Glia.sharedInstance.stringProviding,
bundleManaging: BundleManaging = .live
) -> String {
guard
let stringProviding,
let remoteString = stringProviding.getRemoteString(key)
else {
let format = bundleManaging.current().localizedString(forKey: key, value: value, table: table)
return String(format: format, locale: Locale.current, arguments: args)
}

return remoteString
}
}
14 changes: 14 additions & 0 deletions GliaWidgets/Localization+Templates.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Foundation

extension Localization {
enum Templates {
static let percentValue = "{uploadPercentValue}%"
static let fileNameWithProgressValue = "{uploadedFileName}, {uploadPercentValue}%"
static let operatorName = "{operatorName}"
static let callDuration = "{callDuration}"
static let titleAndBadgeValue = "{buttonTitle}, {badgeValue}"
static let errorMessage = "{message}"
static let downloadWithFileState = "{downloadedFileName}, {downloadedFileState}"
static let downloadWithFileStateAndPercentValue = "{downloadedFileName}, {downloadedFileState} {downloadPercentValue}%"
}
}
546 changes: 306 additions & 240 deletions GliaWidgets/Localization.swift

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions GliaWidgets/Public/Configuration/Configuration+Mock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ extension Configuration {
static func mock(
authMethod: AuthorizationMethod = .siteApiKey(id: "site-api-key-id", secret: "site-api-key-secret"),
environment: Environment = .beta,
site: String = "site-id"
site: String = "site-id",
companyName: String = ""
) -> Self {
Configuration(
authorizationMethod: authMethod,
environment: environment,
site: site
site: site,
companyName: companyName
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion GliaWidgets/Public/Configuration/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public struct Configuration {
visitorContext: VisitorContext? = nil,
pushNotifications: PushNotifications = .disabled,
isWhiteLabelApp: Bool = false,
companyName: String = L10n.Chat.Connect.Queue.firstText
companyName: String = ""
) {
self.authorizationMethod = authorizationMethod
self.environment = environment
Expand Down
43 changes: 42 additions & 1 deletion GliaWidgets/Public/Glia/Glia+StartEngagement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ extension Glia {
interactor.queueIds = queueIds
}

theme.chat.connect.queue.firstText = companyName(
using: interactor,
themeCompanyName: theme.chat.connect.queue.firstText
)

theme.call.connect.queue.firstText = companyName(
using: interactor,
themeCompanyName: theme.call.connect.queue.firstText
)

let viewFactory = ViewFactory(
with: theme,
messageRenderer: messageRenderer,
Expand All @@ -69,6 +79,36 @@ extension Glia {
)
}

func companyName(
using interactor: Interactor,
themeCompanyName: String?
) -> String {
let companyNameStringKey = "general.company_name"

// Company name has been set on the custom locale and is not empty.
if let remoteCompanyName = stringProviding?.getRemoteString(companyNameStringKey),
!remoteCompanyName.isEmpty {
return remoteCompanyName
}
// As the default value in the theme is not empty, it means that
// the integrator has set a value on the theme itself. Return that
// same value.
else if let themeCompanyName, !themeCompanyName.isEmpty {
return themeCompanyName
}
// Integrator has not set a company name in the custom locale,
// but has set it on the configuration.
else if !interactor.configuration.companyName.isEmpty {
return interactor.configuration.companyName
}
// Integrator has not set a company name anywhere, use the default.
else {
// This will return the fallback value every time, because we have
// already determined that the remote string is empty.
return Localization.General.companyNameLocalFallbackOnly
}
}

func startRootCoordinator(
with interactor: Interactor,
viewFactory: ViewFactory,
Expand Down Expand Up @@ -124,7 +164,8 @@ extension Glia {
startSocketObservation: environment.coreSdk.startSocketObservation,
stopSocketObservation: environment.coreSdk.stopSocketObservation,
pushNotifications: environment.coreSdk.pushNotifications,
createSendMessagePayload: environment.coreSdk.createSendMessagePayload
createSendMessagePayload: environment.coreSdk.createSendMessagePayload,
orientationManager: environment.orientationManager
)
)
rootCoordinator?.delegate = { [weak self] event in
Expand Down
15 changes: 9 additions & 6 deletions GliaWidgets/Public/Glia/Glia.Deprecated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,15 @@ extension Glia {
interactor = createdInteractor

if let callback = completion {
createdInteractor.withConfiguration { [weak createdInteractor] in
guard let interactor = createdInteractor else { return }
interactor.state = GliaCore.sharedInstance
.getCurrentEngagement()?.engagedOperator
.map(InteractorState.engaged) ?? interactor.state
callback()
createdInteractor.withConfiguration { [weak createdInteractor, weak self] in
guard let createdInteractor, let self else { return }

self.stringProviding = .init(getRemoteString: self.environment.coreSdk.localeProvider.getRemoteString)

createdInteractor.state = self.environment.coreSdk
.getCurrentEngagement()?.engagedOperator
.map(InteractorState.engaged) ?? createdInteractor.state
callback()
}
}

Expand Down
23 changes: 15 additions & 8 deletions GliaWidgets/Public/Glia/Glia.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public class Glia {
/// Used to monitor engagement state changes.
public var onEvent: ((GliaEvent) -> Void)?

var stringProviding: StringProviding?

public lazy var callVisualizer = CallVisualizer(
environment: .init(
data: environment.data,
Expand All @@ -81,7 +83,8 @@ public class Glia {
uiConfig: { [weak self] in self?.uiConfig },
assetsBuilder: { [weak self] in self?.assetsBuilder ?? .standard },
getCurrentEngagement: environment.coreSdk.getCurrentEngagement,
eventHandler: onEvent
eventHandler: onEvent,
orientationManager: environment.orientationManager
)
)
var rootCoordinator: EngagementCoordinator?
Expand Down Expand Up @@ -124,12 +127,16 @@ public class Glia {
interactor = createdInteractor

if let callback = completion {
createdInteractor.withConfiguration { [weak createdInteractor] in
guard let interactor = createdInteractor else { return }
interactor.state = GliaCore.sharedInstance
.getCurrentEngagement()?.engagedOperator
.map(InteractorState.engaged) ?? interactor.state
callback()
createdInteractor.withConfiguration { [weak createdInteractor, weak self] in
guard let createdInteractor, let self else { return }

self.stringProviding = .init(getRemoteString: self.environment.coreSdk.localeProvider.getRemoteString)

createdInteractor.state = self.environment.coreSdk
.getCurrentEngagement()?.engagedOperator
.map(InteractorState.engaged) ?? createdInteractor.state

callback()
}
}

Expand All @@ -143,7 +150,7 @@ public class Glia {
rootCoordinator?.minimize()
}

/// Maximizes engagement view if ongoing engagment exists.
/// Maximizes engagement view if ongoing engagement exists.
/// Throws error if ongoing engagement not exist.
/// Use this function for resuming engagement view If bubble is hidden programmatically and you need to
/// present engagement view.
Expand Down
Loading