Skip to content

Add support for sharing PGN on iOS#3255

Draft
veloce wants to merge 3 commits into
mainfrom
drop_receive_sharing_intent
Draft

Add support for sharing PGN on iOS#3255
veloce wants to merge 3 commits into
mainfrom
drop_receive_sharing_intent

Conversation

@veloce
Copy link
Copy Markdown
Contributor

@veloce veloce commented May 29, 2026

Also:

  • drop the stalled receive_sharing_intent package.
  • Refactor sharing intent logic in its dedicated service.

And drop the stalled receive_sharing_intent package.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds native iOS PGN sharing support (file open + Share Extension) and refactors Android sharing onto a dedicated Flutter service, replacing the stalled receive_sharing_intent package.

Changes:

  • New SharedPgnService (Dart) listening on mobile.lichess.org/share MethodChannel + EventChannel, routing to ImportPgnScreen.handlePgnText; old _initSharingIntent removed from Application.
  • iOS: new ShareExtension target (silent UI), SharePlugin handling file:// URLs and org.lichess.mobile://shared-pgn deeplinks via App Group handoff, Info.plist document/UTI for PGN, entitlements, signing/fastlane updates.
  • Android: MainActivity reads PGN from ACTION_VIEW/ACTION_SEND intents and forwards over the new channels.

Reviewed changes

Copilot reviewed 15 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pubspec.yaml / pubspec.lock / ios/Podfile.lock Drop receive_sharing_intent dependency.
lib/src/shared_pgn_service.dart New Riverpod service receiving PGNs from native channels.
lib/src/app.dart Remove old sharing intent setup; start sharedPgnServiceProvider.
lib/src/app_links_service.dart Ignore org.lichess.mobile://shared-pgn (owned by SharePlugin).
android/.../MainActivity.kt Read PGN from intents and expose via Method/EventChannel.
ios/Runner/SharePlugin.swift Native plugin bridging file URLs and shared-pgn deeplinks to Flutter.
ios/Runner/AppDelegate.swift Register SharePlugin with the implicit engine.
ios/Runner/Info.plist Declare PGN document type and org.lichess.pgn UTI; open-in-place.
ios/Runner/Runner.entitlements Add group.org.lichess.mobileV2.share App Group.
ios/ShareExtension/* New silent share extension writing PGN to App Group and opening host app.
ios/Runner.xcodeproj/project.pbxproj Add ShareExtension target, build configs, embed phase.
ios/fastlane/Fastfile, Matchfile Include org.lichess.mobileV2.ShareExtension app identifier.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1012 to +1036
E3872FEF6A461C3E4809EF26 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_WEAK = NO;
CODE_SIGN_ENTITLEMENTS = ShareExtension/ShareExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
GENERATE_INFOPLIST_FILE = NO;
INFOPLIST_FILE = ShareExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = "$(FLUTTER_BUILD_NAME)";
PRODUCT_BUNDLE_IDENTIFIER = org.lichess.mobileV2.ShareExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
Comment on lines +76 to +91
private func readPgn(fromFileURL url: URL) -> String? {
let scoped = url.startAccessingSecurityScopedResource()
defer { if scoped { url.stopAccessingSecurityScopedResource() } }
return try? String(contentsOf: url, encoding: .utf8)
}

private func readSharedPgnFromAppGroup() -> String? {
guard
let container = FileManager.default.containerURL(
forSecurityApplicationGroupIdentifier: Self.appGroupId)
else { return nil }
let fileURL = container.appendingPathComponent(Self.sharedFileName)
let pgn = try? String(contentsOf: fileURL, encoding: .utf8)
try? FileManager.default.removeItem(at: fileURL)
return pgn
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants