Summary:
There exists a potential issue that duplicate install can be sent because `applicationDidBecomeActive` may be triggered multiple times within a very short time (e.g. App Launch and ATT prompt can trigger this function) and thus cause `publichInstall` is triggered multiple times.
In order to fix this issue, this diff reuses the existing key `lastAttributionPingString` and `lastInstallResponseKey`. The flow will be
1. PublishInstall is triggered
2. Check if `lastAttributionPingString` exists and will send install event and set the key if the key doesn't exist. We do nothing if the key exists.
3. If the install event is sent successfully, we will set the key `lastInstallResponseKey`. If not, we'll remove the key `lastAttributionPingString`.
4. When app terminates, we'll check if `lastInstallResponseKey` exists to check if the install event is sent successfully. If the key exists, we'll do nothing. If the key doesn't exist, it means the install event is not sent successfully in the app launch and we'll remove the key `lastAttributionPingString`.
Reviewed By: jjiang10
Differential Revision: D53170017
fbshipit-source-id: 340e21188d884088215a65d06fffc402065a5102
Summary:
All of the other public "configureWithNetworker" methods have an override for NS_SWIFT_NAME that renames the Swift method to use "networker" instead of "withNetworker". This "fixes" the definition of what the private method should be in Swift.
Also adding a few missing imports that will have to be eventually added when the FBAEMKit.h file is removed.
Reviewed By: samodom
Differential Revision: D40191595
fbshipit-source-id: 033c316c42ec976702bb40aba7e074703200df68
Summary:
- TestTools is now 100% Swift
- FBSDKCoreKit imports had to be added since it was no longer imported globally via TestTools.h
- A few line breaks had to be added above the new import to prevent the "Imports should be sorted" violation from SwiftLint
Reviewed By: samodom
Differential Revision: D40077738
fbshipit-source-id: 2cb5cbeceb90214f58fa0f6fe635eef133faa336
Summary: This is the only other header file in TestTools other than TestTools.h
Reviewed By: samodom
Differential Revision: D40077737
fbshipit-source-id: 8cc5810f87046623304e354714ffe9fdb8a48286
Summary: Refactored and moved excludes into a new .swiftconfig in the internal folder
Reviewed By: samodom
Differential Revision: D39933313
fbshipit-source-id: 6875ea67efbe52b5203ac64fb10a1c445717e170
Summary: The decodeObjectCheck in ProfileTests was unused
Reviewed By: joesus
Differential Revision: D39778958
fbshipit-source-id: 7b7b539548d94f8078fb552455271a0ac16e11b1
Summary: Updated `xcodeVersion` from **13.3** to **14.0** in `xcodegen_project_common.yml` so that the `LastUpgradeCheck` gets set to **1440** so that Xcode doesn't ask to update to recommended settings.
Reviewed By: samodom
Differential Revision: D39708211
fbshipit-source-id: 0a4c135451dd5a9c64b7bc42a934d6869778eb72
Summary:
More context here:
https://github.com/realm/SwiftLint/issues/4015
The full warning is:
```
warning build: Run script build phase 'Run Swiftlint' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase.
```
The fix is to uncheck "Based on dependency analysis" for the run script build phase.
This adds a "alwaysOutOfDate = 1;" setting to the Xcode pbxproj file
This setting is turned on by using "basedOnDependencyAnalysis: false" in xcodegen
Reviewed By: samodom
Differential Revision: D39678897
fbshipit-source-id: 90ed96cab52c3e2a0be3082dc94884a773faa1c6
Summary:
The IPHONEOS_DEPLOYMENT_TARGET and TVOS_DEPLOYMENT_TARGET are now 12.0
The main code change update was to use the "requiringSecureCoding" version of the `NSKeyedArchiver.archivedData(withRootObject:requiringSecureCoding:)` method.
Reviewed By: samodom
Differential Revision: D39670757
fbshipit-source-id: c98c47d4bef591c96bed33391b0393920a50ebfe
Summary: Xcode compatibility version is changed to 11 in TestTools every time "generate-projects.sh" is run. Changing it once and for all to avoid its generation every time.
Reviewed By: samodom
Differential Revision: D38867127
fbshipit-source-id: 6101ba28d13461399da5d0b35499c020da607f97
Summary: Adds additional method to notification delivering protocol to mirror what is in Foundation’s Notification interface.
Reviewed By: josueBrizuelaXD
Differential Revision: D37653609
fbshipit-source-id: a1d2f6bd25d3749317fe5c7635773b85bdc40f6d
Summary: Moves the helper to test tools so that it can be used in GamingServicesKit tests.
Reviewed By: josueBrizuelaXD
Differential Revision: D37648330
fbshipit-source-id: b135bcc2b56989c49b00b38d0632dd5f2b47856c
Summary: The NSURLSessionDataTask and NSURLSession bases for these protocols create a risk of conflict if we make any of the referenced symbols more abstract
Reviewed By: joesus
Differential Revision: D37358714
fbshipit-source-id: 4d88162f2f212702612a1eebe1f157a6d9a08154
Summary: The NSBundle basis for this protocol creates a risk of conflict if we make any of the referenced symbols more abstract
Reviewed By: joesus
Differential Revision: D37358716
fbshipit-source-id: 2ca5885075e89bddbab664a1e6b785772577f6cd
Summary: This protocol isn't strictly necessary and will cause issues with symbol ambiguity in Swift.
Reviewed By: shuxinzhang
Differential Revision: D36887434
fbshipit-source-id: b26d3f446a7c38c0c2360c8609dd505e3b64ec02
Summary: This protocol isn't strictly necessary and is causing issues with symbol ambiguity in Swift.
Reviewed By: shuxinzhang
Differential Revision: D36887435
fbshipit-source-id: f876d53e3b055d55051921e9c5190d8f33c010ee
Summary:
* Make `AuthenticationToken` use `current` as the Swift name for `currentAuthenticationToken`
* Declare `AccessToken` conformance to `AccessTokenSetting`
* Declare `AuthenticationToken` conformance to `AuthenticationTokenProviding` and `AuthenticationTokenSetting`
* Make `AuthenticationTokenProviding` and `AuthenticationTokenSetting` use `current` as the Swift name for `currentAuthenticationToken`
* Declare `Profile` conformance to `ProfileProviding`
Reviewed By: josueBrizuelaXD
Differential Revision: D36706552
fbshipit-source-id: 714e02483c23cb1dbff001cb27c2cb59e9e1626b
Summary: We were using the wrong Swift name for the current access token when accessing it via the provider abstraction.
Reviewed By: jawwad
Differential Revision: D35806611
fbshipit-source-id: fdf857e5343b913bed36f84d46ef5c2af62470c5
Summary:
This diff also ads a TestUtils.encodeAndDecode(_:) method to reduce some boilerplate in tests and make it silghtly easier to do the rest of these tasks.
I couldn't use XCTUnwrap in TestUtils since I can't import XCTest because its in the TestTools project and not in a test target. So I decided to just return an optional and have the caller unwrap it.
Reviewed By: wx0165927473, samodom
Differential Revision: D35320238
fbshipit-source-id: 53c5f1a96b32e71eb8efc48a5a24a7920d2487a4
Summary:
Updated `xcodeVersion` from **13.2** to **13.3** in `xcodegen_project_common.yml` so that the `LastUpgradeCheck` gets set to **1330** so that Xcode doesn't ask to update to recommended settings.
Did it manually for the `FBSDKTVOSKit` project since that project file isn't generated with xcodegen.
Reviewed By: samodom
Differential Revision: D35147732
fbshipit-source-id: 3dbd970e846d45439b60df6bcefecc9db56fdbdf
Summary:
- In the build phase this is shown as a "Show environment variables in build log" option that can be unchecked
- This in turn adds the following line to the pbxproj file "showEnvVarsInLog = 0"
- With xcodegen this option is disabled by setting "showEnvVars: false"
This gets rid of the lines that say "export ENV_VAR_NAME..."
This change reduces the number of lines in the build output from ~6000 to ~3000
```
xcodebuild clean build -workspace FacebookSDK.xcworkspace -scheme BuildAllKits-Dynamic > ~/Desktop/xcodebuild_log_before.txt
// Made this change
xcodebuild clean build -workspace FacebookSDK.xcworkspace -scheme BuildAllKits-Dynamic > ~/Desktop/xcodebuild_log_after.txt
$ wc -l ~/Desktop/xcodebuild_log_before.txt
6232 /Users/jawwad/Desktop/xcodebuild_log_before.txt
$ wc -l ~/Desktop/xcodebuild_log_after.txt
3123 /Users/jawwad/Desktop/xcodebuild_log_after.txt
```
Reviewed By: samodom
Differential Revision: D35067834
fbshipit-source-id: c1a42a053a4a31e4646e9d766f00b970e776472d
Summary: This allows for stubbing behavior and maintains the spy-like behavior already available.
Differential Revision: D34899787
fbshipit-source-id: 84b6f77c1bf27c1a1879510ec8b0e5efc5b44681
Summary:
## See the following [Proposal](https://fburl.com/gdoc/z90ch5in)
## Problem
We want to add support for universal links.
In order to do that, developers who have app events integration (AEM) will be required to add a call to the `openURL:` on the SDK delegate class from `application(_:continue:restorationHandler:)` in the short term.
We would like to simplify things for app developers since extracting the webpage URL from NSUserActivity may cause confusion and errors for deep linking.
## Solution
The better way is to just introduce a method with a similar signature to `application(_:continue:restorationHandler:)` in the SDK delegate.
Developers could simply invoke that method in order to have the universal link processed.
By doing that, we will to make FB SDK more accessible to developers.
## Testing
See the test plan section
Reviewed By: samodom
Differential Revision: D34786435
fbshipit-source-id: 289fea5ecc9e106fe0c9fcc94bf2a65b0c07c0ab
Summary: Also enabled the `trailingCommas` rule in SwiftFormat so that these will be corrected when running swiftformat
Reviewed By: samodom
Differential Revision: D34253615
fbshipit-source-id: 7c450fdd8a15070a8445c9380ab5ba33c2952cdc
Summary:
There were only 2 instances in which I had to add a disable comment for prefer_final_classes due to subclassing
Used the following to add the final keyword (Adds final to any class that doesn't have final or open before it and doesn't have func after it)
```
find . -name '*.swift' | xargs perl -pi -e 's/(?<!final )(?<!open )(class (?!func).*\{)/final \1/g'
```
Reviewed By: samodom
Differential Revision: D34119233
fbshipit-source-id: 963d64fefc1686095d0bfe18ac7cb9677606f4e6
Summary:
* Conformance to protocol in multiple places by InternalUtility was failing to compile (from Swift conversion of ShareDialog)
* Corrected name (and file name) to reflect internal use
Reviewed By: jawwad
Differential Revision: D33923076
fbshipit-source-id: 8517accfd70ab39b3837c03c32fff97996628807
Summary:
Added a custom rule named `swiftlint_disable_without_this_or_next` to discourage bare usage of "swiftlint:disable"
If you really need to use a global disable, you can add the following line before it to disable its flagging
```
// swiftlint:disable:next swiftlint_disable_without_this_or_next
```
Yes, you'd need to disable flagging of your swiftlint:disable with a swiftlint:disable:next.
There are 2 rules that are exempt from being flagged when disabled globally: implicitly_unwrapped_optional and force_unwrapping
i.e. the following disables won't be flagged
```
// swiftlint:disable implicitly_unwrapped_optional
// swiftlint:disable force_unwrapping
```
Reviewed By: samodom
Differential Revision: D33809590
fbshipit-source-id: f2b6d656b6ea8a4c5f4e20ddd16790cb9d650473
Summary: Set it to 56 which is our current maximum variable length. (Setting to 55 shows 2 warnings)
Reviewed By: samodom
Differential Revision: D33808397
fbshipit-source-id: c162362a20d11426fa024bd79f1bc8563d19e01f
Summary:
This is to prevent the following error that was seen in D33750740 (8044535803)
```
objc attribute used without importing module 'Foundation'
```
Found the files with:
```
git ls-files '*.swift' | xargs ack -l 'objc' | xargs ack -L 'import (Foundation|XCTest)'
```
Note: In D33783526 (4610b07bda) a custom SwiftLint rule was added to detect this but it only works if there aren't any other imports.
Reviewed By: samodom
Differential Revision: D33803396
fbshipit-source-id: 575d7798a77aac30384f8f44c1d45f97d60fe8f7
Summary:
In D33750740 (8044535803) Hackbook started showing me the following error
```
objc attribute used without importing module 'Foundation'
```
This custom rule should prevent most cases of this. (It will only detect cases in which there are only empty lines between the license and the first objc)
Ran the following to add missing imports
```
git ls-files '*.swift' | xargs perl -0777 -pi -e s'/(of this source tree.\n \*\/)\n+\objc/\1\n\nimport Foundation\n\n\objc/'
```
Reviewed By: samodom
Differential Revision: D33783526
fbshipit-source-id: e75e1a66152d9a9790aa363d2fe7c71fd9446849
Summary: The IPHONEOS_DEPLOYMENT_TARGET and TVOS_DEPLOYMENT_TARGET are now 11.0
Reviewed By: samodom
Differential Revision: D33721097
fbshipit-source-id: 95afae6119fe09c0773252890aef6411f54d24d1
Summary: Also unnest test error type
Reviewed By: jamestouri
Differential Revision: D33380686
fbshipit-source-id: b9a966222a720087858ab0dde693b965f0644d1b