haptic static method

Future<bool> haptic(
  1. HapticsType? type, {
  2. bool force = false,
})

Implementation

static Future<bool> haptic(HapticsType? type, {bool force = false}) async {
  if (!kHapticsAvailable && $app == null && !_checkHaptics) {
    _checkHaptics = true;
    kHapticsAvailable = await Haptics.canVibrate();
    $shadEvent = ArcaneShadEvents();
  }

  if (type != null &&
      kHapticsAvailable &&
      Arcane.globalTheme.haptics.enabled &&
      (DateTime.timestamp().millisecondsSinceEpoch - _lastHaptic > 100 ||
          force)) {
    _lastHaptic = DateTime.timestamp().millisecondsSinceEpoch;
    return Haptics.vibrate(type).then((_) => true).catchError((e) => false);
  } else {
    //verbose("type=$type avail=$kHapticsAvailable enabled=${Arcane.globalTheme.haptics.enabled} force=$force overflow=${DateTime.timestamp().millisecondsSinceEpoch - _lastHaptic > 100}");
  }

  return Future.value(false);
}