-
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.
Add Engagement Launcher interface and getter from Glia
- Loading branch information
1 parent
5ee54c2
commit bd25f43
Showing
3 changed files
with
83 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Foundation | ||
|
||
extension Glia { | ||
/// Retrieves an instance of `EngagementLauncher`. | ||
/// | ||
/// - Parameters: | ||
/// - queueIds: A list of queue IDs to be used for the engagement launcher. When nil, the default queues will be used. | ||
/// | ||
/// - Returns: | ||
/// - `EngagementLauncher` instance. | ||
public func getEngagementLauncher(queueIds: [String]?) -> EngagementLauncher { | ||
.init(queueIds: queueIds) | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
GliaWidgets/Sources/EngagementLauncher/EngagementLauncher.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,53 @@ | ||
import Foundation | ||
import GliaCoreSDK | ||
|
||
/// `EngagementLauncher`class allows launching different types of engagements, such as chat, | ||
/// audio calls, video calls, and secure messaging. | ||
public final class EngagementLauncher { | ||
private let queueIds: [String]? | ||
|
||
public init(queueIds: [String]?) { | ||
self.queueIds = queueIds | ||
} | ||
|
||
/// Starts a chat. | ||
/// | ||
/// - Parameters: | ||
/// - sceneProvider: Used to provide `UIWindowScene` to the framework. Defaults to | ||
/// the first active foreground scene. | ||
public func startChat(sceneProvider: SceneProvider? = nil) { | ||
startEngagement(of: .chat, sceneProvider: sceneProvider) | ||
} | ||
|
||
/// Starts a audio call. | ||
/// | ||
/// - Parameters: | ||
/// - sceneProvider: Used to provide `UIWindowScene` to the framework. Defaults to | ||
/// the first active foreground scene. | ||
public func startAudioCall(sceneProvider: SceneProvider? = nil) { | ||
startEngagement(of: .audioCall, sceneProvider: sceneProvider) | ||
} | ||
|
||
/// Starts a video call. | ||
/// | ||
/// - Parameters: | ||
/// - sceneProvider: Used to provide `UIWindowScene` to the framework. Defaults to | ||
/// the first active foreground scene. | ||
public func startVideoCall(sceneProvider: SceneProvider? = nil) { | ||
startEngagement(of: .videoCall, sceneProvider: sceneProvider) | ||
} | ||
|
||
/// Starts a secure messaging. | ||
/// | ||
/// - Parameters: | ||
/// - sceneProvider: Used to provide `UIWindowScene` to the framework. Defaults to | ||
/// the first active foreground scene. | ||
public func startSecureMessaging(sceneProvider: SceneProvider? = nil) { | ||
startEngagement(of: .messaging(.welcome), sceneProvider: sceneProvider) | ||
} | ||
|
||
private func startEngagement( | ||
of engagementKind: EngagementKind, | ||
sceneProvider: SceneProvider? | ||
) {} | ||
} |