feat:add alert for iOS
This commit is contained in:
parent
9a6f2d7f9f
commit
3f5099d29a
@ -36,4 +36,19 @@ - (void)toast:(NSDictionary *)dic withPromise:(DoricPromise *)promise {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)alert:(NSDictionary *)dic withPromise:(DoricPromise *)promise {
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
UIAlertController *alert = [UIAlertController alertControllerWithTitle:dic[@"title"]
|
||||||
|
message:dic[@"msg"]
|
||||||
|
preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
UIAlertAction *action = [UIAlertAction actionWithTitle:dic[@"okLabel"]
|
||||||
|
style:UIAlertActionStyleDefault
|
||||||
|
handler:^(UIAlertAction *action) {
|
||||||
|
[promise resolve:nil];
|
||||||
|
}];
|
||||||
|
[alert addAction:action];
|
||||||
|
UIViewController *vc = [UIApplication sharedApplication].keyWindow.rootViewController;
|
||||||
|
[vc presentViewController:alert animated:YES completion:nil];
|
||||||
|
});
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
Reference in New Issue
Block a user