Commit df9cb1ef by pidan

Merge branch 'feature/模块化' of http://git.yabolive.net:88/pidan/FuSiLive into feature/模块化

parents 662aadcd 72a1a73f
Showing with 155 additions and 41 deletions
......@@ -78,14 +78,14 @@
//中奖奖音效
BOOL soundSwitch = [[[NSUserDefaults standardUserDefaults] objectForKey:FUSUserUDKeys.fus_SETTING_SOUND_SWITCH_BOOL] boolValue];
BOOL soundSwitch = [FUSSoundAndVibrateHelper systemSoundOpen];
if (soundSwitch && needRing && ![NSString isNull:soundName]) {
[FUSSoundAndVibrateHelper playSoundEffect:soundName bundle:[FUSCommonBundle bundle] ofType:@"mp3"];
}
//振动效果
if (needVibrate) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
BOOL vibrateSwitch = [[[NSUserDefaults standardUserDefaults] objectForKey:FUSUserUDKeys.fus_SETTING_VIBRATE_SWITCH_BOOL] boolValue];
BOOL vibrateSwitch = [FUSSoundAndVibrateHelper systemVibrateOpen];
if (vibrateSwitch) {
[FUSSoundAndVibrateHelper fus_playSystemVibrate];
}
......
......@@ -137,6 +137,26 @@
return @"1155170616178706#yabolivetv-sandbox";
}
/// facebook key
- (NSString *)facebookLoginKey {
return @"382456482257502";
}
/// facebook secret
- (NSString *)facebookLoginSecret {
return @"045478b9202f7c4913ab5366eaf15f8a";
}
/// facebook key
- (NSString *)facebookShareKey {
return @"948124033391771";
}
/// facebook secret
- (NSString *)facebookShareSecret {
return @"0a161eeda8135dcd07ef3d46c7a9121c";
}
@end
#pragma mark -
......@@ -225,7 +245,7 @@
NSArray *postDatas = [self.postJsonList copy];
[self.postJsonList removeAllObjects];
[FUSHttpHelper postRequestJsonWithUrl:@"/stat/ios/json/data"
[FUSHttpHelper postRequestBinaryWithUrl:@"/stat/ios/json/data"
params:@{@"json":postDatas.description}
success:nil
failure:nil];
......
......@@ -42,11 +42,6 @@ NS_ASSUME_NONNULL_BEGIN
// 用户是否已认证
+ (NSString *)fus_USER_AUTHSTATE;
// 设置中声音开关
+ (NSString *)fus_SETTING_SOUND_SWITCH_BOOL;
// 设置中振动开关
+ (NSString *)fus_SETTING_VIBRATE_SWITCH_BOOL;
// 设置中启动语音开关
+ (NSString *)fus_SETTING_LAUNCH_SOUND_SWITCH_BOOL;
......
......@@ -59,15 +59,6 @@
return @"videoAuthState";
}
// 设置中声音开关
+ (NSString *)fus_SETTING_SOUND_SWITCH_BOOL {
return @"SettingSoundSwitchBool";
}
// 设置中振动开关
+ (NSString *)fus_SETTING_VIBRATE_SWITCH_BOOL {
return @"SettingVibrateSwitchBool";
}
// 设置中启动语音开关
+ (NSString *)fus_SETTING_LAUNCH_SOUND_SWITCH_BOOL {
return @"SettingLaunchSoundSwitchBool";
......
......@@ -42,6 +42,8 @@ Pod::Spec.new do |s|
s.private_header_files = ['FUSFoundation/Classes/FUSFoundation/Tools/ThirdParty/Audio/**/*.h']
s.project_header_files = 'FUSFoundation/Classes/FUSFoundation/Tools/ThirdParty/ByteDanceBeauty/include/*.h'
s.prefix_header_contents = ['#import "NSString+MD5.h"']
s.libraries = 'stdc++', 'c++', 'bz2'
s.dependency 'AFNetworking'
......
......@@ -8,8 +8,20 @@
#import <Foundation/Foundation.h>
@interface FUSStringDecoderHelper : NSObject
/// 解码后的key
@property (nonatomic, copy) NSString *decodeKey;
/// 解码后的字符串缓存
@property (nonatomic, strong) NSMutableDictionary<NSString *, NSString *> *decodeStrDict;
@end
@interface NSString (MD5)
- (NSString *)fus_decodeAESStr;
/**
* 获取MD5字符串
*/
......@@ -21,5 +33,4 @@
*/
+ (NSString *)md5String:(NSString *)str;
@end
......@@ -8,9 +8,55 @@
#import "NSString+MD5.h"
#import <CommonCrypto/CommonDigest.h>
#import <CommonCrypto/CommonCryptor.h>
#import "ObfuseTableBase64.h"
#import "NSString+Check.h"
@implementation FUSStringDecoderHelper
+ (instancetype)sharedInstance {
static id shared = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
shared = [[super alloc] init];
});
return shared;
}
- (instancetype)init
{
self = [super init];
if (self) {
_decodeStrDict = [NSMutableDictionary dictionary];
}
return self;
}
- (NSString *)decodeKey {
if (_decodeKey == nil) {
_decodeKey = [[ObfuseTableBase64 inst] decode:@"RnVzaUNsdWIxMjM0NTY3OA=="];
}
return _decodeKey;
}
@end
@implementation NSString (MD5)
- (NSString *)fus_decodeAESStr {
if ([NSString isNull:self]) {
return self;
}
if (FUSStringDecoderHelper.sharedInstance.decodeStrDict[self]) {
return FUSStringDecoderHelper.sharedInstance.decodeStrDict[self];
} else {
return [NSString aesDecrypt:self];
}
}
/**
* 获取MD5字符串
......@@ -20,7 +66,6 @@
return [NSString md5String:self];
}
/**
* 获取MD5字符串
*/
......@@ -35,4 +80,32 @@
return [hash lowercaseString];
}
+ (NSString *)aesDecrypt:(NSString *)secretStr {
if (!secretStr) {
return nil;
}
//先对加密的字符串进行base64解码
NSData * decodeData = [[NSData alloc] initWithBase64EncodedString:secretStr options:NSDataBase64DecodingIgnoreUnknownCharacters];
char keyPtr[kCCKeySizeAES256 + 1];
bzero(keyPtr, sizeof(keyPtr));
[FUSStringDecoderHelper.sharedInstance.decodeKey getCString:keyPtr maxLength:sizeof(keyPtr) encoding:NSUTF8StringEncoding];
NSUInteger dataLength = [decodeData length];
size_t bufferSize = dataLength + kCCBlockSizeAES128;
void * buffer = malloc(bufferSize);
size_t numBytesDecrypted = 0;
CCCryptorStatus cryptStatus = CCCrypt(kCCDecrypt, kCCAlgorithmAES128, kCCOptionPKCS7Padding | kCCOptionECBMode, keyPtr, kCCBlockSizeAES128, NULL, [decodeData bytes], dataLength, buffer, bufferSize, &numBytesDecrypted);
if (cryptStatus == kCCSuccess) {
NSData * data = [NSData dataWithBytesNoCopy:buffer length:numBytesDecrypted];
NSString * result = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
return result;
} else {
free(buffer);
return secretStr;
}
}
@end
......@@ -422,6 +422,10 @@ NSString * const FUSSocializedIsSafariLoginKey = @"FUSSocializedIsSafariLoginKey
[FUSHttpManager httpGetRequestWithUrl:@"https://facebook.com/" params:nil headers:nil timeout:6 requestType:HTTPRequestType responseType:HTTPResponseType contentTypes:nil success:^(NSURLSessionDataTask *operation, id responseObject) {
FBSDKSettings.appID = FUSConfig.sharedInstanced.sdkConfigs.facebookLoginKey;
FBSDKSettings.clientToken = FUSConfig.sharedInstanced.sdkConfigs.facebookLoginSecret;
if (!_fbLoginManager) {
self.fbLoginManager = [[FBSDKLoginManager alloc] init];
}
......@@ -442,12 +446,17 @@ NSString * const FUSSocializedIsSafariLoginKey = @"FUSSocializedIsSafariLoginKey
[self fus_fetchFacebookUserInfoDictWithCompletion:^(NSDictionary *info) {
[infoDict addEntriesFromDictionary:info];
if (self.loginSuccess) self.loginSuccess(infoDict);
FBSDKSettings.appID = FUSConfig.sharedInstanced.sdkConfigs.facebookShareKey;
FBSDKSettings.clientToken = FUSConfig.sharedInstanced.sdkConfigs.facebookShareSecret;
}];
}];
} failure:^(NSURLSessionDataTask *operation, NSError *error) {
if (failure) failure(error);
[FUSDialogView fus_showDialog:@"can not connect to Facebook" autoDismissTime:2];
FBSDKSettings.appID = FUSConfig.sharedInstanced.sdkConfigs.facebookShareKey;
FBSDKSettings.clientToken = FUSConfig.sharedInstanced.sdkConfigs.facebookShareSecret;
}];
}
}
......
......@@ -15,8 +15,6 @@
static NSString *const kSETTINGSOUNDSWITCHBOOLUDKey = @"kSETTINGSOUNDSWITCHBOOLUDKey";
static NSString *const kSETTINGVIBRATESWITCHBOOLUDKey = @"kSETTINGVIBRATESWITCHBOOLUDKey";
//播放语音完成的回调
static void completionCallback(SystemSoundID mySSID) {
AudioServicesPlaySystemSound(mySSID);
......
......@@ -17,6 +17,18 @@ NS_ASSUME_NONNULL_BEGIN
/// twitter secret
@property (nonatomic, copy) NSString *twitterSecret;
/// facebook key
@property (nonatomic, copy) NSString *facebookLoginKey;
/// facebook secret
@property (nonatomic, copy) NSString *facebookLoginSecret;
/// facebook key
@property (nonatomic, copy) NSString *facebookShareKey;
/// facebook secret
@property (nonatomic, copy) NSString *facebookShareSecret;
/// TalkingData
@property (nonatomic, copy) NSString *talkingData;
......
......@@ -220,8 +220,9 @@ static NSString *const kGtAppSecret = @"OSSSWqbWY0ACJiUv4AHdW7";
BOOL notFirst = [[[NSUserDefaults standardUserDefaults] objectForKey:NOT_FIRST_LAUNCH_BOOL] boolValue];
if (!notFirst) {
[[NSUserDefaults standardUserDefaults] setObject:@(YES) forKey:NOT_FIRST_LAUNCH_BOOL];
[[NSUserDefaults standardUserDefaults] setObject:@(YES) forKey:FUSUserUDKeys.fus_SETTING_SOUND_SWITCH_BOOL];
[[NSUserDefaults standardUserDefaults] setObject:@(YES) forKey:FUSUserUDKeys.fus_SETTING_VIBRATE_SWITCH_BOOL];
[FUSSoundAndVibrateHelper setSystemSoundOpen:YES];
[FUSSoundAndVibrateHelper setSystemVibrateOpen:YES];
[[NSUserDefaults standardUserDefaults] setObject:@(YES) forKey:FUSUserUDKeys.fus_SETTING_LAUNCH_SOUND_SWITCH_BOOL];
[[NSUserDefaults standardUserDefaults] setObject:@(YES) forKey:kFUSConfigAppStatusUDKey];
[[NSUserDefaults standardUserDefaults] setObject:@(YES) forKey:FUSLiveUDKeys.fus_SHOULD_REMOTE_NOTIFICATION_TIP];
......
......@@ -53,7 +53,7 @@
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>fb382456482257502</string>
<string>fb948124033391771</string>
</array>
</dict>
<dict>
......@@ -70,11 +70,11 @@
<key>FacebookAdvertiserIDCollectionEnabled</key>
<true/>
<key>FacebookAppID</key>
<string>382456482257502</string>
<string>948124033391771</string>
<key>FacebookAutoLogAppEventsEnabled</key>
<true/>
<key>FacebookClientToken</key>
<string>045478b9202f7c4913ab5366eaf15f8a</string>
<string>0a161eeda8135dcd07ef3d46c7a9121c</string>
<key>FacebookDisplayName</key>
<string>FuSiLive</string>
<key>ITSAppUsesNonExemptEncryption</key>
......
......@@ -114,17 +114,17 @@
};
FUSCustomSettingItem *messageSoundItem = [FUSCustomSettingItem fus_itemWithTitle:[NSString fus_localString:@"声音提醒"] type:CustomSettingItemTypeSwitch];
messageSoundItem.switchState = [[[NSUserDefaults standardUserDefaults] objectForKey:FUSUserUDKeys.fus_SETTING_SOUND_SWITCH_BOOL] boolValue];
messageSoundItem.switchState = [FUSSoundAndVibrateHelper systemSoundOpen];
messageSoundItem.switchClick = ^(FUSCustomSettingItem *item){
[FUSTalkingData fus_trackEvent:FUSUserEventTrackParams.fus_EVENT_SETTING_NEWSSLERT_SOUNDALERT];
[[NSUserDefaults standardUserDefaults] setObject:@(item.currentSwitchState) forKey:FUSUserUDKeys.fus_SETTING_SOUND_SWITCH_BOOL];
[FUSSoundAndVibrateHelper setSystemSoundOpen:item.currentSwitchState];
};
FUSCustomSettingItem *meesageShockItem = [FUSCustomSettingItem fus_itemWithTitle:[NSString fus_localString:@"振动提醒"] type:CustomSettingItemTypeSwitch];
meesageShockItem.switchState = [[[NSUserDefaults standardUserDefaults] objectForKey:FUSUserUDKeys.fus_SETTING_VIBRATE_SWITCH_BOOL] boolValue];
meesageShockItem.switchState = [FUSSoundAndVibrateHelper systemVibrateOpen];;
meesageShockItem.switchClick = ^(FUSCustomSettingItem *item){
[FUSTalkingData fus_trackEvent:FUSUserEventTrackParams.fus_EVENT_SETTING_NEWSSLERT_VIBRATEALERT];
[[NSUserDefaults standardUserDefaults] setObject:@(item.currentSwitchState) forKey:FUSUserUDKeys.fus_SETTING_VIBRATE_SWITCH_BOOL];
[FUSSoundAndVibrateHelper setSystemVibrateOpen:item.currentSwitchState];
};
FUSCustomSettingItem *clearAllUnreadItem = [FUSCustomSettingItem fus_itemWithTitle:[NSString fus_localString:@"全部标为已读"] type:CustomSettingItemTypeShowTextAndArrow];
......
......@@ -166,11 +166,10 @@
}
_url = url;
NSString *mute = [[NSUserDefaults standardUserDefaults] stringForKey:FUSUserUDKeys.fus_SETTING_SOUND_SWITCH_BOOL];
if (![NSString isNullWithString:FUSLiveHelper.shareInstance.roomInfoModel.roomId]) {
url = [FUSHttpManager fus_getHttUrl:url params:@{@"roomid":FUSLiveHelper.shareInstance.roomInfoModel.roomId}];
}
url = [FUSHttpManager fus_getHttUrl:url params:@{@"sound":mute}];
url = [FUSHttpManager fus_getHttUrl:url params:@{@"sound":@([FUSSoundAndVibrateHelper systemSoundOpen])}];
FUSWKWebViewController *wkVC = [[FUSWKWebViewController alloc] init];
wkVC.webView.clearCache = self.clearCache;
......
......@@ -463,7 +463,6 @@ typedef NS_ENUM(NSInteger, FUSMySettingItemType){
}
break;
case FUSMyHeaderButtonTypeIntimacy:{
if (FUSConfig.sharedInstanced.devConfigs.appStatus) return;
[FUSRouter.chatRouter fus_enterFriendVC];
}
break;
......
......@@ -338,17 +338,17 @@
};
_messageSoundItem = [FUSCustomSettingItem fus_itemWithTitle:[NSString fus_localString:@"声音提醒"] type:CustomSettingItemTypeSwitch];
_messageSoundItem.switchState = [[[NSUserDefaults standardUserDefaults] objectForKey:FUSUserUDKeys.fus_SETTING_SOUND_SWITCH_BOOL] boolValue];
_messageSoundItem.switchState = [FUSSoundAndVibrateHelper systemSoundOpen];
_messageSoundItem.switchClick = ^(FUSCustomSettingItem *item){
[FUSTalkingData fus_trackEvent:FUSUserEventTrackParams.fus_EVENT_SETTING_NEWSSLERT_SOUNDALERT];
[[NSUserDefaults standardUserDefaults] setObject:@(item.currentSwitchState) forKey:FUSUserUDKeys.fus_SETTING_SOUND_SWITCH_BOOL];
[FUSSoundAndVibrateHelper setSystemSoundOpen:item.currentSwitchState];
};
_meesageShockItem = [FUSCustomSettingItem fus_itemWithTitle:[NSString fus_localString:@"振动提醒"] type:CustomSettingItemTypeSwitch];
_meesageShockItem.switchState = [[[NSUserDefaults standardUserDefaults] objectForKey:FUSUserUDKeys.fus_SETTING_VIBRATE_SWITCH_BOOL] boolValue];
_meesageShockItem.switchState = [FUSSoundAndVibrateHelper systemVibrateOpen];
_meesageShockItem.switchClick = ^(FUSCustomSettingItem *item){
[FUSTalkingData fus_trackEvent:FUSUserEventTrackParams.fus_EVENT_SETTING_NEWSSLERT_VIBRATEALERT];
[[NSUserDefaults standardUserDefaults] setObject:@(item.currentSwitchState) forKey:FUSUserUDKeys.fus_SETTING_VIBRATE_SWITCH_BOOL];
[FUSSoundAndVibrateHelper setSystemVibrateOpen:item.currentSwitchState];
};
......
......@@ -326,7 +326,7 @@
[self.getAwardImageView setWebImageWithSubURLString:model.icon placeholder:[FUSUserCenterBunble imageNamed:@"checkIn_placeholder"] completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
BOOL soundSwitch = [[[NSUserDefaults standardUserDefaults] objectForKey:FUSUserUDKeys.fus_SETTING_SOUND_SWITCH_BOOL] boolValue];
BOOL soundSwitch = [FUSSoundAndVibrateHelper systemSoundOpen];
if (soundSwitch && FUSConfig.sharedInstanced.liveConfigs.isAnchor == NO) {
[FUSSoundAndVibrateHelper playSoundEffect:@"check_in_success" bundle:[FUSUserCenterBunble bundle] ofType:@"mp3"];
......
......@@ -181,7 +181,7 @@
completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
BOOL soundSwitch = [[[NSUserDefaults standardUserDefaults] objectForKey:FUSUserUDKeys.fus_SETTING_SOUND_SWITCH_BOOL] boolValue];
BOOL soundSwitch = [FUSSoundAndVibrateHelper systemSoundOpen];
if (soundSwitch && FUSConfig.sharedInstanced.liveConfigs.isAnchor == NO) {
[FUSSoundAndVibrateHelper playSoundEffect:@"check_in_success" bundle:[FUSUserCenterBunble bundle] ofType:@"mp3"];
......
......@@ -343,7 +343,7 @@ SPEC CHECKSUMS:
FirebaseInstallations: 40bd9054049b2eae9a2c38ef1c3dd213df3605cd
FMDB: 854a0341b4726e53276f2a8996f06f1b80f9259a
FUSCommon: 066e3b5e5dc867d63ba19dbd23079c78e9fde88f
FUSFoundation: a0bd03bc1b0d01e4a6af473f169f9a46b6c9bf1b
FUSFoundation: 466140db3f8513a5f5bd8c76a0a6a67566ddfde0
GCDWebServer: 2c156a56c8226e2d5c0c3f208a3621ccffbe3ce4
GoogleAppMeasurement: 6b6a08fd9c71f4dbc89e0e812acca81d797aa342
GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a
......
......@@ -66,6 +66,9 @@
"FUSFoundation/Classes/FUSFoundation/Tools/ThirdParty/Audio/**/*.h"
],
"project_header_files": "FUSFoundation/Classes/FUSFoundation/Tools/ThirdParty/ByteDanceBeauty/include/*.h",
"prefix_header_contents": [
"#import \"NSString+MD5.h\""
],
"libraries": [
"stdc++",
"c++",
......
......@@ -343,7 +343,7 @@ SPEC CHECKSUMS:
FirebaseInstallations: 40bd9054049b2eae9a2c38ef1c3dd213df3605cd
FMDB: 854a0341b4726e53276f2a8996f06f1b80f9259a
FUSCommon: 066e3b5e5dc867d63ba19dbd23079c78e9fde88f
FUSFoundation: a0bd03bc1b0d01e4a6af473f169f9a46b6c9bf1b
FUSFoundation: 466140db3f8513a5f5bd8c76a0a6a67566ddfde0
GCDWebServer: 2c156a56c8226e2d5c0c3f208a3621ccffbe3ce4
GoogleAppMeasurement: 6b6a08fd9c71f4dbc89e0e812acca81d797aa342
GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -10,3 +10,4 @@
#endif
#endif
#import "NSString+MD5.h"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment