QueueITSDK 1.0.7

QueueITSDK 1.0.7

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最后发布2016年12月
SwiftSwift 版本3.0
SPM支持 SPM

Alexander YaremchukQueueITLibrary 维护。



  • Queue-It

QueueIT.iOS.Sdk

将 Queue-IT 逻辑集成到 iOS 应用的库。SDK 将根据 Queue-IT 服务器响应发布相应的事件。作为 SDK 的用户,可以在以下情况下订阅通知:

  • 用户通过了队列
  • 分配了队列 ID
  • 发布 postQueue 事件
  • 小部件的状态已改变
  • 队列 ID 已被拒绝
  • 队列为 '空闲' 模式

用法

func setupAndRunQueueIT {
    let customerId = "exampleCustomerId"
    let eventId = "exampleEventId"
    let configId = "exampleConfigId"
    let countDownWidget = WidgetRequest("CountDown", 1)
    let progressWidget = WidgetRequest("Progress", 1)
    let engine = QueueITEngine(customerId: customerId,
                               eventId: eventId,
                               configId: configId,
                               widgets: countDownWidget, progressWidget,
                               layoutName: "",
                               language: "",
                               onQueueItemAssigned: (onQueueItemAssigned),
                               onQueuePassed: (onQueuePassed),
                               onPostQueue: (onPostQueue),
                               onIdleQueue: (onIdleQueue),
                               onWidgetChanged: (onWidgetChanged),
                               onQueueIdRejected: (onQueueIdRejected),
                               onQueueItError: (onQueueItError))

    engine.run()
}

func onQueueItemAssigned(queueItemDetails: QueueItemDetails) {
    print(queueItemDetails.queueId)
}

func onQueuePassed() {
    print("You have been redirected!")
}

func onPostQueue() {
    print("Event has ended!")
}

func onIdleQueue() {
    print("Event has not started yet!")
}

func onWidgetChanged(widget: WidgetDetails) {
    print("Widget changed!: \(widget.name)")
    if widget.name == "Progress" {
        print("value: \(widget.data["progress"])")
    }
}

func onQueueIdRejected(reason: String) {
    print("QueueId rejected! Reason: \(reason)")
}

func onQueueItError(errorMessage: String) {
    print("ERROR: \(errorMessage)")
}

重要

The SDK logic does not execute in the background. Once the application view  (which integrates with SDK)
goes out of scope, you will need to invoke run() method on QueueITEngine instance every time the view 
needs to become active again.