-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zhiruiou
committed
Dec 7, 2021
1 parent
457b121
commit 2664f4b
Showing
119 changed files
with
4,096 additions
and
409 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
File renamed without changes.
File renamed without changes.
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 @@ | ||
// | ||
// SmallButton.h | ||
// | ||
// Created by stcui on 15/7/14. | ||
// Copyright © 2015年 Tencent. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
// extend hitTest area when rect width is smaller than 44px | ||
@interface SmallButton : UIButton | ||
|
||
@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,28 @@ | ||
// | ||
// SmallButton.m | ||
// | ||
// Created by stcui on 15/7/14. | ||
// Copyright © 2015年 Tencent. All rights reserved. | ||
// | ||
|
||
#import "SmallButton.h" | ||
|
||
@implementation SmallButton | ||
|
||
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event { | ||
if (!self.enabled || self.hidden) return [super pointInside:point withEvent:event]; | ||
CGRect area = self.frame; | ||
area.origin = CGPointZero; | ||
if (CGRectGetWidth(area) < 44) { | ||
area.origin.x = CGRectGetMidX(area) - 22; | ||
area.size.width = 44; | ||
} | ||
if (CGRectGetHeight(area) < 44) { | ||
area.origin.y = CGRectGetMidY(area) - 22; | ||
area.size.height = 44; | ||
} | ||
|
||
return CGRectContainsPoint(area, point); | ||
} | ||
|
||
@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,32 @@ | ||
// | ||
// TCHttpUtil.h | ||
// TXLiteAVDemo | ||
// | ||
// Created by rushanting on 2017/11/10. | ||
// Copyright © 2017年 Tencent. All rights reserved. | ||
// | ||
|
||
#define kHttpTimeout 30 | ||
|
||
#define kHttpServerAddr @"https://lvb.qcloud.com/weapp/utils" | ||
#define kHttpUGCServerAddr @"http://demo.vod2.myqcloud.com/shortvideo" //@"http://119.29.189.135:8000" | ||
#define UGCAppid @"1256468886" | ||
#define UGCAppKey @"1973fcc2b70445af8b51053d4f9022bb" | ||
|
||
//错误码 | ||
#define kError_InvalidParam -10001 | ||
#define kError_ConvertJsonFailed -10002 | ||
#define kError_HttpError -10003 | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface TCHttpUtil : NSObject | ||
|
||
+ (NSData *)dictionary2JsonData:(NSDictionary *)dict; | ||
+ (NSDictionary *)jsonData2Dictionary:(NSString *)jsonData; | ||
+ (void)asyncSendHttpRequest:(NSString*)request | ||
httpServerAddr:(NSString *)httpServerAddr | ||
HTTPMethod:(NSString *)HTTPMethod | ||
param:(NSDictionary *)param | ||
handler:(void (^)(int result, NSDictionary* resultDict))handler; | ||
@end |
114 changes: 114 additions & 0 deletions
114
Demo/TXLiteAVDemo/App/AppCommon/TCHttpUtil/TCHttpUtil.m
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,114 @@ | ||
// | ||
// TCHttpUtil.m | ||
// TXLiteAVDemo | ||
// | ||
// Created by rushanting on 2017/11/10. | ||
// Copyright © 2017年 Tencent. All rights reserved. | ||
// | ||
|
||
#import "TCHttpUtil.h" | ||
#import "NSString+Common.h" | ||
|
||
@implementation TCHttpUtil | ||
|
||
+ (NSData *)dictionary2JsonData:(NSDictionary *)dict | ||
{ | ||
// 转成Json数据 | ||
if ([NSJSONSerialization isValidJSONObject:dict]) | ||
{ | ||
NSError *error = nil; | ||
NSData *data = [NSJSONSerialization dataWithJSONObject:dict options:0 error:&error]; | ||
if(error) | ||
{ | ||
NSLog(@"[%@] Post Json Error", [self class]); | ||
} | ||
return data; | ||
} | ||
else | ||
{ | ||
NSLog(@"[%@] Post Json is not valid", [self class]); | ||
} | ||
return nil; | ||
} | ||
|
||
+ (NSDictionary *)jsonData2Dictionary:(NSString *)jsonData | ||
{ | ||
if (jsonData == nil) { | ||
return nil; | ||
} | ||
NSData *data = [jsonData dataUsingEncoding:NSUTF8StringEncoding]; | ||
NSError *err = nil; | ||
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&err]; | ||
if (err) { | ||
NSLog(@"Json parse failed: %@", jsonData); | ||
return nil; | ||
} | ||
return dic; | ||
} | ||
|
||
+ (void)asyncSendHttpRequest:(NSString*)request | ||
httpServerAddr:(NSString *)httpServerAddr | ||
HTTPMethod:(NSString *)HTTPMethod | ||
param:(NSDictionary *)param | ||
handler:(void (^)(int result, NSDictionary* resultDict))handler | ||
{ | ||
dispatch_async(dispatch_get_global_queue(0, 0), ^{ | ||
NSString* strUrl = @""; | ||
if ([httpServerAddr isEqualToString:kHttpUGCServerAddr]) { | ||
NSDate* date = [NSDate dateWithTimeIntervalSinceNow:0]; | ||
UInt64 timestamp= (UInt64)[date timeIntervalSince1970]; | ||
UInt64 msTimestamp = (UInt64)([date timeIntervalSince1970] * 1000); | ||
NSString *nonce = [[NSString stringWithFormat:@"%llu",msTimestamp] md5]; | ||
NSString *sig = [[NSString stringWithFormat:@"%@%llu%@%@",UGCAppid,timestamp,nonce,UGCAppKey] md5]; | ||
strUrl = [NSString stringWithFormat:@"%@/%@?timestamp=%llu&nonce=%@&sig=%@&appid=%@", httpServerAddr, request,timestamp,nonce,sig,UGCAppid]; | ||
}else{ | ||
strUrl = [NSString stringWithFormat:@"%@/%@", httpServerAddr, request]; | ||
} | ||
|
||
if ([param allKeys].count > 0 && [HTTPMethod isEqual:@"GET"]) { | ||
NSMutableString *getUrl = [[NSMutableString alloc] initWithString:strUrl]; | ||
if (![getUrl containsString:@"?"]) { | ||
[getUrl appendString:@"?"]; | ||
} | ||
for (NSString* key in param.allKeys) { | ||
if (![[getUrl substringFromIndex:[getUrl length] - 1] isEqualToString:@"?"]) { | ||
[getUrl appendString:@"&"]; | ||
} | ||
[getUrl appendString:[NSString stringWithFormat:@"%@=%@",key,param[key]]]; | ||
} | ||
strUrl = [NSString stringWithString:getUrl]; | ||
} | ||
|
||
NSURL *URL = [NSURL URLWithString:strUrl]; | ||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL]; | ||
|
||
[request setHTTPMethod:HTTPMethod]; | ||
[request setValue:@"application/json; charset=UTF-8" forHTTPHeaderField:@"Content-Type"]; | ||
[request setTimeoutInterval:kHttpTimeout]; | ||
for (NSString *key in param.allKeys) { | ||
[request setValue:param[key] forHTTPHeaderField:key]; | ||
} | ||
|
||
NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { | ||
if (error != nil) | ||
{ | ||
NSLog(@"internalSendRequest failed,NSURLSessionDataTask return error code:%ld, des:%@", [error code], [error description]); | ||
dispatch_async(dispatch_get_main_queue(), ^{ | ||
handler(kError_HttpError, nil); | ||
}); | ||
} | ||
else | ||
{ | ||
NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; | ||
NSDictionary* resultDict = [TCHttpUtil jsonData2Dictionary:responseString]; | ||
dispatch_async(dispatch_get_main_queue(), ^{ | ||
handler(0, resultDict); | ||
}); | ||
} | ||
}]; | ||
|
||
[task resume]; | ||
}); | ||
} | ||
|
||
@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
6 changes: 3 additions & 3 deletions
6
Demo/TXLiteAVDemo/App/Resource/Assets.xcassets/Play/SuperPlayer/Contents.json
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} | ||
} |
Binary file removed
BIN
-15.5 KB
...esource/Assets.xcassets/Play/SuperPlayer/player_close.imageset/player_close.png
Binary file not shown.
Binary file removed
BIN
-1.81 KB
...urce/Assets.xcassets/Play/SuperPlayer/player_close.imageset/[email protected]
Binary file not shown.
Binary file removed
BIN
-2.27 KB
...urce/Assets.xcassets/Play/SuperPlayer/player_close.imageset/[email protected]
Binary file not shown.
6 changes: 3 additions & 3 deletions
6
Demo/TXLiteAVDemo/App/Resource/Assets.xcassets/TRTCVoiceRoom/Contents.json
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -2,22 +2,21 @@ | |
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "bgm_pause.png", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "bgm_pause.png", | ||
"idiom" : "universal", | ||
"filename" : "[email protected]", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} | ||
} |
Binary file removed
BIN
-3.89 KB
.../App/Resource/Assets.xcassets/TRTCVoiceRoom/bgm_pause.imageset/[email protected]
Binary file not shown.
Oops, something went wrong.