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:
parent
c852f24a72
commit
f57b0f9c26
|
|
@ -6,6 +6,10 @@
|
|||
-keep class io.flutter.** { *; }
|
||||
-keep class io.flutter.plugins.** { *; }
|
||||
|
||||
# Play Core (deferred components)
|
||||
-dontwarn com.google.android.play.core.**
|
||||
-keep class com.google.android.play.core.** { *; }
|
||||
|
||||
# 保持Gson相关
|
||||
-keepattributes Signature
|
||||
-keepattributes *Annotation*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:logger/logger.dart';
|
||||
|
||||
class LoggingInterceptor extends Interceptor {
|
||||
|
|
@ -8,19 +9,25 @@ class LoggingInterceptor extends Interceptor {
|
|||
|
||||
@override
|
||||
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);
|
||||
}
|
||||
|
||||
@override
|
||||
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);
|
||||
}
|
||||
|
||||
@override
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,12 +69,9 @@ final contributionRecordsProvider = FutureProvider.family<ContributionRecordsPag
|
|||
(ref, params) async {
|
||||
// 空字符串不请求
|
||||
if (params.accountSequence.isEmpty) {
|
||||
print('[ContributionRecordsProvider] accountSequence is empty, skipping request');
|
||||
return null;
|
||||
}
|
||||
|
||||
print('[ContributionRecordsProvider] Fetching records for ${params.accountSequence}, page=${params.page}, pageSize=${params.pageSize}');
|
||||
|
||||
final repository = ref.watch(contributionRepositoryProvider);
|
||||
final result = await repository.getContributionRecords(
|
||||
params.accountSequence,
|
||||
|
|
@ -82,12 +79,6 @@ final contributionRecordsProvider = FutureProvider.family<ContributionRecordsPag
|
|||
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 活跃
|
||||
ref.keepAlive();
|
||||
|
||||
|
|
@ -119,14 +110,8 @@ final contributionStatsProvider = FutureProvider<ContributionStats?>((ref) async
|
|||
ref.onDispose(() => timer.cancel());
|
||||
|
||||
return result.fold(
|
||||
(failure) {
|
||||
print('[ContributionStatsProvider] Error: ${failure.message}');
|
||||
return null;
|
||||
},
|
||||
(stats) {
|
||||
print('[ContributionStatsProvider] Total contribution: ${stats.totalContribution}');
|
||||
return stats;
|
||||
},
|
||||
(failure) => null,
|
||||
(stats) => stats,
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue