disable bugly, add onDestroy on WaitingForCardViewModel, always show handle print in PaymentActivity

This commit is contained in:
Ahmed Al-Omairi 2025-08-29 13:02:12 +03:00
parent 491fcb8d94
commit 09a032aa97
3 changed files with 39 additions and 22 deletions

View File

@ -54,28 +54,31 @@ public class TerminalApplication extends BaseApplication {
private void initBugly() {
Context context = getApplicationContext();
CrashReport.enableBugly(false);
return;
// Get the current package name
String packageName = context.getPackageName();
// Get the current process name
String processName = DevUtils.getProcessName(android.os.Process.myPid());
// Set whether it is a reporting process
CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(context);
strategy.setUploadProcess(processName == null || processName.equals(packageName));
strategy.setAppVersion(DevUtils.getPackageVersionName(this, packageName));
strategy.setAppPackageName(packageName);
// Initialize Bugly
CrashReport.initCrashReport(context, "b2d80aa171", BuildConfig.DEBUG, strategy);
BuglyLog.setCache(1024 * 10); // 设置本地缓存大小(10KB)
// Set user data
CrashReport.setUserId(DevUtils.getDeviceId(this));
CrashReport.setDeviceModel(this,Build.MODEL);
// Add custom logs
CrashReport.setUserSceneTag(context, 9527); // Set label
CrashReport.putUserData(context, "deviceModel", Build.MODEL);
CrashReport.putUserData(context, "deviceManufacturer", Build.MANUFACTURER);
// String packageName = context.getPackageName();
// // Get the current process name
// String processName = DevUtils.getProcessName(android.os.Process.myPid());
// // Set whether it is a reporting process
// CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(context);
// strategy.setUploadProcess(processName == null || processName.equals(packageName));
// strategy.setAppVersion(DevUtils.getPackageVersionName(this, packageName));
// strategy.setAppPackageName(packageName);
//
// // Initialize Bugly
// CrashReport.initCrashReport(context, "b2d80aa171", BuildConfig.DEBUG, strategy);
// BuglyLog.setCache(1024 * 10); // 设置本地缓存大小(10KB)
//
// // Set user data
// CrashReport.setUserId(DevUtils.getDeviceId(this));
// CrashReport.setDeviceModel(this,Build.MODEL);
//
// // Add custom logs
// CrashReport.setUserSceneTag(context, 9527); // Set label
// CrashReport.putUserData(context, "deviceModel", Build.MODEL);
// CrashReport.putUserData(context, "deviceManufacturer", Build.MANUFACTURER);
}
private void initShiply(){

View File

@ -245,8 +245,9 @@ public class PaymentActivity extends BaseActivity<ActivityPaymentBinding, Paymen
POS.getInstance().sendOnlineProcessResult("8A023030");
} else {
if (DeviceUtils.isPrinterDevices()) {
handleSendReceipt();
// handleSendReceipt();
}
handleSendReceipt();
viewModel.setTransactionSuccess();
}
} else {

View File

@ -8,6 +8,9 @@ import androidx.annotation.NonNull;
import androidx.databinding.ObservableBoolean;
import androidx.databinding.ObservableField;
import com.dspread.pos.common.manager.QPOSCallbackManager;
import com.dspread.pos.printerAPI.PrinterHelper;
import com.dspread.pos.utils.LogFileConfig;
import com.dspread.pos.utils.QRCodeGenerator;
import me.goldze.mvvmhabit.base.BaseViewModel;
@ -61,4 +64,14 @@ public class WaitingForCardViewModel extends BaseViewModel {
// Handle cancel action
Log.d("WaitingForCardViewModel", "onCancel: ");
}
@Override
public void onDestroy() {
Log.d("WaitingCardVM", "onDestroy: ");
// super.onDestroy();
// LogFileConfig.getInstance(this).readLog();
// QPOSCallbackManager.getInstance().unregisterPaymentCallback();
// PrinterHelper.getInstance().close();
}
}