Skip to content

Commit 27fc699

Browse files
authored
Merge branch 'trunk' into issue/24091-site-list-not-dismissed-after-adding-a-self-hosted-site
2 parents e02db0d + 09ea7dc commit 27fc699

File tree

104 files changed

+551
-628
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+551
-628
lines changed

Modules/Package.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,18 @@ let package = Package(
7777
resources: [.process("Resources")],
7878
swiftSettings: [.swiftLanguageMode(.v5)]
7979
),
80-
.target(name: "FormattableContentKit", dependencies: ["WordPressShared"]),
80+
.target(
81+
name: "FormattableContentKit",
82+
dependencies: [
83+
"WordPressShared",
84+
"WordPressUI",
85+
.product(name: "Gridicons", package: "Gridicons-iOS"),
86+
// TODO: Remove — It's here just for a NSMutableParagraphStyle init helper
87+
.product(name: "WordPressKit", package: "WordPressKit-iOS"),
88+
],
89+
// Set to v5 to avoid @Sendable warnings and errors
90+
swiftSettings: [.swiftLanguageMode(.v5)]
91+
),
8192
.target(name: "JetpackStatsWidgetsCore", swiftSettings: [.swiftLanguageMode(.v5)]),
8293
.target(
8394
name: "ShareExtensionCore",
@@ -124,6 +135,7 @@ let package = Package(
124135
.target(
125136
name: "WordPressShared",
126137
dependencies: [
138+
.product(name: "Reachability", package: "Reachability"),
127139
.target(name: "SFHFKeychainUtils"),
128140
.target(name: "WordPressSharedObjC"),
129141
],

Modules/Sources/BuildSettingsKit/BuildSettings+Live.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ extension BuildSettings {
1414
itunesAppID = bundle.infoValue(forKey: "WPItunesAppID")
1515
appURLScheme = bundle.infoValue(forKey: "WPAppURLScheme")
1616
jetpackAppURLScheme = bundle.infoValue(forKey: "WPJetpackAppURLScheme")
17+
about = ProductAboutDetails(
18+
twitterHandle: bundle.infoValue(forKey: "WPProductTwitterHandle"),
19+
twitterURL: bundle.urlValue(forKey: "WPProductTwitterURL"),
20+
blogURL: bundle.urlValue(forKey: "WPProductBlogURL")
21+
)
22+
zendeskSourcePlatform = bundle.infoValue(forKey: "WPZendeskSourcePlatform")
23+
mobileAnnounceAppID = bundle.infoValue(forKey: "WPMobileAnnounceAppID")
24+
authKeychainServiceName = bundle.infoValue(forKey: "WPAuthKeychainServiceName")
1725
}
1826
}
1927

@@ -32,6 +40,11 @@ private extension Bundle {
3240
fatalError("unexpected value: \(object) for key: \(key)")
3341
}
3442
}
43+
44+
func urlValue(forKey key: String) -> URL {
45+
let urlWithoutScheme: String = infoValue(forKey: key)
46+
return URL(string: "https://\(urlWithoutScheme)")!
47+
}
3548
}
3649

3750
private extension Bundle {

Modules/Sources/BuildSettingsKit/BuildSettings+Preview.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,15 @@ extension BuildSettings {
1212
explatPlatform: "xcpreview",
1313
itunesAppID: "1234567890",
1414
appURLScheme: "xcpreview",
15-
jetpackAppURLScheme: "jetpack"
15+
jetpackAppURLScheme: "jetpack",
16+
about: ProductAboutDetails(
17+
twitterHandle: "@wordpress",
18+
twitterURL: URL(string: "www.example.com")!,
19+
blogURL: URL(string: "www.example.com")!
20+
),
21+
zendeskSourcePlatform: "zen",
22+
mobileAnnounceAppID: "1234567890",
23+
authKeychainServiceName: "public-api.wordpress.com"
1624
)
1725
}
1826

Modules/Sources/BuildSettingsKit/BuildSettings.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ public struct BuildSettings: Sendable {
2222
public var itunesAppID: String
2323
public var appURLScheme: String
2424
public var jetpackAppURLScheme: String
25+
public var about: ProductAboutDetails
26+
public var zendeskSourcePlatform: String
27+
public var mobileAnnounceAppID: String
28+
public var authKeychainServiceName: String
29+
30+
public struct ProductAboutDetails: Sendable {
31+
public var twitterHandle: String
32+
public var twitterURL: URL
33+
public var blogURL: URL
34+
}
2535

2636
public static var current: BuildSettings {
2737
switch BuildSettingsEnvironment.current {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public class HeaderContentGroup: FormattableContentGroup {}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public class SubjectContentGroup: FormattableContentGroup {}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import WordPressShared
2+
3+
public class SnippetsContentStyles: FormattableContentStyles {
4+
public var attributes: [NSAttributedString.Key: Any] {
5+
return WPStyleGuide.Notifications.snippetRegularStyle
6+
}
7+
8+
public var quoteStyles: [NSAttributedString.Key: Any]?
9+
10+
public var rangeStylesMap: [FormattableRangeKind: [NSAttributedString.Key: Any]]?
11+
12+
public var linksColor: UIColor?
13+
14+
public var key: String
15+
16+
public init(
17+
quoteStyles: [NSAttributedString.Key: Any]? = nil,
18+
rangeStylesMap: [FormattableRangeKind: [NSAttributedString.Key: Any]]? = nil,
19+
linksColor: UIColor? = nil,
20+
key: String = "SnippetsContentStyles"
21+
) {
22+
self.quoteStyles = quoteStyles
23+
self.rangeStylesMap = rangeStylesMap
24+
self.linksColor = linksColor
25+
self.key = key
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import WordPressShared
2-
import FormattableContentKit
32

4-
class SubjectContentStyles: FormattableContentStyles {
5-
var attributes: [NSAttributedString.Key: Any] {
3+
public class SubjectContentStyles: FormattableContentStyles {
4+
public var attributes: [NSAttributedString.Key: Any] {
65
return WPStyleGuide.Notifications.subjectRegularStyle
76
}
87

9-
var quoteStyles: [NSAttributedString.Key: Any]? {
8+
public var quoteStyles: [NSAttributedString.Key: Any]? {
109
return WPStyleGuide.Notifications.subjectItalicsStyle
1110
}
1211

13-
var rangeStylesMap: [FormattableRangeKind: [NSAttributedString.Key: Any]]? {
12+
public var rangeStylesMap: [FormattableRangeKind: [NSAttributedString.Key: Any]]? {
1413
return [
1514
.user: WPStyleGuide.Notifications.subjectRegularStyle,
1615
.post: WPStyleGuide.Notifications.subjectRegularStyle,
@@ -21,6 +20,11 @@ class SubjectContentStyles: FormattableContentStyles {
2120
]
2221
}
2322

24-
var linksColor: UIColor? = nil
25-
var key: String = "SubjectContentStyles"
23+
public var linksColor: UIColor?
24+
public var key: String
25+
26+
public init(linkColor: UIColor? = nil, key: String = "SubjectContentStyles") {
27+
self.linksColor = linkColor
28+
self.key = key
29+
}
2630
}

WordPress/Classes/ViewRelated/Notifications/Style/WPStyleGuide+Notifications.swift renamed to Modules/Sources/FormattableContentKit/Styles/WPStyleGuide+Notifications.swift

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
// FIXME: This does not belong here, see https://github.com/wordpress-mobile/WordPress-iOS/pull/24297
12
import Foundation
2-
33
import Gridicons
4+
import UIKit
45
import WordPressShared
6+
import WordPressKit // FIXME: Here just for the NSMutableParagraphStyle custom init
57
import WordPressUI
68

79
extension WPStyleGuide {
@@ -285,3 +287,29 @@ extension WPStyleGuide {
285287
fileprivate static let blockNoticonFont = subjectNoticonFont
286288
}
287289
}
290+
291+
// FIXME: Duplicated move to appropriate location
292+
extension UIFont {
293+
/// Returns a UIFont instance with the italic trait applied.
294+
func italic() -> UIFont {
295+
return withSymbolicTraits(.traitItalic)
296+
}
297+
298+
/// Returns a UIFont instance with the semibold trait applied.
299+
func semibold() -> UIFont {
300+
return withWeight(.semibold)
301+
}
302+
303+
private func withSymbolicTraits(_ traits: UIFontDescriptor.SymbolicTraits) -> UIFont {
304+
guard let descriptor = fontDescriptor.withSymbolicTraits(traits) else {
305+
return self
306+
}
307+
308+
return UIFont(descriptor: descriptor, size: 0)
309+
}
310+
311+
private func withWeight(_ weight: UIFont.Weight) -> UIFont {
312+
let descriptor = fontDescriptor.addingAttributes([.traits: [UIFontDescriptor.TraitKey.weight: weight]])
313+
return UIFont(descriptor: descriptor, size: 0)
314+
}
315+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import Foundation
2+
3+
public extension Notification {
4+
static let reachabilityKey = "org.wordpress.reachability"
5+
}
6+
7+
public extension Notification.Name {
8+
static var reachabilityChanged: Notification.Name {
9+
return Notification.Name("\(Notification.reachabilityKey).changed")
10+
}
11+
}
12+
13+
@objc extension NSNotification {
14+
public static let ReachabilityChangedNotification = Notification.Name.reachabilityChanged
15+
}

0 commit comments

Comments
 (0)