More icon update and a couple of small issues (#252)

* update logo icon

* faviconBackground color

* prevent bottom bar from being visible after switching size class when search is active

* changelog

* search result list always top when appearing

* search result list view color and tableview style

* search result tableview cells

* detail text label

* tableview separator insets
This commit is contained in:
ChrisLi 2020-05-16 11:45:22 -04:00 committed by GitHub
parent 8b9fcee263
commit d7e523bf40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 222 additions and 138 deletions

View File

@ -7,6 +7,10 @@ Speed improvements and more options for search snippets:
- First Sentence: from first paragraph, further extract the first sentence with iOS natural language processing engine
- Matches: highlight search term matches in the article (slowest, what we offer before)
New:
- updated app icon
Bug fixes:
- fix: swipe back gesture was not working due to conflict with gesture to show sidebar

View File

@ -12,7 +12,6 @@ import SwiftyUserDefaults
extension SearchOperation {
var results: [SearchResult] { get { __results as? [SearchResult] ?? [] } }
static private let boldFont = NSUIFont.boldSystemFont(ofSize: 12.0)
open override func main() {
let mode = SearchResultSnippetMode(rawValue: Defaults[.searchResultSnippetMode]) ?? SearchResultSnippetMode.disabled

View File

@ -16,7 +16,7 @@ class Parser {
private let document: Document
private lazy var firstParagraph: Element? = try? document.body()?.getElementsByTag("p").first()
static private let boldFont = NSUIFont.boldSystemFont(ofSize: 12.0)
static private let boldFont = NSUIFont.systemFont(ofSize: 12.0, weight: .medium)
init(document: Document) {
self.document = document

View File

@ -1,16 +1,16 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "Kiwix_icon_transparent.pdf"
"filename" : "Kiwix_logo_v3.pdf",
"idiom" : "universal"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template",
"preserves-vector-representation" : true
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}
}

View File

@ -1,71 +0,0 @@
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="763.54071" height="763.54071" id="svg2" version="1.0" inkscape:version="0.47pre4 r22446" sodipodi:docname="Kiwix_icon.svg" inkscape:output_extension="org.inkscape.output.svg.inkscape" sodipodi:version="0.32">
<defs id="defs4">
<linearGradient id="linearGradient3648">
<stop offset="0" id="stop3650" style="stop-color:#ffffff;stop-opacity:1"/>
<stop offset="1" id="stop3652" style="stop-color:#adadad;stop-opacity:1"/>
</linearGradient>
<linearGradient id="linearGradient3640">
<stop offset="0" id="stop3642" style="stop-color:#3d3d3d;stop-opacity:1"/>
<stop offset="1" id="stop3644" style="stop-color:#cccccc;stop-opacity:0"/>
</linearGradient>
<linearGradient id="linearGradient3708">
<stop offset="0" id="stop3710" style="stop-color:#646464;stop-opacity:1"/>
<stop offset="1" id="stop3712" style="stop-color:#000000;stop-opacity:0"/>
</linearGradient>
<linearGradient inkscape:collect="always" id="linearGradient3687">
<stop offset="0" id="stop3689" style="stop-color:#000000;stop-opacity:1"/>
<stop offset="1" id="stop3691" style="stop-color:#000000;stop-opacity:0"/>
</linearGradient>
<inkscape:perspective sodipodi:type="inkscape:persp3d" inkscape:vp_x="0 : 526.18109 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_z="744.09448 : 526.18109 : 1" inkscape:persp3d-origin="372.04724 : 350.78739 : 1" id="perspective10"/>
<inkscape:perspective id="perspective3678" inkscape:persp3d-origin="0.5 : 0.33333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d"/>
<inkscape:perspective id="perspective3724" inkscape:persp3d-origin="0.5 : 0.33333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d"/>
<inkscape:perspective id="perspective3756" inkscape:persp3d-origin="0.5 : 0.33333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d"/>
<inkscape:perspective id="perspective3814" inkscape:persp3d-origin="0.5 : 0.33333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d"/>
<inkscape:perspective id="perspective3836" inkscape:persp3d-origin="0.5 : 0.33333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d"/>
<inkscape:perspective id="perspective3858" inkscape:persp3d-origin="0.5 : 0.33333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d"/>
<inkscape:perspective id="perspective3917" inkscape:persp3d-origin="0.5 : 0.33333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d"/>
<inkscape:perspective id="perspective3917-8" inkscape:persp3d-origin="0.5 : 0.33333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d"/>
<inkscape:perspective id="perspective4051" inkscape:persp3d-origin="0.5 : 0.33333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d"/>
<inkscape:perspective id="perspective4074" inkscape:persp3d-origin="0.5 : 0.33333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d"/>
<inkscape:perspective id="perspective4096" inkscape:persp3d-origin="0.5 : 0.33333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d"/>
<inkscape:perspective id="perspective4120" inkscape:persp3d-origin="0.5 : 0.33333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d"/>
<inkscape:perspective id="perspective4142" inkscape:persp3d-origin="0.5 : 0.33333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d"/>
<inkscape:perspective id="perspective4171" inkscape:persp3d-origin="0.5 : 0.33333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d"/>
<inkscape:perspective id="perspective4197" inkscape:persp3d-origin="0.5 : 0.33333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d"/>
<inkscape:perspective id="perspective4197-7" inkscape:persp3d-origin="0.5 : 0.33333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d"/>
<inkscape:perspective id="perspective4244" inkscape:persp3d-origin="0.5 : 0.33333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d"/>
<inkscape:perspective id="perspective4281" inkscape:persp3d-origin="0.5 : 0.33333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d"/>
<inkscape:perspective id="perspective4320" inkscape:persp3d-origin="0.5 : 0.33333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d"/>
<inkscape:perspective id="perspective4344" inkscape:persp3d-origin="0.5 : 0.33333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d"/>
<inkscape:perspective id="perspective4383" inkscape:persp3d-origin="0.5 : 0.33333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d"/>
<inkscape:perspective id="perspective2435" inkscape:persp3d-origin="372.04724 : 350.78739 : 1" inkscape:vp_z="744.09448 : 526.18109 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 526.18109 : 1" sodipodi:type="inkscape:persp3d"/>
<inkscape:perspective id="perspective3623" inkscape:persp3d-origin="0.5 : 0.33333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d"/>
<inkscape:perspective id="perspective3661" inkscape:persp3d-origin="0.5 : 0.33333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d"/>
<linearGradient inkscape:collect="always" xlink:href="#linearGradient3687" id="linearGradient3693" x1="-500.52509" y1="1106.8184" x2="-500.52509" y2="722.66022" gradientUnits="userSpaceOnUse"/>
<linearGradient inkscape:collect="always" xlink:href="#linearGradient3687" id="linearGradient3695" gradientUnits="userSpaceOnUse" x1="-500.52509" y1="1106.8184" x2="-500.52509" y2="722.66022"/>
<linearGradient inkscape:collect="always" xlink:href="#linearGradient3687" id="linearGradient3697" gradientUnits="userSpaceOnUse" x1="-500.52509" y1="1106.8184" x2="-500.52509" y2="722.66022"/>
<linearGradient inkscape:collect="always" xlink:href="#linearGradient3687" id="linearGradient3699" gradientUnits="userSpaceOnUse" x1="-500.52509" y1="1106.8184" x2="-500.52509" y2="722.66022"/>
<linearGradient inkscape:collect="always" xlink:href="#linearGradient3687" id="linearGradient3701" gradientUnits="userSpaceOnUse" x1="-500.52509" y1="1106.8184" x2="-500.52509" y2="722.66022"/>
</defs>
<sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.4400477" inkscape:cx="765.01137" inkscape:cy="468.02909" inkscape:document-units="px" inkscape:current-layer="g3209" showgrid="false" inkscape:window-width="1280" inkscape:window-height="950" inkscape:window-x="0" inkscape:window-y="25" inkscape:window-maximized="1"/>
<metadata id="metadata7">
<rdf:RDF>
<cc:Work rdf:about="">
<dc:format>
image/svg+xml
</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<dc:title/>
</cc:Work>
</rdf:RDF>
</metadata>
<g inkscape:label="Capa 1" inkscape:groupmode="layer" id="layer1" transform="translate(3739.1853,-41.383514)">
<g id="g3885" transform="matrix(25,0,0,25,90820.575,-9012.8355)" fill="#808080"/>
<g id="g3209">
<path id="path3204" d="m-3085.1983 553.74734c0 63.78595-51.0804 115.49422-114.0847 115.49422-63.0042 0-114.0822-51.70827-114.0822-115.49422 0-63.78574 51.078-115.49376 114.0822-115.49376 63.0043 0 114.0847 51.70802 114.0847 115.49376z" style="fill-opacity:1;fill:#000"/>
<path sodipodi:nodetypes="cccccccccccccccccccccccccccc" id="path3202" d="m-3499.7177 140.36479c-161.5217 2.35967-284.5793 180.38224-126.8046 341.99599l42.0522 110.93491c6.9794 25.35905-16.7046 81.16438-6.2181 96.7456 12.0784-23.92672 15.1194-58.1351 31.088-62.07824 28.0815 19.87357 69.6214 26.61551 93.1001 52.24248 8.7721-24.84423-26.8104-37.53228-56.6132-51.75895 27.8509 4.65813 47.1211-10.46714 67.741 13.86695 3.0387-12.31012-0.8075-21.72309-8.8367-29.3461l-12.5976-17.25299c23.2894 12.39094 81.2592 12.31386 94.5722 34.02222 5.152-41.08066-43.5957-27.0502-66.5944-39.34326 14.9233 1.85232 29.7497-5.58569 44.5068-3.54744-3.9545-11.5234-10.747-16.50832-20.7813-15.64056-79.1297 18.89929-84.6994-115.02939-83.6104-153.0195 106.2215-45.15179 213.495 35.84535 298.9397-41.92295 27.9778-41.87649 143.4536 67.4941 179.0039 160.11415 53.1569-22.52125-98.4853-169.62429-142.5168-209.45435 23.001-61.25648-66.62-150.42858-147.5885-111.09653-56.9707-54.20552-120.418-76.31471-178.8423-75.46143zm-42.8666 331.03132c7.7455-0.14014 14.0142 4.0653 15.2187 12.73828l17.1799 82.23395c-9.2591 2.66988-13.2875 11.9518-11.4533 28.70095 3.9224-4.63711 5.5352-12.55958 14.5611-9.99716l21.2728 27.41131c-72.3438 5.66862-77.9182-35.28801-90.4882-103.03368 3.8324-25.14672 20.8-37.77358 33.709-38.05365z" style="fill-opacity:1;fill:#000"/>
<path transform="matrix(2.0593305,0,0,2.3234417,-4182.9265,106.09335)" d="m463.91255 78.701393a15.404826 14.520943 0 1 1-30.80966 0 15.404826 14.520943 0 1 1 30.80966 0z" sodipodi:ry="14.520943" sodipodi:rx="15.404826" sodipodi:cy="78.701393" sodipodi:cx="448.50772" id="path4159" sodipodi:type="arc" style="fill-opacity:1;fill:#fff"/>
<path transform="matrix(1.3531424,0,0,1.5266833,-3852.2505,190.26722)" d="m463.91255 78.701393a15.404826 14.520943 0 1 1-30.80966 0 15.404826 14.520943 0 1 1 30.80966 0z" sodipodi:ry="14.520943" sodipodi:rx="15.404826" sodipodi:cy="78.701393" sodipodi:cx="448.50772" id="path4159-1" sodipodi:type="arc" style="fill-opacity:1;fill:#000"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 11 KiB

View File

@ -0,0 +1,70 @@
%PDF-1.4
%µí®û
4 0 obj
<< /Length 5 0 R
/Filter /FlateDecode
>>
stream
xœmUKn9 Ü÷)t<>(â_:FŽ0xÀ$ {13÷¦HvÛFp?R"EV•( ÿŽòx½_ÿ\k®%‡Ébüùç¿?Ç÷¿ÖøùßµCfØ0|VèxÛcË0µ!c3OÁ…Ÿ<16>ä1rb2Ö_#H&…_C¶NÕ3K_AÒ½hø¶Ú*nSX3dáTŽÁÛ§_Q;éPr #<23>tÎ`±Jõª1(¸Â߬Ôça6ŽÀnâ5=k"[ÕÎ78²|Q,äV¡ªÅ¸S½ÚsvyèÞ¡H6s\åp¶r$""U<>±Ý!ÝŽqT]$»Àd~² lšŠþ”+9™UYf<7'ïò,èF——4Agâð·AûÌ<C3BB>ÊÛq¥'<27>riõ—O[,™þÇó6Taq´
áÕÇ^Ù„°W¶p<C2B6>=
uÅa»Py™ÉY€•Å•‰Ëc>Ö<>»îYsÙ ÝÝfk„Ý µÛ“éØtš}nb-ñQÂàLAg?¼Z<C2BC>„êXÊX×Áäà‡Š¾[n¼ïød¥Dâ‰J¢T¢zg?É3²¥²Ê Ö±ä…#CýÈöÅ=¶Óö¦®íÃqdEÃ)Çó6”±Øvƒi÷ *ÒTSÅy“¬Xѵ[6øö º¨¤ÒRèµ/ð‡$4±<Kº†·ÖÚ<C396>µfH@RZâ2°¢ŠhqYŠÛm»žDèú«ùñXèï;¸×¤ÉCï{þœz;>êú IDR<†CRyJ÷pîš$'üÅK…ˆsÍÀÇ cœ¤Ú<1F>H_F÷¦ý±ÛjøóZ˜Òð:ô.f#LQg)̼_F=]k¶\Uÿ.<2E>¥«F2<U l¿9Ï –ö½\Ó-ª¨ì8,Ü•I¡Õ¼™ wJâ‰!Ò€+2<«ÔeF66òYŠÁ¡¥:!=UI;vœº¾VüÛ#ó¿.‡~rä àé}¤'»È¹“gúê'@rr'0gUµ<55> D=Q×çoµfŠÒËck©7C<1E>I£ŒW­õUÐØýLiÝüA;â= ó¥ÓÙýDÞ6÷ˆ~}x®|J~˜Ž\]Sf<53>gMÛ9 >Ú}<Î4žhü¾¾d¯%éížrÉÚ¤‡Èïxþ㿯×ÿæ§•ò
endstream
endobj
5 0 obj
894
endobj
3 0 obj
<<
/ExtGState <<
/a0 << /CA 1 /ca 1 >>
>>
>>
endobj
2 0 obj
<< /Type /Page % 1
/Parent 1 0 R
/MediaBox [ 0 0 942 942 ]
/Contents 4 0 R
/Group <<
/Type /Group
/S /Transparency
/I true
/CS /DeviceRGB
>>
/Resources 3 0 R
>>
endobj
1 0 obj
<< /Type /Pages
/Kids [ 2 0 R ]
/Count 1
>>
endobj
6 0 obj
<< /Producer (cairo 1.16.0 (https://cairographics.org))
/CreationDate (D:20200513220958Z)
>>
endobj
7 0 obj
<< /Type /Catalog
/Pages 1 0 R
>>
endobj
xref
0 8
0000000000 65535 f
0000001298 00000 n
0000001080 00000 n
0000001008 00000 n
0000000015 00000 n
0000000986 00000 n
0000001363 00000 n
0000001474 00000 n
trailer
<< /Size 8
/Root 7 0 R
/Info 6 0 R
>>
startxref
1526
%%EOF

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.1.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1"
id="Layer_1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1256 1256"
style="enable-background:new 0 0 1256 1256;" xml:space="preserve">
<style type="text/css">
.st0{fill:#010101;}
</style>
<path class="st0" d="M1165,764.1c-8.3-36.4-68.5-141.3-191.6-234.4c-22.5-17.1-42.8-31.3-59.7-42.6
c24.6-105.3-103.3-232.3-228.1-172.5C596,230.3,496.1,195.9,404.2,197.3c-243.3,3.4-431,256.9-229.1,498.8c0.1,0.1,0.2,0.2,0.4,0.4
c3.1,3.7,6.3,7.4,9.5,11.1c13.1,15.7,21.8,29.6,29.2,54.1L274.4,959h-21.3c-19.6,0-35.6,15.9-35.6,35.6h80.8l135.8,64.2
c8.4-17.8,0.8-39-16.9-47.3l-35.6-16.8H484c0-19.6-15.9-35.6-35.6-35.6h-92.8c-16.2,0-30.6-10.6-35.3-26.1l-47.7-156.7
c-11.9-41.2,15.4-68.1,41.1-71.3c23.4-2.9,35.2,12.2,46.2,48.8l42.4,139h-21.3c-19.6,0-35.6,15.9-35.6,35.6h80.8l135.8,64.2
c8.4-17.8,0.8-39-16.9-47.3l-35.6-16.8h75.1c7.6,12.9,16.9,25.1,28,36.1c70,70,183.7,70,253.7,0s70-183.7,0-253.7s-183.7-70-253.7,0
c-49.2,49.2-63.9,120-43.9,182h-85c-16.2,0-30.6-10.6-35.3-26.1L378,635.4l12-6.4c167.1-70.1,345.8,55.1,470.2-65.2
c0.3-0.3,0.6-0.6,0.8-0.8c15.4-14,30.8-28.3,76.3,0.2c49,30.7,157.1,110.8,206.1,247.8C1143.5,811,1173.2,800.4,1165,764.1z
M821.2,460.6c-0.4-18.7-15.6-33.7-34.5-33.7c-19,0-34.5,15.4-34.5,34.5c0,10.4,4.6,19.6,11.8,25.9c-25-4.8-43.8-26.6-43.8-52.9
c0-29.8,24.1-53.9,53.9-53.9c29.8,0,53.9,24.1,53.9,53.9C828,443.9,825.5,452.8,821.2,460.6z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,31 @@
{
"colors" : [
{
"color" : {
"color-space" : "extended-gray",
"components" : {
"alpha" : "0.000",
"white" : "1.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"platform" : "ios",
"reference" : "systemFillColor"
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -29,6 +29,8 @@ class ContentViewController: UIViewController, UISearchControllerDelegate, WebVi
private(set) lazy var welcomeController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "WelcomeController") as! WelcomeController
private(set) lazy var libraryController = LibraryController()
// MARK:- Initialization
init() {
self.searchResultsController = SearchResultsController()
self.searchController = UISearchController(searchResultsController: self.searchResultsController)

View File

@ -44,7 +44,9 @@ class LibraryCategoryController: UIViewController, UITableViewDataSource, UITabl
tableView.delegate = self
tableView.dataSource = self
tableView.register(TableViewCell.self, forCellReuseIdentifier: "Cell")
tableView.separatorInset = UIEdgeInsets(top: 0, left: tableView.separatorInset.left + 42, bottom: 0, right: 0)
tableView.cellLayoutMarginsFollowReadableWidth = true
tableView.separatorInsetReference = .fromAutomaticInsets
tableView.separatorInset = UIEdgeInsets(top: 0, left: 40, bottom: 0, right: 0)
}
override func viewDidLoad() {

View File

@ -56,7 +56,8 @@ class LibraryMasterController: UIViewController, UIDocumentPickerDelegate, UITab
tableView.dataSource = self
tableView.register(TableViewCell.self, forCellReuseIdentifier: "Cell")
tableView.register(TableViewCell.self, forCellReuseIdentifier: "CategoryCell")
tableView.separatorInset = UIEdgeInsets(top: 0, left: tableView.separatorInset.left + 42, bottom: 0, right: 0)
tableView.separatorInsetReference = .fromAutomaticInsets
tableView.separatorInset = UIEdgeInsets(top: 0, left: 40, bottom: 0, right: 0)
}
override func viewDidLoad() {

View File

@ -76,6 +76,7 @@ class LibraryZimFileDetailController: UIViewController, UITableViewDataSource, U
view = tableView
tableView.delegate = self
tableView.dataSource = self
tableView.cellLayoutMarginsFollowReadableWidth = true
tableView.register(UIRightDetailTableViewCell.self, forCellReuseIdentifier: "Cell")
tableView.register(UIActionTableViewCell.self, forCellReuseIdentifier: "ActionCell")
}

View File

@ -72,7 +72,7 @@ class RootController: UISplitViewController, UISplitViewControllerDelegate, UIGe
func primaryViewController(forCollapsing splitViewController: UISplitViewController) -> UIViewController? {
contentViewController.configureToolbar(isGrouped: false)
let navigationController = UINavigationController(rootViewController: contentViewController)
navigationController.isToolbarHidden = false
navigationController.isToolbarHidden = contentViewController.searchController.isActive
return navigationController
}
@ -80,7 +80,7 @@ class RootController: UISplitViewController, UISplitViewControllerDelegate, UIGe
separateSecondaryFrom primaryViewController: UIViewController) -> UIViewController? {
contentViewController.configureToolbar(isGrouped: true)
let navigationController = UINavigationController(rootViewController: contentViewController)
navigationController.isToolbarHidden = false
navigationController.isToolbarHidden = contentViewController.searchController.isActive
return navigationController
}

View File

@ -55,6 +55,8 @@ class SearchFilterController: UIViewController, UITableViewDelegate, UITableView
tableView.cellLayoutMarginsFollowReadableWidth = true
tableView.register(TableViewCell.self, forCellReuseIdentifier: "Cell")
tableView.register(RecentSearchTableViewCell.self, forCellReuseIdentifier: "RecentSearchCell")
tableView.separatorInsetReference = .fromAutomaticInsets
tableView.separatorInset = UIEdgeInsets(top: 0, left: 40, bottom: 0, right: 0)
}
override func viewWillAppear(_ animated: Bool) {

View File

@ -48,7 +48,11 @@ class SearchResultsController: UIViewController, UISearchResultsUpdating {
override func loadView() {
view = UIView()
view.backgroundColor = .groupTableViewBackground
if #available(iOS 13.0, *) {
view.backgroundColor = .systemBackground
} else {
view.backgroundColor = .white
}
if #available(iOS 13, *) {} else {
/* Prevent SearchResultsController view from being automatically hidden by UISearchController */

View File

@ -16,21 +16,13 @@ class SearchResultsListController: UITableViewController {
private(set) var results = [SearchResult]()
private weak var clearResultTimer: Timer?
init() {
super.init(style: .grouped)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
tableView.estimatedRowHeight = 44
tableView.rowHeight = UITableView.automaticDimension
tableView.cellLayoutMarginsFollowReadableWidth = true
tableView.register(TableViewCell.self, forCellReuseIdentifier: "Cell")
tableView.register(SearchResultTableViewCell.self, forCellReuseIdentifier: "Cell")
tableView.keyboardDismissMode = .onDrag
tableView.separatorInsetReference = .fromAutomaticInsets
tableView.separatorInset = UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 0)
}
func update(searchText: String, zimFileIDs: Set<String>, results: [SearchResult]) {
@ -38,6 +30,9 @@ class SearchResultsListController: UITableViewController {
self.zimFileIDs = zimFileIDs
self.results = results
tableView.reloadData()
if !results.isEmpty {
tableView.scrollToRow(at: IndexPath(row: 0, section: 0), at: .top, animated: false)
}
}
func update(recentSearchText newSearchText: String) {
@ -75,7 +70,7 @@ class SearchResultsListController: UITableViewController {
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! TableViewCell
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! SearchResultTableViewCell
let result = results[indexPath.row]
cell.titleLabel.text = result.title
@ -86,9 +81,9 @@ class SearchResultsListController: UITableViewController {
cell.thumbImageView.contentMode = .scaleAspectFit
} catch {}
cell.titleLabel.font = UIFont.systemFont(ofSize: 16, weight: .medium)
if let snippet = result.snippet {
cell.detailLabel.attributedText = snippet
cell.detailLabel.numberOfLines = 4
}
return cell
@ -101,12 +96,4 @@ class SearchResultsListController: UITableViewController {
content.searchController.dismiss(animated: true)
content.searchController.isActive = false
}
override func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
if results[indexPath.row].snippet != nil {
return traitCollection.horizontalSizeClass == .regular ? 120 : 190
} else {
return 44
}
}
}

View File

@ -13,7 +13,7 @@ class TableViewCell: UITableViewCell {
let detailLabel = UILabel()
let thumbImageView = UIImageView()
let thumbImageBackgroundView = UIView()
private let textStackView = UIStackView()
fileprivate let textStackView = UIStackView()
private var configuredConstraints = false
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
@ -36,7 +36,41 @@ class TableViewCell: UITableViewCell {
override func updateConstraints() {
defer { super.updateConstraints() }
guard !configuredConstraints else { return }
configureConstraints()
configuredConstraints = true
}
fileprivate func configure() {
titleLabel.setContentHuggingPriority(UILayoutPriority(250), for: .vertical)
detailLabel.setContentHuggingPriority(UILayoutPriority(251), for: .vertical)
titleLabel.setContentCompressionResistancePriority(UILayoutPriority(750), for: .vertical)
detailLabel.setContentCompressionResistancePriority(UILayoutPriority(749), for: .vertical)
detailLabel.numberOfLines = 4
detailLabel.font = UIFont.systemFont(ofSize: 12, weight: .regular)
thumbImageView.clipsToBounds = true
thumbImageView.layer.cornerRadius = 4
thumbImageBackgroundView.clipsToBounds = true
thumbImageBackgroundView.layer.cornerRadius = 6
if #available(iOS 13.0, *) {
thumbImageBackgroundView.backgroundColor = UIColor(named: "faviconBackground")
} else {
thumbImageBackgroundView.backgroundColor = .groupTableViewBackground
}
textStackView.axis = .vertical
textStackView.alignment = .leading
textStackView.distribution = .fill
textStackView.addArrangedSubview(titleLabel)
textStackView.addArrangedSubview(detailLabel)
[thumbImageBackgroundView, thumbImageView, textStackView].forEach({
$0.translatesAutoresizingMaskIntoConstraints = false
contentView.addSubview($0)
})
setNeedsUpdateConstraints()
}
fileprivate func configureConstraints() {
NSLayoutConstraint.activate([
thumbImageView.heightAnchor.constraint(equalToConstant: 32),
thumbImageView.widthAnchor.constraint(equalToConstant: 32),
@ -49,42 +83,40 @@ class TableViewCell: UITableViewCell {
textStackView.leftAnchor.constraint(equalTo: thumbImageView.rightAnchor, constant: 8),
textStackView.rightAnchor.constraint(equalTo: contentView.readableContentGuide.rightAnchor),
textStackView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 6),
textStackView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -6)])
textStackView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -6),
])
let heightConstraint = contentView.heightAnchor.constraint(greaterThanOrEqualToConstant: 44)
heightConstraint.priority = .defaultHigh
heightConstraint.isActive = true
configuredConstraints = true
}
}
class SearchResultTableViewCell: TableViewCell {
private let thumbImageCornerRadius: CGFloat = 4
private let thumbImageBackgroundViewCornerRadius: CGFloat = 6
override fileprivate func configure() {
super.configure()
thumbImageView.layer.cornerRadius = 3
thumbImageBackgroundView.layer.cornerRadius = 3
}
private func configure() {
titleLabel.setContentHuggingPriority(UILayoutPriority(250), for: .vertical)
detailLabel.setContentHuggingPriority(UILayoutPriority(251), for: .vertical)
titleLabel.setContentCompressionResistancePriority(UILayoutPriority(750), for: .vertical)
detailLabel.setContentCompressionResistancePriority(UILayoutPriority(749), for: .vertical)
detailLabel.numberOfLines = 0
detailLabel.font = UIFont.systemFont(ofSize: 12, weight: UIFont.Weight.regular)
thumbImageView.clipsToBounds = true
thumbImageView.layer.cornerRadius = 4
if #available(iOS 13.0, *) {
thumbImageBackgroundView.backgroundColor = .quaternarySystemFill
} else {
thumbImageBackgroundView.backgroundColor = .groupTableViewBackground
}
thumbImageBackgroundView.clipsToBounds = true
thumbImageBackgroundView.layer.cornerRadius = 6
textStackView.axis = .vertical
textStackView.alignment = .leading
textStackView.distribution = .fill
textStackView.addArrangedSubview(titleLabel)
textStackView.addArrangedSubview(detailLabel)
[thumbImageBackgroundView, thumbImageView, textStackView].forEach({
$0.translatesAutoresizingMaskIntoConstraints = false
contentView.addSubview($0)
})
setNeedsUpdateConstraints()
override fileprivate func configureConstraints() {
NSLayoutConstraint.activate([
thumbImageView.leftAnchor.constraint(equalTo: contentView.readableContentGuide.leftAnchor, constant: -4),
thumbImageView.centerYAnchor.constraint(equalTo: titleLabel.centerYAnchor),
thumbImageView.widthAnchor.constraint(equalToConstant: 18),
thumbImageView.heightAnchor.constraint(equalToConstant: 18),
thumbImageBackgroundView.heightAnchor.constraint(equalToConstant: 20),
thumbImageBackgroundView.widthAnchor.constraint(equalToConstant: 20),
thumbImageBackgroundView.centerXAnchor.constraint(equalTo: thumbImageView.centerXAnchor),
thumbImageBackgroundView.centerYAnchor.constraint(equalTo: thumbImageView.centerYAnchor),
textStackView.leftAnchor.constraint(equalTo: thumbImageView.rightAnchor, constant: 6),
textStackView.rightAnchor.constraint(equalTo: contentView.readableContentGuide.rightAnchor),
textStackView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 6),
textStackView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -6),
contentView.heightAnchor.constraint(greaterThanOrEqualToConstant: 44),
])
}
}