Initial commit
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// IfishAttachment.h
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 16/10/11.
|
||||
// Copyright © 2016年 lianxiang. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
//自定义爱鱼奇官方帐号推送消息 在消息扩展中已经做 这个是自定义消息的以后用 可以按需求重新写,下面没用
|
||||
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
|
||||
@interface IfishAttachment : NSObject<NIMCustomAttachment>
|
||||
|
||||
@property (nonatomic,copy) NSString *pushlink;
|
||||
|
||||
@property (nonatomic,copy) NSString *timestamp;
|
||||
|
||||
@property (nonatomic,copy) NSString *pushType;
|
||||
|
||||
@property (nonatomic,copy) NSString *pushId;
|
||||
|
||||
|
||||
|
||||
@end
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// IfishAttachment.m
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 16/10/11.
|
||||
// Copyright © 2016年 lianxiang. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IfishAttachment.h"
|
||||
|
||||
@implementation IfishAttachment
|
||||
- (NSString *)encodeAttachment{
|
||||
NSDictionary *dict = @{@"push_link":self.pushlink,@"timestamp":self.timestamp,@"msg_type":self.pushType,@"pushId":self.pushId};
|
||||
NSData *data = [NSJSONSerialization dataWithJSONObject:dict options:0 error:nil];
|
||||
NSString *encodeString = @"";
|
||||
if (data) {
|
||||
encodeString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
|
||||
}
|
||||
return encodeString;
|
||||
}
|
||||
//其他协议如上传下载托管可根据自己的业务需求选择实现
|
||||
|
||||
|
||||
#pragma mark - Getter
|
||||
- (NSString *)pushTitle{
|
||||
|
||||
if (!_pushlink) {
|
||||
_pushlink = @"";
|
||||
}
|
||||
return _pushlink;
|
||||
}
|
||||
|
||||
- (NSString *)pushContext{
|
||||
|
||||
if (!_timestamp) {
|
||||
_timestamp = @"";
|
||||
}
|
||||
return _timestamp;
|
||||
}
|
||||
|
||||
- (NSString *)pushType{
|
||||
|
||||
if (!_pushType) {
|
||||
_pushType = @"";
|
||||
}
|
||||
return _pushType;
|
||||
}
|
||||
|
||||
- (NSString *)pushId{
|
||||
|
||||
if (!_pushId) {
|
||||
_pushId = @"";
|
||||
}
|
||||
return _pushId;
|
||||
}
|
||||
|
||||
@end
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// IfishPushmassgaeContentView.h
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 16/10/12.
|
||||
// Copyright © 2016年 lianxiang. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NIMSessionMessageContentView.h"
|
||||
//自定义消息用 暂时没用
|
||||
|
||||
@interface IfishPushmassgaeContentView : NIMSessionMessageContentView
|
||||
//消息内容
|
||||
@property (nonatomic,strong) UILabel *messageLabel;
|
||||
|
||||
@end
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
//
|
||||
// IfishPushmassgaeContentView.m
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 16/10/12.
|
||||
// Copyright © 2016年 lianxiang. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IfishPushmassgaeContentView.h"
|
||||
#import "IfishAttachment.h"
|
||||
@implementation IfishPushmassgaeContentView
|
||||
|
||||
- (instancetype)initSessionMessageContentView{
|
||||
self = [super initSessionMessageContentView];
|
||||
if (self) {
|
||||
_messageLabel = [[UILabel alloc] initWithFrame:CGRectZero];
|
||||
_messageLabel.font = [UIFont systemFontOfSize:13.f];
|
||||
[self addSubview:_messageLabel];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)refresh:(NIMMessageModel*)data{
|
||||
//务必调用super方法
|
||||
[super refresh:data];
|
||||
|
||||
NIMCustomObject *object = data.message.messageObject;
|
||||
IfishAttachment *attachment = (IfishAttachment *)object.attachment;
|
||||
|
||||
self.messageLabel.text = attachment.pushType;
|
||||
|
||||
|
||||
if (!self.model.message.isOutgoingMsg) {
|
||||
self.messageLabel.textColor = [UIColor blackColor];
|
||||
|
||||
}else{
|
||||
self.messageLabel.textColor = [UIColor whiteColor];
|
||||
|
||||
}
|
||||
|
||||
[_messageLabel sizeToFit];
|
||||
|
||||
}
|
||||
|
||||
- (void)layoutSubviews{
|
||||
|
||||
[super layoutSubviews];
|
||||
CGFloat messageOriginX = 10.f;
|
||||
CGFloat messageOriginY = 10.f;
|
||||
|
||||
CGRect frame = self.messageLabel.frame;
|
||||
frame.origin = CGPointMake(messageOriginX, messageOriginY);
|
||||
self.messageLabel.frame = frame;
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)onTouchUpInside:(id)sender
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// RemoteExtMassageModel.h
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 16/10/12.
|
||||
// Copyright © 2016年 lianxiang. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface RemoteExtMassageModel : NSObject
|
||||
|
||||
@property (nonatomic,copy) NSString *pushlink;
|
||||
|
||||
@property (nonatomic,copy) NSString *timestamp;
|
||||
|
||||
@property (nonatomic,copy) NSString *pushType;
|
||||
|
||||
@property (nonatomic,copy) NSString *pushId;
|
||||
|
||||
@property (nonatomic,copy) NSString *pushTitle;
|
||||
|
||||
|
||||
@end
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// RemoteExtMassageModel.m
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 16/10/12.
|
||||
// Copyright © 2016年 lianxiang. All rights reserved.
|
||||
//
|
||||
|
||||
#import "RemoteExtMassageModel.h"
|
||||
|
||||
@implementation RemoteExtMassageModel
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user