adobe track alert
This commit is contained in:
parent
0f4b084880
commit
e0a704ec51
@ -12,5 +12,7 @@
|
|||||||
@interface MVMCoreAlertController : UIAlertController
|
@interface MVMCoreAlertController : UIAlertController
|
||||||
|
|
||||||
@property (nonatomic, readonly, getter=isVisible) BOOL visible;
|
@property (nonatomic, readonly, getter=isVisible) BOOL visible;
|
||||||
|
@property (nullable, nonatomic, copy) NSString *alertPageType;
|
||||||
|
@property (nullable, nonatomic, weak) id delegate;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "MVMCoreAlertController.h"
|
#import "MVMCoreAlertController.h"
|
||||||
|
#import "MVMCoreLoggingHandler.h"
|
||||||
|
|
||||||
@interface MVMCoreAlertController ()
|
@interface MVMCoreAlertController ()
|
||||||
|
|
||||||
@ -22,6 +23,7 @@
|
|||||||
[self willChangeValueForKey:@"isVisible"];
|
[self willChangeValueForKey:@"isVisible"];
|
||||||
self.visible = YES;
|
self.visible = YES;
|
||||||
[self didChangeValueForKey:@"isVisible"];
|
[self didChangeValueForKey:@"isVisible"];
|
||||||
|
[MVMCoreLoggingHandler logAlertForAlertPageType:self.alertPageType delegate:self.delegate];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewDidDisappear:(BOOL)animated {
|
- (void)viewDidDisappear:(BOOL)animated {
|
||||||
|
|||||||
@ -80,7 +80,7 @@
|
|||||||
return [self showAlertWithTitle:title message:message actions:actions alertStyle:UIAlertControllerStyleAlert isGreedy:isGreedy alertDelegate:alertDelegate];
|
return [self showAlertWithTitle:title message:message actions:actions alertStyle:UIAlertControllerStyleAlert isGreedy:isGreedy alertDelegate:alertDelegate];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray<UIAlertAction *>*)actions alertStyle:(UIAlertControllerStyle)alertStyle isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject <MVMCoreAlertDelegateProtocol>*)alertDelegate {
|
- (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message pageType:(nullable NSString *)pageType actions:(nullable NSArray<UIAlertAction *>*)actions alertStyle:(UIAlertControllerStyle)alertStyle isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject <MVMCoreAlertDelegateProtocol>*)alertDelegate {
|
||||||
|
|
||||||
// It's a greedy alert! Clear all alerts that are queued up and the one that is showing
|
// It's a greedy alert! Clear all alerts that are queued up and the one that is showing
|
||||||
if (isGreedy) {
|
if (isGreedy) {
|
||||||
@ -89,6 +89,8 @@
|
|||||||
|
|
||||||
// Create the alert. Adds the actions one by one.
|
// Create the alert. Adds the actions one by one.
|
||||||
MVMCoreAlertController *alertController = [MVMCoreAlertController alertControllerWithTitle:(title ?: @"") message:message preferredStyle:alertStyle];
|
MVMCoreAlertController *alertController = [MVMCoreAlertController alertControllerWithTitle:(title ?: @"") message:message preferredStyle:alertStyle];
|
||||||
|
alertController.alertPageType = pageType;
|
||||||
|
alertController.delegate = alertDelegate;
|
||||||
for (NSUInteger i = 0; i < [actions count]; i++) {
|
for (NSUInteger i = 0; i < [actions count]; i++) {
|
||||||
UIAlertAction *action = [actions objectAtIndex:i ofType:[UIAlertAction class]];
|
UIAlertAction *action = [actions objectAtIndex:i ofType:[UIAlertAction class]];
|
||||||
if (action) {
|
if (action) {
|
||||||
@ -102,7 +104,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (nonnull UIAlertController *)showAlertWithAlertObject:(nonnull MVMCoreAlertObject *)alertObject {
|
- (nonnull UIAlertController *)showAlertWithAlertObject:(nonnull MVMCoreAlertObject *)alertObject {
|
||||||
return [self showAlertWithTitle:alertObject.title message:alertObject.message actions:alertObject.actions alertStyle:alertObject.alertStyle isGreedy:alertObject.isGreedy alertDelegate:alertObject.alertDelegate];
|
return [self showAlertWithTitle:alertObject.title message:alertObject.message pageType:alertObject.pageType actions:alertObject.actions alertStyle:alertObject.alertStyle isGreedy:alertObject.isGreedy alertDelegate:alertObject.alertDelegate];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)removeAllAlertViews {
|
- (void)removeAllAlertViews {
|
||||||
|
|||||||
@ -29,6 +29,7 @@ typedef void (^TextFieldErrorHandler)(NSArray * _Nonnull fieldErrors);
|
|||||||
|
|
||||||
@property (nullable, strong, nonatomic) NSString *title;
|
@property (nullable, strong, nonatomic) NSString *title;
|
||||||
@property (nullable, strong, nonatomic) NSString *message;
|
@property (nullable, strong, nonatomic) NSString *message;
|
||||||
|
@property (nullable, strong, nonatomic) NSString *pageType;
|
||||||
@property (nonnull, strong, nonatomic) NSArray *actions;
|
@property (nonnull, strong, nonatomic) NSArray *actions;
|
||||||
@property (nonatomic) BOOL isGreedy;
|
@property (nonatomic) BOOL isGreedy;
|
||||||
@property (nonatomic) UIAlertControllerStyle alertStyle;
|
@property (nonatomic) UIAlertControllerStyle alertStyle;
|
||||||
|
|||||||
@ -71,7 +71,6 @@
|
|||||||
// Perform a popup.
|
// Perform a popup.
|
||||||
alert.type = MFAlertTypePopup;
|
alert.type = MFAlertTypePopup;
|
||||||
alert.alertStyle = UIAlertControllerStyleAlert;
|
alert.alertStyle = UIAlertControllerStyleAlert;
|
||||||
|
|
||||||
// Check if we have a popup driven by page object (otherwise by default it will just use response info title message with an OK button).
|
// Check if we have a popup driven by page object (otherwise by default it will just use response info title message with an OK button).
|
||||||
NSString *pageTypeForPopup = [responseInfo stringForKey:@"popupPageType"];
|
NSString *pageTypeForPopup = [responseInfo stringForKey:@"popupPageType"];
|
||||||
[[MVMCoreCache sharedCache] fetchJSONForPageType:pageTypeForPopup queue:nil waitUntilFinished:YES completionHandler:^(NSDictionary * _Nullable jsonDictionary) {
|
[[MVMCoreCache sharedCache] fetchJSONForPageType:pageTypeForPopup queue:nil waitUntilFinished:YES completionHandler:^(NSDictionary * _Nullable jsonDictionary) {
|
||||||
@ -88,6 +87,8 @@
|
|||||||
alert = popupAlert;
|
alert = popupAlert;
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
alert.pageType = pageTypeForPopup;
|
||||||
|
alert.alertDelegate = actionDelegate;
|
||||||
} else if (messageStyle.length == 0 && pageType) {
|
} else if (messageStyle.length == 0 && pageType) {
|
||||||
|
|
||||||
// No message style!
|
// No message style!
|
||||||
|
|||||||
@ -24,4 +24,6 @@
|
|||||||
// Log that the load has finished.
|
// Log that the load has finished.
|
||||||
- (void)logLoadFinished:(nullable MVMCoreLoadObject *)loadObject loadedViewController:(nullable UIViewController <MVMCoreViewControllerProtocol> *)loadedViewController error:(nullable MVMCoreErrorObject *)error;
|
- (void)logLoadFinished:(nullable MVMCoreLoadObject *)loadObject loadedViewController:(nullable UIViewController <MVMCoreViewControllerProtocol> *)loadedViewController error:(nullable MVMCoreErrorObject *)error;
|
||||||
|
|
||||||
|
// Log alert
|
||||||
|
- (void)logAlertForAlertPageType:(nullable NSString *)pageType delegate:(nullable id)delegate;
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -20,5 +20,6 @@
|
|||||||
+ (void)logDebugMessageWithDelegate:(nullable NSString *)message;
|
+ (void)logDebugMessageWithDelegate:(nullable NSString *)message;
|
||||||
+ (void)logWithDelegateWithObject:(nullable id)object withName:(nullable NSString *)name withExtraInfo:(nullable NSDictionary *)extra;
|
+ (void)logWithDelegateWithObject:(nullable id)object withName:(nullable NSString *)name withExtraInfo:(nullable NSDictionary *)extra;
|
||||||
+ (void)logWithDelegateLoadFinished:(nullable MVMCoreLoadObject *)loadObject loadedViewController:(nullable UIViewController <MVMCoreViewControllerProtocol> *)loadedViewController error:(nullable MVMCoreErrorObject *)error;
|
+ (void)logWithDelegateLoadFinished:(nullable MVMCoreLoadObject *)loadObject loadedViewController:(nullable UIViewController <MVMCoreViewControllerProtocol> *)loadedViewController error:(nullable MVMCoreErrorObject *)error;
|
||||||
|
+ (void)logAlertForAlertPageType:(nullable NSString *)pageType delegate:(_Nullable id)delegate;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -35,5 +35,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (void)logAlertForAlertPageType:(nullable NSString *)pageType delegate:(_Nullable id)delegate {
|
||||||
|
if ([[MVMCoreObject sharedInstance].loggingDelegate respondsToSelector:@selector(logAlertForAlertPageType:delegate:)]) {
|
||||||
|
[[MVMCoreObject sharedInstance].loggingDelegate logAlertForAlertPageType:pageType delegate:delegate];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user