Skip to content

Commit

Permalink
更新 SDK 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
IsanHu committed May 3, 2018
1 parent 741e83f commit 543d904
Show file tree
Hide file tree
Showing 32 changed files with 1,259 additions and 2,450 deletions.
552 changes: 275 additions & 277 deletions ChatDemo-UI3.0/ChatDemo-UI3.0.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Expand Up @@ -9,14 +9,15 @@
#ifndef BQMM_h
#define BQMM_h

#define BQMM_VERSION 0x00020000
#define BQMM_VERSION 0x00020100
#define BQMM_BUILD @"release"

#import "MMEmotionCentre.h"
#import "MMTheme.h"
#import "MMEmoji.h"
#import "MMGif.h"
#import "UITextView+BQMM.h"
#import "MMImageView.h"


#endif /* BQMM_h */
Expand Up @@ -141,15 +141,17 @@ typedef enum
* @param appkey third party appKey
* @param platformId third party platform id
*/
- (void)setAppkey:(nonnull NSString *)appkey platformId:(nonnull NSString *)platformId;
- (void)setAppkey:(nonnull NSString *)appkey
platformId:(nonnull NSString *)platformId;

/**
* initialize SDK
* Apply for appId and secret: http://open.biaoqingmm.com/open/register/index.html
* @param appId the unique app id that assigned to your app
* @param secret the unique app secret that assigned to your app
*/
- (void)setAppId:(nonnull NSString *)appId secret:(nonnull NSString *)secret;
- (void)setAppId:(nonnull NSString *)appId
secret:(nonnull NSString *)secret;

/**
* set userId to track the status of unique user
Expand Down Expand Up @@ -206,14 +208,6 @@ typedef enum
* @param enable enable
*/
- (void)setUnicodeEmojiTabEnabled: (BOOL)enable;
/**
* the detail view for a single emoji
*
* @param emojiCode the unique code for emoji
*
* @return the detail view controller for emoji
*/
- (nonnull UIViewController *)controllerForEmotionCode:(nonnull NSString *)emojiCode;

/**
* fetch emojis according to emoji type and emoji code
Expand Down Expand Up @@ -241,12 +235,12 @@ typedef enum
- (void)clearCache;


//流行表情数据接口
//trending gif data
- (void)trendingGifsAt:(int)page
withPageSize:(int)pageSize
completionHandler:(void (^ __nonnull)(NSArray<MMGif *> * __nullable gifs, NSError * __nullable error))completionHandler;

//搜索表情数据接口
//search gif data
- (void)searchGifsWithKey:(NSString * _Nullable)key
At:(int)page
withPageSize:(int)pageSize
Expand Down
@@ -0,0 +1,34 @@
//
// MMImageView.h
// StampMeSDK
//
// Created by Tender on 16/03/2018.
// Copyright © 2018 siyanhui. All rights reserved.
//

#ifndef MMImageView_h
#define MMImageView_h

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@class MMEmoji;

@interface MMImageView: UIView

@property (nonatomic, strong, nullable) UIImage *image;
@property (nonatomic, strong, nullable) UIImage *errorImage;


+ (CGSize)sizeForImageSize:(CGSize)size imgMaxSize: (CGSize)mSize;

- (void)prepareForReuse;

- (void)setImageWithEmojiCode:(NSString * _Nonnull)emojiCode;
- (void)setImageWithEmojiCode:(NSString * _Nonnull)emojiCode completHandler:(void (^_Nullable)(BOOL success))handler;

- (void)setImageWithUrl:(NSString * _Nonnull)urlString gifId:(NSString * _Nonnull)gifId;
- (void)setImageWithUrl:(NSString * _Nonnull)urlString gifId:(NSString * _Nonnull)gifId completHandler:(void (^_Nullable)(BOOL success))handler;
@end

#endif /* MMImageView_h */
Expand Up @@ -353,4 +353,20 @@
}
*/
@property (nonatomic, assign) CGFloat keyboardHeight;

/**
* the background color of emoji title view
*/
@property (nonatomic, strong, nullable) UIColor *emojiTitleBgColor;

/**
* the background color of the first emoji label
*/
@property (nonatomic, strong, nullable) UIColor *emojiTitle1Color;

/**
* the background color of the second emoji label
*/
@property (nonatomic, strong, nullable) UIColor *emojiTitle2Color;

@end
Expand Up @@ -140,7 +140,8 @@ - (void)setMmTextData:(NSArray*)extData completionHandler:(void(^)(void))complet
MMTextAttachment *attachment = (MMTextAttachment *)value;
[weakSelf.attachmentRanges addObject:[NSValue valueWithRange:range]];
[weakSelf.attachments addObject:value];
UIImageView *imgView = [[UIImageView alloc] initWithImage:attachment.emoji.emojiImage];
UIImageView *imgView = [[UIImageView alloc] init];
imgView.image = attachment.emoji.emojiImage;
attachment.image = nil;
[weakSelf.imageViews addObject:imgView];
}
Expand Down
Expand Up @@ -9,6 +9,7 @@
#import <UIKit/UIKit.h>
#import <BQMM/BQMM.h>


#define TEXT_MESG_TYPE @"txt_msgType" //key for text message
#define TEXT_MESG_FACE_TYPE @"facetype" //key for big emoji type
#define TEXT_MESG_EMOJI_TYPE @"emojitype" //key for photo-text message
Expand Down Expand Up @@ -43,5 +44,4 @@ typedef void (^MMGifSelectedHandler)(MMGif * _Nullable gif); //搜索表情点
- (void)setSearchModeEnabled:(BOOL)enabled withInputView:(UIResponder<UITextInput> *_Nullable)input;
- (void)setSearchUiVisible:(BOOL)visible withAttatchedView:(UIView *_Nullable)attachedView;
- (void)showTrending;

@end
Expand Up @@ -278,9 +278,11 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPa
if (cell.emojiImageView.userInteractionEnabled) {
return;
}
MMGif *gif = cell.picture;
NSString *keyword = self.showingTrending? @"_trending_": self.currentKey;
[[NSNotificationCenter defaultCenter] postNotificationName:@"MMSendGifNotification" object:nil userInfo:@{@"gifId":gif.imageId, @"keyword": keyword ? keyword: @""}];
[self updateSearchModeAndSearchUIWithStatus:MMSearchModeStatusGifMessageSent];
if (self.selectedHandler) {
MMGif *gif = cell.picture;
self.selectedHandler(gif);
}
}
Expand Down Expand Up @@ -325,6 +327,7 @@ - (void)updateSearchModeAndSearchUIWithStatus:(MMSearchModeStatus)status {
}

if (status & MMSearchModeStatusGifMessageSent) {

[self dismissWebPic];
self.searchModeEnabled = NO;
self.searchUiVisible = NO;
Expand Down
10 changes: 2 additions & 8 deletions ChatDemo-UI3.0/ChatDemo-UI3.0/ChatDemo-UI3.0-Info.plist
Expand Up @@ -26,7 +26,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>2.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -41,7 +41,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>200</string>
<string>20180428</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
Expand All @@ -57,12 +57,6 @@
<string>环信Demo需要使用您的麦克风</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>环信Demo需要访问您的相册</string>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>remote-notification</string>
<string>voip</string>
</array>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand Down
5 changes: 1 addition & 4 deletions ChatDemo-UI3.0/ChatDemo-UI3.0/ChatDemo-UI3.0.entitlements
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
</dict>
<dict/>
</plist>
21 changes: 16 additions & 5 deletions ChatDemo-UI3.0/ChatDemo-UI3.0/Class/AppDelegate.m
Expand Up @@ -68,16 +68,16 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

//BQMM集成
// 初始化表情MMSDK
// NSString *appId = @"dc5bdb26a4e745e3ad4198ff9ea477eb";
// NSString *secret = @"3e48f004b96640a3b43a5d11ce913b88";

NSString *appId = @"15e0710942ec49a29d2224a6af4460ee";
NSString *secret = @"b11e0936a9d04be19300b1d6eec0ccd5";
NSString *appId = @"app id";
NSString *secret = @"app secret";
// [MMEmotionCentre defaultCentre].useHttp = false;
[[MMEmotionCentre defaultCentre] setAppId:appId
secret:secret];
[MMEmotionCentre defaultCentre].sdkLanguage = MMLanguageChinese;
[MMEmotionCentre defaultCentre].sdkRegion = MMRegionOther;

MMTheme *theme = [[MMTheme alloc] init];
[[MMEmotionCentre defaultCentre] setTheme:theme];


#warning 初始化环信SDK,详细内容在AppDelegate+EaseMob.m 文件中
Expand Down Expand Up @@ -144,6 +144,17 @@ - (void)applicationDidBecomeActive:(UIApplication *)application
[[NSNotificationCenter defaultCenter] postNotificationName:RedpacketAlipayNotifaction object:nil];
}

//BQMM集成
- (void)applicationWillEnterForeground:(UIApplication *)application {
[[MMEmotionCentre defaultCentre] clearSession];
}

- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
//BQMM集成
[[MMEmotionCentre defaultCentre] clearCache];
}

// NOTE: iOS9.0之前使用的API接口
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
Expand Down
Expand Up @@ -16,9 +16,6 @@
#import "UserProfileManager.h"
#import "RedPacketChatViewController.h"

//BQMM集成
#import "MMGifManager.h"


@interface ContactListSelectViewController () <EMUserListViewControllerDelegate,EMUserListViewControllerDataSource>

Expand Down
Expand Up @@ -35,7 +35,7 @@ - (void)setCustomModel:(id<IMessageModel>)model
{
UIImage *image = model.image;
if (!image) {
[self.bubbleView.imageView sd_setImageWithURL:[NSURL URLWithString:model.fileURLPath] placeholderImage:[UIImage imageNamed:model.failImageName]];

} else {
_bubbleView.imageView.image = image;
}
Expand Down
Expand Up @@ -35,7 +35,6 @@ - (void)setCustomModel:(id<IMessageModel>)model
{
UIImage *image = model.image;
if (!image) {
[self.bubbleView.imageView sd_setImageWithURL:[NSURL URLWithString:model.fileURLPath] placeholderImage:[UIImage imageNamed:model.failImageName]];
} else {
_bubbleView.imageView.image = image;
}
Expand Down

0 comments on commit 543d904

Please sign in to comment.