Merge branch 'release/6_8' into feature/trial_user

This commit is contained in:
Suresh, Kamlesh 2018-10-31 12:36:16 -04:00
commit 1321eb1422
10 changed files with 28 additions and 3 deletions

View File

@ -219,7 +219,7 @@ NSString * const KeyActionTypeOpen = @"openPage";
NSDictionary *responseInfo = [jsonDictionary dict:KeyResponseInfo];
if (responseInfo) {
MVMCoreAlertObject *alertObject = [MVMCoreAlertObject alertObjectForPageType:pageTypeForTopAlert responseInfo:responseInfo additionalData:additionalData actionDelegate:delegate];
if ([delegate respondsToSelector:@selector(willShowPopupWithAlertObject:alertJson:)]) {
if ([delegate respondsToSelector:@selector(willShowTopAlertWithAlertObject:alertJson:)]) {
alertObject = [delegate willShowTopAlertWithAlertObject:alertObject alertJson:jsonDictionary];
}
[alertObject showAlert];

View File

@ -8,9 +8,11 @@
// Used by our alert handler. Not for subclassing. Simply keeps track of if it's visible. Tries to parallel the UIAlertView to make it easier for the MVMCoreAlertHandler.
#import <UIKit/UIKit.h>
@class MVMCoreAlertObject;
@interface MVMCoreAlertController : UIAlertController
@property (nonatomic, readonly, getter=isVisible) BOOL visible;
@property (nullable, nonatomic, strong) MVMCoreAlertObject *alertObject;
@end

View File

@ -7,6 +7,7 @@
//
#import "MVMCoreAlertController.h"
#import "MVMCoreLoggingHandler.h"
@interface MVMCoreAlertController ()
@ -22,6 +23,7 @@
[self willChangeValueForKey:@"isVisible"];
self.visible = YES;
[self didChangeValueForKey:@"isVisible"];
[MVMCoreLoggingHandler logAlertForAlertController:self];
}
- (void)viewDidDisappear:(BOOL)animated {

View File

@ -8,11 +8,15 @@
// Called for popup style alerts.
#import <Foundation/Foundation.h>
@class MVMCoreAlertObject;
@protocol MVMCoreAlertDelegateProtocol
@optional
// helps tracking alert state
- (nullable NSDictionary *)additionalAlertDataToTrackForAlertWithObject:(nullable MVMCoreAlertObject *)alertObject;
// All are performed on the main thread.
- (void)alertShown:(nonnull UIAlertController *)alertController;
- (void)alertCancelled:(nonnull UIAlertController *)alertController;

View File

@ -102,7 +102,9 @@
}
- (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];
MVMCoreAlertController *controller = (MVMCoreAlertController *)[self showAlertWithTitle:alertObject.title message:alertObject.message actions:alertObject.actions alertStyle:alertObject.alertStyle isGreedy:alertObject.isGreedy alertDelegate:alertObject.alertDelegate];
controller.alertObject = alertObject;
return controller;
}
- (void)removeAllAlertViews {

View File

@ -28,6 +28,7 @@ typedef void (^TextFieldErrorHandler)(NSArray * _Nonnull fieldErrors);
@interface MVMCoreAlertObject : NSObject
@property (nullable, strong, nonatomic) NSString *title;
@property (nullable, copy, nonatomic) NSDictionary *pageJson;
@property (nullable, strong, nonatomic) NSString *message;
@property (nonnull, strong, nonatomic) NSArray *actions;
@property (nonatomic) BOOL isGreedy;

View File

@ -71,7 +71,7 @@
// Perform a popup.
alert.type = MFAlertTypePopup;
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).
NSString *pageTypeForPopup = [responseInfo stringForKey:@"popupPageType"];
[[MVMCoreCache sharedCache] fetchJSONForPageType:pageTypeForPopup queue:nil waitUntilFinished:YES completionHandler:^(NSDictionary * _Nullable jsonDictionary) {
@ -99,6 +99,7 @@
alert.alertStyle = UIAlertControllerStyleAlert;
}
}
alert.alertDelegate = actionDelegate;
return alert;
}
@ -145,6 +146,7 @@
MVMCoreAlertObject *alert = [[MVMCoreAlertObject alloc] init];
alert.title = [page stringForKey:KeyTitle];
alert.pageJson = page;
alert.message = [page stringForKey:KeyMessage];
alert.isGreedy = isGreedy;
alert.type = MFAlertTypePopup;

View File

@ -7,6 +7,7 @@
//
#import <UIKit/UIKit.h>
@class MVMCoreAlertController;
@protocol MVMCoreLoggingDelegateProtocol <NSObject>
@ -24,4 +25,7 @@
// Log that the load has finished.
- (void)logLoadFinished:(nullable MVMCoreLoadObject *)loadObject loadedViewController:(nullable UIViewController <MVMCoreViewControllerProtocol> *)loadedViewController error:(nullable MVMCoreErrorObject *)error;
// Log alert
- (void)logAlertForAlertController:(nullable MVMCoreAlertController *)alertController;
@end

View File

@ -10,6 +10,7 @@
#import <MVMCore/MVMCoreErrorObject.h>
#import <MVMCore/MVMCoreViewControllerProtocol.h>
#import <MVMCore/MVMCoreLoadObject.h>
@class MVMCoreAlertController;
#define MVMCoreLog(fmt, ...) \
[MVMCoreLoggingHandler logDebugMessageWithDelegate:[NSString stringWithFormat:(@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__]];
@ -20,5 +21,6 @@
+ (void)logDebugMessageWithDelegate:(nullable NSString *)message;
+ (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)logAlertForAlertController:(nullable MVMCoreAlertController *)alertController;
@end

View File

@ -35,5 +35,11 @@
}
}
+ (void)logAlertForAlertController:(nullable MVMCoreAlertController *)alertController {
if ([[MVMCoreObject sharedInstance].loggingDelegate respondsToSelector:@selector(logAlertForAlertController:)]) {
[[MVMCoreObject sharedInstance].loggingDelegate logAlertForAlertController:alertController];
}
}
@end