Commit Graph

162 Commits

Author SHA1 Message Date
Jawwad Ahmad
716192723f Fixed a few more NSKeyedUnarchiver validateAllowedClass warnings
Summary:
Warnings in tests were fixed in a previous commit. This fixes warnings that appear when right when the app is launched.

Fixes GitHub issues #1941 and #1930

Reviewed By: samodom

Differential Revision: D32607508

fbshipit-source-id: 903e2967caadc312b41a3b4a6caee060eee305fc
2021-11-23 09:06:58 -08:00
Jawwad Ahmad
a38207417b Fix a few NSKeyedUnarchiver validateAllowedClass Warnings in Xcode Console
Summary:
Running the tests no longer shows these warnings.

Fixed the following warnings when running FBSDKAppEventsStateManagerTests.testPersistingValidState and FBSDKAppEventsTests.testFetchingConfigurationIncludingCertainFeatures

```
Attempted to decode a collection type 'NSString' (subclass of 'NSObject') for key 'NS.keys'. 'NSString' requires its subclasses to be explicitly added to the allowed classes list but it is not present.
allowed unarchiving safe plist type ''NSNumber' (0x7fff863021c8) [/Applications/Xcode_13.0.0_fb.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework]' for key 'NS.objects', even though it was not explicitly included in the client allowed classes set
```

Reviewed By: joesus

Differential Revision: D32606181

fbshipit-source-id: e095005a1904c9b1996df0c3c0ea96482def88de
2021-11-22 16:58:04 -08:00
Xin Wu
8a2449ca2c make app id as optional during FBAEMReporter configuration
Summary: For some MMPs, we let developers set the FB app ID in the info.plist

Reviewed By: samodom

Differential Revision: D32249433

fbshipit-source-id: 5abfb5b5957c8ae6a4a23e2a762a258fa126fe6f
2021-11-19 12:39:20 -08:00
Zilin Zhang
e31eb9f67c Fix getContentID
Reviewed By: wx0165927473, dreamolight

Differential Revision: D32514739

fbshipit-source-id: 3a42bfab828fab28e65896e7e157cbb1ea115acb
2021-11-17 19:54:44 -08:00
CodemodService FBObjcUncrustifyLinterBot
36e20fff5a Daily arc lint --take UNCRUSTIFY
Reviewed By: zertosh

Differential Revision: D32520307

fbshipit-source-id: c7c83fc24a23c30d3c520a86d677490243f9d727
2021-11-17 19:37:07 -08:00
Zilin Zhang
f623eeb18e Add priority addin if the conversion is optimized
Reviewed By: joesus, dreamolight

Differential Revision: D32240117

fbshipit-source-id: c06c0523aae181e3932a8e8e2ef3739e03cb11b4
2021-11-16 21:29:39 -08:00
Zilin Zhang
d75d608dfe Add event optimization check for catalog level reporting
Reviewed By: joesus, dreamolight

Differential Revision: D32239672

fbshipit-source-id: f3445a73ceef59006da7493ecce4ec1cbcb959eb
2021-11-16 21:29:39 -08:00
Zilin Zhang
554d8b0b3c Add catalog optimization request
Reviewed By: joesus

Differential Revision: D31882815

fbshipit-source-id: 138e1924bdd5e3de63904a637fe624a1b3a3a26e
2021-11-16 21:29:39 -08:00
Zilin Zhang
d4f1616b20 Add catalog networker
Reviewed By: joesus

Differential Revision: D31822495

fbshipit-source-id: 4428faa94533c543ff3a46bdefffc5c0e3494390
2021-11-16 18:11:22 -08:00
Zilin Zhang
f29294c3a7 Add shouldUpdateCache to invocation's attribution funciton
Reviewed By: wx0165927473

Differential Revision: D31813173

fbshipit-source-id: a4ca4192162aea4b371eefe60a1f6549a8808677
2021-11-16 14:28:32 -08:00
Zilin Zhang
401cd6639e Add GK for AEM Catalog Report
Summary: This diff adds GK control for AEM catalog report

Reviewed By: wx0165927473

Differential Revision: D31228032

fbshipit-source-id: d0d4ae69c8d67020fe1473db33038c92c0103605
2021-11-16 14:28:32 -08:00
Zilin Zhang
94b94f7471 Add catalog ID support
Reviewed By: dreamolight

Differential Revision: D31123185

fbshipit-source-id: 3570ddb608c08ecf8c9c6baa786697f754ed0282
2021-11-16 14:28:32 -08:00
Zilin Zhang
d9a1a53526 Use in-segment value for CPAS
Reviewed By: dreamolight

Differential Revision: D32199737

fbshipit-source-id: 4fccd8ea6590c686feb8f4e5a46e83aa236b6baf
2021-11-15 22:32:29 -08:00
Zilin Zhang
d9148bf09d Add CPAS config support
Reviewed By: dreamolight

Differential Revision: D32164621

fbshipit-source-id: 5cb93cc711d1c679615d47c25cdb156027267ff2
2021-11-15 22:32:29 -08:00
Zilin Zhang
c4d64290fb Add in segment value calculation support
Reviewed By: dreamolight

Differential Revision: D32162911

fbshipit-source-id: 0a2a2dea84f85fb3188add7908ba552644ed3139
2021-11-15 22:32:28 -08:00
Joe Susnick
5f5c7bcbec Updating project flags
Summary:
Now uses defaults for:
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER
SWIFT_OPTIMIZATION_LEVEL

Reviewed By: samodom

Differential Revision: D32280336

fbshipit-source-id: d2a434956604590fa387d685173186a0473acf70
2021-11-09 09:32:15 -08:00
Sam Odom
d355f0bf31 Remove unnecessary headers that simply declare protocol conformance (Basics)
Summary: Add conformance declarations to main headers

Reviewed By: joesus

Differential Revision: D32239671

fbshipit-source-id: f761126fc583fff91aab59a822b143098112221f
2021-11-08 08:17:12 -08:00
Sam Odom
3db279b78a Correct import statements in umbrella headers
Summary: Two of the umbrella headers were missing modular imports of their files

Reviewed By: jawwad

Differential Revision: D32232931

fbshipit-source-id: d61e1a12d7e6f59560e151243684ae7c084f443b
2021-11-06 21:36:02 -07:00
Zilin Zhang
96046e6b01 Add FBAEMUtility
Summary: As AEMKit grows larger, we add FBAEMUitlity class and will add util functions to this class.

Reviewed By: wx0165927473

Differential Revision: D32116160

fbshipit-source-id: 077d66a3383f6dd81818fd798f90453aacbe7624
2021-11-06 02:08:36 -07:00
Joe Susnick
fd836717ab Getting rid of "helper method" pragmas
Summary: $title

Reviewed By: jawwad

Differential Revision: D32205402

fbshipit-source-id: 75b001ca3fc0b8f6124bbbe4e1b14dc006bb6f90
2021-11-05 10:42:57 -07:00
Xin Wu
cdedc6b4da add getting app id from plist file
Summary: In order to unblock MMP <-> AEM, we need to read the app id from plist file.

Reviewed By: jamestouri

Differential Revision: D31970825

fbshipit-source-id: f2af0e77daa138fccc9464f05034adf4e54884a9
2021-11-04 10:57:53 -07:00
Jawwad Ahmad
ca06b0f182 Revert D31881915: Remove the unused optionIndex param from the attemptRecoveryFromError:optionIndex:completionHandler method in the FBSDKErrorRecoveryAttempting protocol
Differential Revision:
D31881915 (8430143ef5)

Original commit changeset: 79d2bcc014bb

fbshipit-source-id: 18de8f1aa186a9f31df769248ab6648c8579a995
2021-10-27 19:35:02 -07:00
Jawwad Ahmad
8430143ef5 Remove the unused optionIndex param from the attemptRecoveryFromError:optionIndex:completionHandler method in the FBSDKErrorRecoveryAttempting protocol
Summary: In taking a look at the `attemptRecoveryFromError:optionIndex:completionHandler:` method I noticed that optionIndex was unused. The documentation in FBSDKErrorRecoveryAttempting.h shows that this method was modeled on NSErrorRecoveryAttempting. However anytime it was called 0 was passed in for the optionIndex so it was essentially unused.

Reviewed By: samodom

Differential Revision: D31881915

fbshipit-source-id: 79d2bcc014bba0d42288ac289fbdde78b5a7f8cf
2021-10-27 18:32:48 -07:00
Jawwad Ahmad
27995a4a95 Disable uncrustify on methods that use NS_SWIFT_NAME
Summary:
Disabled by surrounding methods that are annotated with NS_SWIFT_NAME with UNCRUSTIFY_FORMAT_OFF / UNCRUSTIFY_FORMAT_ON

This is because uncrustify doesn't know how to align the colons correctly.

Ran the following command to do so:
```
hg files -I '**/*.h' -0 | xargs -0 perl -0777 -pi -e 's/(?<!UNCRUSTIFY_FORMAT_OFF\n)(^[+-][^;]+?\n\s*NS_SWIFT_NAME\(.*?:.*?\).*?;)/\/\/ UNCRUSTIFY_FORMAT_OFF\n\1\n\/\/ UNCRUSTIFY_FORMAT_ON\n/smg'
```

Reviewed By: samodom

Differential Revision: D31933741

fbshipit-source-id: 3071ed7fa65b4b67e86bf9f337d7f525ef9253ce
2021-10-26 16:16:32 -07:00
Jawwad Ahmad
83d9c04c6c Fix formatting for files that uncrustify wasn't running on
Reviewed By: samodom

Differential Revision: D31919253

fbshipit-source-id: 21f1a663be867dd41b99859f4ffc898f46c6964b
2021-10-26 12:09:01 -07:00
Jawwad Ahmad
2373ffab29 Bump SDK version to 12.1.0
Reviewed By: samodom

Differential Revision: D31924716

fbshipit-source-id: 6f641cf855997d8380d536ba990ca910ac5d7f9e
2021-10-26 08:24:47 -07:00
Jawwad Ahmad
09d82b4521 Manually ran uncrustify on some files that were being skipped
Reviewed By: samodom

Differential Revision: D31911219

fbshipit-source-id: 15c4764e5f2e73df5a0330a4945027f9cf2b42cd
2021-10-26 07:30:10 -07:00
Andres Suarez
325eb64e5e Apply LICENSELINT
Reviewed By: johnny2217

Differential Revision: D31866195

fbshipit-source-id: 96c9e2047491ab2b10a3dc8d0b8d570d72c48825
2021-10-22 12:29:20 -07:00
Joe Susnick
3d24f8dc95 Fix archiving on Xcode 12.5
Summary:
It's weird but `@_exported import` does not seem to work when archiving with SPM on Xcode 12.5. This means that symbols are not re-exported under the library names that SPM defines but instead are only available in the underlying `FBSDK`-prefixed modules.

## Some context:
The SPM targets with the `Facebook` prefix (ex: `FacebookCore` are by and large just hacks to help people avoid importing dependent frameworks and libraries such as `Accelerate` and `z`. Essentially they are just wrappers. We were using `@_exported import` so that you could use the symbols from the 'wrapped' framework as though they were coming from the original framework.

This works in Xcode13 but does not work for archiving on 12.5.

If you change the import to be `FBSDK` prefixed, you can still reference all of the symbols you need when using 12.5.

Additionally this changeset fixes the need to explicitly include `FacebookAEM` and `FacebookBasics` in your project.

Reviewed By: jawwad

Differential Revision: D31840198

fbshipit-source-id: 145a904c1408cb8fda3123db185d161485c4607c
2021-10-21 15:39:49 -07:00
Joe Susnick
4c79cbcddd Safer initialization for dependencies
Summary: In ObjC it's easy to provide convenience initializers that do not call a designated initializer. This is a step towards making it more difficult to bypass required initializers by making `new` and `init` unavailable when there are convenience init or factory methods / singletons available.

Reviewed By: samodom

Differential Revision: D31731483

fbshipit-source-id: efb9c7470f5a66aab0f9703865a307fb2a937734
2021-10-19 11:30:42 -07:00
Jawwad Ahmad
3e1d62d19d Bump SDK version to 12.0.2
Summary: This release will re-add compatibility with Xcode 12

Reviewed By: joesus

Differential Revision: D31716891

fbshipit-source-id: ae1dbf3453d8223fd3ba022bfba51c394d23aeab
2021-10-16 19:04:59 -07:00
Jawwad Ahmad
8e28e93626 Bump SDK version to 12.0.1
Summary:
Version bump for 12.0.1 to release a fix for Share Dialog not presenting for SDK 12.0.0

https://github.com/facebook/facebook-ios-sdk/issues/1909

Updated changelog

Reviewed By: samodom

Differential Revision: D31688308

fbshipit-source-id: 7038a111714def6d636ddf7babb194107771ea7e
2021-10-15 10:58:00 -07:00
Jawwad Ahmad
d6ea01d47d Fix a few mis-indented method signatures in header files
Reviewed By: samodom

Differential Revision: D31618347

fbshipit-source-id: bb70c549273eaaf1a9522aafb0a56bbdbb518905
2021-10-13 14:24:17 -07:00
Jawwad Ahmad
9917cb06b2 Add types to usages of NSSet when the contained type is Class, i.e. NSSet<Class>
Summary: This reduces untyped "NSSet *" uses from 50 to 35

Reviewed By: samodom

Differential Revision: D31592478

fbshipit-source-id: 520d6724f3caaa06962b49e541907840879bde42
2021-10-13 07:33:06 -07:00
Jawwad Ahmad
1e6ca6c0c1 Remove unreferenced/duplicate file: CustomUpdateContentMedia.swift
Summary: The file in use is FBSDKGamingServicesKit/FacebookGamingServices/Internal/CustomUpdateContentMedia.swift

Reviewed By: samodom

Differential Revision: D31549002

fbshipit-source-id: d53367b81d68f3694dd7117bad592306252db15f
2021-10-12 09:32:41 -07:00
Jawwad Ahmad
0d55df2300 Remove unused/unreferenced/duplicate file: CustomUpdateContentImage.swift
Summary: The one in use is FBSDKGamingServicesKit/FacebookGamingServices/Internal/CustomUpdateContentImage.swift

Reviewed By: samodom

Differential Revision: D31548913

fbshipit-source-id: 07aff7fd8d4b9369205430753a207988eeb8bc68
2021-10-11 13:50:45 -07:00
Jawwad Ahmad
1eb7f2a8e2 Add nullability annotations to any methods that return nil
Summary:
I searched for any methods that "return nil" and added the nullable annotation to them.

Most of these ended up being private methods just used in the .m file but its nice to have these annotated as well.

Only the following 3 headers had 3 initializers (one in each file) that should have been annotated as nullable. From this it looks like Xcode and the analyzer are fairly reliable in catching what methods should return nullable in header files. Not sure why it didn't know about these.
```
FBSDKCoreKit/FBSDKCoreKit/AppEvents/Internal/Integrity/FBSDKRestrictiveData.h
FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKLoginManagerLogger.h
FBSDKShareKit/FBSDKShareKit/Internal/FBSDKLikeActionController.h
```

Edit: There 2 more tvOS related headers
```
FBSDKCoreKit/FBSDKCoreKit/Internal/Device/FBSDKDeviceButton+Internal.h
FBSDKCoreKit/FBSDKCoreKit/include/FBSDKDeviceButton.h
```

Reviewed By: samodom

Differential Revision: D31496694

fbshipit-source-id: a1fe15c53c17469ac9c2458259cf5a21efcd150d
2021-10-09 13:35:48 -07:00
Jawwad Ahmad
50c7bd6f27 Remove some extra whitespace only lines
Summary:
While working on some other stuff I noticed that we had some whitespace only lines. Ran 2 commands to do a one time cleanup.

Removed whitespace only lines with:
git ls-files -z '*.h' '*.m' '*.swift' | xargs -0 perl -0777 -pi -e 's/\s*$/\n/'

Removed extra trailing newlines in the file with:
git ls-files -z '*.h' '*.m' '*.swift' | xargs -0 perl -0777 -pi -e 's/\s*$/\n/'

Reviewed By: jamestouri

Differential Revision: D31514435

fbshipit-source-id: fc67cbd6a4104815993cf8a524dc904d47760e21
2021-10-08 16:54:00 -07:00
James Touri
8c30afa70b Fix nullability annotation nits on URLSessionTask
Summary: D31492140 (f9ada40dec) got unlanded due to missing objects that were supposed to be unwrapped. This is reimplementing the annotations and adding the unwrapping

Reviewed By: samodom

Differential Revision: D31515004

fbshipit-source-id: 78b33cea081bdd7bfc73ac2fedd9cbda2161ff24
2021-10-08 15:59:33 -07:00
Bohao Li
612a48c5f8 Revert D31492140: Fix nullability annotation nits on URLSessionTask
Differential Revision:
D31492140 (f9ada40dec)

Original commit changeset: 9ef8f41e2ffd

fbshipit-source-id: c3f7ee525e38dbd8d4fe2fbfe27fcdf1da8319d1
2021-10-08 14:10:48 -07:00
James Touri
f9ada40dec Fix nullability annotation nits on URLSessionTask
Summary: From comment D31242077 (d98c297357) make init unavailable

Reviewed By: samodom

Differential Revision: D31492140

fbshipit-source-id: 9ef8f41e2ffd81097e0dc8f1531fa9fb6023126e
2021-10-08 10:59:34 -07:00
Jawwad Ahmad
8421ca38a6 Remove duplicated/unreferenced file: InternalUtility+WindowFinding.swift
Summary:
Deleted:
Sources/FacebookGamingServices/InternalUtility+WindowFinding.swift

The version in use is:
FBSDKGamingServicesKit/FacebookGamingServices/InternalUtility+WindowFinding.swift

Note: A diff showed no differences in the files

Reviewed By: samodom

Differential Revision: D31460365

fbshipit-source-id: 48ae45ba1174bde2af2ac3c0a69aeb6db917c4bf
2021-10-07 10:39:26 -07:00
tanveer
5a80dc7ad1 Fix incorrectly indented method signature in FBSDKBasicUtility.h (#1904)
Summary:
The colons weren't aligned before. Updated them to be aligned.

Pull Request resolved: https://github.com/facebook/facebook-ios-sdk/pull/1904

Reviewed By: samodom

Differential Revision: D31463328

Pulled By: jawwad

fbshipit-source-id: 990e2617ca6a648b1e43b273713936400daf8086
2021-10-06 20:44:17 -07:00
Jawwad Ahmad
3eafabcd5a Removed unused/unreferenced SwitchContextDialogMaking.swift file
Summary: The one being used is FBSDKGamingServicesKit/FacebookGamingServices/Internal/SwitchContextDialogMaking.swift

Reviewed By: samodom

Differential Revision: D31460801

fbshipit-source-id: 4d260a682c8a805cf193a0e0483b85c9587a59ef
2021-10-06 20:06:35 -07:00
Jawwad Ahmad
ad6c616851 Write a script to sync nullability annotations between header and implementation files
Summary:
Since we generally only add `NS_ASSUME_NONNULL_BEGIN` and `NS_ASSUME_NONNULL_END` to our header files, our implementations files don't get the nullable annotations that were added.

This script will overwrite method signatures in the .m files from the method signature in the .h files

Reviewed By: jamestouri

Differential Revision: D31365815

fbshipit-source-id: 4c0a1d27c247834107fd26def3e8cadce374dc5f
2021-10-06 13:49:22 -07:00
Sam Odom
45aaccde9c Back out "Revert D31225824: [iOS SDK] Move FBSDKUserDataStore from Basics to CoreKit"
Summary: This was previously reverted due to having the commit for copying Basics to AudienceNetwork reverted.  That copy commit is now re-committed so these changes should be safe to apply again.

Reviewed By: jawwad

Differential Revision: D31339463

fbshipit-source-id: 9a651ff3648a87db57e373e5d14125536fab705a
2021-10-02 13:17:20 -07:00
Jawwad Ahmad
d6d7bebb37 Combine "#if DEBUG" and "#if FBTEST" into a single line
Summary:
It feels cleaner this way.

Ran this command:
```
git ls-files '*.h' '*.m' | xargs perl -0777 -pi -e 's/#if DEBUG\n #if FBTEST(.*) #endif\n#endif/#if DEBUG && FBTEST\1#endif/s'
```
(The -0777 means treat the file as one big line of text instead of processing line by line and the "/s" modifier means that .* should match over newlines)

Differential Revision: D31251198

fbshipit-source-id: 0cce6948024efc65ffee29826b48cf8107b106fc
2021-09-29 20:41:00 -07:00
Jawwad Ahmad
ee6a4e09e1 Fix: #pragma clang diagnostic ignored "-Warc-performSelector-leaks"
Summary:
The `respondsToSelector` *dance* doesn't need to be done because of the `if (available(iOS 13.0, *)) {` check.

In fact, if its removed, it correctly shows an error: `'isMacCatalystApp' is only available on iOS 13.0 or newer`

Reviewed By: wx0165927473

Differential Revision: D31260380

fbshipit-source-id: 447ccabeafa420e7dfc04a439ec91bfd93b50ff3
2021-09-29 20:37:04 -07:00
Tessera Chin
58079c83c1 Revert D31225824: Move FBSDKUserDataStore from Basics to CoreKit
Differential Revision:
D31225824 (28a6a01028)

Original commit changeset: 29f8f51c83d7

fbshipit-source-id: 990ae19a259c2044e9d340f8a3ed5b8f903e011c
2021-09-29 17:30:16 -07:00
Sam Odom
28a6a01028 Move FBSDKUserDataStore from Basics to CoreKit
Reviewed By: jawwad

Differential Revision: D31225824

fbshipit-source-id: 29f8f51c83d7b1b119c31037ea98b80974ddaabd
2021-09-29 16:38:44 -07:00