Jekyll2022-04-15T18:53:04+00:00https://fixmbr.github.io//feed.xmlMy very cool KDE blogVery professional blog about my KDE involvement.Second month of KDE SoK 20222022-04-15T18:40:00+00:002022-04-15T18:40:00+00:00https://fixmbr.github.io//kde/sok/2022/04/15/second-month-of-kde-sok<p>Within SoK 2022 project, I worked on an in-app alert queueing system for KDE Connect iOS</p>
<p>Since my <a href="https://fixmbr.github.io/kde/sok/2022/03/06/first-month-of-kde-sok.html">previous blog post</a> I’ve been working on migrating all alerts to the new system, iOS 14 support and modernization of manual IP input screen.</p>
<h2 id="migrating-to-the-new-system">Migrating to the new system</h2>
<p>Alerts in the app are now using the new system. Everything has been migrated and works well (everything, besides one text alert, which I will discuss later in the post).</p>
<h2 id="ios-14-compatibility">iOS 14 compatibility</h2>
<p>There were some issues with queuing working on iOS 14, as iOS 15 introduced a lot of new features in swift. One of the problems was caused by a compatibility layer that allowed one view to have multiple <code class="language-plaintext highlighter-rouge">.alert()</code> modifiers. As of now, there is in fact only one alert in the entire app, so removing the compatibility layer was an obvious solution.</p>
<p>Here is a screen from iOS 14 with working alerts.</p>
<p><img src="https://fixmbr.github.io//assets/ios14.png" alt="ios14 alerts" height="500" /></p>
<h2 id="configure-devices-by-ip-screen">Configure Devices by IP screen</h2>
<p>One of the reasons behins changing the “Configure Devices By IP” screen was to bring it up to modern apple standards. This screen used an outdated alert with text input, which is now gone. In the current version, the entire list of IPs is editable and you can add a new line with a click of a button. It works on the same basis as the native iOS reminders app.</p>
<p>Here is a before and after.</p>
<p><img src="https://fixmbr.github.io//assets/ipview.png" alt="ip view screen" height="500" /></p>
<p>The other reason was that the text alert isn’t supported by the new alert manager :)</p>
<h2 id="other-things">Other things</h2>
<p>Having done all of that I focused on cleaning up the code and adding documentation for the new system.</p>
<h2 id="closing-thoughts">Closing thoughts</h2>
<p>My work for SoK is done. It has been a great opportunity to learn more about iOS development and work with a community-driven open source project. Over the span of the last few months, Swift really grew on me. With the help of my mentors’ work
was going smoothly, and SoK was the thing I needed to finally contribute to the Open Source community.</p>Within SoK 2022 project, I worked on an in-app alert queueing system for KDE Connect iOSFirst month of KDE SoK 20222022-03-06T20:00:00+00:002022-03-06T20:00:00+00:00https://fixmbr.github.io//kde/sok/2022/03/06/first-month-of-kde-sok<p>Hello, This is my first blogpost for KDE SoK 2022.</p>
<h2 id="what-im-working-on">What I’m working on.</h2>
<p>My work centres around alerts in KDE Connect iOS app. As it’s under development, a lot of information is communicated to the user using system alerts. iOS is limited to displaying only one alert at a time and doesn’t have any native system for queuing them.</p>
<p>Sample Alert:</p>
<p><img src="https://fixmbr.github.io//assets/alert.jpg" alt="example alert" height="500" /></p>
<h2 id="progress">Progress</h2>
<p>During last month I learned a lot about swift. Getting familiar with the code took me a while.</p>
<p>I started by implementing a basic alert queue. After consulting it with my Mentors, I got the data types right.</p>
<figure class="highlight"><pre><code class="language-swift" data-lang="swift"><span class="kd">struct</span> <span class="kt">AlertContent</span><span class="p">{</span>
<span class="k">let</span> <span class="nv">title</span><span class="p">:</span> <span class="kt">LocalizedStringKey</span>
<span class="k">let</span> <span class="nv">content</span><span class="p">:</span> <span class="kt">Text</span><span class="p">?</span>
<span class="k">let</span> <span class="nv">buttons</span><span class="p">:</span> <span class="p">()</span> <span class="o">-></span> <span class="kt">AlertActionBuilder</span><span class="o">.</span><span class="kt">Buttons</span>
<span class="p">}</span></code></pre></figure>
<p>Buttons also got me stuck as they are created using a custom iOS 14 compatibility view. But eventually, I wrapped my head around this too.</p>
<p>Before my changes, every message was a separate alert. Now there is a single alert with content that changes dynamically.</p>
<figure class="highlight"><pre><code class="language-swift" data-lang="swift"><span class="o">.</span><span class="nf">alert</span><span class="p">(</span><span class="n">alertManager</span><span class="o">.</span><span class="n">currentAlert</span><span class="o">.</span><span class="n">title</span><span class="p">,</span><span class="nv">isPresented</span><span class="p">:</span> <span class="n">alertsBind</span><span class="p">,</span>
<span class="nv">actions</span><span class="p">:</span> <span class="n">alertManager</span><span class="o">.</span><span class="n">currentAlert</span><span class="o">.</span><span class="n">buttons</span><span class="p">){</span>
<span class="n">alertManager</span><span class="o">.</span><span class="n">currentAlert</span><span class="o">.</span><span class="n">content</span>
<span class="p">}</span></code></pre></figure>
<p>It uses a custom binding <code class="language-plaintext highlighter-rouge">alertsBind</code> that detects when the alert is dismissed and, if available, pushes the next alert in.</p>
<p>Overall I spent some time figuring out some of swift’s quirks. It differs from languages that I’m more familiar with, like Python / JS / C++.</p>
<p>The result can be seen here - queued alerts being shown one after another.</p>
<p><img src="https://fixmbr.github.io//assets/alerts.gif" alt="example alert" /></p>
<h2 id="next-steps">Next steps</h2>
<ul>
<li>Switch alerts in app to use this new system.</li>
<li>Clean up the code</li>
</ul>
<p>You can see my current progress in the <a href="https://invent.kde.org/network/kdeconnect-ios/-/merge_requests/42">merge request</a> I created.</p>Hello, This is my first blogpost for KDE SoK 2022.