合并 APPBase 项目

This commit is contained in:
qinglong
2026-07-23 22:00:02 +08:00
parent a57b48ddba
commit 9b12f95b8b
10 changed files with 469 additions and 65 deletions
-4
View File
@@ -55,10 +55,6 @@ android {
dependencies {
api project(':libappbase')
// WinBoLL库 nexus.winboll.cc 地址
//api 'cc.winboll.studio:libappbase:15.20.+'
api 'cc.winboll.studio:libaes:15.20.21'
api 'androidx.appcompat:appcompat:1.3.1'
// JavaMail SMTP (Android兼容版)
api 'com.sun.mail:android-mail:1.6.7'
api 'com.sun.mail:android-activation:1.6.7'
+5 -5
View File
@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Tue Jul 21 18:04:08 HKT 2026
stageCount=4
#Thu Jul 23 19:08:15 HKT 2026
stageCount=5
libraryProject=libappbase
baseVersion=15.21
publishVersion=15.21.3
buildCount=15
baseBetaVersion=15.21.4
publishVersion=15.21.4
buildCount=0
baseBetaVersion=15.21.5
@@ -1,13 +1,11 @@
package cc.winboll.studio.appbase;
import android.content.SharedPreferences;
import cc.winboll.studio.libappbase.CrashActivity;
import cc.winboll.studio.libappbase.GlobalApplication;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.ToastUtils;
import cc.winboll.studio.libappbase.utils.APPMSGMailUtils;
import cc.winboll.studio.libappbase.utils.CrashHandleNotifyUtils;
import cc.winboll.studio.libappbase.utils.SMTPUtils;
import java.io.PrintWriter;
import java.io.StringWriter;
@@ -33,22 +31,32 @@ public class App extends GlobalApplication {
public void onCreate() {
try {
super.onCreate();
// 初始化 Toast 工具类(传入应用全局上下文,确保 Toast 可在任意地方调用)
ToastUtils.init(getApplicationContext());
// 调试异常捕获
final String errorMsg = "初始化异常捕获调试信息,这个是调试异常捕获的测试数据。";
LogUtils.e(TAG, errorMsg);
throw new IllegalArgumentException(errorMsg);
} catch (Throwable e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
pw.close();
String stackTraceStr = sw.toString();
// 发送异常信息邮箱。
sendExceptionMail(stackTraceStr);
// 前台通知栏提醒。
CrashHandleNotifyUtils.handleUncaughtException(
this,
getPackageName(),
stackTraceStr,
CrashActivity.class
);
sendExceptionMail(stackTraceStr);
}
}
@@ -58,50 +66,9 @@ public class App extends GlobalApplication {
* @param stackTraceStr 异常堆栈信息
*/
private void sendExceptionMail(final String stackTraceStr) {
SharedPreferences sp = getSharedPreferences(PREF_NAME, MODE_PRIVATE);
final String host = sp.getString("smtp_server", "");
final String portStr = sp.getString("smtp_port", "");
final String sender = sp.getString("sender_email", "");
final String auth = sp.getString("auth_code", "");
final String recipient = sp.getString("recipient_email", "");
if (host.isEmpty() || portStr.isEmpty() || sender.isEmpty()
|| auth.isEmpty() || recipient.isEmpty()) {
LogUtils.d(TAG, "sendExceptionMail skipped, SMTP config incomplete");
return;
}
final int port;
try {
port = Integer.parseInt(portStr);
} catch (NumberFormatException e) {
LogUtils.e(TAG, "sendExceptionMail failed, port format error: " + portStr);
return;
}
new Thread(new Runnable() {
@Override
public void run() {
String deviceInfo = "\n\n--- Device Info ---\n"
+ "Package: " + getPackageName() + "\n"
+ "Time: " + System.currentTimeMillis() + "\n";
boolean success = SMTPUtils.sendTextMail(
recipient,
"APPBase 异常报告",
stackTraceStr + deviceInfo,
sender,
auth,
host,
port);
if (success) {
LogUtils.d(TAG, "sendExceptionMail success");
} else {
LogUtils.e(TAG, "sendExceptionMail failed");
}
}
}).start();
String subject = "Exception Report - " + getPackageName();
String recipients = APPMSGMailUtils.getRecipient(this);
APPMSGMailUtils.sendMail(this, subject, stackTraceStr, recipients);
}
/**
@@ -3,7 +3,7 @@ package cc.winboll.studio.appbase.develop;
import android.app.Activity;
import android.os.Bundle;
import cc.winboll.studio.appbase.R;
import cc.winboll.studio.libaes.views.SMTPConfigView;
import cc.winboll.studio.libappbase.views.SMTPConfigView;
/**
* @Author 豆包&BigPickle&MiMo&ZhanGSKen<zhangsken@qq.com>
@@ -5,7 +5,7 @@
android:layout_height="match_parent"
android:background="#FAFAFA">
<cc.winboll.studio.libaes.views.SMTPConfigView
<cc.winboll.studio.libappbase.views.SMTPConfigView
android:id="@+id/smtp_config_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>