-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
1,557 additions
and
843 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") } | ||
plugins { id("com.facebook.react.settings") } | ||
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() } | ||
rootProject.name = 'BrazeProject' | ||
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) | ||
include ':app' | ||
includeBuild('../node_modules/@react-native/gradle-plugin') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#import <Foundation/Foundation.h> | ||
|
||
// Braze InAppMessage GIF Support | ||
@interface BrazeReactGIFHelper : NSObject | ||
|
||
+ (void)setGIFProvider; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#import "BrazeReactGIFHelper.h" | ||
#import <SDWebImage/SDAnimatedImage.h> | ||
#import <SDWebImage/SDAnimatedImageView.h> | ||
|
||
@import BrazeUI; | ||
|
||
// Braze InAppMessage GIF Support | ||
@implementation BrazeReactGIFHelper | ||
|
||
+ (void)setGIFProvider { | ||
BRZGIFViewProvider.shared = [BrazeReactGIFHelper sdWebImage]; | ||
} | ||
|
||
+ (BRZGIFViewProvider *)sdWebImage { | ||
return [BRZGIFViewProvider | ||
providerWithView:^UIView *_Nonnull(NSURL *_Nullable url) { | ||
UIImage *image = [BrazeReactGIFHelper imageForURL:url]; | ||
SDAnimatedImageView *view = | ||
[[SDAnimatedImageView alloc] initWithImage:image]; | ||
return view; | ||
} | ||
updateView:^(UIView *_Nonnull view, NSURL *_Nullable url) { | ||
if ([view isKindOfClass:[SDAnimatedImageView class]]) { | ||
((SDAnimatedImageView *)(view)).image = | ||
[BrazeReactGIFHelper imageForURL:url]; | ||
} | ||
}]; | ||
} | ||
|
||
+ (UIImage *)imageForURL:(NSURL *)url { | ||
if (url == nil) { | ||
return nil; | ||
} | ||
if ([url.pathExtension isEqualToString:@"gif"]) { | ||
return [SDAnimatedImage imageWithContentsOfFile:url.path]; | ||
} else { | ||
return [UIImage imageWithContentsOfFile:url.path]; | ||
} | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.