类说明

优质
小牛编辑
127浏览
2023-12-01

类说明

模型类

DTEmoji

说明: 商店表情模型类

<!-- 表情Id -->
@property (nonatomic, copy) NSString *emojiId;

<!-- 表情名称 -->
@property (nonatomic, copy) NSString *emojiName;

<!-- 表情编码 -->
@property (nonatomic, copy) NSString *emojiCode;

<!-- 表情图片 -->
@property (nonatomic, strong) UIImage *emojiImage;

<!-- 图片数据 -->
@property (nonatomic, strong) NSData *emojiData;

<!-- 表情包Id -->
@property (nonatomic, copy) NSString *packageId;

DTGif

说明: 动图模型类

/**
图片id
*/
@property (nonatomic, strong) NSString *imageId;

/**
图片名称
*/
@property (nonatomic, strong) NSString *text;

/**
图片缩略图地址
*/
@property (nonatomic, strong) NSString *thumbImage;

/**
图片缩略图地址  动图
*/
@property (nonatomic, strong) NSString *gifThumbImage;

/**
*  图片地址
*  可能是GIF、PNG、JPG格式
*/
@property (nonatomic, strong) NSString *mainImage;

/**
*  图片尺寸(pix)
*/
@property (nonatomic, assign) CGSize size;

/**
*  是否是动态图片
*/
@property (nonatomic, assign) BOOL isAnimated;

DTUser

说明: APP 用户模型类

/**
 用户id
 */
@property (nullable, nonatomic, retain) NSString *userId;


/**
 用户名
 */
@property (nullable, nonatomic, retain) NSString *name;

/**
 电话
 */
@property (nullable, nonatomic, retain) NSString *phone;

/**
 邮件
 */
@property (nullable, nonatomic, retain) NSString *email;

/**
 地址
 */
@property (nullable, nonatomic, retain) NSString *address;

/**
 用户性别  1:男,2:女
 */
@property (nonatomic) NSInteger gender;

/**
 其他信息
 */
@property (nullable, nonatomic, retain) NSDictionary *otherInfo;

管理类

DongtuStore

说明: SDK 主要功能管理类

属性

/**

  • SDK区域 默认为DTRegionChina */ @property (nonatomic) DTRegion sdkRegion;

/**

  • SDK语言 default:DTLanguageChinese */ @property (nonatomic) DTLanguage sdkLanguage;

/**

  • SDK 功能的代理 */ @property (nonatomic, weak, nullable) id delegate;

DongtuStore 单例

```objectivec
+ (nonnull instancetype)sharedInstance;

初始化

/**
@param appId 申请的 appId
@param secret 申请的 secret
*/
- (void)setAppId:(nonnull NSString *)appId secret:(nonnull NSString *)secret;

获取 SDK 的版本

/**
@return SDK 的版本
*/
+ (NSString *)version;

设置app本地用户信息

/**
@param user 用户信息构造的DTUser对象
*/
+(void)setUser:(DTUser *)user;

通过DTStoreTheme设置SDK UI样式

- (void)setTheme:(nonnull DTStoreTheme *)theme;

设置自定义字符表情

- (void)setDefaultEmojiArray:(nonnull NSArray<NSString *> *)emojiArray;

切换到表情键盘

/**
 *  @param input 关联表情键盘的输入框
 */
- (void)attachEmotionKeyboardToInput:(nonnull UIResponder<UITextInput> *)input;

切换到到默认键盘

- (void)switchToDefaultKeyboard;

配置联想表情功能

/**
 *  @param attachedView   联想表情UI展示在attachedView上方
 *  @param input          联想表情功能关联的输入框
 */
- (void)shouldShowSearchPopupAboveView:(nonnull UIView *)attachedView
                             withInput:(nonnull UIResponder <UITextInput> *)input;

将联想表情UI从页面上移除

- (void)dismissSearchPopup;

配置字符表情包是否显示

- (void)setUnicodeEmojiTabEnabled: (BOOL)enable;

表情收藏相关功能

/**
 查看是否已经收藏了emoji

 @param emojiCode DTEmoji对象的emojiCode
 */
-(BOOL)hasCollectedDTEmojiWithEmojiCode:(NSString *_Nonnull)emojiCode;

/**
查看是否已经收藏了gif

 @param gifUrl DTGif对象的mainImage
 @param gifId DTGif对象的imageId
 */
-(BOOL)hasCollectedDTGifWithGifUrl:(NSString *_Nonnull)gifUrl andGifId:(NSString *_Nonnull)gifId;

/**
 取消收藏emoji

 @param emojiCode DTEmoji对象的emojiCode
 @param completionHandler 结果回调函数
 */
-(void)uncollectDTEmojiWithEmojiCode:(NSString *_Nonnull)emojiCode
                   completionHandler:(void (^_Nonnull)(BOOL result, DTError * _Nullable error))completionHandler;

/**
 取消收藏gif

 @param gifUrl DTGif对象的mainImage
 @param gifId DTGif对象的imageId
 @param completionHandler 结果回调函数
 */
-(void)uncollectDTGifWithGifUrl:(NSString *_Nonnull)gifUrl andGifId:(NSString *_Nonnull)gifId
              completionHandler:(void (^_Nonnull)(BOOL result, DTError * _Nullable error))completionHandler;

/**
 收藏emoji

 @param emojiCode DTEmoji对象的emojiCode
 @param completionHandler 结果回调函数
 */
-(void)collectDTEmojiWithEmojiCode:(NSString *_Nonnull)emojiCode
                 completionHandler:(void (^_Nonnull)(BOOL result, DTError * _Nullable error))completionHandler;

/**
 收藏gif

 @param gifUrl DTGif对象的mainImage
 @param gifId DTGif对象的imageId
 @param completionHandler 结果回调函数
 */
-(void)collectDTGifWithGifUrl:(NSString *_Nonnull)gifUrl andGifId:(NSString *_Nonnull)gifId
            completionHandler:(void (^_Nonnull)(BOOL result, DTError * _Nullable error))completionHandler;

清除缓存

- (void)clearCache;

开发者需实现的代理方法

//点击了表情键盘中的表情图片代理
- (void)didSelectEmoji:(DTEmoji *)emoji;

//点击了联想UI和GIF UI中的表情图片代理
- (void)didSelectGif:(DTGif *)gif;

//点击表情键盘上发送按钮的代理
- (void)didSendWithInput:(UIResponder<UITextInput> *)input;

//点击输入框的代理(这个代理方法的触发意味着键盘从表情键盘切换回了系统键盘)
- (void)tapOverlay;

UI相关类

DTStoreTheme

说明: 可对SDK 的 UI进行一定程度的自定义

  • groupViewBgColor - 键盘背景色

    @property (nonatomic, strong) UIColor  *groupViewBgColor;
    
  • inputToolViewBgColor - 键盘表情包背景色

    @property (nonatomic, strong) UIColor  *inputToolViewBgColor;
    
  • packageBgColor - 键盘表情包背景色

    @property (nonatomic, strong) UIColor  *packageBgColor;
    
  • packageSelectedBgColor - 键盘表情包选中状态背景色

    @property (nonatomic, strong) UIColor  *packageSelectedBgColor;
    
  • sendBtnBgColor - 键盘底部发送按钮的背景色

    @property (nonatomic, strong) UIColor  *sendBtnBgColor;
    
  • sendBtnTitleColor - 键盘底部发送按钮的文字的颜色

    @property (nonatomic, strong) UIColor  *sendBtnTitleColor;
    
  • navigationBarColor - 表情商店顶部导航条颜色

    @property (nonatomic, strong) UIColor  *navigationBarColor;
    
  • navigationBarTintColor - 表情商店顶部导航条文字颜色

    @property (nonatomic, strong) UIColor  *navigationBarTintColor;
    
  • navigationTitleFont - 表情商店顶部导航条文字字体

    @property (nonatomic, strong) UIFont   *navigationTitleFont;
    
  • separateColor - 分隔线的颜色

    @property (nonatomic, strong) UIColor  *separateColor;
    
  • shopCategoryFont - 在商店界面,表情分类名文字字体

    @property (nonatomic, strong) UIFont   *shopCategoryFont;
    
  • shopCategoryColor - 在商店界面,表情分类名文字颜色

    @property (nonatomic, strong) UIColor  *shopCategoryColor;
    
  • shopPackageTitleFont - 在商店界面,表情包标题文字字体

    @property (nonatomic, strong) UIFont   *shopPackageTitleFont;
    
  • shopPackageTitleColor - 在商店界面,表情包标题文字颜色

    @property (nonatomic, strong) UIColor  *shopPackageTitleColor;
    
  • shopPackageSubTitleFont - 在商店界面,表情包子标题文字字体

    @property (nonatomic, strong) UIFont   *shopPackageSubTitleFont;
    
  • shopPackageSubTitleColor - 在商店界面,表情包子标题文字颜色

    @property (nonatomic, strong) UIColor  *shopPackageSubTitleColor;
    
  • removeBtnBgColor - 在已下载表情界面,移除按钮背景色

    @property (nonatomic, strong) UIColor  *removeBtnBgColor;
    
  • removeBtnTitleFont - 在已下载表情界面,移除按钮字体

    @property (nonatomic, strong) UIFont  *removeBtnTitleFont;
    
  • removeBtnTitleColor - 在已下载表情界面,移除按钮字颜色

    @property (nonatomic, strong) UIColor  *removeBtnTitleColor;
    
  • removeBtnBorderColor - 在已下载表情界面,移除按钮边框颜色

    @property (nonatomic, strong) UIColor  *removeBtnBorderColor;
    
  • detailPackageTitleFont - 表情包详情页标题文字字体

    @property (nonatomic, strong) UIFont   *detailPackageTitleFont;
    
  • 禁止下载label的背景色

    @property (nonatomic, strong, nullable) UIColor  *detailPackageBannedBgColor;
    
  • 禁止下载label的字体

    @property (nonatomic, strong, nullable) UIFont   *detailPackageBannedFont;
    
  • 禁止下载label的字体颜色

    @property (nonatomic, strong, nullable) UIColor  *detailPackageBannedColor;
    
  • detailPackageTitleColor - 表情包详情页标题文字颜色

    @property (nonatomic, strong) UIColor  *detailPackageTitleColor;
    
  • detailPackageDescFont - 表情包详情页描述文字字体

    @property (nonatomic, strong) UIFont   *detailPackageDescFont;
    
  • detailPackageDescColor - 表情包详情页描述文字颜色

    @property (nonatomic, strong) UIColor  *detailPackageDescColor;
    
  • detailPackagePreviewFont - 表情包详情页"长按表情可预览"文字字体

    @property (nonatomic, strong) UIFont   *detailPackagePreviewFont;
    
  • detailPackagePreviewColor - 表情包详情页"长按表情可预览"文字颜色

    @property (nonatomic, strong) UIColor  *detailPackagePreviewColor;
    
  • downloadTitleFont - 表情包列表"下载"按钮文字字体

    @property (nonatomic, strong) UIFont   *downloadTitleFont;
    
  • downloadTitleColor - 表情包列表"下载"按钮文字颜色

    @property (nonatomic, strong) UIColor  *downloadTitleColor;
    
  • downloadedTitleColor - 表情包列表"已下载"按钮文字颜色

    @property (nonatomic, strong) UIColor  *downloadedTitleColor;
    
  • downloadedBgColor - 表情包列表"已下载"按钮背景色

    @property (nonatomic, strong) UIColor  *downloadedBgColor;
    
  • downloadedBorderColor - 表情包列表"已下载"按钮边框颜色背景色

    @property (nonatomic, strong) UIColor  *downloadedBorderColor;
    
  • downloadBorderColor - 表情包列表下载控件边框颜色

    @property (nonatomic, strong) UIColor  *downloadBorderColor;
    
  • downloadBgColor - 表情包列表下载控件背景色

    @property (nonatomic, strong) UIColor  *downloadBgColor;
    
  • downloadingColor - 表情包列表下载控件下载进度条下载中填充色

    @property (nonatomic, strong) UIColor  *downloadingColor;
    
  • downloadingTextColor - 表情包列表下载控件下载中文字颜色

    @property (nonatomic, strong) UIColor  *downloadingTextColor;
    
  • copyrightFont - 表情包详情页,底部版权文字字体

    @property (nonatomic, strong) UIFont   *copyrightFont;
    
  • copyrightColor - 表情包详情页,底部版权文字颜色

    @property (nonatomic, strong) UIColor  *copyrightColor;
    
  • promptLabelFont - 错误提示文字字体

    @property (nonatomic, strong) UIFont   *promptLabelFont;
    
  • promptLabelColor - 错误提示文字颜色

    @property (nonatomic, strong) UIColor  *promptLabelColor;
    
  • retryBtnFont - 键盘内错误提示重试按钮字体

    @property (nonatomic, strong) UIFont   *retryBtnFont;
    
  • retryBtnColor - 键盘内错误提示重试按钮文字颜色

    @property (nonatomic, strong) UIColor  *retryBtnColor;
    
  • retryBtnBgColor - 键盘内错误提示重试按钮背景色

    @property (nonatomic, strong) UIColor  *retryBtnBgColor;
    
  • retryBtnBorderColor - 键盘内错误提示重试按钮边框颜色

    @property (nonatomic, strong) UIColor  *retryBtnBorderColor;
    
  • shopBtnBgColor - 键盘商店按钮背景色

    @property (nonatomic, strong) UIColor  *shopBtnBgColor;
    
  • shopBtnIconColor - 键盘商店按钮图标颜色

    @property (nonatomic, strong) UIColor  *shopBtnIconColor;
    
  • remindLabelFont - 表情预览页面错误提示文字字体

    @property (nonatomic, strong) UIFont   *remindLabelFont;
    
  • remindLabelColor - 表情预览页面错误提示文字颜色

    @property (nonatomic, strong) UIColor  *remindLabelColor;
    
  • loadFailedLabelFont - 商店内错误页面提示文字字体

    @property (nonatomic, strong) UIFont   *loadFailedLabelFont;
    
  • loadFailedLabelColor - 商店内错误页面提示文字颜色

    @property (nonatomic, strong) UIColor  *loadFailedLabelColor;
    
  • reloadBtnFont - 商店内错误页面重试按钮字体

    @property (nonatomic, strong) UIFont   *reloadBtnFont;
    
  • reloadBtnColor - 商店内错误页面重试按钮文字颜色

    @property (nonatomic, strong) UIColor  *reloadBtnColor;
    
  • orderBtnColor - 我的表情页面排序按钮的颜色

    @property (nonatomic, strong, nullable) UIColor *orderBtnColor;
    
  • finishBtnColor - 我的表情页面完成状态按钮的颜色

    @property (nonatomic, strong, nullable) UIColor *finishBtnColor;
    
  • packageBannedBgColor - 表情包禁止下载的提示背景颜色

    @property (nonatomic, strong, nullable) UIColor *packageBannedBgColor;
    
  • packageBannedTextColor - 表情包禁止下载的提示文字颜色

    @property (nonatomic, strong, nullable) UIColor *packageBannedTextColor;
    
  • packageBannedTextFont - 表情包禁止下载的提示文字字体

    @property (nonatomic, strong, nullable) UIFont   *packageBannedTextFont;
    
  • keyboardHeight - 键盘高度

    @property (nonatomic, assign) CGFloat  keyboardHeight;
    
  • emojiTitleBgColor - 表情view底部title view的背景色

    @property (nonatomic, strong, nullable) UIColor *emojiTitleBgColor;
    
  • emojiTitleBgColor - 表情view底部title view的第一个label的背景色

    @property (nonatomic, strong, nullable) UIColor *emojiTitle1Color;
    
  • emojiTitleBgColor - 表情view底部title view的第二个label的背景色

    @property (nonatomic, strong, nullable) UIColor *emojiTitle2Color;
    
  • gif keyboard => hot word button title button

    @property (nonatomic, strong, nullable) UIFont *gifKeyboardHotWordButtonTitleFont;
    
  • gif keyboard => hot word button title color

    @property (nonatomic, strong, nullable) UIColor *gifKeyboardHotWordButtonTitleColor;
    
  • gif keyboard => hot word button background color

    @property (nonatomic, strong, nullable) UIColor *gifKeyboardHotWordButtonBgColor;
    
  • gif keyboard => hot word button border color

    @property (nonatomic, strong, nullable) UIColor *gifKeyboardHotWordButtonBorderColor;
    
  • gif keyboard => hot word button border width

    @property (nonatomic, assign) CGFloat gifKeyboardHotWordButtonBorderWidth;
    
  • gif keyboard => hot word button corner radius

    @property (nonatomic, assign) CGFloat gifKeyboardHotWordButtonCornerRadius;
    
  • gif keyboard => search bar text font

    @property (nonatomic, strong, nullable) UIFont *gifKeyboardSearchBarTextFont;
    
  • gif keyboard => search bar text color

    @property (nonatomic, strong, nullable) UIColor *gifKeyboardSearchBarTextColor;
    
  • gif keyboard => search bar background color

    @property (nonatomic, strong, nullable) UIColor *gifKeyboardSearchBarBgColor;
    
  • gif keyboard => search bar border color

    @property (nonatomic, strong, nullable) UIColor *gifKeyboardSearchBarBorderColor;
    
  • gif keyboard => search bar border width

    @property (nonatomic, assign) CGFloat gifKeyboardSearchBarBorderWidth;
    
  • gif keyboard => search bar corner radius

    @property (nonatomic, assign) CGFloat gifKeyboardSearchBarCornerRadius;
    
  • collectionManageButtonTitleColor - 收藏表情管理页面整理按钮文字颜色

    @property (nonatomic, strong, nullable) UIColor *collectionManageButtonTitleColor;
    
  • collectionManageFinishButtonTitleColor - 收藏表情管理页面完成按钮文字颜色

    @property (nonatomic, strong, nullable) UIColor *collectionManageFinishButtonTitleColor;
    
  • collectionManageTopButtonTitleColor - 收藏表情管理页面置顶按钮文字颜色

    @property (nonatomic, strong, nullable) UIColor *collectionManageTopButtonTitleColor;
    
  • collectionManageDeleteButtonTitleColor - 收藏表情管理页面删除按钮文字颜色

    @property (nonatomic, strong, nullable) UIColor *collectionManageDeleteButtonTitleColor;
    

DTImageView

说明: 展示动图数据的控件

/**
设置DTImageView的image
*/
@property (nonatomic, strong, nullable) UIImage *image;

/**
设置DTImageView加载图片失败后显示的图片
*/
@property (nonatomic, strong, nullable) UIImage *errorImage;

/**
计算DTImageView尺寸

@param size 图片尺寸
@param mSize DTImageView控件最大尺寸
@return DTImageView尺寸
*/
+ (CGSize)sizeForImageSize:(CGSize)size imgMaxSize: (CGSize)mSize;

/**
设置图片数据函数

@param urlString 图片url
@param gifId 图片id
*/
- (void)setImageWithDTUrl:(NSString * _Nonnull)urlString gifId:(NSString * _Nonnull)gifId;

/**
设置图片数据函数

@param urlString 图片url
@param gifId 图片id
@param handler 函数回调
*/
- (void)setImageWithDTUrl:(NSString * _Nonnull)urlString gifId:(NSString * _Nonnull)gifId completHandler:(void (^_Nullable)(BOOL success))handler;

/**
 设置表情包中表情数据函数

 @param emojiCode 表情code
 */
- (void)setImageWithEmojiCode:(NSString * _Nonnull)emojiCode;


/**
 设置表情包中表情数据函数

 @param emojiCode 表情code
 @param handler 处理成功回调
 */
- (void)setImageWithEmojiCode:(NSString * _Nonnull)emojiCode completHandler:(void (^_Nullable)(BOOL success))handler;

/**
DTImageView 重用
*/
- (void)prepareForReuse;