Skip to content

Drop iOS 14 Support: Update Share Extensions#20866

Merged
kean merged 1 commit intotrunkfrom
task/ios-15-migrate-01
Jun 14, 2023
Merged

Drop iOS 14 Support: Update Share Extensions#20866
kean merged 1 commit intotrunkfrom
task/ios-15-migrate-01

Conversation

@kean
Copy link
Contributor

@kean kean commented Jun 13, 2023

Related: #20860

Update* share extensions to support iOS 15 as minimum deployment target.

* There is one more change needed, but it'll affect multiple screens – I'll update it separately.

To test:

Test the following supported types (all or at least some of them):

  • Plain Text: Share plain text from any app in the system and verify that the extension displays it.
  • URL: Share a URL and verify that the extension displays it.
  • Property List: Share a link from Safari, e.g. apple.com, and verify that the extension displays it.
  • Image: Share an image from Photos.
  • TextBundle: It's a relatively obscure format that's powered by the following library. To test it, you can download one of the sample bundles from the repo, save it to Files, and share it from there. Verify that bundles with media work:
Screenshot 2023-06-13 at 7 20 30 PM

If you need to debug the extension select Debug / Attach to Process by PID or Process Name: “JetpackShareExtension”

The changes I made to TextBundle.m do not affect any of the functionality because this code is unused, but I tested it manually just to make sure it still works:

// Before
(__bridge_transfer NSString *)UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)@"net.daringfireball.markdown", kUTTagClassFilenameExtension);
// prints "md"

// After
[[UTType typeWithIdentifier:@"net.daringfireball.markdown"] preferredFilenameExtension];
// prints "md"

(Unrelated to PR) The preferredFilenameExtension is not going to work for @"org.textbundle.package" unless the app exports it as a custom file type, but that's not a problem unless we add writing of these files :)

Regression Notes

  1. Potential unintended areas of impact: Share Extension
  2. What I did to test those areas of impact (or what existing automated tests I relied on): manual testing
  3. What automated tests I added (or what prevented me from doing so): n/a

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@kean kean added this to the Pending milestone Jun 13, 2023
@kean kean requested a review from guarani June 13, 2023 23:48
@kean kean force-pushed the task/ios-15-migrate-01 branch from bb3e151 to 4c0d7c8 Compare June 13, 2023 23:49
@wpmobilebot
Copy link
Contributor

Jetpack Alpha📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
App NameJetpack Alpha Jetpack Alpha
ConfigurationRelease-Alpha
Build Numberpr20866-4c0d7c8
Version22.6
Bundle IDcom.jetpack.alpha
Commit4c0d7c8
App Center Buildjetpack-installable-builds #4990
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@wpmobilebot
Copy link
Contributor

WordPress Alpha📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
App NameWordPress Alpha WordPress Alpha
ConfigurationRelease-Alpha
Build Numberpr20866-4c0d7c8
Version22.6
Bundle IDorg.wordpress.alpha
Commit4c0d7c8
App Center BuildWPiOS - One-Offs #5962
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@kean kean requested a review from mokagio June 14, 2023 16:13
Copy link
Contributor

@guarani guarani left a comment

Choose a reason for hiding this comment

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

👋 Hey @kean, thanks for the PR! The testing steps worked as expected except for a crash which I've detailed below (but I haven't yet checked if it's present in trunk).

These are the steps to reproduce the crash (reproducible on 2 out of 2 attempts):

  1. Shared text (highlight text in an online text editor, long-press, Share, choose Jetpack)
  2. Opened a different app and shared text (highlighted text in notes field of Contacts app, long-press, Share, choose Jetpack
  3. Share extension crashes in Xcode
* thread #31, queue = 'com.apple.NSURLSession-delegate', stop reason = EXC_BREAKPOINT (code=1, subcode=0x10c6c11b8)
    frame #0: 0x000000010c6c11b8 CoreData`_PFAssertSafeMultiThreadedAccess_impl + 520
    frame #1: 0x000000010c6c8f90 CoreData`-[NSManagedObjectContext executeRequest:error:] + 2552
    frame #2: 0x000000010c61f488 CoreData`__C.NSManagedObjectContext.fetch<τ_0_0 where τ_0_0: __C.NSFetchRequestResult>(__C.NSFetchRequest<τ_0_0>) throws -> Swift.Array<τ_0_0> + 80
  * frame #3: 0x00000001029d80bc Jetpack`SharedCoreDataStack.fetchSessionUploadOps(taskIdentifier=1, sessionID="group.org.wordpress.06C9B0C5-26E7-427C-9551-6143F857DD49", self=0x00000002951df010) at SharedCoreDataStack.swift:194:44
    frame #4: 0x00000001025d2270 Jetpack`ShareExtensionSessionManager.urlSession(session=0x0000000295cb37f0, task=0x00000002952a2f40, error=nil, self=0x0000000295c8f920) at ShareExtensionSessionManager.swift:338:45
    frame #5: 0x00000001025d3034 Jetpack`@objc ShareExtensionSessionManager.urlSession(_:task:didCompleteWithError:) at <compiler-generated>:0
    frame #6: 0x00000001168540e0 CFNetwork`___lldb_unnamed_symbol2749 + 32
    frame #7: 0x000000011ccec528 libdispatch.dylib`_dispatch_call_block_and_release + 24
    frame #8: 0x000000011ccedd50 libdispatch.dylib`_dispatch_client_callout + 16
    frame #9: 0x000000011ccf6014 libdispatch.dylib`_dispatch_lane_serial_drain + 924
    frame #10: 0x000000011ccf6da4 libdispatch.dylib`_dispatch_lane_invoke + 480
    frame #11: 0x000000011cd04b74 libdispatch.dylib`_dispatch_workloop_worker_thread + 1716
    frame #12: 0x00000001b1834878 libsystem_pthread.dylib`_pthread_wqthread + 284

The changes I made to TextBundle.m do not affect any of the functionality because this code is unused, but I tested it manually just to make sure it still works:

What do you mean by unused? Does this mean dead code that could be removed?

@guarani
Copy link
Contributor

guarani commented Jun 14, 2023

Testing on trunk now.

@guarani guarani self-requested a review June 14, 2023 19:17
Copy link
Contributor

@guarani guarani left a comment

Choose a reason for hiding this comment

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

I confirmed the above crash happens on trunk so it's unrelated to this PR (I created #20873 to track it separately).

Approving now, all the tests worked great and the code changes look good.

@kean
Copy link
Contributor Author

kean commented Jun 14, 2023

What do you mean by unused? Does this mean dead code that could be removed?

Yes, but it's the library code, so I would suggest keeping it. It'll make it easier to update it in the future if needed.

P.S. I looked into the library and there is some development happening, but I don't see any new stable releases.

@kean kean merged commit f71cf03 into trunk Jun 14, 2023
@kean kean deleted the task/ios-15-migrate-01 branch June 14, 2023 21:09
@kean kean removed the General label Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants