chore(linter/swift): add shorthand_optional_binding rule (#3456)
* chore(linter/swift): add `shorthand_optional_binding` rule * lint code
This commit is contained in:
@@ -48,7 +48,7 @@ enum RCTVideoDRM {
|
||||
var request = URLRequest(url: URL(string: licenseServer)!)
|
||||
request.httpMethod = "POST"
|
||||
|
||||
if let headers = headers {
|
||||
if let headers {
|
||||
for item in headers {
|
||||
guard let key = item.key as? String, let value = item.value as? String else {
|
||||
continue
|
||||
@@ -90,7 +90,7 @@ enum RCTVideoDRM {
|
||||
reject(spcError)
|
||||
}
|
||||
|
||||
guard let spcData = spcData else {
|
||||
guard let spcData else {
|
||||
reject(RCTVideoErrorHandler.noSPC)
|
||||
return
|
||||
}
|
||||
@@ -101,7 +101,7 @@ enum RCTVideoDRM {
|
||||
|
||||
static func createCertificateData(certificateStringUrl: String?, base64Certificate: Bool?) -> Promise<Data> {
|
||||
return Promise<Data>(on: .global()) { fulfill, reject in
|
||||
guard let certificateStringUrl = certificateStringUrl,
|
||||
guard let certificateStringUrl,
|
||||
let certificateURL = URL(string: certificateStringUrl.addingPercentEncoding(withAllowedCharacters: .urlFragmentAllowed) ?? "") else {
|
||||
reject(RCTVideoErrorHandler.noCertificateURL)
|
||||
return
|
||||
@@ -115,7 +115,7 @@ enum RCTVideoDRM {
|
||||
}
|
||||
} catch {}
|
||||
|
||||
guard let certificateData = certificateData else {
|
||||
guard let certificateData else {
|
||||
reject(RCTVideoErrorHandler.noCertificateData)
|
||||
return
|
||||
}
|
||||
@@ -130,7 +130,7 @@ enum RCTVideoDRM {
|
||||
|
||||
return RCTVideoDRM.createCertificateData(certificateStringUrl: certificateUrl, base64Certificate: base64Certificate)
|
||||
.then { certificateData -> Promise<Data> in
|
||||
guard let contentIdData = contentIdData else {
|
||||
guard let contentIdData else {
|
||||
throw RCTVideoError.invalidContentId as! Error
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ enum RCTVideoDRM {
|
||||
)
|
||||
}
|
||||
.then { spcData -> Promise<Data> in
|
||||
guard let licenseServer = licenseServer else {
|
||||
guard let licenseServer else {
|
||||
throw RCTVideoError.noLicenseServerURL as! Error
|
||||
}
|
||||
return RCTVideoDRM.fetchLicense(
|
||||
|
||||
Reference in New Issue
Block a user