Compare commits

...

2 Commits

Author SHA1 Message Date
oschly 77ceb617dd Add app pictures 2026-05-19 19:45:00 +02:00
oschly 5188619eee Improve the code formatting 2026-05-19 19:44:54 +02:00
11 changed files with 139 additions and 28 deletions
+17 -10
View File
@@ -265,20 +265,27 @@ Przykładowy zapis instancji obiektu `NoteMessage` wygląda następująco:
Po tym jak serwer odbierze wysłaną wiadomość, wywoływana jest metoda `session`, która w argumentach przekazuje zakodowane dane, sesję serwera oraz identyfikator użytkownika, który wysłał załączone dane. Po udanym zdekodowaniu danych, wybieramy wszystkich użytkowników, którzy dołączyli do sesji edycji notatki i wysyłamy do nich kopię otrzymanej wiadomości, a serwer dodatkowo wysyła identyczną kopię do warstwy prezentacji.
```swift
#let code_session_did_receive_data_server = [```swift
func session(_ session: MCSession, didReceive data: Data, fromPeer peerID: MCPeerID) {
guard let message = try? JSONDecoder().decode(NoteMessage.self, from: data) else { return }
let otherPeers = session.connectedPeers.filter { $0 != peerID }
let otherPeers = session.connectedPeers.filter { $0 != peerID }
if !otherPeers.isEmpty {
try? session.send(data, toPeers: otherPeers, with: .reliable)
}
if !otherPeers.isEmpty {
try? session.send(data, toPeers: otherPeers, with: .reliable)
}
DispatchQueue.main.async {
self.noteChangesEmitter.send(message)
}
}
```
DispatchQueue.main.async {
self.noteChangesEmitter.send(message)
}
}
```]
#figure(
code_session_did_receive_data_server,
kind: raw,
caption: [Implementacja metody session do otrzymywania danych od innych klientów],
)
== Algorytm rozwiązywania konfliktów
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
+44 -15
View File
@@ -253,29 +253,58 @@
]
}
show raw.where(block: false): it => {
box(
fill: gray-zut.lighten(93%),
inset: (x: 3pt, y: 1pt),
radius: 2pt,
set raw(theme: "zut.tmTheme")
show raw.where(block: true): it => {
let lines = it.lines
block(
fill: gray-zut.lighten(100%),
radius: 4pt,
clip: true,
width: 100%,
)[
#set text(size: 10pt, font: ("Fira Mono", "Courier New"))
#it
#grid(
columns: (auto, 1fr),
inset: (left: 10pt, right: 10pt, top: 2pt, bottom: 2pt),
align: (x, y) => if x == 0 { right + top } else { left + top },
grid.vline(x: 1, stroke: (paint: luma(160), thickness: 1pt)),
..lines
.map(line => (
text(fill: luma(160), size: 9pt)[#line.number],
line.body,
))
.flatten(),
)
]
}
// ── 3.7 PODPISY RYSUNKÓW I TABEL ────────────────────────
set figure(gap: 0.8em)
let raw-fig-counter = counter("raw-fig")
show figure.caption: it => {
set text(size: 9.5pt, font: "Fira Sans")
let kind-label = if it.kind == image { [Rysunek] } else if it.kind == table { [Tabela] } else { [Algorytm] }
[
#text(fill: blue-zut, weight: "bold")[
#kind-label #it.counter.display()
]#it.separator#it.body
]
show heading.where(level: 1): it => {
raw-fig-counter.update(1)
it
}
show figure.where(kind: raw): it => {
// Step the custom counter
raw-fig-counter.step()
// Build the number: heading-index.figure-index
let heading-num = counter(heading.where(level: 1)).display()
let fig-num = raw-fig-counter.display("1")
let full-number = heading-num + "." + fig-num
it.body
v(10pt, weak: true)
align(center, block(width: auto)[
#text(weight: "bold", fill: blue-zut, font: "Fira Sans")[Algorytm #full-number:]
#text(font: "Fira Sans")[#it.caption.body]
])
}
-1
View File
@@ -76,4 +76,3 @@
// Miasto i rok
#move(text(size: 14.2pt)[#placesubmit, #yearsubmit], dx: 8pt, dy: -10pt)
]
+58
View File
@@ -0,0 +1,58 @@
<?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>name</key>
<string>ZUT</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
<dict>
<key>foreground</key><string>#000000</string>
<key>background</key><string>#F0F0F0</string>
</dict>
</dict>
<dict>
<key>name</key><string>Keyword</string>
<key>scope</key>
<string>keyword, storage.type, storage.modifier, keyword.control</string>
<key>settings</key>
<dict>
<key>foreground</key><string>#800080</string>
</dict>
</dict>
<dict>
<key>name</key><string>String</string>
<key>scope</key><string>string</string>
<key>settings</key>
<dict>
<key>foreground</key><string>#008000</string>
</dict>
</dict>
<dict>
<key>name</key><string>Comment</string>
<key>scope</key><string>comment</string>
<key>settings</key>
<dict>
<key>foreground</key><string>#808080</string>
</dict>
</dict>
<dict>
<key>name</key><string>Number</string>
<key>scope</key><string>constant.numeric</string>
<key>settings</key>
<dict>
<key>foreground</key><string>#0000CD</string>
</dict>
</dict>
</array>
</dict>
</plist>