WDWClient

Objective-C

@interface WDWClient : NSObject

Swift

class WDWClient : NSObject

Primary class to interact with the WDW-SDK. Use WDWBuilder to instanciate.

  • delegate should implement the WDWClientDelegate protocol. All delegate methods are executed on the provided delegateQueue

    Declaration

    Objective-C

    @property (nonatomic, weak) id<WDWClientDelegate> delegate;

    Swift

    weak var delegate: (any WDWClientDelegate)! { get set }
  • Dispatch queue for the WDWClientDelegate callbacks execution

    By default, all delegate messages are delivered to the main dispatch queue, which helps you to manage UI update events. You can provide your own serial queue:

    self.wdwClient = dispatch_queue_create("myQueue", DISPATCH_QUEUE_SERIAL);

    Declaration

    Objective-C

    @property (nonatomic) dispatch_queue_t delegateQueue;

    Swift

    unowned(unsafe) var delegateQueue: dispatch_queue_t! { get set }
  • Starts monitoring location and motion data. If the current location is in a relevant area, the WDW-SDK provides a json string. This string can be evaluated by the server. Also, the monitoring of the location is required for the evaluation of push messages.

    Declaration

    Objective-C

    - (void)startMonitoring;

    Swift

    func startMonitoring()
  • Stops monitoring location and motion data. The monitoring can be restarted with startMonitoring.

    Declaration

    Objective-C

    - (void)stopMonitoring;

    Swift

    func stopMonitoring()
  • Evaluates the push notification payload. Triggers the WDWClientDelegate callback if a payload is recognized as a type of WDWWarning

    If you’re using your own push instead of the WDW’s push service, the push message needs to be an NSDictionary using a message string as Key and a warning in form of an escaped JSON as value.

       NSDictionary *wdwMessage = @{@"message" = @"Put your escaped JSON String from your backend here"};
       [self.wdwClient evaluatePushMesage:wdwMessage];
     

    If your delegate implements -wdwClient:didReceiveDrivingWarning: it will be triggered on the delegateQueue as result.

    See

    -wdwClient:didReceiveDrivingWarning

    Declaration

    Objective-C

    - (WDWWarning *)evaluatePushMesage:(NSDictionary *)payload;

    Swift

    func evaluatePushMesage(_ payload: [AnyHashable : Any]!) -> WDWWarning!

    Parameters

    payload

    you’ve received in AppDelegate’s application:didReceiveRemoteNotification.

    Return Value

    WDWWarning object if notification sourced from WDW service, nil otherwise

  • Returns the WDW-SDK framework version

    Declaration

    Objective-C

    + (NSString *)version;

    Swift

    class func version() -> String!