Skip to content

Commit

Permalink
feat(quill_native_bridge): extend the support for macOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
EchoEllet committed Sep 15, 2024
1 parent 9397b6c commit e6ff099
Show file tree
Hide file tree
Showing 41 changed files with 1,617 additions and 36 deletions.
1 change: 0 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'package:flutter_localizations/flutter_localizations.dart'
GlobalWidgetsLocalizations;
import 'package:flutter_quill/flutter_quill.dart' show Document;
import 'package:flutter_quill/translations.dart' show FlutterQuillLocalizations;
import 'package:flutter_quill_extensions/flutter_quill_extensions.dart';
import 'package:hydrated_bloc/hydrated_bloc.dart'
show HydratedBloc, HydratedStorage;
import 'package:path_provider/path_provider.dart'
Expand Down
2 changes: 2 additions & 0 deletions example/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import flutter_inappwebview_macos
import gal
import irondash_engine_context
import path_provider_foundation
import quill_native_bridge
import share_plus
import sqflite
import super_native_extensions
Expand All @@ -26,6 +27,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
GalPlugin.register(with: registry.registrar(forPlugin: "GalPlugin"))
IrondashEngineContextPlugin.register(with: registry.registrar(forPlugin: "IrondashEngineContextPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
QuillNativeBridgePlugin.register(with: registry.registrar(forPlugin: "QuillNativeBridgePlugin"))
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
SuperNativeExtensionsPlugin.register(with: registry.registrar(forPlugin: "SuperNativeExtensionsPlugin"))
Expand Down
6 changes: 6 additions & 0 deletions example/macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- quill_native_bridge (0.0.1):
- FlutterMacOS
- share_plus (0.0.1):
- FlutterMacOS
- sqflite (0.0.3):
Expand All @@ -40,6 +42,7 @@ DEPENDENCIES:
- gal (from `Flutter/ephemeral/.symlinks/plugins/gal/darwin`)
- irondash_engine_context (from `Flutter/ephemeral/.symlinks/plugins/irondash_engine_context/macos`)
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)
- quill_native_bridge (from `Flutter/ephemeral/.symlinks/plugins/quill_native_bridge/macos`)
- share_plus (from `Flutter/ephemeral/.symlinks/plugins/share_plus/macos`)
- sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/darwin`)
- super_native_extensions (from `Flutter/ephemeral/.symlinks/plugins/super_native_extensions/macos`)
Expand Down Expand Up @@ -67,6 +70,8 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/irondash_engine_context/macos
path_provider_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin
quill_native_bridge:
:path: Flutter/ephemeral/.symlinks/plugins/quill_native_bridge/macos
share_plus:
:path: Flutter/ephemeral/.symlinks/plugins/share_plus/macos
sqflite:
Expand All @@ -88,6 +93,7 @@ SPEC CHECKSUMS:
irondash_engine_context: da62996ee25616d2f01bbeb85dc115d813359478
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
quill_native_bridge: 1a3a4bfab7cbe4ed0232a17d8aae201a3ce6d302
share_plus: 36537c04ce0c3e3f5bd297ce4318b6d5ee5fd6cf
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
super_native_extensions: 85efee3a7495b46b04befcfc86ed12069264ebf3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import 'package:flutter/foundation.dart' show defaultTargetPlatform;
import 'package:flutter/services.dart' show Clipboard, Uint8List;
import 'package:quill_native_bridge/quill_native_bridge.dart'
show QuillNativeBridge;

import '../../common/utils/platform.dart';
import 'clipboard_service.dart';

/// Default implementation
class DefaultClipboardService implements ClipboardService {
@override
Future<bool> canProvideHtmlText() async => isAndroidApp || isIosApp;
Future<bool> canProvideHtmlText() async =>
QuillNativeBridge.supportedHtmlClipboardPlatforms
.contains(defaultTargetPlatform);

@override
Future<String?> getHtmlText() => QuillNativeBridge.getClipboardHTML();
Expand Down
3 changes: 3 additions & 0 deletions quill_native_bridge/.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ migration:
- platform: ios
create_revision: 4cf269e36de2573851eaef3c763994f8f9be494d
base_revision: 4cf269e36de2573851eaef3c763994f8f9be494d
- platform: macos
create_revision: 4cf269e36de2573851eaef3c763994f8f9be494d
base_revision: 4cf269e36de2573851eaef3c763994f8f9be494d

# User provided section

Expand Down
27 changes: 0 additions & 27 deletions quill_native_bridge/example/ios/RunnerTests/RunnerTests.swift

This file was deleted.

4 changes: 2 additions & 2 deletions quill_native_bridge/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ class Buttons extends StatelessWidget {
);
return;
}
if (!{TargetPlatform.android, TargetPlatform.iOS}
if (!QuillNativeBridge.supportedHtmlClipboardPlatforms
.contains(defaultTargetPlatform)) {
scaffoldMessenger.showText(
'Currently, this functionality is only supported on Android and iOS.',
'Currently, this functionality is only supported on Android, iOS and macOS.',
);
return;
}
Expand Down
7 changes: 7 additions & 0 deletions quill_native_bridge/example/macos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Flutter-related
**/Flutter/ephemeral/
**/Pods/

# Xcode-related
**/dgph
**/xcuserdata/
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// Generated file. Do not edit.
//

import FlutterMacOS
import Foundation

import quill_native_bridge

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
QuillNativeBridgePlugin.register(with: registry.registrar(forPlugin: "QuillNativeBridgePlugin"))
}
43 changes: 43 additions & 0 deletions quill_native_bridge/example/macos/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
platform :osx, '10.14'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_macos_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_macos_build_settings(target)
end
end
22 changes: 22 additions & 0 deletions quill_native_bridge/example/macos/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
PODS:
- FlutterMacOS (1.0.0)
- quill_native_bridge (0.0.1):
- FlutterMacOS

DEPENDENCIES:
- FlutterMacOS (from `Flutter/ephemeral`)
- quill_native_bridge (from `Flutter/ephemeral/.symlinks/plugins/quill_native_bridge/macos`)

EXTERNAL SOURCES:
FlutterMacOS:
:path: Flutter/ephemeral
quill_native_bridge:
:path: Flutter/ephemeral/.symlinks/plugins/quill_native_bridge/macos

SPEC CHECKSUMS:
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
quill_native_bridge: 1a3a4bfab7cbe4ed0232a17d8aae201a3ce6d302

PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367

COCOAPODS: 1.15.2
Loading

0 comments on commit e6ff099

Please sign in to comment.