feat:add confirm of modal for Android and iOS
This commit is contained in:
@@ -41,7 +41,7 @@ - (void)alert:(NSDictionary *)dic withPromise:(DoricPromise *)promise {
|
||||
UIAlertController *alert = [UIAlertController alertControllerWithTitle:dic[@"title"]
|
||||
message:dic[@"msg"]
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *action = [UIAlertAction actionWithTitle:dic[@"okLabel"]
|
||||
UIAlertAction *action = [UIAlertAction actionWithTitle:dic[@"okLabel"] ?: NSLocalizedString(@"OK", nil)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *action) {
|
||||
[promise resolve:nil];
|
||||
@@ -51,4 +51,27 @@ - (void)alert:(NSDictionary *)dic withPromise:(DoricPromise *)promise {
|
||||
[vc presentViewController:alert animated:YES completion:nil];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)confirm:(NSDictionary *)dic withPromise:(DoricPromise *)promise {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
UIAlertController *alert = [UIAlertController alertControllerWithTitle:dic[@"title"]
|
||||
message:dic[@"msg"]
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *okAction = [UIAlertAction actionWithTitle:dic[@"okLabel"] ?: NSLocalizedString(@"Ok", nil)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *action) {
|
||||
[promise resolve:nil];
|
||||
}];
|
||||
[alert addAction:okAction];
|
||||
|
||||
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:dic[@"cancelLabel"] ?: NSLocalizedString(@"Cancel", nil)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *action) {
|
||||
[promise reject:nil];
|
||||
}];
|
||||
[alert addAction:cancelAction];
|
||||
UIViewController *vc = [UIApplication sharedApplication].keyWindow.rootViewController;
|
||||
[vc presentViewController:alert animated:YES completion:nil];
|
||||
});
|
||||
}
|
||||
@end
|
||||
|
@@ -23,8 +23,6 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "DoricContext.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface DoricPromise : NSObject
|
||||
- (instancetype)initWithContext:(DoricContext *)context callbackId:(NSString *)callbackId;
|
||||
|
||||
@@ -32,5 +30,3 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)reject:(id)result;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
Reference in New Issue
Block a user