checkEnabled method

  1. @override
bool checkEnabled(
  1. ExecContext context
)
override

Decide whether to apply this action based on the contents of context.

Return true if applicable.

contextの内容を元にこのアクションを適用するかどうかを決定する。

適用する場合trueを返す。

Implementation

@override
bool checkEnabled(ExecContext context) {
  final ecosystem = context.yaml.getAsMap("ecosystem");
  final enable = ecosystem.get("enable", false);
  final type = ecosystem.get("type", "");
  if (!enable) {
    return false;
  }
  switch (type) {
    case "point":
      final purchase = context.yaml.getAsMap("purchase");
      final enablePurchase = purchase.get("enable", false);
      final ads = context.yaml.getAsMap("ads");
      final enableAds = ads.get("enable", false);
      if (!enablePurchase || !enableAds) {
        return false;
      }
  }
  return true;
}