Introduce swiftformat

This commit is contained in:
Sasha Weiss 2025-12-19 14:36:47 -08:00 committed by GitHub
parent bb70ac18cc
commit 45f63da0ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 192 additions and 160 deletions

View File

@ -89,8 +89,8 @@ jobs:
- name: Check for any changes
run: git diff --exit-code
lint:
name: Lint
precommit:
name: Precommit
timeout-minutes: 5
@ -105,9 +105,9 @@ jobs:
run: git fetch origin --depth 1 ${{ github.base_ref }}
- name: Install Dependencies
run: brew install clang-format swiftlint
run: brew install clang-format swiftformat
- name: Lint files changed in the PR
- name: Run precommit on files changed in the PR
run: |
Scripts/precommit.py --ref origin/${{ github.base_ref }}

93
.swiftformat Normal file
View File

@ -0,0 +1,93 @@
--exclude Pods
--exclude SignalServiceKit/Protos/Generated
--exclude Signal/Emoji/Generated
--exclude **/*.pb.swift
--exclude **/*+SDS.swift
# Temporary excludes.
--exclude Signal
--exclude SignalNSE
--exclude SignalServiceKit
--exclude SignalShareExtension
--exclude SignalUI
--swift-version 6.2
--language-mode 5
# The following are the set of enabled rules.
#
# Most SwiftFormat rules have a set of associated "options"; for those rules
# where we use non-default options, the option is grouped next to the rule using
# indentation.
#
# - Important
# While most options (and at the time of writing, all options explicitly
# included here) only affect a single rule, they are "SwiftFormat-wide" and
# some rules do apply to multiple options. Take care when adding new rules, or
# adding a new option, that any potential interactions with other existing
# rules/options is accounted for.
--rules andOperator
--rules anyObjectProtocol
--rules blankLinesAroundMark
--rules blankLinesBetweenChainedFunctions
--rules blankLinesBetweenScopes
--rules braces
--rules consecutiveBlankLines
--rules consecutiveSpaces
--rules consistentSwitchCaseSpacing
--rules docCommentsBeforeModifiers
--rules duplicateImports
--rules elseOnSameLine
--rules emptyExtensions
--rules enumNamespaces
--rules indent
--ifdef outdent
--indent 4
--rules linebreakAtEndOfFile
--rules modifierOrder
--rules modifiersOnSameLine
--rules redundantBreak
--rules redundantEquatable
--rules redundantFileprivate
--rules redundantGet
--rules redundantInit
--rules redundantInternal
--rules redundantMemberwiseInit
--rules redundantOptionalBinding
--rules redundantParens
--rules redundantPattern
--rules redundantPublic
--rules semicolons
--rules singlePropertyPerLine
--rules sortImports
--import-grouping testable-last
--rules sortTypealiases
--rules spaceAroundBraces
--rules spaceAroundComments
--rules spaceAroundGenerics
--rules spaceAroundOperators
--operator-func no-space
--ranges no-space
--rules spaceAroundParens
--rules spaceInsideBraces
--rules spaceInsideBrackets
--rules spaceInsideComments
--rules spaceInsideParens
--rules strongifiedSelf
--rules trailingCommas
--rules trailingSpace
--rules void
--rules wrapArguments
--allow-partial-wrapping false
--wrap-arguments before-first
--wrap-collections before-first
--wrap-parameters before-first
--wrap-conditions before-first
--call-site-paren balanced
--closing-paren balanced
--rules wrapAttributes
--func-attributes prev-line
--type-attributes prev-line
--rules wrapEnumCases
--rules wrapMultilineStatementBraces

View File

@ -1,57 +0,0 @@
excluded:
- Pods
- ThirdParty
- SignalServiceKit/Protos/Generated
- SignalServiceKit/Protos/Backups
# SwiftLint has trouble with these files. See <https://github.com/realm/SwiftLint/issues/3988>.
- Signal/Emoji/Emoji+SkinTones.swift
- Signal/Emoji/EmojiWithSkinTones+String.swift
disabled_rules:
- block_based_kvo
- closure_parameter_position
- compiler_protocol_init
- control_statement
- cyclomatic_complexity
- empty_enum_arguments
- file_length
- for_where
- force_cast
- force_try
- function_body_length
- function_parameter_count
- identifier_name
- line_length
- multiple_closures_with_trailing_closure
- nesting
- no_fallthrough_only
- non_optional_string_data_conversion
- notification_center_detachment
- opening_brace
- redundant_void_return
- static_over_final_class
- todo
- trailing_comma
- type_body_length
- unavailable_condition
- unneeded_synthesized_initializer
- unused_closure_parameter
- unused_optional_binding
opt_in_rules:
- comma_inheritance
- empty_string
- sorted_first_last
inclusive_language:
override_allowed_terms: ["master", "whitelist"]
large_tuple:
warning: 4
error: 4
type_name:
min_length:
warning: 2
error: 2
max_length:
warning: 500
error: 500
excluded:
- Id
allowed_symbols: ["_"]

View File

@ -16,6 +16,7 @@ enum EmojiError: Error {
}
// MARK: - Remote Model
// These definitions are kept fairly lightweight since we don't control their format
// All processing of remote data is done by converting RemoteModel items to EmojiModel items
@ -77,7 +78,7 @@ struct EmojiModel {
let base: Character
let skintoneSequence: SkinToneSequence
static func < (lhs: Self, rhs: Self) -> Bool {
static func <(lhs: Self, rhs: Self) -> Bool {
for (leftElement, rightElement) in zip(lhs.skintoneSequence, rhs.skintoneSequence) {
if leftElement.sortId != rightElement.sortId {
return leftElement.sortId < rightElement.sortId
@ -248,7 +249,7 @@ extension EmojiGenerator {
// Main enum: Create a string enum defining our enumNames equal to the baseEmoji string
// e.g. case grinning = "😀"
writeBlock(fileName: "Emoji.swift") { fileHandle in
fileHandle.writeLine("// swiftlint:disable all")
fileHandle.writeLine("// swiftformat:disable all")
fileHandle.writeLine("")
fileHandle.writeLine("/// A sorted representation of all available emoji")
fileHandle.writeLine("enum Emoji: String, CaseIterable, Equatable {")
@ -258,12 +259,12 @@ extension EmojiGenerator {
}
}
fileHandle.writeLine("}")
fileHandle.writeLine("// swiftlint:disable all")
fileHandle.writeLine("// swiftformat:disable all")
}
}
static func writeStringConversionsFile(from emojiModel: EmojiModel) {
// Conversion from String: Creates an mapping from a single character emoji string to the
// Conversion from String: Creates an mapping from a single character emoji string to the
// Emoji + SkinTone components. These components can then be uses to instantiate an
// EmojiWithSkinTones
// e.g.
@ -276,7 +277,7 @@ extension EmojiGenerator {
fileHandle.indent {
fileHandle.writeLine("switch emoji {")
emojiModel.definitions.forEach { emojiDef in
let skintoneVariants = emojiDef.variants.filter({ $0.skintoneSequence != .none})
let skintoneVariants = emojiDef.variants.filter({ $0.skintoneSequence != .none })
if skintoneVariants.isEmpty {
// None of our variants have a skintone, nothing to do
return
@ -336,7 +337,7 @@ extension EmojiGenerator {
fileHandle.indent {
fileHandle.writeLine("switch self {")
emojiModel.definitions.forEach { emojiDef in
let skintoneVariants = emojiDef.variants.filter({ $0.skintoneSequence != .none})
let skintoneVariants = emojiDef.variants.filter({ $0.skintoneSequence != .none })
if skintoneVariants.isEmpty {
// None of our variants have a skintone, nothing to do
return
@ -373,7 +374,7 @@ extension EmojiGenerator {
.travel,
.objects,
.symbols,
.flags
.flags,
]
writeBlock(fileName: "Emoji+Category.swift") { fileHandle in
@ -513,9 +514,10 @@ extension EmojiGenerator {
class WriteHandle {
static let emojiDirectory = URL(
fileURLWithPath: "../Signal/Emoji",
fileURLWithPath: "../Signal/Emoji/Generated",
isDirectory: true,
relativeTo: EmojiGenerator.pathToFolderContainingThisScript!)
relativeTo: EmojiGenerator.pathToFolderContainingThisScript!,
)
let handle: FileHandle

View File

@ -179,17 +179,6 @@ def should_process_file(file_path: str) -> bool:
return True
def swiftlint(file_paths):
file_paths = list(filter(lambda f: get_ext(f) == ".swift", file_paths))
if len(file_paths) == 0:
return True
subprocess.run(["swiftlint", "lint", "--quiet", "--fix", *file_paths])
proc = subprocess.run(["swiftlint", "lint", "--quiet", "--strict", *file_paths])
return proc.returncode == 0
def clang_format(file_paths):
file_paths = list(filter(lambda f: get_ext(f) in CLANG_FORMAT_EXTS, file_paths))
if len(file_paths) == 0:
@ -198,6 +187,15 @@ def clang_format(file_paths):
return proc.returncode == 0
def swiftformat(file_paths):
file_paths = list(filter(lambda f: get_ext(f) == ".swift", file_paths))
if len(file_paths) == 0:
return True
proc = subprocess.run(["swiftformat", "--quiet", *file_paths])
return proc.returncode == 0
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="lint & format files")
parser.add_argument("path", nargs="*", help="a path to process")
@ -227,11 +225,6 @@ if __name__ == "__main__":
result = False
print("")
print("Running swiftlint...", flush=True)
if not swiftlint(file_paths):
result = False
print("")
print("Sorting forward declarations...", flush=True)
for file_path in file_paths:
process(file_path)
@ -246,6 +239,11 @@ if __name__ == "__main__":
result = False
print("")
print("Running swiftformat...", flush=True)
if not swiftformat(file_paths):
result = False
print("")
print("Running clang-format...", flush=True)
if not clang_format(file_paths):
result = False

View File

@ -14,7 +14,7 @@ let package = Package(
.executableTarget(
name: "translation-tool",
dependencies: [],
path: "src"
)
]
path: "src",
),
],
)

View File

@ -38,7 +38,7 @@ struct CLI {
try Genstrings.filterPluralAware(
resourceFile: pluralAwareFile,
repositoryURL: Constant.repositoryURL,
temporaryDirectoryURL: URL(fileURLWithPath: temporaryDirectoryPath)
temporaryDirectoryURL: URL(fileURLWithPath: temporaryDirectoryPath),
)
default:
print("Unknown action: \(arg)")
@ -57,7 +57,7 @@ struct CLI {
let client = Smartling(
projectIdentifier: Constant.projectIdentifier,
userIdentifier: userIdentifier,
userSecret: userSecret
userSecret: userSecret,
)
let result = CLI(repositoryURL: Constant.repositoryURL, client: client)
loadedCLI = result
@ -68,7 +68,7 @@ struct CLI {
private static let metadataFiles: [MetadataFile] = [
MetadataFile(filename: "release_notes.txt"),
MetadataFile(filename: "description.txt")
MetadataFile(filename: "description.txt"),
]
private static let pluralAwareFile = ResourceFile(filename: "PluralAware.stringsdict")
@ -76,7 +76,7 @@ struct CLI {
private static let resourceFiles: [ResourceFile] = [
ResourceFile(filename: "InfoPlist.strings"),
ResourceFile(filename: "Localizable.strings"),
pluralAwareFile
pluralAwareFile,
]
var repositoryURL: URL
@ -87,7 +87,7 @@ struct CLI {
for translatableFile in files {
try await taskGroup.addTask {
try await client.uploadSourceFile(
at: repositoryURL.appendingPathComponent(translatableFile.relativeSourcePath)
at: repositoryURL.appendingPathComponent(translatableFile.relativeSourcePath),
)
print("Uploaded \(translatableFile.filename)")
}

View File

@ -5,7 +5,7 @@
import Foundation
struct Genstrings {
enum Genstrings {
enum DecodingError: Error {
case nonStringKeys
}
@ -28,7 +28,7 @@ struct Genstrings {
static func filterPluralAware(
resourceFile: ResourceFile,
repositoryURL: URL,
temporaryDirectoryURL: URL
temporaryDirectoryURL: URL,
) throws {
precondition(resourceFile.filename.hasSuffix(".stringsdict"))

View File

@ -40,7 +40,7 @@ private let languageMap: [String: [String]] = [
"uk-UA": ["uk"],
"vi": ["vi"],
"zh-CN": ["zh-Hans"],
"zh-HK": ["zh-Hant"]
"zh-HK": ["zh-Hant"],
// These don't exist in App Store Connect, so there's no need to fetch them from Smartling.
// "be-BY": [],
@ -91,7 +91,7 @@ struct MetadataFile: TranslatableFile {
let localRelativePath = relativePath(for: localIdentifier)
try FileManager.default.copyItem(
at: fileURL,
replacingItemAt: repositoryURL.appendingPathComponent(localRelativePath)
replacingItemAt: repositoryURL.appendingPathComponent(localRelativePath),
)
print("Saved \(localRelativePath)")
}
@ -101,7 +101,7 @@ struct MetadataFile: TranslatableFile {
try checkForUnusedLocalizations(
in: repositoryURL.appendingPathComponent(Self.relativeDirectoryPath),
suffix: "",
expectedLocalizations: languageMap.flatMap { $1 } + extraEnglishLanguages + ["en-US"]
expectedLocalizations: languageMap.flatMap { $1 } + extraEnglishLanguages + ["en-US"],
)
}
}

View File

@ -50,7 +50,7 @@ private let languageMap: [String: String] = [
"zh-CN": "zh_CN",
"zh-HK": "zh_HK",
"zh-TW": "zh_TW",
"zh-YU": "yue"
"zh-YU": "yue",
]
struct ResourceFile: TranslatableFile {
@ -73,7 +73,7 @@ struct ResourceFile: TranslatableFile {
let localRelativePath = relativePath(for: localIdentifier)
try FileManager.default.copyItem(
at: fileURL,
replacingItemAt: repositoryURL.appendingPathComponent(localRelativePath)
replacingItemAt: repositoryURL.appendingPathComponent(localRelativePath),
)
print("Saved \(localRelativePath)")
}
@ -84,7 +84,7 @@ struct ResourceFile: TranslatableFile {
try checkForUnusedLocalizations(
in: repositoryURL.appendingPathComponent(relativeDirectoryPath),
suffix: ".lproj",
expectedLocalizations: languageMap.map { $1 } + ["en"]
expectedLocalizations: languageMap.map { $1 } + ["en"],
)
}
}

View File

@ -33,7 +33,7 @@ class Smartling {
let rawToken = try await fetchNewToken()
let newToken = Token(
accessToken: rawToken.accessToken,
expirationDate: Date(timeIntervalSinceNow: TimeInterval(rawToken.expiresIn))
expirationDate: Date(timeIntervalSinceNow: TimeInterval(rawToken.expiresIn)),
)
print("Got new token that expires at \(newToken.expirationDate)")
return newToken
@ -70,7 +70,7 @@ class Smartling {
let url = buildURL(path: urlPath, queryItems: [
"fileUri": filename,
"retrievalType": "published",
"includeOriginalStrings": "true"
"includeOriginalStrings": "true",
])
var urlRequest = buildRequest(url: url, token: try await fetchToken())
urlRequest.httpMethod = "GET"
@ -90,7 +90,7 @@ private extension Smartling {
func buildRequest(url: URL, token: Token? = nil) -> URLRequest {
var request = URLRequest(url: url)
if let token = token {
if let token {
request.addValue("Bearer \(token.accessToken)", forHTTPHeaderField: "Authorization")
}
return request
@ -123,7 +123,7 @@ extension URLRequest {
httpBody = Self.multipartFormData(boundary: boundary, items: [
("file", .file(name: filename, value: try Data(contentsOf: fileURL))),
("fileUri", .text(value: filename)),
("fileType", .text(value: Self.fileType(for: fileURL)))
("fileType", .text(value: Self.fileType(for: fileURL))),
])
}

View File

@ -218,12 +218,8 @@
3426A36A255D9D7C0036407F /* ConversationViewController+Selection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3426A369255D9D7C0036407F /* ConversationViewController+Selection.swift */; };
3426A37025631C250036407F /* CVComponentLinkPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3426A36F25631C220036407F /* CVComponentLinkPreview.swift */; };
3426A37A2563F0EA0036407F /* CVComponentBottomButtons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3426A3792563F0EA0036407F /* CVComponentBottomButtons.swift */; };
3428577726BD8777005A2A96 /* Emoji+Category.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3428577026BD8777005A2A96 /* Emoji+Category.swift */; };
3428577826BD8777005A2A96 /* EmojiWithSkinTones+String.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3428577126BD8777005A2A96 /* EmojiWithSkinTones+String.swift */; };
3428577926BD8777005A2A96 /* Emoji+SkinTones.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3428577226BD8777005A2A96 /* Emoji+SkinTones.swift */; };
3428577A26BD8777005A2A96 /* EmojiWithSkinTones.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3428577326BD8777005A2A96 /* EmojiWithSkinTones.swift */; };
3428577B26BD8777005A2A96 /* Emoji.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3428577426BD8777005A2A96 /* Emoji.swift */; };
3428577C26BD8777005A2A96 /* Emoji+Name.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3428577526BD8777005A2A96 /* Emoji+Name.swift */; };
3428577D26BD8777005A2A96 /* Emoji+Available.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3428577626BD8777005A2A96 /* Emoji+Available.swift */; };
342FFE57271DA8C9000AC89F /* Sounds+SignalUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 342FFE56271DA8C9000AC89F /* Sounds+SignalUI.swift */; };
342FFE59271DAA25000AC89F /* AudioSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 342FFE58271DAA25000AC89F /* AudioSession.swift */; };
@ -2562,6 +2558,10 @@
D949C4052DF3A597007E095C /* BackupConfirmKeyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D949C4042DF3A588007E095C /* BackupConfirmKeyViewController.swift */; };
D94AEB3A2D28837F00B03D7A /* MasterKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = D94AEB392D28837A00B03D7A /* MasterKey.swift */; };
D94AEB3C2D28940A00B03D7A /* PreKeyTaskAPIClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = D94AEB3B2D28940500B03D7A /* PreKeyTaskAPIClient.swift */; };
D94B71762EF5FD7A000C4C98 /* Emoji+Category.swift in Sources */ = {isa = PBXBuildFile; fileRef = D94B71712EF5FD7A000C4C98 /* Emoji+Category.swift */; };
D94B71772EF5FD7A000C4C98 /* Emoji+Name.swift in Sources */ = {isa = PBXBuildFile; fileRef = D94B71722EF5FD7A000C4C98 /* Emoji+Name.swift */; };
D94B71782EF5FD7A000C4C98 /* EmojiWithSkinTones+String.swift in Sources */ = {isa = PBXBuildFile; fileRef = D94B71742EF5FD7A000C4C98 /* EmojiWithSkinTones+String.swift */; };
D94B71792EF5FD7A000C4C98 /* Emoji+SkinTones.swift in Sources */ = {isa = PBXBuildFile; fileRef = D94B71732EF5FD7A000C4C98 /* Emoji+SkinTones.swift */; };
D94D67CD2C9DEF870091B485 /* BackupArchivePostFrameRestoreActionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D94D67CC2C9DEF6E0091B485 /* BackupArchivePostFrameRestoreActionManager.swift */; };
D94D67CF2C9DF4720091B485 /* TSInfoMessage+ContactHidden.swift in Sources */ = {isa = PBXBuildFile; fileRef = D94D67CE2C9DF46E0091B485 /* TSInfoMessage+ContactHidden.swift */; };
D951F5312D9B236700C5EBF3 /* BackupSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D951F5302D9B236100C5EBF3 /* BackupSettingsViewController.swift */; };
@ -4201,12 +4201,8 @@
3426A369255D9D7C0036407F /* ConversationViewController+Selection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ConversationViewController+Selection.swift"; sourceTree = "<group>"; };
3426A36F25631C220036407F /* CVComponentLinkPreview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CVComponentLinkPreview.swift; sourceTree = "<group>"; };
3426A3792563F0EA0036407F /* CVComponentBottomButtons.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CVComponentBottomButtons.swift; sourceTree = "<group>"; };
3428577026BD8777005A2A96 /* Emoji+Category.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Emoji+Category.swift"; sourceTree = "<group>"; };
3428577126BD8777005A2A96 /* EmojiWithSkinTones+String.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "EmojiWithSkinTones+String.swift"; sourceTree = "<group>"; };
3428577226BD8777005A2A96 /* Emoji+SkinTones.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Emoji+SkinTones.swift"; sourceTree = "<group>"; };
3428577326BD8777005A2A96 /* EmojiWithSkinTones.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EmojiWithSkinTones.swift; sourceTree = "<group>"; };
3428577426BD8777005A2A96 /* Emoji.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Emoji.swift; sourceTree = "<group>"; };
3428577526BD8777005A2A96 /* Emoji+Name.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Emoji+Name.swift"; sourceTree = "<group>"; };
3428577626BD8777005A2A96 /* Emoji+Available.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Emoji+Available.swift"; sourceTree = "<group>"; };
342FFE56271DA8C9000AC89F /* Sounds+SignalUI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Sounds+SignalUI.swift"; sourceTree = "<group>"; };
342FFE58271DAA25000AC89F /* AudioSession.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AudioSession.swift; sourceTree = "<group>"; };
@ -6724,6 +6720,10 @@
D949C4042DF3A588007E095C /* BackupConfirmKeyViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackupConfirmKeyViewController.swift; sourceTree = "<group>"; };
D94AEB392D28837A00B03D7A /* MasterKey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasterKey.swift; sourceTree = "<group>"; };
D94AEB3B2D28940500B03D7A /* PreKeyTaskAPIClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreKeyTaskAPIClient.swift; sourceTree = "<group>"; };
D94B71712EF5FD7A000C4C98 /* Emoji+Category.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Emoji+Category.swift"; sourceTree = "<group>"; };
D94B71722EF5FD7A000C4C98 /* Emoji+Name.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Emoji+Name.swift"; sourceTree = "<group>"; };
D94B71732EF5FD7A000C4C98 /* Emoji+SkinTones.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Emoji+SkinTones.swift"; sourceTree = "<group>"; };
D94B71742EF5FD7A000C4C98 /* EmojiWithSkinTones+String.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "EmojiWithSkinTones+String.swift"; sourceTree = "<group>"; };
D94D67CC2C9DEF6E0091B485 /* BackupArchivePostFrameRestoreActionManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackupArchivePostFrameRestoreActionManager.swift; sourceTree = "<group>"; };
D94D67CE2C9DF46E0091B485 /* TSInfoMessage+ContactHidden.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TSInfoMessage+ContactHidden.swift"; sourceTree = "<group>"; };
D9517ABD292C596B00DDD37E /* Paypal+WebAuthentication.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Paypal+WebAuthentication.swift"; sourceTree = "<group>"; };
@ -8483,17 +8483,14 @@
3428576F26BD8777005A2A96 /* Emoji */ = {
isa = PBXGroup;
children = (
D94B71752EF5FD7A000C4C98 /* Generated */,
3428577626BD8777005A2A96 /* Emoji+Available.swift */,
3428577026BD8777005A2A96 /* Emoji+Category.swift */,
3428577526BD8777005A2A96 /* Emoji+Name.swift */,
3428577226BD8777005A2A96 /* Emoji+SkinTones.swift */,
3428577426BD8777005A2A96 /* Emoji.swift */,
880D902B2480889B003D2B14 /* EmojiPickerCollectionView.swift */,
880D902D2480A23E003D2B14 /* EmojiPickerSectionToolbar.swift */,
880D90292480887F003D2B14 /* EmojiPickerSheet.swift */,
F090C81F2762F2C5005C20FC /* EmojiReactionPickerConfigViewController.swift */,
88238EBB24F21EE400F28079 /* EmojiSkinTonePicker.swift */,
3428577126BD8777005A2A96 /* EmojiWithSkinTones+String.swift */,
3428577326BD8777005A2A96 /* EmojiWithSkinTones.swift */,
);
path = Emoji;
@ -13107,6 +13104,17 @@
path = Avatars;
sourceTree = "<group>";
};
D94B71752EF5FD7A000C4C98 /* Generated */ = {
isa = PBXGroup;
children = (
D94B71712EF5FD7A000C4C98 /* Emoji+Category.swift */,
D94B71722EF5FD7A000C4C98 /* Emoji+Name.swift */,
D94B71732EF5FD7A000C4C98 /* Emoji+SkinTones.swift */,
D94B71742EF5FD7A000C4C98 /* EmojiWithSkinTones+String.swift */,
);
path = Generated;
sourceTree = "<group>";
};
D951F52F2D9B233300C5EBF3 /* Backups */ = {
isa = PBXGroup;
children = (
@ -17910,9 +17918,9 @@
B9A53B992D0250FC0000578B /* EditCallLinkNameViewController.swift in Sources */,
C11C278129F2D2CD006779B4 /* EditHistoryTableSheetViewController.swift in Sources */,
3428577D26BD8777005A2A96 /* Emoji+Available.swift in Sources */,
3428577726BD8777005A2A96 /* Emoji+Category.swift in Sources */,
3428577C26BD8777005A2A96 /* Emoji+Name.swift in Sources */,
3428577926BD8777005A2A96 /* Emoji+SkinTones.swift in Sources */,
D94B71762EF5FD7A000C4C98 /* Emoji+Category.swift in Sources */,
D94B71772EF5FD7A000C4C98 /* Emoji+Name.swift in Sources */,
D94B71792EF5FD7A000C4C98 /* Emoji+SkinTones.swift in Sources */,
3428577B26BD8777005A2A96 /* Emoji.swift in Sources */,
8855DF89238F2E690066D96F /* EmojiCountsCollectionView.swift in Sources */,
32A9E22624C11B3F00C43518 /* EmojiMoodPickerView.swift in Sources */,
@ -17922,7 +17930,7 @@
F090C8202762F2C5005C20FC /* EmojiReactionPickerConfigViewController.swift in Sources */,
8855DF87238F1E0C0066D96F /* EmojiReactorsTableView.swift in Sources */,
88238EBC24F21EE400F28079 /* EmojiSkinTonePicker.swift in Sources */,
3428577826BD8777005A2A96 /* EmojiWithSkinTones+String.swift in Sources */,
D94B71782EF5FD7A000C4C98 /* EmojiWithSkinTones+String.swift in Sources */,
3428577A26BD8777005A2A96 /* EmojiWithSkinTones.swift in Sources */,
D98CA2BE2DF398EF0060370E /* EnterAccountEntropyPoolViewController.swift in Sources */,
88A505F423DA16E10005C012 /* ExperienceUpgradeManager.swift in Sources */,

View File

@ -353,9 +353,7 @@ extension CallsListViewController {
switch fetchDirection {
case .older:
// swiftlint:disable shorthand_operator
self.callHistoryItemReferences = self.callHistoryItemReferences + fetchedCallHistoryItemReferences
// swiftlint:enable shorthand_operator
case .newer:
self.callHistoryItemReferences = fetchedCallHistoryItemReferences + self.callHistoryItemReferences
}

View File

@ -5,7 +5,7 @@
// This file is generated by EmojiGenerator.swift, do not manually edit it.
// swiftlint:disable all
// swiftformat:disable all
/// A sorted representation of all available emoji
enum Emoji: String, CaseIterable, Equatable {
@ -1921,4 +1921,4 @@ enum Emoji: String, CaseIterable, Equatable {
case flagScotland = "🏴󠁧󠁢󠁳󠁣󠁴󠁿"
case flagWales = "🏴󠁧󠁢󠁷󠁬󠁳󠁿"
}
// swiftlint:disable all
// swiftformat:disable all

View File

@ -151,13 +151,11 @@ extension BackupArchive {
}
internal subscript(_ threadUniqueId: ThreadUniqueId) -> ChatId? {
// swiftlint:disable:next implicit_getter
get { map[threadUniqueId] }
map[threadUniqueId]
}
internal subscript(_ chatId: ChatId) -> CachedThreadInfo? {
// swiftlint:disable:next implicit_getter
get { threadCache[chatId] }
threadCache[chatId]
}
}
@ -191,8 +189,7 @@ extension BackupArchive {
}
internal subscript(_ recipientId: RecipientId) -> ChatId? {
// swiftlint:disable:next implicit_getter
get { recipientToChatMap[recipientId] }
recipientToChatMap[recipientId]
}
internal subscript(_ chatId: ChatId) -> ChatThread? {
@ -372,8 +369,7 @@ extension BackupArchive {
}
internal subscript(_ customChatColorKey: CustomChatColor.Key) -> CustomChatColorId? {
// swiftlint:disable:next implicit_getter
get { map[customChatColorKey] }
map[customChatColorKey]
}
}

View File

@ -203,29 +203,26 @@ extension BackupArchive {
}
subscript(_ address: Address) -> RecipientId? {
// swiftlint:disable:next implicit_getter
get {
switch address {
case .releaseNotesChannel:
return releaseNotesChannelRecipientId
case .group(let groupId):
return groupIdMap[groupId]
case .distributionList(let distributionId):
return distributionIdMap[distributionId]
case .contact(let contactAddress):
// Go down identifiers in priority order, return the first we have.
if let aci = contactAddress.aci {
return contactAciMap[aci]
} else if let e164 = contactAddress.e164 {
return contactE164Map[e164]
} else if let pni = contactAddress.pni {
return contactPniMap[pni]
} else {
return nil
}
case .callLink(let callLinkId):
return callLinkIdMap[callLinkId]
switch address {
case .releaseNotesChannel:
return releaseNotesChannelRecipientId
case .group(let groupId):
return groupIdMap[groupId]
case .distributionList(let distributionId):
return distributionIdMap[distributionId]
case .contact(let contactAddress):
// Go down identifiers in priority order, return the first we have.
if let aci = contactAddress.aci {
return contactAciMap[aci]
} else if let e164 = contactAddress.e164 {
return contactE164Map[e164]
} else if let pni = contactAddress.pni {
return contactPniMap[pni]
} else {
return nil
}
case .callLink(let callLinkId):
return callLinkIdMap[callLinkId]
}
}

View File

@ -64,9 +64,7 @@ public class ChainedPromiseTest: XCTestCase {
}
failIfExecuteSecondPromise.set(false)
// swiftlint:disable discouraged_direct_init
firstFuture.resolve(with: Promise<Void>.init(error: NSError()))
// swiftlint:enable discouraged_direct_init
firstFuture.resolve(with: Promise<Void>(error: NSError()))
secondFuture.resolve(())
expectFailure(firstResultPromise, description: "first result failure", timeout: 0.1)

View File

@ -8,7 +8,6 @@ import LibSignalClient
import UIKit
public import SignalServiceKit
// swiftlint:disable:next class_delegate_protocol
public protocol ConversationAvatarViewDelegate: UIViewController {
func didTapBadge()