import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';

import 'system_share_platform_interface.dart';

/// An implementation of [SystemSharePlatform] that uses method channels.
class MethodChannelSystemShare extends SystemSharePlatform {
  /// The method channel used to interact with the native platform.
  @visibleForTesting
  final methodChannel = const MethodChannel('system_share');

  @override
  Future<bool> isInstalled(String packageName) async {
    return await methodChannel.invokeMethod("isInstalled", {
      "packageName": packageName,
    });
  }

  @override
  Future<void> shareFile(
      String filePath, String packageName, String? shareTitle,
      {String? shareFileType}) async {
    return await methodChannel.invokeMethod("shareFile", {
      "filePath": filePath,
      "packageName": packageName,
      "shareTitle": shareTitle,
      "shareFileType": shareFileType,
    });
  }
}
