-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
154 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:flutter/services.dart'; | ||
import 'flutter_gromore_ads_platform_interface.dart'; | ||
|
||
class MethodChannelFlutterGromoreAds extends FlutterGromoreAdsPlatform { | ||
@visibleForTesting | ||
final methodChannel = const MethodChannel('flutter_gromore_ads'); | ||
|
||
@visibleForTesting | ||
final eventChannel = const EventChannel('flutter_gromore_ads_event'); | ||
|
||
@override | ||
Future<bool> requestIDFA() async { | ||
final bool result = await methodChannel.invokeMethod('requestIDFA'); | ||
return result; | ||
} | ||
|
||
@override | ||
Future<bool> requestPermissionIfNecessary() async { | ||
final bool result = | ||
await methodChannel.invokeMethod('requestPermissionIfNecessary'); | ||
return result; | ||
} | ||
|
||
@override | ||
Future<bool> initAd(String appId, | ||
{String? config, int limitPersonalAds = 0}) async { | ||
final bool result = await methodChannel.invokeMethod( | ||
'initAd', | ||
{ | ||
'appId': appId, | ||
'config': config, | ||
'limitPersonalAds': limitPersonalAds, | ||
}, | ||
); | ||
print( | ||
"🎉🎉🎉 FlutterAds ==> 初始化完成,推荐使用 GroMore Pro 版本,获得更高的收益:https://flutterads.top/"); | ||
//打印购买正版 | ||
print( | ||
"🎉🎉🎉 FlutterAds ==> 请购买支持正版,否则可能出现上线后广告不加载的情况,避免收益下降、不结算等情况,请访问:https://flutterads.top/"); | ||
return result; | ||
} | ||
|
||
@override | ||
Future<bool> showSplashAd(String posId, | ||
{String? logo, double timeout = 3.5}) async { | ||
final bool result = await methodChannel.invokeMethod( | ||
'showSplashAd', | ||
{ | ||
'posId': posId, | ||
'logo': logo, | ||
'timeout': timeout, | ||
}, | ||
); | ||
return result; | ||
} | ||
|
||
@override | ||
Future<bool> showInterstitialAd(String posId) async { | ||
final bool result = await methodChannel.invokeMethod( | ||
'showInterstitialAd', | ||
{'posId': posId}, | ||
); | ||
return result; | ||
} | ||
|
||
@override | ||
Stream<dynamic> getEventStream() { | ||
return eventChannel.receiveBroadcastStream(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import 'package:plugin_platform_interface/plugin_platform_interface.dart'; | ||
import 'flutter_gromore_ads_method_channel.dart'; | ||
|
||
abstract class FlutterGromoreAdsPlatform extends PlatformInterface { | ||
FlutterGromoreAdsPlatform() : super(token: _token); | ||
|
||
static final Object _token = Object(); | ||
|
||
static FlutterGromoreAdsPlatform _instance = MethodChannelFlutterGromoreAds(); | ||
|
||
static FlutterGromoreAdsPlatform get instance => _instance; | ||
|
||
static set instance(FlutterGromoreAdsPlatform instance) { | ||
PlatformInterface.verifyToken(instance, _token); | ||
_instance = instance; | ||
} | ||
|
||
Future<bool> requestIDFA() { | ||
throw UnimplementedError('requestIDFA() has not been implemented.'); | ||
} | ||
|
||
Future<bool> requestPermissionIfNecessary() { | ||
throw UnimplementedError( | ||
'requestPermissionIfNecessary() has not been implemented.'); | ||
} | ||
|
||
Future<bool> initAd(String appId, | ||
{String? config, int limitPersonalAds = 0}) { | ||
throw UnimplementedError('initAd() has not been implemented.'); | ||
} | ||
|
||
Future<bool> showSplashAd(String posId, | ||
{String? logo, double timeout = 3.5}) { | ||
throw UnimplementedError('showSplashAd() has not been implemented.'); | ||
} | ||
|
||
Future<bool> showInterstitialAd(String posId) { | ||
throw UnimplementedError('showInterstitialAd() has not been implemented.'); | ||
} | ||
|
||
Stream<dynamic> getEventStream() { | ||
throw UnimplementedError('getEventStream() has not been implemented.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters