Skip to content

Commit

Permalink
Credits (#122)
Browse files Browse the repository at this point in the history
* 🎨 Basic credit UI

* 🎨 Division par section

* 🎨 Role under name in credits

* πŸ‘½ Fetch contributors from backend

* πŸ—‘ Removing hardcoded store

* 🎨 Updating header view with a description label

* πŸ”§ Last fixes before merge

* ↩️ Reverted code that should not be deleted

* πŸ“„ String localization + Linting

* πŸ”§ Updating API Service to use Result

* ✨ Fixed problems after merging 'develop'

* πŸ”§ Updating app to match new contributors endpoint

* ✨ Fixed Xcode errors after merge

* ✨ Adding contributors cell to settings

* Fixing issues about requested changes

* Adding an image button for contributor link

* refactor: #37 - list of contributors

- Improve icon of hyperlink
- Display icon of hyperlink only if hyperlink defined and working
- Keep unique contirbutors

Signed-off-by: Pierre-Yves Lapersonne <[email protected]>

* refactor: #37 - roles and profiles

- Improve display of role with correct syntax
- Improve vocalization of roles
- Add label and hint for profil button

Signed-off-by: Pierre-Yves Lapersonne <[email protected]>

* refactor: #37 - hide role if too big text size in use for a11y reasons

Signed-off-by: Pierre-Yves Lapersonne <[email protected]>

* refactor: #37 - remove warnings

Signed-off-by: Pierre-Yves Lapersonne <[email protected]>

* doc: #37 - add licence of KingFisher

Signed-off-by: Pierre-Yves Lapersonne <[email protected]>

Co-authored-by: Pierre-Yves Lapersonne <[email protected]>
  • Loading branch information
nathanfallet and pylapp authored Jan 1, 2022
1 parent 907eebf commit c027f37
Show file tree
Hide file tree
Showing 27 changed files with 985 additions and 38 deletions.
109 changes: 98 additions & 11 deletions ViteMaDose.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@
"version": "3.0.3"
}
},
{
"package": "Kingfisher",
"repositoryURL": "https://github.com/onevcat/Kingfisher.git",
"state": {
"branch": null,
"revision": "15d199e84677303a7004ed2c5ecaa1a90f3863f8",
"version": "6.2.1"
}
},
{
"package": "leveldb",
"repositoryURL": "https://github.com/firebase/leveldb.git",
Expand Down
2 changes: 1 addition & 1 deletion ViteMaDose.xcodeproj/xcshareddata/xcschemes/Debug.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1310"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1310"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1310"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
16 changes: 16 additions & 0 deletions ViteMaDose/Helpers/Classes/DoubledString.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// DoubledString.swift
// ViteMaDose
//
// Created by Pierre-Yves Lapersonne on 01/01/2022.
//

import Foundation

/// Allows to gather two strings in one `Hashable` object
struct DoubledString: Hashable {
/// The string which can be displayed in the GUI
let toDisplay: String
/// The string which can be vocalized with VoiceOver
let toVocalize: String
}
25 changes: 25 additions & 0 deletions ViteMaDose/Helpers/Extensions/UIContentSizeCategory+Commons.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Software Name: vitemadose-ios
// SPDX-FileCopyrightText: Copyright (c) 2021 CovidTracker
// SPDX-License-Identifier: GNU General Public License v3.0 or later
//
// This software is distributed under the GPL-3.0-or-later license.

import Foundation
import UIKit

extension UIContentSizeCategory {

/// True if big text size is in use with accessibility feature enabled, false otherwise
var isAccessibleLargeTextSize: Bool {
switch self {
case UIContentSizeCategory.accessibilityExtraExtraExtraLarge,
UIContentSizeCategory.accessibilityExtraExtraLarge,
UIContentSizeCategory.accessibilityExtraLarge,
UIContentSizeCategory.accessibilityLarge,
UIContentSizeCategory.accessibilityMedium:
return true
default:
return false
}
}
}
1 change: 1 addition & 0 deletions ViteMaDose/Helpers/Utils/AppAnalytics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum AppAnalytics {
case home = "home"
case searchResults = "search_results"
case departmentSelect = "departement_select"
case credit = "credit"
}

static func logScreen(_ screenName: ScreenName, screenClass: String) {
Expand Down
46 changes: 46 additions & 0 deletions ViteMaDose/Models/Credit.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// Credit.swift
// ViteMaDose
//
// Created by Nathan FALLET on 20/04/2021.
//

import Foundation

// MARK: - Credit

struct Credit: Codable {
let id: String?
let nom: String?
let pseudo: String?
let photo: String?
let site_web: String?
let job: String?
let localisation: String?
let company: String?
let teams: [String]?
let links: [CreditLink]?

var shownName: String {
nom ?? pseudo ?? id ?? Localization.Credits.noName
}

var shownRole: String {
teams?.joined(separator: ", ") ?? Localization.Credits.noRole
}
}

// MARK: - Credit Link

struct CreditLink: Codable {
let site: String?
let url: String?
}

extension CreditLink: Hashable {}

// MARK: - Credits

struct Credits: Codable {
let contributors: [Credit]?
}
19 changes: 15 additions & 4 deletions ViteMaDose/Networking/BaseAPIService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Moya

enum BaseAPI {
case stats
case credits
case vaccinationCentres(departmentCode: String)
case departmentSlots(departmentCode: String)
}
Expand All @@ -28,6 +29,8 @@ extension BaseAPI: TargetType {
switch self {
case .stats:
return Self.remoteConfig.statsPath
case .credits:
return Self.remoteConfig.contributorsPath
case let .vaccinationCentres(code):
return Self.remoteConfig.departmentPath(withCode: code)
case let .departmentSlots(code):
Expand All @@ -38,8 +41,9 @@ extension BaseAPI: TargetType {
var method: Moya.Method {
switch self {
case .stats,
.vaccinationCentres,
.departmentSlots:
.credits,
.vaccinationCentres,
.departmentSlots:
return .get
}
}
Expand All @@ -55,6 +59,7 @@ extension BaseAPI: TargetType {
var task: Task {
switch self {
case .stats,
.credits,
.vaccinationCentres,
.departmentSlots:
return .requestPlain
Expand All @@ -73,6 +78,7 @@ protocol BaseAPIServiceProvider: AnyObject {

func fetchVaccinationCentres(departmentCode: String, completion: @escaping (Result<VaccinationCentres, Error>) -> Void)
func fetchStats(completion: @escaping (Result<Stats, Error>) -> Void)
func fetchCredits(completion: @escaping (Result<Credits, Error>) -> Void)
func fetchDepartmentSlots(departmentCode: String, completion: @escaping (Result<DepartmentSlots, Error>) -> Void)
}

Expand All @@ -87,6 +93,10 @@ final class BaseAPIService: BaseAPIServiceProvider {
request(target: .stats, completion: completion)
}

func fetchCredits(completion: @escaping (Result<Credits, Error>) -> Void) {
request(target: .credits, completion: completion)
}

func fetchVaccinationCentres(departmentCode: String, completion: @escaping (Result<VaccinationCentres, Error>) -> Void) {
request(target: .vaccinationCentres(departmentCode: departmentCode), completion: completion)
}
Expand Down Expand Up @@ -117,8 +127,9 @@ extension BaseAPI: CachePolicyGettable {
var cachePolicy: URLRequest.CachePolicy {
switch self {
case .stats,
.vaccinationCentres,
.departmentSlots:
.credits,
.vaccinationCentres,
.departmentSlots:
return .reloadIgnoringLocalCacheData
}
}
Expand Down
4 changes: 4 additions & 0 deletions ViteMaDose/Networking/RemoteConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ extension RemoteConfiguration {
return vaccinationCentresListRadiusInKm.doubleValue * 1000
}

var contributorsPath: String {
return configuration.configValue(forKey: "path_contributors").stringValue!
}

func departmentPath(withCode code: String) -> String {
let path = configuration.configValue(forKey: "path_data_department").stringValue!
return path.replacingOccurrences(of: "{code}", with: code)
Expand Down
23 changes: 23 additions & 0 deletions ViteMaDose/Resources/Localization/Localization.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ enum Localization {
}
}

enum Credits {
static let noName = "credits.no_name".localized
static let noRole = "credits.no_role".localized

enum MainTitle {
static let title = "credits.main_title.title".localized
static let subtitle = "credits.main_title.subtitle".localized
static let highlightedText1 = "credits.main_title.highlightedText1".localized
static let highlightedText2 = "credits.main_title.highlightedText2".localized
}
}

enum Locations {
static let list_title = "locations.list_title".localized
static let followed_list_title = "locations.followed_list_title".localized
Expand Down Expand Up @@ -108,6 +120,11 @@ enum Localization {
static let subtitle = "settings.website.subtitle".localized
}

enum Contributors {
static let title = "settings.contributors.title".localized
static let subtitle = "settings.contributors.subtitle".localized
}

enum Contact {
static let title = "settings.contact.title".localized
static let subtitle = "settings.contact.subtitle".localized
Expand Down Expand Up @@ -177,11 +194,17 @@ enum Localization {
static let button_label = "a11y.voiceover.settings.button.label".localized
static let button_hint = "a11y.voiceover.settings.button.hint".localized
static let action_website = "a11y.voiceover.settings.action.website".localized
static let action_contributors = "a11y.voiceover.settings.action.contributors".localized
static let action_contact = "a11y.voiceover.settings.action.contact".localized
static let action_twitter = "a11y.voiceover.settings.action.twitter".localized
static let action_sourcecode = "a11y.voiceover.settings.action.sourcecode".localized
static let action_advanced = "a11y.voiceover.settings.action.advanced".localized
}

enum Credits {
static let credit_button_label = "a11y.voiceover.credits.credit_button.label".localized
static let credit_button_hint = "a11y.voiceover.credits.credit_button.hint".localized
}
}
}
}
14 changes: 14 additions & 0 deletions ViteMaDose/Resources/Localization/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@
"home.stats.locations_with_availabilities" = "Lieux avec rendez-vous disponibles";
"home.stats.available_locations_percentage" = "De lieux avec des disponibilitΓ©s";

// MARK: - Credits

"credits.main_title.title" = "Contributeurs";
"credits.main_title.subtitle" = "ViteMaDose est un projet open source, construit par l'ensemble de nos gΓ©nΓ©reux contributeurs";
"credits.main_title.highlightedText1" = "open source";
"credits.main_title.highlightedText2" = "gΓ©nΓ©reux contributeurs";
"credits.no_name" = "Nom inconnu";
"credits.no_role" = "RΓ΄le inconnu";
"a11y.voiceover.credits.credit_button.label" = "Profil";
"a11y.voiceover.credits.credit_button.hint" = "Tappez deux fois pour accΓ©der Γ  son site web";

// MARK: - Department Selection

"location_search.main_title" = "SΓ©lectionnez ou recherchez un lieu en France";
Expand Down Expand Up @@ -96,6 +107,7 @@
"a11y.voiceover.settings.button.label" = "RΓ©glages";
"a11y.voiceover.settings.button.hint" = "Tappez deux fois pour accΓ©der aux rΓ©glages de l'application";
"a11y.voiceover.settings.action.website" = "Tappez deux fois pour aller sur le site CovidTracker.fr";
"a11y.voiceover.settings.action.contributors" = "Tappez deux fois pour afficher la liste des contributeurs du projet";
"a11y.voiceover.settings.action.contact" = "Tappez deux fois pour afficher le formulaire de contact du site CovidTracker.fr";
"a11y.voiceover.settings.action.twitter" = "Tappez deux fois pour aller sur le profil Twitter de CovidTracker.";
"a11y.voiceover.settings.action.sourcecode" = "Tappez deux fois pour accΓ©der au dΓ©pot GitHub de l'application pour avoir son code source.";
Expand All @@ -106,6 +118,8 @@
"settings.title" = "RΓ©glages";
"settings.website.title" = "CovidTracker.fr";
"settings.website.subtitle" = "Retrouvez nous sur notre site web";
"settings.contributors.title" = "Contributeurs";
"settings.contributors.subtitle" = "Découvrez l'équipe derrière le projet";
"settings.contact.title" = "Contact";
"settings.contact.subtitle" = "AccΓ©dez Γ  notre formulaire de contact";
"settings.twitter.title" = "Twitter";
Expand Down
16 changes: 8 additions & 8 deletions ViteMaDose/Settings.bundle/com.mono0926.LicensePlist.plist
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@
<key>Type</key>
<string>PSChildPaneSpecifier</string>
</dict>
<dict>
<key>File</key>
<string>com.mono0926.LicensePlist/Kingfisher</string>
<key>Title</key>
<string>Kingfisher</string>
<key>Type</key>
<string>PSChildPaneSpecifier</string>
</dict>
<dict>
<key>File</key>
<string>com.mono0926.LicensePlist/leveldb</string>
Expand All @@ -106,14 +114,6 @@
<key>Type</key>
<string>PSChildPaneSpecifier</string>
</dict>
<dict>
<key>File</key>
<string>com.mono0926.LicensePlist/LicensePlist</string>
<key>Title</key>
<string>LicensePlist</string>
<key>Type</key>
<string>PSChildPaneSpecifier</string>
</dict>
<dict>
<key>File</key>
<string>com.mono0926.LicensePlist/Moya</string>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>FooterText</key>
<string>The MIT License (MIT)
Copyright (c) 2019 Wei Wang
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
</array>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<key>FooterText</key>
<string>MIT License
Copyright (c) 2018 Orta
Copyright (c) 2018 onwards: @orta + @fmeloni
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit c027f37

Please sign in to comment.