Commit b36b83bb authored by Kourser's avatar Kourser
Browse files

Actualiser les nouveautés, les captures et les fiches App Store

Intégrer la sauvegarde automatique, les gestes du calendrier, les rappels et le formulaire de retour. Documenter les nouveautés dans les 24 langues et actualiser les 23 fiches App Store avec leurs notes de version.

Renouveler huit captures françaises iPhone et iPad sur données fictives. Ajouter un parcours de capture reproductible et normaliser leur orientation avant export.

Validation : compilations iOS et macOS réussies ; 609 tests du cœur sans échec (2 ignorés) ; captures XCTest iPhone et iPad réussies ; construction des 24 langues (264 pages), catalogues et fiches App Store vérifiés.
parent 6ecc2421
Loading
Loading
Loading
Loading
+62 −3
Changes for App/Calendar/CalendarController.swift: 62 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -420,9 +420,22 @@ extension CalendarController {
        return nil
    }

    struct CreationTarget: Identifiable {
        let account: CalendarAccount
        let collection: CalDAVCollection
        var id: String { account.id.uuidString + ":" + collection.path }
        var label: String { account.label + " · " + (collection.displayName ?? collection.path) }
    }

    func creationTargets(_ kind: CalendarObject.Kind) -> [CreationTarget] {
        accounts.flatMap { account in
            account.writableCollections(for: kind).map { CreationTarget(account: account, collection: $0) }
        }
    }

    /// Vrai si l'on peut créer un objet de ce type quelque part.
    func canCreate(_ kind: CalendarObject.Kind) -> Bool {
        !outboxIsUnusable && accounts.contains { $0.writeCollection(for: kind) != nil }
        !outboxIsUnusable && !creationTargets(kind).isEmpty
    }

    /// Les comptes qui acceptent une création de ce type.
@@ -433,9 +446,10 @@ extension CalendarController {
    /// Met en file la création d'un objet, et le montre tout de suite.
    @discardableResult
    func create(_ draft: CalendarObject.Draft, kind: CalendarObject.Kind,
                in account: CalendarAccount) throws -> String {
                in account: CalendarAccount, collectionPath: String? = nil) throws -> String {
        guard !outboxIsUnusable else { throw CalendarWriteRefusal.queueUnusable }
        guard let collection = account.writeCollection(for: kind) else {
        guard let current = accounts.first(where: { $0.id == account.id }),
              let collection = (collectionPath == nil ? current.writeCollection(for: kind) : current.writableCollections(for: kind).first { $0.path == collectionPath }) else {
            throw CalendarWriteRefusal.noWritableCollection
        }
        // Un UID qui nous appartient, et qui dit d'où vient l'objet.
@@ -480,6 +494,47 @@ extension CalendarController {
           in: account.id, collection: collection.path)
    }

    func canReschedule(_ occurrence: CalendarOccurrence) -> Bool {
        guard occurrence.kind == .event, occurrence.isEditable, !outboxIsUnusable,
              let account = account(of: occurrence),
              collection(holding: occurrence.path, in: account)?.isWritable == true else { return false }
        return !conflicts.contains { $0.accountID == account.id && $0.objectPath == occurrence.path }
    }

    func reschedule(_ occurrence: CalendarOccurrence, to interval: DateInterval) throws {
        guard canReschedule(occurrence), interval.duration > 0,
              let file = cached(at: occurrence.path, accountID: occurrence.accountID),
              let current = file.objects().first(where: { $0.uid == occurrence.object.uid && $0.recurrenceID == occurrence.object.recurrenceID }),
              current == occurrence.object else { throw CalendarWriteRefusal.notEditable }
        var draft = current.draft
        draft.start = CalendarEventTiming.date(interval.start, preserving: draft.start, allDay: occurrence.isAllDay, calendar: calendar)
        draft.end = CalendarEventTiming.date(interval.end, preserving: draft.end ?? draft.start, allDay: occurrence.isAllDay, calendar: calendar)
        try update(occurrence, with: draft)
    }

    func canChangeTaskStatus(_ occurrence: CalendarOccurrence) -> Bool {
        guard occurrence.kind == .task, occurrence.isEditable, !outboxIsUnusable,
              occurrence.object.taskStatus != nil || occurrence.object.component.property("STATUS") == nil,
              let account = account(of: occurrence),
              collection(holding: occurrence.path, in: account)?.isWritable == true else { return false }
        return !conflicts.contains { $0.accountID == account.id && $0.objectPath == occurrence.path }
    }

    /// Read the latest cached draft so checking a task cannot overwrite other fields
    /// changed since its row appeared. The usual outbox preserves ETags and conflicts.
    func changeTaskStatus(_ occurrence: CalendarOccurrence, to status: JournalKnowledge.Status?) throws {
        guard canChangeTaskStatus(occurrence) else { throw CalendarWriteRefusal.notEditable }
        guard let file = cached(at: occurrence.path, accountID: occurrence.accountID),
              let current = file.objects().first(where: { $0.uid == occurrence.object.uid && $0.recurrenceID == occurrence.object.recurrenceID })
        else { throw CalendarWriteRefusal.unknownObject }
        var latest = occurrence
        latest.object = current
        guard canChangeTaskStatus(latest), current.taskStatus == occurrence.object.taskStatus else { throw CalendarWriteRefusal.notEditable }
        var draft = current.draft
        draft.status = status
        try update(latest, with: draft)
    }

    /// Met en file la suppression d'un objet.
    func delete(_ occurrence: CalendarOccurrence) throws {
        guard !outboxIsUnusable else { throw CalendarWriteRefusal.queueUnusable }
@@ -522,6 +577,10 @@ extension CalendarController {
    private func apply(_ file: CalendarCachedObject?, at path: String,
                       in accountID: UUID, collection collectionPath: String) {
        var cache = caches[accountID] ?? CalendarCache(accountID: accountID)
        if !cache.collections.contains(where: { $0.collection.path == collectionPath }) {
            guard file != nil, let collection = accounts.first(where: { $0.id == accountID })?.discovered.first(where: { $0.path == collectionPath }) else { return }
            cache.collections.append(CalendarCollectionCache(collection: collection))
        }
        guard let index = cache.collections.firstIndex(where: { $0.collection.path == collectionPath })
        else { return }
        cache.collections[index].objects.removeAll { $0.path == path }
+22 −15
Changes for App/Features/Calendar/CalendarObjectEditor.swift: 22 added lines, 15 removed lines.
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ struct CalendarObjectEditor: View {
    let editing: CalendarOccurrence?
    /// Le jour proposé pour une création.
    var proposedDay: Date = Date()
    var proposedSelection: CalendarSelection?

    @State private var summary = ""
    @State private var isAllDay = false
@@ -29,7 +30,7 @@ struct CalendarObjectEditor: View {
    @State private var categories = ""
    /// Le compte choisi, par son identifiant : `CalendarAccount` n'est pas
    /// `Hashable`, et l'identifiant est de toute façon son identité.
    @State private var accountID: UUID?
    @State private var targetID: String?
    @State private var failure: String?
    @State private var confirmingDeletion = false
    @State private var filled = false
@@ -56,8 +57,10 @@ struct CalendarObjectEditor: View {
                            .accessibilityIdentifier("calendar.editor.allday")
                        DatePicker("Début", selection: $start,
                                   displayedComponents: isAllDay ? [.date] : [.date, .hourAndMinute])
                            .accessibilityIdentifier("calendar.editor.start")
                        DatePicker("Fin", selection: $end, in: start...,
                                   displayedComponents: isAllDay ? [.date] : [.date, .hourAndMinute])
                            .accessibilityIdentifier("calendar.editor.end")
                    } footer: {
                        if isAllDay {
                            Text("Un jour entier reste un jour : Envorenn ne lui donne pas d'heure.")
@@ -90,17 +93,18 @@ struct CalendarObjectEditor: View {
                }

                if isNew {
                    let candidates = calendars.accountsAccepting(kind)
                    let candidates = calendars.creationTargets(kind)
                    Section {
                        if candidates.isEmpty {
                            Text("Aucun calendrier n'est désigné pour les nouveaux objets de ce type. Choisissez-en un dans les réglages.")
                                .journalFont(.caption).foregroundStyle(Color.secondaryText)
                        } else {
                            Picker("Calendrier", selection: $accountID) {
                            Picker("Calendrier", selection: $targetID) {
                                ForEach(candidates) { candidate in
                                    Text(name(of: candidate)).tag(UUID?.some(candidate.id))
                                    Text(verbatim: candidate.label).tag(String?.some(candidate.id))
                                }
                            }
                            .accessibilityIdentifier("calendar.editor.target")
                        }
                    } header: {
                        Text("Où l'enregistrer")
@@ -156,17 +160,12 @@ struct CalendarObjectEditor: View {

    private var canSave: Bool {
        guard !summary.trimmingCharacters(in: .whitespaces).isEmpty else { return false }
        if isNew { return chosenAccount != nil }
        if isNew { return chosenTarget != nil }
        return editing?.isEditable == true
    }

    private var chosenAccount: CalendarAccount? {
        calendars.accountsAccepting(kind).first { $0.id == accountID }
    }

    private func name(of candidate: CalendarAccount) -> String {
        guard let collection = candidate.writeCollection(for: kind) else { return candidate.label }
        return candidate.label + " · " + (collection.displayName ?? collection.path)
    private var chosenTarget: CalendarController.CreationTarget? {
        calendars.creationTargets(kind).first { $0.id == targetID }
    }

    // MARK: - Lecture et écriture du brouillon
@@ -181,8 +180,16 @@ struct CalendarObjectEditor: View {
            start = calendar.date(bySettingHour: (time.hour ?? 9) + 1, minute: 0, second: 0,
                                  of: proposedDay) ?? proposedDay
            end = start.addingTimeInterval(3600)
            if let proposedSelection, kind == .event {
                isAllDay = proposedSelection.isAllDay
                start = proposedSelection.interval.start
                end = isAllDay
                    ? ICalendarDate.lastDay(ofExclusiveEnd: proposedSelection.interval.end, in: calendar)
                    : proposedSelection.interval.end
            }
            due = calendar.date(bySettingHour: 12, minute: 0, second: 0, of: proposedDay) ?? proposedDay
            accountID = calendars.accountsAccepting(kind).first?.id
            let targets = calendars.creationTargets(kind)
            targetID = targets.first { $0.account.writeCollection(for: kind)?.path == $0.collection.path }?.id ?? targets.first?.id
            return
        }
        let draft = editing.object.draft
@@ -235,8 +242,8 @@ struct CalendarObjectEditor: View {
        do {
            if let editing {
                try calendars.update(editing, with: draft())
            } else if let account = chosenAccount {
                try calendars.create(draft(), kind: kind, in: account)
            } else if let target = chosenTarget {
                try calendars.create(draft(), kind: kind, in: target.account, collectionPath: target.collection.path)
            }
            dismiss()
        } catch {
+519 −72

File changed.

Preview size limit exceeded, changes collapsed.

+220 −109

File changed.

Preview size limit exceeded, changes collapsed.

+110 −130

File changed.

Preview size limit exceeded, changes collapsed.

Loading