Skip to content

Commit

Permalink
Merge pull request #320 from salemove/dev
Browse files Browse the repository at this point in the history
Glia Widgets SDK Release 0.9.0
  • Loading branch information
dukhovnyi authored Jun 23, 2022
2 parents af71a0a + b0afc45 commit 7fe359f
Show file tree
Hide file tree
Showing 188 changed files with 4,664 additions and 715 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,11 @@ fastlane/test_output
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/

# SnapshotTesting
#
# Image based snapshots are to be retrieved separately from deidcated repo with Git LFS.
# The reason Git LFS is not used for current repo is because Swift Package Manager fails to work properly
# with it.
SnapshotTests/__Snapshots__/
.vscode
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 = '0.8.1'
s.version = '0.9.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,7 +19,7 @@ Pod::Spec.new do |s|
}
s.exclude_files = ['GliaWidgets/Window/**']

s.dependency 'SalemoveSDK', '0.33.3'
s.dependency 'SalemoveSDK', '0.33.4'
s.dependency 'PureLayout', '~>3.1'
s.dependency 'lottie-ios', '3.2.3'
end
500 changes: 392 additions & 108 deletions GliaWidgets.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
extension AttachmentSourceItemStyle {
/// Accessibility properties for AttachmentSourceItemStyle.
public struct Accessibility: Equatable {
/// Flag that provides font dynamic type by setting `adjustsFontForContentSizeCategory` for component that supports it.
public var isFontScalingEnabled: Bool

///
/// - Parameter isFontScalingEnabled: Flag that provides font dynamic type by setting `adjustsFontForContentSizeCategory` for component that supports it.
public init(isFontScalingEnabled: Bool) {
self.isFontScalingEnabled = isFontScalingEnabled
}

/// Accessibility is not supported intentionally.
public static let unsupported = Self(isFontScalingEnabled: false)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public class AttachmentSourceItemStyle {
/// Color of the icon.
public var iconColor: UIColor?

/// Accessibility related properties.
public var accessibility: Accessibility

///
/// - Parameters:
/// - kind: Kind of an item shown in the attachment source list view (e.g. Photo Library, Take Photo or Browse).
Expand All @@ -28,20 +31,23 @@ public class AttachmentSourceItemStyle {
/// - titleColor: Color of the title.
/// - icon: Icon of the item. Default is one of three icons (Take Photo, Photo Library or Browse) corresponding to the kind of attachment.
/// - iconColor: Color of the icon.
/// - accessibility: Accessibility related properties.
///
public init(
kind: AtttachmentSourceItemKind,
title: String,
titleFont: UIFont,
titleColor: UIColor,
icon: UIImage?,
iconColor: UIColor?
iconColor: UIColor?,
accessibility: Accessibility = .unsupported
) {
self.kind = kind
self.title = title
self.titleFont = titleFont
self.titleColor = titleColor
self.icon = icon
self.iconColor = iconColor
self.accessibility = accessibility
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ class AttachmentSourceItemView: UIView {
titleLabel.font = style.titleFont
titleLabel.textColor = style.titleColor

accessibilityTraits = .button
accessibilityLabel = style.title
isAccessibilityElement = true

setFontScalingEnabled(
style.accessibility.isFontScalingEnabled,
for: titleLabel
)

stackView.axis = .horizontal
stackView.spacing = 10
stackView.addArrangedSubview(titleLabel)
Expand Down
24 changes: 24 additions & 0 deletions GliaWidgets/Component/Bubble/BubbleStyle.Accessibility.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
extension BubbleStyle {
/// Accessibility properties for BubbleStyle.
public struct Accessibility: Equatable {
/// Accessibility label for BubbleView.
public var label: String
/// Accessibility hint for BubbleView.
public var hint: String

///
/// - Parameters:
/// - label: Accessibility label for BubbleView.
/// - hint: Accessibility hint for BubbleView.
public init(label: String, hint: String) {
self.label = label
self.hint = hint
}

/// Accessibility is not supported intentionally.
public static let unsupported = Self(
label: "",
hint: ""
)
}
}
9 changes: 8 additions & 1 deletion GliaWidgets/Component/Bubble/BubbleStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,26 @@ public class BubbleStyle {

/// Style of a visitor's on hold state overlay.
public var onHoldOverlay: OnHoldOverlayStyle

/// Accessibility related properties.
public var accessibility: Accessibility

///
/// - Parameters:
/// - userImage: Style of a user's image shown in the bubble.
/// - badge: Style of a badge shown on the bubble.
/// - onHoldOverlay: Style of a visitor's on hold state overlay.
/// - accessibility: Accessibility related properties.
///
public init(
userImage: UserImageStyle,
badge: BadgeStyle? = nil,
onHoldOverlay: OnHoldOverlayStyle = .bubble
onHoldOverlay: OnHoldOverlayStyle = .bubble,
accessibility: Accessibility = .unsupported
) {
self.userImage = userImage
self.badge = badge
self.onHoldOverlay = onHoldOverlay
self.accessibility = accessibility
}
}
4 changes: 2 additions & 2 deletions GliaWidgets/Component/Bubble/BubbleView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ class BubbleView: UIView {
addGestureRecognizer(panRecognizer)
isAccessibilityElement = true
accessibilityTraits = [.button]
accessibilityLabel = "Operator Avatar"
accessibilityHint = "Deactivates minimize."
accessibilityLabel = style.accessibility.label
accessibilityHint = style.accessibility.hint

update(kind)
}
Expand Down
11 changes: 9 additions & 2 deletions GliaWidgets/Component/Button/Action/ActionButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ class ActionButton: UIButton {

var title: String? {
get { return title(for: .normal) }
set { setTitle(newValue, for: .normal) }
set {
setTitle(newValue, for: .normal)
accessibilityLabel = newValue
}
}

private let style: ActionButtonStyle
Expand Down Expand Up @@ -60,10 +63,14 @@ class ActionButton: UIButton {
setTitleColor(style.titleColor, for: .normal)
titleLabel?.textAlignment = .center
setTitle(style.title, for: .normal)
titleLabel?.adjustsFontSizeToFitWidth = true

addTarget(self, action: #selector(tapped), for: .touchUpInside)

accessibilityLabel = style.title
setFontScalingEnabled(
style.accessibility.isFontScalingEnabled,
for: self
)
}

private func layout() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
extension ActionButtonStyle {
/// Accessibility properties of ActionButtonStyle.
public struct Accessibility: Equatable {
/// Accessibility label.
public var label: String

/// Flag that provides font dynamic type by setting `adjustsFontForContentSizeCategory` for component that supports it.
public var isFontScalingEnabled: Bool

///
/// - Parameters:
/// - label: Accessibility label.
/// - isFontScalingEnabled: Flag that provides font dynamic type by setting `adjustsFontForContentSizeCategory` for component that supports it.
public init(
label: String,
isFontScalingEnabled: Bool
) {
self.label = label
self.isFontScalingEnabled = isFontScalingEnabled
}

/// Accessibility is not supported intentionally.
public static let unsupported = Self(
label: "",
isFontScalingEnabled: false
)
}
}
8 changes: 7 additions & 1 deletion GliaWidgets/Component/Button/Action/ActionButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public struct ActionButtonStyle {
/// Border color of the button.
public var borderColor: UIColor?

/// Accessibility related properties.
public var accessibility: Accessibility

///
/// - Parameters:
/// - title: Title of the button.
Expand All @@ -48,6 +51,7 @@ public struct ActionButtonStyle {
/// - shadowOpacity: Shadow opacity of the button.
/// - borderWidth: Border width of the button.
/// - borderColor: Border color of the button.
/// - accessibility: Accessibility related properties.
///
public init(
title: String,
Expand All @@ -60,7 +64,8 @@ public struct ActionButtonStyle {
shadowRadius: CGFloat? = 2.0,
shadowOpacity: Float? = nil,
borderWidth: CGFloat? = nil,
borderColor: UIColor? = nil
borderColor: UIColor? = nil,
accessibility: Accessibility = .unsupported
) {
self.title = title
self.titleFont = titleFont
Expand All @@ -73,5 +78,6 @@ public struct ActionButtonStyle {
self.shadowOpacity = shadowOpacity
self.borderWidth = borderWidth
self.borderColor = borderColor
self.accessibility = accessibility
}
}
2 changes: 2 additions & 0 deletions GliaWidgets/Component/Button/Header/HeaderButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class HeaderButton: UIButton {
setImage(style.image, for: .normal)
setImage(style.image, for: .highlighted)
addTarget(self, action: #selector(tapped), for: .touchUpInside)
accessibilityLabel = style.accessibility.label
accessibilityHint = style.accessibility.hint
}

private func layout() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
extension HeaderButtonStyle {
/// Accessibility properties of HeaderButtonStyle.
public struct Accessibility: Equatable {
/// Accessiblity label.
public var label: String
/// Accessibility hint.
public var hint: String

///
/// - Parameters:
/// - label: Accessiblity label.
/// - hint: Accessibility hint.
public init(
label: String,
hint: String
) {
self.label = label
self.hint = hint
}

/// Accessibility is not supported intentionally.
public static let unsupported = Self(
label: "",
hint: ""
)
}
}
12 changes: 10 additions & 2 deletions GliaWidgets/Component/Button/Header/HeaderButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@ public struct HeaderButtonStyle {
/// Color of the button's image.
public var color: UIColor

/// Accessibility related properties.
public var accessibility: Accessibility

///
/// - Parameters:
/// - image: Image of the button.
/// - color: Color of the button's image.
///
public init(image: UIImage, color: UIColor) {
/// - accessibility: Accessibility related properties.
public init(
image: UIImage,
color: UIColor,
accessibility: Accessibility = .unsupported
) {
self.image = image
self.color = color
self.accessibility = accessibility
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
extension MessageButtonStyle {
/// Accessibility properties of MessageButtonStyle.
public struct Accessibility: Equatable {
/// Accessibility label of the button.
public var accessibilityLabel: String

///
/// - Parameter accessibilityLabel: Accessibility label of the button.
public init(accessibilityLabel: String) {
self.accessibilityLabel = accessibilityLabel
}

/// Accessibility is not supported intentionally.
public static let unsupported = Self(accessibilityLabel: "")
}
}
12 changes: 10 additions & 2 deletions GliaWidgets/Component/Button/Message/MessageButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@ public struct MessageButtonStyle {
/// Color of the button's image.
public var color: UIColor

/// Accessibility related properties.
public var accessibility: Accessibility

///
/// - Parameters:
/// - image: Image of the button.
/// - color: Color of the button's image.
///
public init(image: UIImage, color: UIColor) {
/// - accessibility: Accessibility related properties.
public init(
image: UIImage,
color: UIColor,
accessibility: Accessibility = .unsupported
) {
self.image = image
self.color = color
self.accessibility = accessibility
}
}
Loading

0 comments on commit 7fe359f

Please sign in to comment.