Repository Public
1// SP Notes iOS2// File: App/SampleData+Shell.swift3// Description: Sample content for the 2.0 shell screens (UI tests and screenshots only): tasks in every group and links between the sample notes (a backlink with a block, an AI-suggested relation).4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7import Foundation8import SPNotesCore910extension SampleData {11 static let overdueTaskID = id(101)12 static let todayTaskID = id(102)1314 @MainActor15 static func seedShell(into app: AppModel) async {16 let tasks = app.repositories.tasks17 let today = TaskDue.today()18 func day(_ offset: Int) -> String { TaskDue.day(today, adding: offset).string }19 _ = try? await tasks.create(title: "Renouveler le passeport", dueDay: day(-6), status: .done, id: id(106))20 _ = try? await tasks.create(title: "Trier les photos du voyage", priority: .low, id: id(105))21 _ = try? await tasks.create(title: "Préparer la réunion de lundi", dueDay: day(3), id: id(104))22 _ = try? await tasks.create(title: "Appeler le garagiste", dueDay: day(0), id: id(103))23 _ = try? await tasks.create(title: "Relire le chapitre 3", dueDay: day(0), priority: .high, pageId: editorGuideNoteID, id: todayTaskID)24 _ = try? await tasks.create(title: "Envoyer le rapport de stage", dueDay: day(-2), priority: .high, id: overdueTaskID)2526 // Links as the change feed delivers them: the guide links to the welcome note (from one of its blocks), and an analysis27 // suggested a relation that the user has not accepted.28 let block = (try? await app.store.page(id: editorGuideNoteID)).flatMap { $0 }.flatMap { try? NoteDocument(json: $0.content) }?.lines.first?.attrs["id"]29 var blockField = ""30 if case .string(let blockId)? = block { blockField = #","sourceBlockId":"\#(blockId)""# }31 let link = #"{"id":"\#(id(201))","fromId":"\#(editorGuideNoteID)","toId":"\#(welcomeNoteID)","sourceKind":"page","targetKind":"page","kind":"link","relType":"related","origin":"system","status":"accepted","createdAt":"2026-11-01T10:00:00.000Z"\#(blockField)}"#32 let suggested = #"{"id":"\#(id(202))","fromId":"\#(welcomeNoteID)","toId":"\#(groceriesNoteID)","sourceKind":"page","targetKind":"page","kind":"relation","relType":"about","origin":"ai","status":"suggested","model":"claude-haiku","rationale":"Les deux notes parlent de la même semaine.","createdAt":"2026-11-02T10:00:00.000Z"}"#33 _ = try? await app.store.applyRemoteEntities([34 RemoteEntity(kind: .edge, id: id(201), rev: 0, json: Data(link.utf8)),35 RemoteEntity(kind: .edge, id: id(202), rev: 0, json: Data(suggested.utf8)),36 ])37 }38}39