Skip to content

Commit

Permalink
2022/09/3
Browse files Browse the repository at this point in the history
修复
  • Loading branch information
ag2s20150909 committed Sep 3, 2022
1 parent 32d0d80 commit e0a5f84
Show file tree
Hide file tree
Showing 16 changed files with 38,146 additions and 39 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
2022/07/31
2022/09/3

bug 修复
修复
82 changes: 62 additions & 20 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ plugins {
}

android {
compileSdk 32
buildToolsVersion '32.0.0'
compileSdk 33
buildToolsVersion '33.0.0'
//签名设置
signingConfigs {
release {
Expand Down Expand Up @@ -77,22 +77,22 @@ android {
android.applicationVariants.all {
variant ->

variant.outputs.all { output ->
def buildType = variant.buildType.name
println("buildType=" + buildType)
if (buildType != "debug") {
//apk默认路径
String defaultOutputApkPath =
variant.getPackageApplicationProvider().get().outputDirectory.getAsFile().get().getPath() +
File.separator
println("defaultOutputApkPath=" + defaultOutputApkPath)
//在项目根目录创建apk文件夹
def outputFileDir = new File("$rootDir" + File.separator, "release")
// println("outputFileDir=" + outputFileDir)
//设置自定义apk生成路径
variant.getPackageApplicationProvider().get().outputDirectory = outputFileDir
}
}
// variant.outputs.all { output ->
// def buildType = variant.buildType.name
// println("buildType=" + buildType)
// if (buildType != "debug") {
// //apk默认路径
// String defaultOutputApkPath =
// variant.getPackageApplicationProvider().get().outputDirectory.getAsFile().get().getPath() +
// File.separator
// println("defaultOutputApkPath=" + defaultOutputApkPath)
// //在项目根目录创建apk文件夹
// def outputFileDir = new File("$rootDir" + File.separator, "release")
//// println("outputFileDir=" + outputFileDir)
// //设置自定义apk生成路径
// variant.getPackageApplicationProvider().get().outputDirectory = outputFileDir
// }
// }


def path = ((project.name != "app") ? project.name : rootProject.name.replace(" ", "")) + "_" +
Expand All @@ -106,18 +106,60 @@ android {

}

// android.assembleRelease{
// doLast {
// Sync{
// from "$projectDir/build/outputs"
// into "$rootDir/release"
// preserve{
// include("apks/**")
// include("mapping/**")
// exclude("logs/**")
// }
// }
// }
// }




}

tasks.whenTaskAdded {task ->
//新版的AGP7.1.0修改apk输出路径会导致文件找不到而出错(硬编码???),暂时禁用这个task
if(task.name.contains("createReleaseApkListingFileRedirect")) {
task.enabled = false
// if(task.name.contains("createReleaseApkListingFileRedirect")) {
// //task.enabled = false
// }
if (task.name == 'assembleRelease') {
task.finalizedBy syncApkFile
}
}


task syncMappingFile(type: Sync){
from "$projectDir/build/outputs/mapping/release"
into "$rootDir/release/mapping"
exclude("configuration.txt")
exclude("resources.txt")


}


task syncApkFile(type: Sync) {
dependsOn syncMappingFile
from "$projectDir/build/outputs/apk/release"
into "$rootDir/release"
exclude("logs/**")
exclude("sdk-dependencies/**")
//保护下面的不会被删除
preserve{
include("mapping/**")
}
}



dependencies {

//coreLibraryDesugaring('com.android.tools:desugar_jdk_libs:1.1.5')
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/me/ag2s/tts/services/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public final class Constants {


public static final String EDGE_ORIGIN = "chrome-extension://jdiccldimpdaibmpdkjnbmckianbfold";
public static final String EDGE_UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36 Edg/103.0.1264.77";
public static final String EDGE_UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36 Edg/104.0.1293.70";
public static final String EDGE_URL = "https://speech.platform.bing.com/consumer/speech/synthesize/readaloud/edge/v1?TrustedClientToken=6A5AA1D4EAFF4E9FB37E23D68491D6F4";

}
22 changes: 12 additions & 10 deletions app/src/main/java/me/ag2s/tts/services/TTSService.java
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public void updateNotification(@NotNull String title, @Nullable String content)
@Override
public void onCreate() {
super.onCreate();
TokenHolder.startToken();
//TokenHolder.startToken();
startForegroundService();
reNewWakeLock();

Expand Down Expand Up @@ -571,13 +571,13 @@ public WebSocket getOrCreateWs() {
if (this.webSocket == null) {


while (TokenHolder.token == null) {
try {
this.wait(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
// while (TokenHolder.token == null) {
// try {
// this.wait(500);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// }

//避免同时重复请求
while (webSocketState == WebSocketState.CONNECTING) {
Expand All @@ -590,8 +590,10 @@ public WebSocket getOrCreateWs() {

String url;
String origin;
if (TokenHolder.token != null && APP.getBoolean(Constants.USE_PREVIEW, false)) {
url = "wss://eastus.tts.speech.microsoft.com/cognitiveservices/websocket/v1?Authorization=bearer " + TokenHolder.token + "&X-ConnectionId=" + CommonTool.getMD5String(new Date().toString());
// if (TokenHolder.token != null && APP.getBoolean(Constants.USE_PREVIEW, false)) {
if (APP.getBoolean(Constants.USE_PREVIEW, false)) {
//url = "wss://eastus.tts.speech.microsoft.com/cognitiveservices/websocket/v1?Authorization=bearer " + TokenHolder.token + "&X-ConnectionId=" + CommonTool.getMD5String(new Date().toString());
url = "wss://eastus.api.speech.microsoft.com/cognitiveservices/websocket/v1?TrafficType=AzureDemo&Authorization=bearer undefined&X-ConnectionId=" + CommonTool.getMD5String(new Date().toString());
origin = "https://azure.microsoft.com";
isPreview = true;
} else {
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/me/ag2s/tts/services/TtsActorManger.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ private TtsActorManger() {
actors.add(new TtsActor("云泽", "zh-CN-YunzeNeural", "zh-CN", false, "老年男声," + previewNote));
actors.add(new TtsActor("云夏", "zh-CN-YunxiaNeural", "zh-CN", false, "少年年男声," + previewNote));

actors.add(new TtsActor("晓梦", "zh-CN-XiaomengNeural", "zh-CN", true, "" + previewNote));
actors.add(new TtsActor("晓伊", "zh-CN-XiaoyiNeural", "zh-CN", true, "" + previewNote));
actors.add(new TtsActor("晓甄", "zh-CN-XiaozhenNeural", "zh-CN", true, "" + previewNote));

actors.add(new TtsActor("晓涵", "zh-CN-XiaohanNeural", "zh-CN", true, "温暖、甜美、富有感情的声音,可用于许多对话场景。"));
actors.add(new TtsActor("晓墨", "zh-CN-XiaomoNeural", "zh-CN", true, "清晰、放松的声音,具有丰富的角色扮演和情感,适合音频书籍。"));
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext{
agp_version= '7.2.1'
agp_version= '7.2.2'
kotlin_version = '1.7.10'
okhttp_version= '5.0.0-alpha.10'
okio_version="3.2.0"
}
}
plugins {
id 'com.android.application' version "$agp_version" apply false
id 'com.android.application' version '7.2.2' apply false
id 'com.android.library' version "$agp_version" apply false
id 'org.jetbrains.kotlin.android' version "$kotlin_version" apply false
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Jul 17 20:47:45 CST 2022
#Sat Sep 03 08:05:19 CST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Loading

0 comments on commit e0a5f84

Please sign in to comment.