Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions iOS_SDK/OneSignalSDK/Source/OSInAppMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic) BOOL isPreview;
@property (nonatomic) BOOL isDisplayedInSession;
@property (nonatomic) BOOL isTriggerChanged;
@property (nonatomic) BOOL dragToDismissDisabled;
@property (nonatomic) NSNumber *height;

- (BOOL)isBanner;
Expand Down
1 change: 1 addition & 0 deletions iOS_SDK/OneSignalSDK/Source/OSInAppMessageBridgeEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ typedef NS_ENUM(NSUInteger, OSInAppMessageBridgeEventType) {
@interface OSInAppMessageBridgeEventRenderingComplete : NSObject <OSJSONDecodable>
@property (nonatomic) OSInAppMessageDisplayPosition displayLocation;
@property (nonatomic) NSNumber *height;
@property (nonatomic) BOOL dragToDismissDisabled;
@end

@interface OSInAppMessageBridgeEventResize : NSObject <OSJSONDecodable>
Expand Down
4 changes: 4 additions & 0 deletions iOS_SDK/OneSignalSDK/Source/OSInAppMessageBridgeEvent.m
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ + (instancetype)instanceWithJson:(NSDictionary *)json {
if (json[@"pageMetaData"][@"rect"][@"height"])
instance.height = json[@"pageMetaData"][@"rect"][@"height"];

if (json[@"dragToDismissDisabled"]) {
instance.dragToDismissDisabled = [json[@"dragToDismissDisabled"] boolValue];
}

return instance;
}

Expand Down
18 changes: 10 additions & 8 deletions iOS_SDK/OneSignalSDK/Source/OSInAppMessageViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -487,15 +487,16 @@ - (void)beginPanAtLocation:(CGPoint)location {
Adds the pan recognizer (for swiping up and down) and the tap recognizer (for dismissing)
*/
- (void)setupGestureRecognizers {
// Pan gesture recognizer for swiping
let recognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGestureRecognizerDidMove:)];

[self.messageView addGestureRecognizer:recognizer];

recognizer.maximumNumberOfTouches = 1;
recognizer.minimumNumberOfTouches = 1;

self.panGestureRecognizer = recognizer;
if (!self.message.dragToDismissDisabled) {
// Pan gesture recognizer for swiping
let recognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGestureRecognizerDidMove:)];
[self.messageView addGestureRecognizer:recognizer];
recognizer.maximumNumberOfTouches = 1;
recognizer.minimumNumberOfTouches = 1;

self.panGestureRecognizer = recognizer;
}

// Only center modal and full screen should dismiss on background click
// Banners will allow interacting with the view behind it still
Expand Down Expand Up @@ -632,6 +633,7 @@ - (void)jsEventOccurredWithBody:(NSData *)body {

self.message.position = event.renderingComplete.displayLocation;
self.message.height = event.renderingComplete.height;
self.message.dragToDismissDisabled = event.renderingComplete.dragToDismissDisabled;

// The page is fully loaded and should now be displayed
// This is only fired once the javascript on the page sends the "rendering_complete" type event
Expand Down