Skip to content
This repository was archived by the owner on Oct 9, 2021. It is now read-only.

Commit

Permalink
release SealTalk Demo version 2.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephJue committed Jun 21, 2016
1 parent 3fb26de commit 346e09b
Show file tree
Hide file tree
Showing 1,016 changed files with 102,594 additions and 0 deletions.
Binary file added 70s Electric Piano 52.caf
Binary file not shown.
30 changes: 30 additions & 0 deletions AFAppDotNetAPIClient.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// AFAppDotNetAPIClient.h
//
// Copyright (c) 2012 Mattt Thompson (http://mattt.me/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import <Foundation/Foundation.h>
#import "AFHTTPSessionManager.h"
//#import "constants.h"
@interface AFAppDotNetAPIClient : AFHTTPSessionManager

+ (instancetype)sharedClient;

@end
36 changes: 36 additions & 0 deletions AFAppDotNetAPIClient.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// AFAppDotNetAPIClient.h
//
// Copyright (c) 2012 Mattt Thompson (http://mattt.me/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import "AFAppDotNetAPIClient.h"
@implementation AFAppDotNetAPIClient

+ (instancetype)sharedClient {
static AFAppDotNetAPIClient *_sharedClient = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedClient = [[AFAppDotNetAPIClient alloc] initWithBaseURL:[NSURL URLWithString:@""]];
});

return _sharedClient;
}

@end
14 changes: 14 additions & 0 deletions AddAppKeyViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// AddAppKeyViewController.h
// RCloudMessage
//
// Created by litao on 15/5/28.
// Copyright (c) 2015年 RongCloud. All rights reserved.
//

//本文件为了切换appkey测试用的,请应用开发者忽略关于本文件的信息。
#import <UIKit/UIKit.h>
#import "AppkeyModel.h"
@interface AddAppKeyViewController : UIViewController
@property (nonatomic, strong)void (^result)(AppkeyModel *addedKey);
@end
54 changes: 54 additions & 0 deletions AddAppKeyViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//
// AddAppKeyViewController.m
// RCloudMessage
//
// Created by litao on 15/5/28.
// Copyright (c) 2015年 RongCloud. All rights reserved.
//

//本文件为了切换appkey测试用的,请应用开发者忽略关于本文件的信息。
#import "AddAppKeyViewController.h"

@interface AddAppKeyViewController ()
@property (nonatomic, strong)UITextField *keyField;
@property (nonatomic, strong)UITextField *devField;
@end

@implementation AddAppKeyViewController
-(void)viewDidLoad
{
[super viewDidLoad];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Save" style:UIBarButtonItemStylePlain target:self action:@selector(onSave:)];

self.keyField = [[UITextField alloc] initWithFrame:CGRectMake(5, 80, 220, 40)];
self.devField = [[UITextField alloc] initWithFrame:CGRectMake(5, 140, 220, 40)];

[self.keyField setBorderStyle:UITextBorderStyleRoundedRect];
[self.devField setBorderStyle:UITextBorderStyleRoundedRect];

self.keyField.placeholder = @"appkey";
self.devField.placeholder = @"dev";

[self.view addSubview:self.keyField];
[self.view addSubview:self.devField];
[self.view setBackgroundColor:[UIColor whiteColor]];
}
- (void)onSave:(id)sender
{
NSString *appKey = self.keyField.text;
int env = [self.devField.text intValue];
if (env != 1 && env != 2) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert"
message:@"dev值必须是1或者2"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil,nil];
[alert show];
return;
}
AppkeyModel *model = [[AppkeyModel alloc] initWithKey:appKey env:env];
self.result(model);
[self.navigationController popViewControllerAnimated:YES];
}

@end
16 changes: 16 additions & 0 deletions AppkeyModel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// AppkeyModel.h
// RCloudMessage
//
// Created by litao on 15/5/27.
// Copyright (c) 2015年 RongCloud. All rights reserved.
//

//本文件为了切换appkey测试用的,请应用开发者忽略关于本文件的信息。
#import <Foundation/Foundation.h>

@interface AppkeyModel : NSObject
@property (nonatomic, strong)NSString *appKey;
@property (nonatomic)int env;
- (instancetype)initWithKey:(NSString *)appKey env:(int)env;
@end
22 changes: 22 additions & 0 deletions AppkeyModel.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// AppkeyModel.m
// RCloudMessage
//
// Created by litao on 15/5/27.
// Copyright (c) 2015年 RongCloud. All rights reserved.
//

//本文件为了切换appkey测试用的,请应用开发者忽略关于本文件的信息。
#import "AppkeyModel.h"

@implementation AppkeyModel
- (instancetype)initWithKey:(NSString *)appKey env:(int)env
{
self = [super init];
if (self) {
self.appKey = appKey;
self.env = env;
}
return self;
}
@end
19 changes: 19 additions & 0 deletions DefaultPortraitView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// DefaultPortraitView.h
// RCloudMessage
//
// Created by Jue on 16/3/31.
// Copyright © 2016年 RongCloud. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface DefaultPortraitView : UIView

@property (nonatomic, strong) NSString *firstCharacter;

-(void)setColorAndLabel:(NSString *)userId Nickname:(NSString *)nickname;

- (UIImage *)imageFromView;

@end
165 changes: 165 additions & 0 deletions DefaultPortraitView.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
//
// DefaultPortraitView.m
// RCloudMessage
//
// Created by Jue on 16/3/31.
// Copyright © 2016年 RongCloud. All rights reserved.
//

#import "DefaultPortraitView.h"
#import "pinyin.h"

@implementation DefaultPortraitView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/

-(id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {


}
return self;
}

-(void)setColorAndLabel:(NSString *)userId Nickname:(NSString *)nickname
{
//设置背景色

userId = [userId uppercaseString];//设置为大写
int asciiCode = [userId characterAtIndex:0];
int colorIndex = asciiCode % 5;
NSArray *colorList = [[NSArray alloc] initWithObjects:@"#e97ffb",@"#00b8d4",@"#82b2ff",@"#f3db73",@"#f0857c", nil];
NSString *backgroundColorStr = colorList[colorIndex];
self.backgroundColor = [self hexStringToColor:backgroundColorStr];

//设置字母Label
UILabel *firstCharacterLabel = [[UILabel alloc] init];
NSString *firstLetter = [nickname substringToIndex:1];
firstCharacterLabel.text = firstLetter;
firstCharacterLabel.textColor = [UIColor whiteColor];
firstCharacterLabel.textAlignment = UITextAlignmentCenter;
firstCharacterLabel.font = [UIFont systemFontOfSize:50];
firstCharacterLabel.frame = CGRectMake(self.frame.size.width / 2 - 30, self.frame.size.height / 2 - 30, 60, 60);
// firstCharacterLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:firstCharacterLabel];

// NSDictionary *views=NSDictionaryOfVariableBindings(firstCharacterLabel);
//
// [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-10-[firstCharacterLabel(60)]" options:0 metrics:nil views:views]];
//
// [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-10-[firstCharacterLabel(60)]" options:0 metrics:nil views:views]];

// [self addConstraint:[NSLayoutConstraint
// constraintWithItem:firstCharacterLabel
// attribute:NSLayoutAttributeCenterY
// relatedBy:NSLayoutRelationEqual
// toItem:self
// attribute:NSLayoutAttributeCenterY
// multiplier:1.0f
// constant:0
// ]];
// [self addConstraint:[NSLayoutConstraint
// constraintWithItem:firstCharacterLabel
// attribute:NSLayoutAttributeCenterX
// relatedBy:NSLayoutRelationEqual
// toItem:self
// attribute:NSLayoutAttributeCenterX
// multiplier:1.0f
// constant:0
// ]];

}

-(UIColor *) hexStringToColor: (NSString *) stringToConvert
{
NSString *cString = [[stringToConvert stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
// String should be 6 or 8 characters

if ([cString length] < 6) return [UIColor blackColor];
// strip 0X if it appears
if ([cString hasPrefix:@"0X"]) cString = [cString substringFromIndex:2];
if ([cString hasPrefix:@"#"]) cString = [cString substringFromIndex:1];
if ([cString length] != 6) return [UIColor blackColor];

// Separate into r, g, b substrings

NSRange range;
range.location = 0;
range.length = 2;
NSString *rString = [cString substringWithRange:range];
range.location = 2;
NSString *gString = [cString substringWithRange:range];
range.location = 4;
NSString *bString = [cString substringWithRange:range];
// Scan values
unsigned int r, g, b;

[[NSScanner scannerWithString:rString] scanHexInt:&r];
[[NSScanner scannerWithString:gString] scanHexInt:&g];
[[NSScanner scannerWithString:bString] scanHexInt:&b];

return [UIColor colorWithRed:((float) r / 255.0f)
green:((float) g / 255.0f)
blue:((float) b / 255.0f)
alpha:1.0f];
}

- (UIImage *)imageFromView
{

UIGraphicsBeginImageContext(self.frame.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[self.layer renderInContext:context];
UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

return theImage;
}

- (UIImage*)captureWithView
{
// 1.开启上下文
UIGraphicsBeginImageContextWithOptions(self.frame.size, NO, 0.0);

// 2.将控制器view的layer渲染到上下文
[self.layer renderInContext:UIGraphicsGetCurrentContext()];

// 3.取出图片
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();

// 4.结束上下文
UIGraphicsEndImageContext();

return newImage;
}

/**
* 汉字转拼音
*
* @param hanZi 汉字
*
* @return 转换后的拼音
*/
-(NSString *) hanZiToPinYinWithString:(NSString *)hanZi
{
if(!hanZi) return nil;
NSString *pinYinResult=[NSString string];
for(int j=0;j<hanZi.length;j++){
NSString *singlePinyinLetter=[[NSString stringWithFormat:@"%c",pinyinFirstLetter([hanZi characterAtIndex:j])] uppercaseString];
pinYinResult=[pinYinResult stringByAppendingString:singlePinyinLetter];

}

return pinYinResult;

}

@end
13 changes: 13 additions & 0 deletions RCDAboutRongCloudTableViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// RCDAboutRongCloudTableViewController.h
// RCloudMessage
//
// Created by litao on 15/4/27.
// Copyright (c) 2015年 RongCloud. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface RCDAboutRongCloudTableViewController : UITableViewController

@end
Loading

0 comments on commit 346e09b

Please sign in to comment.