Add support for sharing PGN on iOS#3255
Draft
veloce wants to merge 3 commits into
Draft
Conversation
And drop the stalled receive_sharing_intent package.
Contributor
There was a problem hiding this comment.
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 onmobile.lichess.org/shareMethodChannel + EventChannel, routing toImportPgnScreen.handlePgnText; old_initSharingIntentremoved fromApplication. - iOS: new
ShareExtensiontarget (silent UI),SharePluginhandlingfile://URLs andorg.lichess.mobile://shared-pgndeeplinks via App Group handoff, Info.plist document/UTI for PGN, entitlements, signing/fastlane updates. - Android:
MainActivityreads PGN fromACTION_VIEW/ACTION_SENDintents 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 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Also:
receive_sharing_intentpackage.