Jelajahi Sumber

up 解决 bug. 配置开关

openlockPPP 1 tahun lalu
induk
melakukan
19c76d89fa

+ 2 - 2
jiaPei.xcodeproj/project.pbxproj

@@ -11702,7 +11702,7 @@
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				"CODE_SIGN_RESOURCE_RULES_PATH[sdk=*]" = "";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 2032023072601;
+				CURRENT_PROJECT_VERSION = 2032023072701;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				DEVELOPMENT_TEAM = K7T6CU5SW5;
 				ENABLE_BITCODE = NO;
@@ -11784,7 +11784,7 @@
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 2032023072601;
+				CURRENT_PROJECT_VERSION = 2032023072701;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				DEVELOPMENT_TEAM = K7T6CU5SW5;
 				ENABLE_BITCODE = NO;

TEMPAT SAMPAH
jiaPei.xcworkspace/xcuserdata/mimasigeling.xcuserdatad/UserInterfaceState.xcuserstate


+ 2 - 0
jiaPei/APPdelegateModularForRequest.m

@@ -135,6 +135,8 @@ RQAppEventMod(APPdelegateModularForRequest)
                 RQ_COMMON_MANAGER.JSJP_APP_AD_OPEN = [[NSString stringWithFormat:@"%@",dictInfoModel.dictValue] isEqualToString:@"1"]? YES : NO;
             }else if ([dictInfoModel.dictLabel isEqualToString:@"JSJP_APP_JSQ_ICON_OPEN"]) {
                 RQ_COMMON_MANAGER.JSJP_APP_JSQ_ICON_OPEN = [[NSString stringWithFormat:@"%@",dictInfoModel.dictValue] isEqualToString:@"1"]? YES : NO;
+            }else if ([dictInfoModel.dictLabel isEqualToString:@"JSJP_APP_VOICE"]) {
+                RQ_COMMON_MANAGER.JSJP_APP_VOICE = [[NSString stringWithFormat:@"%@",dictInfoModel.dictValue] isEqualToString:@"1"]? YES : NO;
             }else if ([dictInfoModel.dictLabel isEqualToString:@"JSJP_APP_AD_CYCLE"]) {
                 RQ_COMMON_MANAGER.JSJP_APP_AD_CYCLE = [dictInfoModel.dictValue integerValue];
             } else if ([dictInfoModel.dictLabel isEqualToString:@"JSJP_Is_Online_Media_Image"]) {

+ 1 - 0
jiaPei/Modules/OtherModules/ExerciseModule/Controller/RQExerciseViewController.m

@@ -145,6 +145,7 @@
     } else {
         [self.viewModel.services popViewModelAnimated:YES];
     }
+    [NY_VOICE_MANAGER stopPayVoiceAction];//停止读题
 }
 
 - (void)setAction {

+ 24 - 17
jiaPei/Modules/OtherModules/ExerciseModule/ViewModel/ExercisePage/itemViewModel/RQExerciseQuestionItemViewModel.m

@@ -233,23 +233,25 @@
 //    }];
     [testText appendAttributedString: attrString];
     
-    //读题
-    QMUIButton *readBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
-    CGFloat ebtnH = 20.f;
-    CGFloat ebtnW = 58.f;
-    CGSize ebtnSize = CGSizeMake(ebtnW, ebtnH);
-    readBtn.size = btnSize;
-    [readBtn setImage:RQImageNamed(@"读题pay") forState:UIControlStateNormal];
-    [readBtn setImage:RQImageNamed(@"读题pause") forState:UIControlStateSelected];
-    [readBtn addTarget:self action:@selector(buttonActionPayVoicedo:) forControlEvents:UIControlEventTouchUpInside];
-    NSMutableAttributedString *readAttachment = [NSMutableAttributedString yy_attachmentStringWithContent:readBtn
-                                                               contentMode:UIViewContentModeCenter
-                                                            attachmentSize:ebtnSize
-                                                               alignToFont:[UIFont systemFontOfSize:RQ_Exercise_Module.exerciseFontSize]
-                                                                 alignment:YYTextVerticalAlignmentCenter];
-    self.readBtn = readBtn;
-    [testText appendAttributedString:self.spaceAttachment];
-    [testText appendAttributedString:readAttachment];
+    if (RQ_COMMON_MANAGER.JSJP_APP_VOICE) {//读题-是否开启
+        //读题
+        QMUIButton *readBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
+        CGFloat ebtnH = 20.f;
+        CGFloat ebtnW = 58.f;
+        CGSize ebtnSize = CGSizeMake(ebtnW, ebtnH);
+        readBtn.size = btnSize;
+        [readBtn setImage:RQImageNamed(@"读题pay") forState:UIControlStateNormal];
+        [readBtn setImage:RQImageNamed(@"读题pause") forState:UIControlStateSelected];
+        [readBtn addTarget:self action:@selector(buttonActionPayVoicedo:) forControlEvents:UIControlEventTouchUpInside];
+        NSMutableAttributedString *readAttachment = [NSMutableAttributedString yy_attachmentStringWithContent:readBtn
+                                                                   contentMode:UIViewContentModeCenter
+                                                                attachmentSize:ebtnSize
+                                                                   alignToFont:[UIFont systemFontOfSize:RQ_Exercise_Module.exerciseFontSize]
+                                                                     alignment:YYTextVerticalAlignmentCenter];
+        self.readBtn = readBtn;
+        [testText appendAttributedString:self.spaceAttachment];
+        [testText appendAttributedString:readAttachment];
+    }
     
     [text appendAttributedString:testText];
 //    [text appendAttributedString:[self padding]];
@@ -306,6 +308,7 @@
 #pragma mark -事件
 - (void)buttonActionPayVoicedo:(UIButton *)btn
 {
+    btn.userInteractionEnabled = NO;
     btn.selected = !btn.isSelected;
     if(btn.selected){//播放
         if (NY_VOICE_MANAGER.state == NYVoiceType_Pause){
@@ -338,6 +341,10 @@
     }else {//暂停
         [NY_VOICE_MANAGER pausePayVoiceAction];
     }
+    //防止频繁点击 1 秒点一次
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+        self.readBtn.userInteractionEnabled = YES;
+    });
 }
 
 @end

+ 17 - 0
jiaPei/OLD/Util/SingletonManger/VoiceManager/NYVoiceManager.m

@@ -198,6 +198,23 @@ static dispatch_once_t onceToken;
     */
     _checkTimeout = 300;
     
+    @try {
+        NSDictionary *dict = @{
+            @"onlineSpeed":@"0",//设置合成声音速度0默认 1正常 1.2倍
+            @"onlineVoiceType":@"1001",//设置合成声音类型
+            @"onlineLanguage":@"1",//设置合成语种-1中文 2英文
+            @"onlineVolume":@"0",//设置合成声音大小默认值为0
+        };
+        if(dict){ //读取服务器配置
+            _onlineSpeed = [dict[@"onlineSpeed"] floatValue];
+            _onlineVoiceType = [dict[@"onlineVoiceType"] intValue];
+            _onlineLanguage = [dict[@"onlineLanguage"] intValue];
+            _onlineVolume = [dict[@"onlineVolume"] floatValue];
+        }
+    } @catch (NSException *exception) {
+        NSLog(@"%@",exception.description);
+    }
+   
 }
 
 #pragma mark -- QCloudTTSEngineDelegate

+ 1 - 0
jiaPei/Utils/Manager/CommonManager/RQCommonManager.h

@@ -24,6 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic, readwrite, assign) NSInteger JSJP_APP_AD_CYCLE;
 
 @property (nonatomic, readwrite, assign) BOOL JSJP_APP_JSQ_ICON_OPEN;
+@property (nonatomic, readwrite, assign) BOOL JSJP_APP_VOICE;
 
 @property (nonatomic, readwrite, assign) BOOL JSJP_Is_Online_Media_Image;
 @property (nonatomic, readwrite, assign) BOOL JSJP_Is_Online_Media_Video;

+ 14 - 0
jiaPei/Utils/Manager/CommonManager/RQCommonManager.m

@@ -118,6 +118,16 @@
     }
 }
 
+- (BOOL)JSJP_APP_VOICE {
+    id object = [RQ_SHARE_FUNCTION getObjectWithKey:@"JSJP_APP_VOICE"];
+    if (RQObjectIsNil(object)) {
+        return NO;
+    } else {
+        BOOL appadopen = [object boolValue];
+        return appadopen;
+    }
+}
+
 - (void)setJSJP_APP_AD_OPEN:(BOOL)JSJP_APP_AD_OPEN {
     [RQ_SHARE_FUNCTION saveObjectWithObject:[NSNumber numberWithBool:JSJP_APP_AD_OPEN] ForKey:@"JSJP_APP_AD_OPEN"];
 }
@@ -127,6 +137,10 @@
     [RQ_SHARE_FUNCTION saveObjectWithObject:[NSNumber numberWithBool:JSJP_APP_JSQ_ICON_OPEN] ForKey:@"JSJP_APP_JSQ_ICON_OPEN"];
 }
 
+- (void)setJSJP_APP_VOICE:(BOOL)JSJP_APP_VOICE {
+    [RQ_SHARE_FUNCTION saveObjectWithObject:[NSNumber numberWithBool:JSJP_APP_VOICE] ForKey:@"JSJP_APP_VOICE"];
+}
+
 - (NSInteger)JSJP_APP_AD_CYCLE {
     id object = [RQ_SHARE_FUNCTION getObjectWithKey:@"JSJP_APP_AD_CYCLE"];
     if (RQObjectIsNil(object)) {