Browse Source

更新回调

tags/0.0.18
Weller 3 years ago
parent
commit
3dade05ef6
2 changed files with 12 additions and 13 deletions
  1. +3
    -4
      lib/util/advertising_util.dart
  2. +9
    -9
      lib/util/application.dart

+ 3
- 4
lib/util/advertising_util.dart View File

@@ -3,13 +3,12 @@ import 'package:flutter/cupertino.dart';
import 'application.dart'; import 'application.dart';


class AdvertisingUtils { class AdvertisingUtils {
static Future init() async {
await Application.doStringParamsMethod("init_advertising", data: {});
static Future init() {
return Application.doStringParamsMethod("init_advertising", data: {});
//await Application.doStringParamsMethod("init_advertising", data: {"androidAppId": "5173995", "iosAppId": "5167929", "appName": "智莺生活"}); //await Application.doStringParamsMethod("init_advertising", data: {"androidAppId": "5173995", "iosAppId": "5167929", "appName": "智莺生活"});
} }


static Future openSplashAd() async { static Future openSplashAd() async {
await Application.doStringParamsMethod("advertising_splash", data: {});
return Application.doStringParamsMethod("advertising_splash", data: {});
} }
} }


+ 9
- 9
lib/util/application.dart View File

@@ -34,28 +34,28 @@ class Application {
return _initStringMethods.containsKey(type); return _initStringMethods.containsKey(type);
} }


static doStringMethod(String type) {
static Future doStringMethod(String type) {
if (_initStringMethods.containsKey(type)) { if (_initStringMethods.containsKey(type)) {
print("存在方法" + type); print("存在方法" + type);
_initStringMethods[type]();
} else {
print("不存在方法" + type);
return _initStringMethods[type]();
} }
print("不存在方法" + type);
return Future(() => false);
} }


static addStringParamsMethod({String type , StringParamsMethod method}) {
static addStringParamsMethod({String type, StringParamsMethod method}) {
if (type == null || method == null) { if (type == null || method == null) {
return; return;
} }
_initStringParamsMethods[type] = method; _initStringParamsMethods[type] = method;
} }


static doStringParamsMethod(String type, {Map<String, dynamic> data}) {
static Future doStringParamsMethod(String type, {Map<String, dynamic> data}) {
if (_initStringParamsMethods.containsKey(type)) { if (_initStringParamsMethods.containsKey(type)) {
print("存在方法" + type); print("存在方法" + type);
_initStringParamsMethods[type](data);
} else {
print("不存在方法" + type);
return _initStringParamsMethods[type](data);
} }
print("不存在方法" + type);
return Future(() => false);
} }
} }

Loading…
Cancel
Save