-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/giphy-support-ios-binding' into 'release/v2.3.9'
Feature/giphy support ios binding See merge request megachat/MEGAchat!952
- Loading branch information
Showing
8 changed files
with
120 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface MEGAChatGiphy : NSObject | ||
|
||
@property (nullable, readonly, nonatomic) NSString *mp4Src; | ||
@property (nullable, readonly, nonatomic) NSString *webpSrc; | ||
|
||
@property (readonly, nonatomic) long mp4Size; | ||
@property (readonly, nonatomic) long webpSize; | ||
@property (nullable, readonly, nonatomic) NSString *title; | ||
@property (readonly, nonatomic) int width; | ||
@property (readonly, nonatomic) int height; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_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,65 @@ | ||
|
||
#import "MEGAChatGiphy.h" | ||
|
||
#import "megachatapi.h" | ||
|
||
using namespace megachat; | ||
|
||
@interface MEGAChatGiphy () | ||
|
||
@property MegaChatGiphy *megaChatGiphy; | ||
@property BOOL cMemoryOwn; | ||
|
||
@end | ||
|
||
@implementation MEGAChatGiphy | ||
|
||
- (instancetype)initWithMegaChatGiphy:(MegaChatGiphy *)megaChatGiphy cMemoryOwn:(BOOL)cMemoryOwn { | ||
NSParameterAssert(megaChatGiphy); | ||
|
||
if (self = [super init]) { | ||
_megaChatGiphy = megaChatGiphy; | ||
_cMemoryOwn = cMemoryOwn; | ||
} | ||
|
||
return self; | ||
} | ||
|
||
- (NSString *)mp4Src { | ||
if (!self.megaChatGiphy) return nil; | ||
return self.megaChatGiphy->getMp4Src() ? [[NSString alloc] initWithUTF8String:self.megaChatGiphy->getMp4Src()] : nil; | ||
} | ||
|
||
- (NSString *)webpSrc { | ||
if (!self.megaChatGiphy) return nil; | ||
return self.megaChatGiphy->getWebpSrc() ? [[NSString alloc] initWithUTF8String:self.megaChatGiphy->getWebpSrc()] : nil; | ||
} | ||
|
||
- (NSString *)title { | ||
if (!self.megaChatGiphy) return nil; | ||
return self.megaChatGiphy->getTitle() ? [[NSString alloc] initWithUTF8String:self.megaChatGiphy->getTitle()] : nil; | ||
} | ||
|
||
- (long)mp4Size { | ||
return self.megaChatGiphy->getMp4Size(); | ||
} | ||
|
||
- (long)webpSize { | ||
return self.megaChatGiphy->getWebpSize(); | ||
} | ||
|
||
- (int)width { | ||
return self.megaChatGiphy->getWidth(); | ||
} | ||
|
||
- (int)height { | ||
return self.megaChatGiphy->getHeight(); | ||
} | ||
|
||
- (void)dealloc { | ||
if (self.cMemoryOwn) { | ||
delete _megaChatGiphy; | ||
} | ||
} | ||
|
||
@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
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,13 @@ | ||
|
||
#import "MEGAChatGiphy.h" | ||
#import "megachatapi.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface MEGAChatGiphy (init) | ||
|
||
- (instancetype)initWithMegaChatGiphy:(const megachat::MegaChatGiphy *)megaChatGiphy cMemoryOwn:(BOOL)cMemoryOwn; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |