Updates handling
Updates from the backend
Updates from SDK
//inside UIViewController
- (void)viewDidLoad {
[super viewDidLoad];
int32_t orgId = self.tpd_organizationId;
TPDOrganizationContext *organizationContext = [[TPDMessagingContext sharedContext] contextForOrganization:orgId];
[organizationContext.userDboManager addObserver:self];
}
#pragma mark <TPDDboManagerObserver>
- (void)dboManager:(nonnull TPDDboManager *)manager observeChangesForType:(TPDDboManagerChangeType)changesType
withUserInfo:(nonnull NSDictionary *)userInfo
{
switch (changesType) {
case TPDDboManagerChangeUpdate: {
TPDDboManagerUpdater updater = userInfo[TPDDboManagerUpdaterKey];
if (!updater) {
return;
}
let oldUsername = _user.username;
if (updater(_user)) {
let newUsername = _user.username;
if (newUsername.length == 0) {
[self doneActionWithSender:nil];
} else if (![oldUsername isEqualToString:newUsername]) {
[self reloadQRCodeAnimated:YES];
}
}
break;
}
case TPDDboManagerChangeDelete:
case TPDDboManagerChangeNew: {
//do nothing
break;
}
}
}Last updated
