forked from wordpress-mobile/WordPress-iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/22.8' into compliance-pop-up
- Loading branch information
Showing
262 changed files
with
5,016 additions
and
2,339 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
14.2 | ||
14.3.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 0 additions & 50 deletions
50
WordPress/Classes/Extensions/UITextField+WorkaroundContinueIssue.swift
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import Foundation | ||
|
||
/// Blog extension for methods related to Jetpack Social. | ||
extension Blog { | ||
// MARK: - Publicize | ||
|
||
/// Whether the blog has Social auto-sharing limited. | ||
/// Note that sites hosted at WP.com has no Social sharing limitations. | ||
var isSocialSharingLimited: Bool { | ||
let features = planActiveFeatures ?? [] | ||
return !isHostedAtWPcom && !features.contains(Constants.socialSharingFeature) | ||
} | ||
|
||
/// The auto-sharing limit information for the blog. | ||
var sharingLimit: PublicizeInfo.SharingLimit? { | ||
// For blogs with unlimited shares, return nil early. | ||
// This is because the endpoint will still return sharing limits as if the blog doesn't have unlimited sharing. | ||
guard isSocialSharingLimited else { | ||
return nil | ||
} | ||
return publicizeInfo?.sharingLimit | ||
} | ||
|
||
// MARK: - Private constants | ||
|
||
private enum Constants { | ||
/// The feature key listed in the blog's plan's features. At the moment, `social-shares-1000` means unlimited | ||
/// sharing, but in the future we might introduce a proper differentiation between 1000 and unlimited. | ||
static let socialSharingFeature = "social-shares-1000" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
WordPress/Classes/Models/PublicizeInfo+CoreDataClass.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import Foundation | ||
import CoreData | ||
import WordPressKit | ||
|
||
/// `PublicizeInfo` encapsulates the information related to Jetpack Social auto-sharing. | ||
/// | ||
/// WP.com sites will not have a `PublicizeInfo`, and currently doesn't have auto-sharing limitations. | ||
/// Furthermore, sites eligible for unlimited sharing will still return a `PublicizeInfo` along with its sharing | ||
/// limitations, but the numbers should be ignored (at least for now). | ||
/// | ||
@objc public class PublicizeInfo: NSManagedObject { | ||
|
||
var sharingLimit: SharingLimit { | ||
SharingLimit(remaining: Int(sharesRemaining), limit: Int(shareLimit)) | ||
} | ||
|
||
@nonobjc public class func fetchRequest() -> NSFetchRequest<PublicizeInfo> { | ||
return NSFetchRequest<PublicizeInfo>(entityName: "PublicizeInfo") | ||
} | ||
|
||
@nonobjc public class func newObject(in context: NSManagedObjectContext) -> PublicizeInfo? { | ||
return NSEntityDescription.insertNewObject(forEntityName: Self.classNameWithoutNamespaces(), into: context) as? PublicizeInfo | ||
} | ||
|
||
func configure(with remote: RemotePublicizeInfo) { | ||
self.shareLimit = Int64(remote.shareLimit) | ||
self.toBePublicizedCount = Int64(remote.toBePublicizedCount) | ||
self.sharedPostsCount = Int64(remote.sharedPostsCount) | ||
self.sharesRemaining = Int64(remote.sharesRemaining) | ||
} | ||
|
||
/// A value-type representation for Publicize auto-sharing usage. | ||
struct SharingLimit { | ||
/// The remaining shares available for use. | ||
let remaining: Int | ||
|
||
/// Maximum number of shares allowed for the site. | ||
let limit: Int | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
WordPress/Classes/Models/PublicizeInfo+CoreDataProperties.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import Foundation | ||
import CoreData | ||
|
||
extension PublicizeInfo { | ||
/// The maximum number of Social shares for the associated `blog`. | ||
@NSManaged public var shareLimit: Int64 | ||
|
||
/// The number of Social sharing to be published in the future. | ||
@NSManaged public var toBePublicizedCount: Int64 | ||
|
||
/// The number of posts that have been auto-shared. | ||
@NSManaged public var sharedPostsCount: Int64 | ||
|
||
/// The remaining Social shares available for the associated `blog`. | ||
@NSManaged public var sharesRemaining: Int64 | ||
|
||
/// The associated Blog instance. | ||
@NSManaged public var blog: Blog? | ||
} |
Oops, something went wrong.