Skip to content

Commit

Permalink
Bump min OS version from 13.4 to 15.1
Browse files Browse the repository at this point in the history
Summary:
Starting from version 459, Messenger is [deprecating support for iOS versions 12.4 through 15.0](https://fb.workplace.com/groups/363724914618734/permalink/1176957889962095).

This diff bumps the Messenger minimum supported OS version to 15.1 and sets the proper `target_sdk_version` on libraries that are shared with targets that support an older version. This is necessary to avoid build errors like:

```
The target:

  fbsource//fbobjc/Apps/MSQRD/MSQRDPlayer:ARStudioPlayer

requires supporting target_sdk_version 13.4.
However, these libraries are specifying a more recent version:

 - fbsource//fbobjc/Libraries/METAMediaCompositionKit:METARegion fbsource//fbobjc/Libraries/METAMediaCompositionKit:METADynamicOverlay fbsource//fbobjc/Apps/Instagram/AppLibraries/Core/IGTuple:IGTuple fbsource//fbobjc/Apps/Instagram/AppLibraries/Core/IGAssociatedObjectUtils:IGAssociatedObjectUtils fbsource//fbobjc/Libraries/METAMediaCompositionKit:METAAudioEffect fbsource//fbobjc/Libraries/METAMediaCompositionKit:METAKeyFrameInterpolationModes fbsource//fbobjc/Apps/Instagram/AppLibraries/Core/IGFoundationFunctions:IGFoundationFunctions fbsource//fbobjc/Libraries/METAMediaCompositionKit:METAAnimationCurveInterpolations fbsource//fbobjc/Libraries/METAMediaCompositionKit:METAAnimationCurve fbsource//fbobjc/Libraries/ImageSource:ImageSourceProtocols fbsource//fbobjc/Libraries/METAMediaCompositionKit:METANormalizedKeyFrame fbsource//fbobjc/Libraries/METAMediaCompositionKit:METAIGLUFilterParameterMap fbsource//fbobjc/Libraries/METAMediaCompositionKit:METAIGLUFilterUpdater fbsource//fbobjc/Libraries/ImageSource:ImageSourceIGLSupport

This command may be able to automatically fix this issue:

  arc buildozer 'set target_sdk_version "13.4"' fbsource//fbobjc/Libraries/METAMediaCompositionKit:METARegion fbsource//fbobjc/Libraries/METAMediaCompositionKit:METADynamicOverlay fbsource//fbobjc/Apps/Instagram/AppLibraries/Core/IGTuple:IGTuple fbsource//fbobjc/Apps/Instagram/AppLibraries/Core/IGAssociatedObjectUtils:IGAssociatedObjectUtils fbsource//fbobjc/Libraries/METAMediaCompositionKit:METAAudioEffect fbsource//fbobjc/Libraries/METAMediaCompositionKit:METAKeyFrameInterpolationModes fbsource//fbobjc/Apps/Instagram/AppLibraries/Core/IGFoundationFunctions:IGFoundationFunctions fbsource//fbobjc/Libraries/METAMediaCompositionKit:METAAnimationCurveInterpolations fbsource//fbobjc/Libraries/METAMediaCompositionKit:METAAnimationCurve fbsource//fbobjc/Libraries/ImageSource:ImageSourceProtocols fbsource//fbobjc/Libraries/METAMediaCompositionKit:METANormalizedKeyFrame fbsource//fbobjc/Libraries/METAMediaCompositionKit:METAIGLUFilterParameterMap fbsource//fbobjc/Libraries/METAMediaCompositionKit:METAIGLUFilterUpdater fbsource//fbobjc/Libraries/ImageSource:ImageSourceIGLSupport
```

Reviewed By: tomrozanski-fb

Differential Revision: D57180362

fbshipit-source-id: dc6faa93004a9ee1f959c7f8635753fd1436e910
  • Loading branch information
cesar-vargas88 authored and facebook-github-bot committed May 13, 2024
1 parent 1a9df5a commit 4d08d76
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 33 deletions.
105 changes: 75 additions & 30 deletions Lexical/Helper/CopyPasteHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import Foundation
import MobileCoreServices
import UIKit
import UniformTypeIdentifiers

internal func setPasteboard(selection: BaseSelection, pasteboard: UIPasteboard) throws {
guard let editor = getActiveEditor() else {
Expand All @@ -23,23 +24,44 @@ internal func setPasteboard(selection: BaseSelection, pasteboard: UIPasteboard)
completionHandler?(data, nil)
}

pasteboard.items =
[
[(kUTTypeRTF as String): try getAttributedStringFromFrontend().data(
from: NSRange(location: 0, length: getAttributedStringFromFrontend().length),
documentAttributes: [.documentType: NSAttributedString.DocumentType.rtf])],
[LexicalConstants.pasteboardIdentifier: encodedData]
]
if #available(iOS 14.0, *) {
pasteboard.items =
[
[(UTType.rtf.identifier ): try getAttributedStringFromFrontend().data(
from: NSRange(location: 0, length: getAttributedStringFromFrontend().length),
documentAttributes: [.documentType: NSAttributedString.DocumentType.rtf])],
[LexicalConstants.pasteboardIdentifier: encodedData]
]
} else {
pasteboard.items =
[
[(kUTTypeRTF as String): try getAttributedStringFromFrontend().data(
from: NSRange(location: 0, length: getAttributedStringFromFrontend().length),
documentAttributes: [.documentType: NSAttributedString.DocumentType.rtf])],
[LexicalConstants.pasteboardIdentifier: encodedData]
]
}
}

internal func insertDataTransferForRichText(selection: RangeSelection, pasteboard: UIPasteboard) throws {
let itemSet = pasteboard.itemSet(
withPasteboardTypes: [
(kUTTypeUTF8PlainText as String),
(kUTTypeURL as String),
LexicalConstants.pasteboardIdentifier
]
)
let itemSet: IndexSet?
if #available(iOS 14.0, *) {
itemSet = pasteboard.itemSet(
withPasteboardTypes: [
(UTType.utf8PlainText.identifier),
(UTType.url.identifier),
LexicalConstants.pasteboardIdentifier
]
)
} else {
itemSet = pasteboard.itemSet(
withPasteboardTypes: [
(kUTTypeUTF8PlainText as String),
(kUTTypeURL as String),
LexicalConstants.pasteboardIdentifier
]
)
}

if let pasteboardData = pasteboard.data(
forPasteboardType: LexicalConstants.pasteboardIdentifier,
Expand All @@ -52,24 +74,47 @@ internal func insertDataTransferForRichText(selection: RangeSelection, pasteboar
return
}

if let pasteboardRTFData = pasteboard.data(
forPasteboardType: (kUTTypeRTF as String),
inItemSet: itemSet)?.last {
let attributedString = try NSAttributedString(
data: pasteboardRTFData,
options: [.documentType: NSAttributedString.DocumentType.rtf],
documentAttributes: nil
)

try insertRTF(selection: selection, attributedString: attributedString)
return
if #available(iOS 14.0, *) {
if let pasteboardRTFData = pasteboard.data(
forPasteboardType: (UTType.rtf.identifier),
inItemSet: itemSet)?.last {
let attributedString = try NSAttributedString(
data: pasteboardRTFData,
options: [.documentType: NSAttributedString.DocumentType.rtf],
documentAttributes: nil
)
try insertRTF(selection: selection, attributedString: attributedString)
return
}
} else {
if let pasteboardRTFData = pasteboard.data(
forPasteboardType: (kUTTypeRTF as String),
inItemSet: itemSet)?.last {
let attributedString = try NSAttributedString(
data: pasteboardRTFData,
options: [.documentType: NSAttributedString.DocumentType.rtf],
documentAttributes: nil
)

try insertRTF(selection: selection, attributedString: attributedString)
return
}
}

if let pasteboardStringData = pasteboard.data(
forPasteboardType: (kUTTypeUTF8PlainText as String),
inItemSet: itemSet)?.last {
try insertPlainText(selection: selection, text: String(decoding: pasteboardStringData, as: UTF8.self))
return
if #available(iOS 14.0, *) {
if let pasteboardStringData = pasteboard.data(
forPasteboardType: (UTType.utf8PlainText.identifier),
inItemSet: itemSet)?.last {
try insertPlainText(selection: selection, text: String(decoding: pasteboardStringData, as: UTF8.self))
return
}
} else {
if let pasteboardStringData = pasteboard.data(
forPasteboardType: (kUTTypeUTF8PlainText as String),
inItemSet: itemSet)?.last {
try insertPlainText(selection: selection, text: String(decoding: pasteboardStringData, as: UTF8.self))
return
}
}

if let url = pasteboard.urls?.first as? URL {
Expand Down
12 changes: 9 additions & 3 deletions Lexical/TextView/TextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import MobileCoreServices
import UIKit
import UniformTypeIdentifiers

protocol LexicalTextViewDelegate: NSObjectProtocol {
func textViewDidBeginEditing(textView: TextView)
Expand Down Expand Up @@ -146,11 +147,16 @@ protocol LexicalTextViewDelegate: NSObjectProtocol {
return true
} else if !(pasteboard.data(forPasteboardType: LexicalConstants.pasteboardIdentifier)?.isEmpty ?? true) {
return true
} else if !(pasteboard.data(forPasteboardType: (kUTTypeUTF8PlainText as String))?.isEmpty ?? true) {
return true
} else if #available(iOS 14.0, *) {
if !(pasteboard.data(forPasteboardType: (UTType.utf8PlainText.identifier))?.isEmpty ?? true) {
return true
}
} else {
return super.canPerformAction(action, withSender: sender)
if !(pasteboard.data(forPasteboardType: (kUTTypeUTF8PlainText as String))?.isEmpty ?? true) {
return true
}
}
return super.canPerformAction(action, withSender: sender)
} else {
return super.canPerformAction(action, withSender: sender)
}
Expand Down

0 comments on commit 4d08d76

Please sign in to comment.