Files
slogan/lib/core/ads/ads_service.dart
T

25 lines
713 B
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:flutter_riverpod/flutter_riverpod.dart';
/// 广告服务抽象:P0 用 Mock(保证业务链路可开发可测),P1 换穿山甲 SDK
abstract class AdsService {
bool get enabled;
Future<bool> showRewarded();
}
/// 本地模拟激励视频(约 1 秒"播放"后返回完整观看)
class MockAdsService implements AdsService {
@override
bool get enabled => true;
@override
Future<bool> showRewarded() async {
await Future.delayed(const Duration(milliseconds: 900));
return true;
}
}
final adsServiceProvider = Provider<AdsService>((ref) {
// P1AppConfig.pangleAppId 非空时替换为 PangleAdsService(穿山甲 SDK 实现)
return MockAdsService();
});