Reputation: 10172
In documentation i see this code to get user's last activity
Can someone help me to use it in swift?
QBUUser *user = ...;
NSInteger currentTimeInterval = [[NSDate date] timeIntervalSince1970];
NSInteger userLastRequestAtTimeInterval = [[user lastRequestAt] timeIntervalSince1970];
// if user didn't do anything last 1 minute (60 seconds)
if((currentTimeInterval - userLastRequestAtTimeInterval) > 60)
{
// user is offline now
}
I am on chat dialog viewcontroller.
I get dialog id, recipientID etc etc
But how can i retrieve user's lastRequestAt field ?
QBUUser *user = ...;
What is this three dots? ...
what should i pass in this?
Upvotes: 0
Views: 512
Reputation: 539
You should first get user by id:
QBRequest.userWithID(userID, successBlock: { (response : QBResponse, user: QBUUser?) -> Void in
lastRequestAt = Int((user?.lastRequestAt?.timeIntervalSince1970)!)
}, errorBlock: {(response: QBResponse) -> Void in
// Handle error
})
Upvotes: 1