Skip to content

Commit

Permalink
Deprecate share dialog mode to string conversion function
Browse files Browse the repository at this point in the history
Reviewed By: joesus

Differential Revision: D33519170

fbshipit-source-id: 511abcce0c44898971892a41a4667eee0d448afe
  • Loading branch information
samodom authored and facebook-github-bot committed Jan 11, 2022
1 parent e097e75 commit 7afa624
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
### Deprecated

- `SDKError` has been deprecated in favor of the new `ErrorFactory` and `NetworkErrorChecker` types
- `NSStringFromFBSDKShareDialogMode()` has been deprecated in favor of `ShareDialog.Mode.description`

[2022-01-06](https://github.com/facebook/facebook-ios-sdk/releases/tag/v12.3.0) |
[Full Changelog](https://github.com/facebook/facebook-ios-sdk/compare/v12.2.1...v12.3.0)
Expand Down
3 changes: 3 additions & 0 deletions FBSDKShareKit/FBSDKShareKit/FBSDKShareDialog.m
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,10 @@ - (void)_invokeDelegateDidFailWithError:(nonnull NSError *)error

- (void)_logDialogShow
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
NSString *shareMode = NSStringFromFBSDKShareDialogMode(self.mode);
#pragma clang diagnostic pop

NSString *contentType;
if ([self.shareContent isKindOfClass:FBSDKShareLinkContent.class]) {
Expand Down
1 change: 1 addition & 0 deletions FBSDKShareKit/FBSDKShareKit/FBSDKShareDialogMode.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ typedef NS_ENUM(NSUInteger, FBSDKShareDialogMode) {
Converts an FBSDKShareDialogMode to an NSString.
*/
FOUNDATION_EXPORT NSString *NSStringFromFBSDKShareDialogMode(FBSDKShareDialogMode dialogMode)
DEPRECATED_MSG_ATTRIBUTE("`NSStringFromFBSDKShareDialogMode` is deprecated and will be removed in the next major release; please use `ShareDialog.Mode.description` instead")
NS_REFINED_FOR_SWIFT;

NS_ASSUME_NONNULL_END
11 changes: 10 additions & 1 deletion FBSDKShareKit/FBSDKShareKit/Swift/Enums+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@
extension ShareDialog.Mode: CustomStringConvertible {
/// The string description
public var description: String {
__NSStringFromFBSDKShareDialogMode(self)
switch self {
case .automatic: return "Automatic"
case .native: return "Native"
case .shareSheet: return "ShareSheet"
case .browser: return "Browser"
case .web: return "Web"
case .feedBrowser: return "FeedBrowser"
case .feedWeb: return "FeedWeb"
default: return "Unknown"
}
}
}

Expand Down

0 comments on commit 7afa624

Please sign in to comment.