Skip to content

Commit

Permalink
Fix swift lint indentation_width
Browse files Browse the repository at this point in the history
  • Loading branch information
levieggertcru committed Jul 16, 2024
1 parent 541058f commit 3cbcaf5
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,8 @@ struct DownloadableLanguageItemView: View {
}

private func shouldContinueDownloadProgressAnimation() -> Bool {
guard isVisible,
let animationDownloadProgress = animationDownloadProgress
else {

guard isVisible, let animationDownloadProgress = animationDownloadProgress else {
return false
}

Expand Down
2 changes: 1 addition & 1 deletion godtools/App/Share/Common/FileCache/FileCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ class FileCache {

// delete directory since contents were moved
do {
try fileManager.removeItem(at: childDirectory)
try fileManager.removeItem(at: childDirectory)
}
catch let error {
return error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,7 @@ class ArticleAemCache {
let dataIsNotCached: Bool
let uuidChanged: Bool

if let aemCacheObject = self.getAemCacheObject(realm: realm, aemUri: aemData.aemUri),
let cachedUUID = aemCacheObject.aemData.articleJcrContent?.uuid,
let uuid = aemData.articleJcrContent?.uuid,
!cachedUUID.isEmpty,
!uuid.isEmpty {
if let aemCacheObject = self.getAemCacheObject(realm: realm, aemUri: aemData.aemUri), let cachedUUID = aemCacheObject.aemData.articleJcrContent?.uuid, let uuid = aemData.articleJcrContent?.uuid, !cachedUUID.isEmpty, !uuid.isEmpty {

dataIsNotCached = false
uuidChanged = cachedUUID != uuid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,32 +92,30 @@ class ArticleAemDataParser {
}

/*

NOTE:

The below preferred variatons are root level keys found in the json structure that is getting parsed.

It appears that each variation can be appended to an aem import src url in order to load an html page per platform.

For example, take the following aem import src url:

https://www.cru.org/content/experience-fragments/shared-library/language-masters/en/how-to-know-god/what-is-christianity/does-god-answer-our-prayers-

We obtain the json by appending a number representing the maximum amount of levels the json structure will return like so:

https://www.cru.org/content/experience-fragments/shared-library/language-masters/en/how-to-know-god/what-is-christianity/does-god-answer-our-prayers-.10.json (10 levels).

We can also append variations 'master' or ('godtools' or 'godtools-variation') to the import src url to load an html page like so:

master
https://www.cru.org/content/experience-fragments/shared-library/language-masters/en/how-to-know-god/what-is-christianity/does-god-answer-our-prayers-/master.html

//godtools
https://www.cru.org/content/experience-fragments/shared-library/language-masters/en/how-to-know-god/what-is-christianity/does-god-answer-our-prayers-/godtools.html

//godtools-variation
https://www.cru.org/content/experience-fragments/shared-library/language-masters/en/how-to-know-god/what-is-christianity/can-you-explain-the-trinity--/godtools-variation.html

NOTE:

The below preferred variatons are root level keys found in the json structure that is getting parsed.

It appears that each variation can be appended to an aem import src url in order to load an html page per platform.

For example, take the following aem import src url:

https://www.cru.org/content/experience-fragments/shared-library/language-masters/en/how-to-know-god/what-is-christianity/does-god-answer-our-prayers-

We obtain the json by appending a number representing the maximum amount of levels the json structure will return like so:

https://www.cru.org/content/experience-fragments/shared-library/language-masters/en/how-to-know-god/what-is-christianity/does-god-answer-our-prayers-.10.json (10 levels).

We can also append variations 'master' or ('godtools' or 'godtools-variation') to the import src url to load an html page like so:

master
https://www.cru.org/content/experience-fragments/shared-library/language-masters/en/how-to-know-god/what-is-christianity/does-god-answer-our-prayers-/master.html

//godtools
https://www.cru.org/content/experience-fragments/shared-library/language-masters/en/how-to-know-god/what-is-christianity/does-god-answer-our-prayers-/godtools.html

//godtools-variation
https://www.cru.org/content/experience-fragments/shared-library/language-masters/en/how-to-know-god/what-is-christianity/can-you-explain-the-trinity--/godtools-variation.html
*/

private func getPreferredVariation(aemUrl: URL, aemJson: [String: Any]) -> String? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ class LegacyAppsFlyerDeepLinkValueParser: DeepLinkAppsFlyerParserType {
if let deepLinkValue = data["deep_link_value"] as? String {
resourceAbbreviation = deepLinkValue
}
else if let link = data["link"] as? String,
let linkComponents = URLComponents(string: link),
let deepLinkValue = linkComponents.queryItems?.first(where: { $0.name == "deep_link_value" })?.value {
else if let link = data["link"] as? String, let linkComponents = URLComponents(string: link), let deepLinkValue = linkComponents.queryItems?.first(where: { $0.name == "deep_link_value" })?.value {

resourceAbbreviation = deepLinkValue
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ class ToolPathDeepLinkParser: DeepLinkUrlParserType {
return nil
}

guard let resourceAbbreviation = pathComponents[safe: toolPathIndex + 2],
let language = pathComponents[safe: toolPathIndex + 3] else {
guard let resourceAbbreviation = pathComponents[safe: toolPathIndex + 2], let language = pathComponents[safe: toolPathIndex + 3] else {

return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ class ResourcesSHA256FileCache {
continue
}

if let existingRealmSHA256File = realm.object(ofType: RealmSHA256File.self, forPrimaryKey: filenameWithPathExtension),
!existingRealmSHA256File.translations.contains(realmTranslation) {
if let existingRealmSHA256File = realm.object(ofType: RealmSHA256File.self, forPrimaryKey: filenameWithPathExtension), !existingRealmSHA256File.translations.contains(realmTranslation) {

existingRealmSHA256File.translations.append(realmTranslation)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ class TrackDownloadedTranslationsCache {

let downloadedTranslation: RealmDownloadedTranslation = RealmDownloadedTranslation()

guard let languageId = translation.language?.id, !languageId.isEmpty,
let resourceId = translation.resource?.id, !resourceId.isEmpty else {
guard let languageId = translation.language?.id, !languageId.isEmpty, let resourceId = translation.resource?.id, !resourceId.isEmpty else {

return []
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,7 @@ extension TranslationsRepository {

let latestDownloadedTranslation: TranslationModel?

if shouldFallbackToLatestDownloadedTranslation,
let resourceId = translation.resource?.id,
let languageId = translation.language?.id,
let latestTrackedDownloadedTranslation = self.trackDownloadedTranslationsRepository.getLatestDownloadedTranslation(resourceId: resourceId, languageId: languageId) {
if shouldFallbackToLatestDownloadedTranslation, let resourceId = translation.resource?.id, let languageId = translation.language?.id, let latestTrackedDownloadedTranslation = self.trackDownloadedTranslationsRepository.getLatestDownloadedTranslation(resourceId: resourceId, languageId: languageId) {

latestDownloadedTranslation = self.getTranslation(id: latestTrackedDownloadedTranslation.translationId)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,19 @@ class UserCountersRepository {
}

func getUserCountersChanged(reloadFromRemote: Bool) -> AnyPublisher<Void, Never> {

if reloadFromRemote {

if reloadFromRemote {

fetchRemoteUserCounters()
.sink(receiveCompletion: { _ in

}, receiveValue: { _ in

})
.store(in: &cancellables)

}

return cache.getUserCountersChanged()
fetchRemoteUserCounters()
.sink(receiveCompletion: { _ in
}, receiveValue: { _ in

})
.store(in: &cancellables)
}

return cache.getUserCountersChanged()
}

func getUserCounters() -> [UserCounterDataModel] {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ class DetermineDeepLinkedToolTranslationsToDownload: DetermineToolTranslationsTo

return primaryTranslation
}
else if let appLanguage = userAppLanguageRepository.getCachedLanguage(),
let appLanguageTranslation = translationsRepository.getLatestTranslation(resourceId: resource.id, languageCode: appLanguage.languageId) {
else if let appLanguage = userAppLanguageRepository.getCachedLanguage(), let appLanguageTranslation = translationsRepository.getLatestTranslation(resourceId: resource.id, languageCode: appLanguage.languageId) {

return appLanguageTranslation
}
Expand Down

0 comments on commit 3cbcaf5

Please sign in to comment.