chore(mining-app): configure release build

- Add kDebugMode check to LoggingInterceptor to suppress logs in release
- Remove debug print statements from contribution_providers
- Add Play Core proguard rules to fix R8 missing classes error

Build command: flutter build apk --release --split-per-abi --target-platform android-arm,android-arm64
Output:
- app-arm64-v8a-release.apk: 18MB
- app-armeabi-v7a-release.apk: 16MB

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-14 17:24:42 -08:00
parent c852f24a72
commit f57b0f9c26
3 changed files with 16 additions and 20 deletions

View File

@ -6,6 +6,10 @@
-keep class io.flutter.** { *; } -keep class io.flutter.** { *; }
-keep class io.flutter.plugins.** { *; } -keep class io.flutter.plugins.** { *; }
# Play Core (deferred components)
-dontwarn com.google.android.play.core.**
-keep class com.google.android.play.core.** { *; }
# 保持Gson相关 # 保持Gson相关
-keepattributes Signature -keepattributes Signature
-keepattributes *Annotation* -keepattributes *Annotation*

View File

@ -1,4 +1,5 @@
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
import 'package:logger/logger.dart'; import 'package:logger/logger.dart';
class LoggingInterceptor extends Interceptor { class LoggingInterceptor extends Interceptor {
@ -8,19 +9,25 @@ class LoggingInterceptor extends Interceptor {
@override @override
void onRequest(RequestOptions options, RequestInterceptorHandler handler) { void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
_logger.d('REQUEST[${options.method}] => PATH: ${options.path}'); if (kDebugMode) {
_logger.d('REQUEST[${options.method}] => PATH: ${options.path}');
}
handler.next(options); handler.next(options);
} }
@override @override
void onResponse(Response response, ResponseInterceptorHandler handler) { void onResponse(Response response, ResponseInterceptorHandler handler) {
_logger.d('RESPONSE[${response.statusCode}] => PATH: ${response.requestOptions.path}'); if (kDebugMode) {
_logger.d('RESPONSE[${response.statusCode}] => PATH: ${response.requestOptions.path}');
}
handler.next(response); handler.next(response);
} }
@override @override
void onError(DioException err, ErrorInterceptorHandler handler) { void onError(DioException err, ErrorInterceptorHandler handler) {
_logger.e('ERROR[${err.response?.statusCode}] => PATH: ${err.requestOptions.path}'); if (kDebugMode) {
_logger.e('ERROR[${err.response?.statusCode}] => PATH: ${err.requestOptions.path}');
}
handler.next(err); handler.next(err);
} }
} }

View File

@ -69,12 +69,9 @@ final contributionRecordsProvider = FutureProvider.family<ContributionRecordsPag
(ref, params) async { (ref, params) async {
// //
if (params.accountSequence.isEmpty) { if (params.accountSequence.isEmpty) {
print('[ContributionRecordsProvider] accountSequence is empty, skipping request');
return null; return null;
} }
print('[ContributionRecordsProvider] Fetching records for ${params.accountSequence}, page=${params.page}, pageSize=${params.pageSize}');
final repository = ref.watch(contributionRepositoryProvider); final repository = ref.watch(contributionRepositoryProvider);
final result = await repository.getContributionRecords( final result = await repository.getContributionRecords(
params.accountSequence, params.accountSequence,
@ -82,12 +79,6 @@ final contributionRecordsProvider = FutureProvider.family<ContributionRecordsPag
pageSize: params.pageSize, pageSize: params.pageSize,
); );
print('[ContributionRecordsProvider] Result: ${result.isRight() ? "success" : "failed"}');
result.fold(
(failure) => print('[ContributionRecordsProvider] Error: ${failure.message}'),
(records) => print('[ContributionRecordsProvider] Records count: ${records.data.length}, total: ${records.total}'),
);
// provider // provider
ref.keepAlive(); ref.keepAlive();
@ -119,14 +110,8 @@ final contributionStatsProvider = FutureProvider<ContributionStats?>((ref) async
ref.onDispose(() => timer.cancel()); ref.onDispose(() => timer.cancel());
return result.fold( return result.fold(
(failure) { (failure) => null,
print('[ContributionStatsProvider] Error: ${failure.message}'); (stats) => stats,
return null;
},
(stats) {
print('[ContributionStatsProvider] Total contribution: ${stats.totalContribution}');
return stats;
},
); );
}); });