#40: Add OnboardingSplashScreen from EI.

Update SplashScreen for EXI
This commit is contained in:
Doug
2022-06-13 17:28:36 +01:00
committed by Doug
parent 272fc5000b
commit 8dc5359a44
32 changed files with 5891 additions and 104 deletions
@@ -1,38 +0,0 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "240",
"green" : "240",
"red" : "240"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "100",
"green" : "100",
"red" : "100"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
@@ -0,0 +1,25 @@
{
"images" : [
{
"filename" : "OnboardingSplashScreenPage1.pdf",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "OnboardingSplashScreenPage1-Dark.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true
}
}
@@ -0,0 +1,872 @@
%PDF-1.7
1 0 obj
<< /Type /XObject
/Length 2 0 R
/Group << /Type /Group
/S /Transparency
>>
/Subtype /Form
/Resources << >>
/BBox [ 0.000000 0.000000 300.000000 300.000000 ]
>>
stream
q
1.000000 0.000000 -0.000000 1.000000 116.000000 142.000000 cm
0.083333 0.083333 0.083333 scn
0.000000 6.500000 m
0.000000 10.089850 2.910149 13.000000 6.500000 13.000000 c
87.500000 13.000000 l
91.089851 13.000000 94.000000 10.089850 94.000000 6.500000 c
94.000000 6.500000 l
94.000000 2.910150 91.089851 0.000000 87.500000 0.000000 c
6.500002 0.000000 l
2.910151 0.000000 0.000000 2.910150 0.000000 6.500000 c
0.000000 6.500000 l
h
f
n
Q
q
1.000000 0.000000 -0.000000 1.000000 116.000000 142.000000 cm
1.000000 0.505882 0.176471 scn
0.000000 6.500000 m
0.000000 10.089850 2.910149 13.000000 6.500000 13.000000 c
87.500000 13.000000 l
91.089851 13.000000 94.000000 10.089850 94.000000 6.500000 c
94.000000 6.500000 l
94.000000 2.910150 91.089851 0.000000 87.500000 0.000000 c
6.500002 0.000000 l
2.910151 0.000000 0.000000 2.910150 0.000000 6.500000 c
0.000000 6.500000 l
h
f
n
Q
endstream
endobj
2 0 obj
882
endobj
3 0 obj
<< /Type /XObject
/Length 4 0 R
/Group << /Type /Group
/S /Transparency
>>
/Subtype /Form
/Resources << >>
/BBox [ 0.000000 0.000000 300.000000 300.000000 ]
>>
stream
q
1.000000 0.000000 -0.000000 1.000000 127.119080 85.000000 cm
0.083333 0.083333 0.083333 scn
0.000000 6.500000 m
0.000000 10.089850 2.910149 13.000000 6.500000 13.000000 c
119.500000 13.000000 l
123.089851 13.000000 126.000000 10.089850 126.000000 6.500000 c
126.000000 6.500000 l
126.000000 2.910150 123.089851 0.000000 119.500000 0.000000 c
6.499998 0.000000 l
2.910147 0.000000 0.000000 2.910150 0.000000 6.500000 c
0.000000 6.500000 l
h
f
n
Q
q
1.000000 0.000000 -0.000000 1.000000 127.119080 85.000000 cm
0.454902 0.819608 0.172549 scn
0.000000 6.500000 m
0.000000 10.089850 2.910149 13.000000 6.500000 13.000000 c
119.500000 13.000000 l
123.089851 13.000000 126.000000 10.089850 126.000000 6.500000 c
126.000000 6.500000 l
126.000000 2.910150 123.089851 0.000000 119.500000 0.000000 c
6.499998 0.000000 l
2.910147 0.000000 0.000000 2.910150 0.000000 6.500000 c
0.000000 6.500000 l
h
f
n
Q
endstream
endobj
4 0 obj
896
endobj
5 0 obj
<< /Type /XObject
/Length 6 0 R
/Group << /Type /Group
/S /Transparency
>>
/Subtype /Form
/Resources << >>
/BBox [ 0.000000 0.000000 300.000000 300.000000 ]
>>
stream
q
1.000000 0.000000 -0.000000 1.000000 102.000000 207.000000 cm
0.083333 0.083333 0.083333 scn
0.000000 6.500000 m
0.000000 10.089850 2.910149 13.000000 6.500000 13.000000 c
119.500000 13.000000 l
123.089851 13.000000 126.000000 10.089850 126.000000 6.500000 c
126.000000 6.500000 l
126.000000 2.910150 123.089851 0.000000 119.500000 0.000000 c
6.499998 0.000000 l
2.910147 0.000000 0.000000 2.910150 0.000000 6.500000 c
0.000000 6.500000 l
h
f
n
Q
q
1.000000 0.000000 -0.000000 1.000000 102.000000 207.000000 cm
0.360784 0.337255 0.960784 scn
0.000000 6.500000 m
0.000000 10.089850 2.910149 13.000000 6.500000 13.000000 c
119.500000 13.000000 l
123.089851 13.000000 126.000000 10.089850 126.000000 6.500000 c
126.000000 6.500000 l
126.000000 2.910150 123.089851 0.000000 119.500000 0.000000 c
6.499998 0.000000 l
2.910147 0.000000 0.000000 2.910150 0.000000 6.500000 c
0.000000 6.500000 l
h
f
n
Q
endstream
endobj
6 0 obj
898
endobj
7 0 obj
<< /Type /XObject
/Length 8 0 R
/Group << /Type /Group
/S /Transparency
>>
/Subtype /Form
/Resources << /XObject << /X2 1 0 R
/X3 3 0 R
/X1 5 0 R
>>
/ExtGState << /E6 << /ca 0.400000 >>
/E4 << /ca 0.500000 >>
/E2 << /ca 0.500000 >>
/E5 << /ca 0.700000 >>
/E3 << /ca 0.700000 >>
/E1 << /ca 0.700000 >>
>>
>>
/BBox [ 0.000000 0.000000 300.000000 300.000000 ]
>>
stream
/DeviceRGB CS
/DeviceRGB cs
q
1.000000 0.000000 -0.000000 1.000000 51.000000 183.000000 cm
0.054167 0.054167 0.054167 scn
38.000000 19.000000 m
38.000000 8.506590 29.493410 0.000000 19.000000 0.000000 c
8.506590 0.000000 0.000000 8.506590 0.000000 19.000000 c
0.000000 29.493410 8.506590 38.000000 19.000000 38.000000 c
29.493410 38.000000 38.000000 29.493410 38.000000 19.000000 c
h
f
n
Q
q
/E1 gs
1.000000 0.000000 -0.000000 1.000000 51.000000 183.000000 cm
0.835294 0.847059 0.968627 scn
38.000000 19.000000 m
38.000000 8.506590 29.493410 0.000000 19.000000 0.000000 c
8.506590 0.000000 0.000000 8.506590 0.000000 19.000000 c
0.000000 29.493410 8.506590 38.000000 19.000000 38.000000 c
29.493410 38.000000 38.000000 29.493410 38.000000 19.000000 c
h
f
n
Q
q
/E2 gs
/X1 Do
Q
q
1.000000 0.000000 -0.000000 1.000000 102.000000 184.000000 cm
0.054167 0.054167 0.054167 scn
0.000000 6.500000 m
0.000000 10.089850 2.910149 13.000000 6.500000 13.000000 c
141.500000 13.000000 l
145.089859 13.000000 148.000000 10.089850 148.000000 6.500000 c
148.000000 6.500000 l
148.000000 2.910150 145.089844 0.000000 141.500000 0.000000 c
6.499999 0.000000 l
2.910148 0.000000 0.000000 2.910150 0.000000 6.500000 c
0.000000 6.500000 l
h
f
n
Q
q
1.000000 0.000000 -0.000000 1.000000 102.000000 184.000000 cm
0.556863 0.600000 0.643137 scn
0.000000 6.500000 m
0.000000 10.089850 2.910149 13.000000 6.500000 13.000000 c
141.500000 13.000000 l
145.089859 13.000000 148.000000 10.089850 148.000000 6.500000 c
148.000000 6.500000 l
148.000000 2.910150 145.089844 0.000000 141.500000 0.000000 c
6.499999 0.000000 l
2.910148 0.000000 0.000000 2.910150 0.000000 6.500000 c
0.000000 6.500000 l
h
f
n
Q
q
1.000000 0.000000 -0.000000 1.000000 60.000000 119.000000 cm
0.054167 0.054167 0.054167 scn
38.000000 19.000000 m
38.000000 8.506590 29.493410 0.000000 19.000000 0.000000 c
8.506590 0.000000 0.000000 8.506590 0.000000 19.000000 c
0.000000 29.493410 8.506590 38.000000 19.000000 38.000000 c
29.493410 38.000000 38.000000 29.493410 38.000000 19.000000 c
h
f
n
Q
q
/E3 gs
1.000000 0.000000 -0.000000 1.000000 60.000000 119.000000 cm
0.964706 0.878431 0.811765 scn
38.000000 19.000000 m
38.000000 8.506590 29.493410 0.000000 19.000000 0.000000 c
8.506590 0.000000 0.000000 8.506590 0.000000 19.000000 c
0.000000 29.493410 8.506590 38.000000 19.000000 38.000000 c
29.493410 38.000000 38.000000 29.493410 38.000000 19.000000 c
h
f
n
Q
q
/E4 gs
/X2 Do
Q
q
1.000000 0.000000 -0.000000 1.000000 116.000000 121.000000 cm
0.054167 0.054167 0.054167 scn
0.000000 6.500000 m
0.000000 10.089850 2.910149 13.000000 6.500000 13.000000 c
56.500000 13.000000 l
60.089848 13.000000 63.000000 10.089850 63.000000 6.500000 c
63.000000 6.500000 l
63.000000 2.910150 60.089851 0.000000 56.500000 0.000000 c
6.500001 0.000000 l
2.910151 0.000000 0.000000 2.910150 0.000000 6.500000 c
0.000000 6.500000 l
h
f
n
Q
q
1.000000 0.000000 -0.000000 1.000000 116.000000 121.000000 cm
0.556863 0.600000 0.643137 scn
0.000000 6.500000 m
0.000000 10.089850 2.910149 13.000000 6.500000 13.000000 c
56.500000 13.000000 l
60.089848 13.000000 63.000000 10.089850 63.000000 6.500000 c
63.000000 6.500000 l
63.000000 2.910150 60.089851 0.000000 56.500000 0.000000 c
6.500001 0.000000 l
2.910151 0.000000 0.000000 2.910150 0.000000 6.500000 c
0.000000 6.500000 l
h
f
n
Q
q
1.000000 0.000000 -0.000000 1.000000 189.000000 121.000000 cm
0.054167 0.054167 0.054167 scn
0.000000 6.500000 m
0.000000 10.089850 2.910149 13.000000 6.500000 13.000000 c
57.500000 13.000000 l
61.089851 13.000000 64.000000 10.089850 64.000000 6.500000 c
64.000000 6.500000 l
64.000000 2.910150 61.089851 0.000000 57.500000 0.000000 c
6.500000 0.000000 l
2.910149 0.000000 0.000000 2.910150 0.000000 6.500000 c
0.000000 6.500000 l
h
f
n
Q
q
1.000000 0.000000 -0.000000 1.000000 189.000000 121.000000 cm
0.556863 0.600000 0.643137 scn
0.000000 6.500000 m
0.000000 10.089850 2.910149 13.000000 6.500000 13.000000 c
57.500000 13.000000 l
61.089851 13.000000 64.000000 10.089850 64.000000 6.500000 c
64.000000 6.500000 l
64.000000 2.910150 61.089851 0.000000 57.500000 0.000000 c
6.500000 0.000000 l
2.910149 0.000000 0.000000 2.910150 0.000000 6.500000 c
0.000000 6.500000 l
h
f
n
Q
q
1.000000 0.000000 -0.000000 1.000000 69.999939 60.000000 cm
1.000000 1.000000 1.000000 scn
38.000000 19.000000 m
38.000000 8.506590 29.493410 0.000000 19.000000 0.000000 c
8.506590 0.000000 0.000000 8.506590 0.000000 19.000000 c
0.000000 29.493410 8.506590 38.000000 19.000000 38.000000 c
29.493410 38.000000 38.000000 29.493410 38.000000 19.000000 c
h
f
n
Q
q
1.000000 0.000000 -0.000000 1.000000 69.999939 60.000000 cm
0.054167 0.054167 0.054167 scn
38.000000 19.000000 m
38.000000 8.506590 29.493410 0.000000 19.000000 0.000000 c
8.506590 0.000000 0.000000 8.506590 0.000000 19.000000 c
0.000000 29.493410 8.506590 38.000000 19.000000 38.000000 c
29.493410 38.000000 38.000000 29.493410 38.000000 19.000000 c
h
f
n
Q
q
/E5 gs
1.000000 0.000000 -0.000000 1.000000 69.999939 60.000000 cm
0.894118 0.964706 0.894118 scn
38.000000 19.000000 m
38.000000 8.506590 29.493410 0.000000 19.000000 0.000000 c
8.506590 0.000000 0.000000 8.506590 0.000000 19.000000 c
0.000000 29.493410 8.506590 38.000000 19.000000 38.000000 c
29.493410 38.000000 38.000000 29.493410 38.000000 19.000000 c
h
f
n
Q
q
/E6 gs
/X3 Do
Q
q
1.000000 0.000000 -0.000000 1.000000 115.999939 72.000000 cm
0.000000 0.000000 0.000000 scn
0.000000 9.000000 m
0.000000 13.970562 4.029438 18.000000 9.000000 18.000000 c
23.000000 18.000000 l
27.970562 18.000000 32.000000 13.970562 32.000000 9.000000 c
32.000000 9.000000 l
32.000000 4.029437 27.970562 0.000000 23.000000 0.000000 c
9.000000 0.000000 l
4.029438 0.000000 0.000000 4.029437 0.000000 9.000000 c
0.000000 9.000000 l
h
f
n
Q
q
1.000000 0.000000 -0.000000 1.000000 123.366089 77.722778 cm
0.557143 0.600000 0.642857 scn
4.910892 3.273924 m
4.910892 1.917818 3.811552 0.818478 2.455446 0.818478 c
1.099341 0.818478 0.000000 1.917818 0.000000 3.273924 c
0.000000 4.630030 1.099341 5.729370 2.455446 5.729370 c
3.811552 5.729370 4.910892 4.630030 4.910892 3.273924 c
h
11.458750 2.455442 m
11.458750 1.099336 10.359408 -0.000004 9.003304 -0.000004 c
7.647198 -0.000004 6.547857 1.099336 6.547857 2.455442 c
6.547857 3.811547 7.647198 4.910888 9.003304 4.910888 c
10.359408 4.910888 11.458750 3.811547 11.458750 2.455442 c
h
15.551160 -0.000004 m
16.907265 -0.000004 18.006607 1.099336 18.006607 2.455442 c
18.006607 3.811547 16.907265 4.910888 15.551160 4.910888 c
14.195054 4.910888 13.095714 3.811547 13.095714 2.455442 c
13.095714 1.099336 14.195054 -0.000004 15.551160 -0.000004 c
h
f*
n
Q
endstream
endobj
8 0 obj
6601
endobj
9 0 obj
<< /Length 10 0 R
/Range [ 0.000000 1.000000 0.000000 1.000000 0.000000 1.000000 ]
/Domain [ 0.000000 1.000000 ]
/FunctionType 4
>>
stream
{ 0.890196 exch 0.909804 exch 0.941176 exch dup 0.885417 gt { exch pop exch pop exch pop dup 0.885417 sub -1.163636 mul 0.890196 add exch dup 0.885417 sub -1.163636 mul 0.909804 add exch dup 0.885417 sub -1.197861 mul 0.941176 add exch } if dup 1.000000 gt { exch pop exch pop exch pop 0.756863 exch 0.776471 exch 0.803922 exch } if pop }
endstream
endobj
10 0 obj
339
endobj
11 0 obj
<< /Length 12 0 R
/Range [ 0.000000 1.000000 0.000000 1.000000 0.000000 1.000000 ]
/Domain [ 0.000000 1.000000 ]
/FunctionType 4
>>
stream
{ 0.560784 exch 0.592157 exch 0.639216 exch dup 0.436121 gt { exch pop exch pop exch pop dup 0.436121 sub -1.132947 mul 0.560784 add exch dup 0.436121 sub -1.040270 mul 0.592157 add exch dup 0.436121 sub -1.080743 mul 0.639216 add exch } if dup 0.797508 gt { exch pop exch pop exch pop 0.151351 exch 0.216216 exch 0.248649 exch } if pop }
endstream
endobj
12 0 obj
339
endobj
13 0 obj
<< /Length 14 0 R
/Range [ 0.000000 1.000000 0.000000 1.000000 0.000000 1.000000 ]
/Domain [ 0.000000 1.000000 ]
/FunctionType 4
>>
stream
{ 0.211765 exch 0.545098 exch 0.839216 exch dup 0.000000 gt { exch pop exch pop exch pop dup 0.000000 sub 4.324034 mul 0.211765 add exch dup 0.000000 sub -0.215126 mul 0.545098 add exch dup 0.000000 sub -3.635630 mul 0.839216 add exch } if dup 0.182292 gt { exch pop exch pop exch pop dup 0.182292 sub -0.472174 mul 1.000000 add exch dup 0.182292 sub -0.944349 mul 0.505882 add exch dup 0.182292 sub 1.454296 mul 0.176471 add exch } if dup 0.389925 gt { exch pop exch pop exch pop dup 0.389925 sub -4.864687 mul 0.901961 add exch dup 0.389925 sub 2.143034 mul 0.309804 add exch dup 0.389925 sub 0.150013 mul 0.478431 add exch } if dup 0.572917 gt { exch pop exch pop exch pop dup 0.572917 sub 0.810860 mul 0.011765 add exch dup 0.572917 sub 0.289593 mul 0.701961 add exch dup 0.572917 sub 1.312820 mul 0.505882 add exch } if dup 0.776042 gt { exch pop exch pop exch pop dup 0.776042 sub 2.223803 mul 0.176471 add exch dup 0.776042 sub -2.363885 mul 0.760784 add exch dup 0.776042 sub -0.507798 mul 0.772549 add exch } if dup 1.000000 gt { exch pop exch pop exch pop 0.674510 exch 0.231373 exch 0.658824 exch } if pop }
endstream
endobj
14 0 obj
1119
endobj
15 0 obj
<< /Length 16 0 R
/Range [ 0.000000 1.000000 ]
/Domain [ 0.000000 1.000000 ]
/FunctionType 4
>>
stream
{ 0.000000 exch dup 0.885417 gt { exch pop dup 0.885417 sub 8.727274 mul 0.000000 add exch } if dup 1.000000 gt { exch pop 1.000000 exch } if pop }
endstream
endobj
16 0 obj
148
endobj
17 0 obj
<< /BBox [ 0.000000 0.000000 300.000000 300.000000 ]
/Resources << /Pattern << /P1 << /Matrix [ -127.403831 248.798080 -248.798080 -127.403831 347.956726 70.673119 ]
/Shading << /Coords [ 0.500000 0.500000 0.000000 0.500000 0.500000 0.500000 ]
/ColorSpace /DeviceGray
/Function 15 0 R
/Domain [ 0.000000 1.000000 ]
/ShadingType 3
/Extend [ true true ]
>>
/PatternType 2
/Type /Pattern
>> >> >>
/Subtype /Form
/Length 18 0 R
/Group << /Type /Group
/S /Transparency
/CS /DeviceGray
>>
/Type /XObject
>>
stream
/DeviceGray CS
/DeviceGray cs
1.000000 0.000000 -0.000000 1.000000 25.000000 25.000000 cm
250.000000 125.000000 m
250.000000 55.964401 194.035599 0.000000 125.000000 0.000000 c
55.964405 0.000000 0.000000 55.964401 0.000000 125.000000 c
0.000000 194.035599 55.964405 250.000000 125.000000 250.000000 c
194.035599 250.000000 250.000000 194.035599 250.000000 125.000000 c
h
/Pattern cs
/P1 scn
f
n
endstream
endobj
18 0 obj
396
endobj
19 0 obj
<< /Type /XObject
/Length 20 0 R
/Group << /Type /Group
/S /Transparency
>>
/Subtype /Form
/Resources << /Pattern << /P3 << /Matrix [ -127.403831 248.798080 -248.798080 -127.403831 347.956726 70.673119 ]
/Shading << /Coords [ 0.500000 0.500000 0.000000 0.500000 0.500000 0.500000 ]
/ColorSpace /DeviceRGB
/Function 9 0 R
/Domain [ 0.000000 1.000000 ]
/ShadingType 3
/Extend [ true true ]
>>
/PatternType 2
/Type /Pattern
>>
/P2 << /Matrix [ 105.999977 -284.000061 361.623688 134.972168 -115.811859 256.513977 ]
/Shading << /Coords [ 0.500000 0.500000 0.000000 0.500000 0.500000 0.500000 ]
/ColorSpace /DeviceRGB
/Function 11 0 R
/Domain [ 0.000000 1.000000 ]
/ShadingType 3
/Extend [ true true ]
>>
/PatternType 2
/Type /Pattern
>>
/P1 << /Matrix [ 256.865387 -254.788467 254.788467 256.865387 -268.954285 56.983734 ]
/Shading << /Coords [ 0.000000 0.000000 1.000000 0.000000 ]
/ColorSpace /DeviceRGB
/Function 13 0 R
/Domain [ 0.000000 1.000000 ]
/ShadingType 2
/Extend [ true true ]
>>
/PatternType 2
/Type /Pattern
>>
>>
/ExtGState << /E4 << /SMask << /Type /Mask
/G 17 0 R
/S /Luminosity
>>
/Type /ExtGState
>>
/E2 << /ca 0.500000 >>
/E3 << /ca 0.400000 >>
/E1 << /ca 0.200000 >>
>>
>>
/BBox [ 0.000000 0.000000 300.000000 300.000000 ]
>>
stream
q
1.000000 0.000000 -0.000000 1.000000 25.000000 25.000000 cm
0.098039 0.113725 0.129412 scn
250.000000 125.000000 m
250.000000 55.964401 194.035599 0.000000 125.000000 0.000000 c
55.964405 0.000000 0.000000 55.964401 0.000000 125.000000 c
0.000000 194.035599 55.964405 250.000000 125.000000 250.000000 c
194.035599 250.000000 250.000000 194.035599 250.000000 125.000000 c
h
f
n
Q
q
/E1 gs
1.000000 0.000000 -0.000000 1.000000 25.000000 25.000000 cm
/Pattern cs
/P1 scn
250.000000 125.000000 m
250.000000 55.964401 194.035599 0.000000 125.000000 0.000000 c
55.964405 0.000000 0.000000 55.964401 0.000000 125.000000 c
0.000000 194.035599 55.964405 250.000000 125.000000 250.000000 c
194.035599 250.000000 250.000000 194.035599 250.000000 125.000000 c
h
f
n
Q
q
/E2 gs
1.000000 0.000000 -0.000000 1.000000 25.000000 25.000000 cm
/Pattern cs
/P2 scn
250.000000 125.000000 m
250.000000 55.964401 194.035599 0.000000 125.000000 0.000000 c
55.964405 0.000000 0.000000 55.964401 0.000000 125.000000 c
0.000000 194.035599 55.964405 250.000000 125.000000 250.000000 c
194.035599 250.000000 250.000000 194.035599 250.000000 125.000000 c
h
f
n
Q
q
/E3 gs
/E4 gs
1.000000 0.000000 -0.000000 1.000000 25.000000 25.000000 cm
/Pattern cs
/P3 scn
250.000000 125.000000 m
250.000000 55.964401 194.035599 0.000000 125.000000 0.000000 c
55.964405 0.000000 0.000000 55.964401 0.000000 125.000000 c
0.000000 194.035599 55.964405 250.000000 125.000000 250.000000 c
194.035599 250.000000 250.000000 194.035599 250.000000 125.000000 c
h
f
n
Q
endstream
endobj
20 0 obj
1519
endobj
21 0 obj
<< /Length 22 0 R
/Range [ 0.000000 1.000000 0.000000 1.000000 0.000000 1.000000 ]
/Domain [ 0.000000 1.000000 ]
/FunctionType 4
>>
stream
{ 1.000000 exch 1.000000 exch 1.000000 exch dup 0.258514 gt { exch pop exch pop exch pop dup 0.258514 sub 0.000000 mul 1.000000 add exch dup 0.258514 sub 0.000000 mul 1.000000 add exch dup 0.258514 sub 0.000000 mul 1.000000 add exch } if dup 0.942462 gt { exch pop exch pop exch pop 1.000000 exch 1.000000 exch 1.000000 exch } if pop }
endstream
endobj
22 0 obj
336
endobj
23 0 obj
<< /Length 24 0 R
/Range [ 0.000000 1.000000 ]
/Domain [ 0.000000 1.000000 ]
/FunctionType 4
>>
stream
{ 1.000000 exch dup 0.258514 gt { exch pop dup 0.258514 sub -1.462099 mul 1.000000 add exch } if dup 0.942462 gt { exch pop 0.000000 exch } if pop }
endstream
endobj
24 0 obj
149
endobj
25 0 obj
<< /BBox [ 0.000000 0.000000 300.000000 300.000000 ]
/Resources << /Pattern << /P1 << /Matrix [ 18.000000 -296.999969 296.999969 18.000000 -16.499969 313.000000 ]
/Shading << /Coords [ 0.500000 0.500000 0.000000 0.500000 0.500000 0.500000 ]
/ColorSpace /DeviceGray
/Function 23 0 R
/Domain [ 0.000000 1.000000 ]
/ShadingType 3
/Extend [ true true ]
>>
/PatternType 2
/Type /Pattern
>> >> >>
/Subtype /Form
/Length 26 0 R
/Group << /Type /Group
/S /Transparency
/CS /DeviceGray
>>
/Type /XObject
>>
stream
/DeviceGray CS
/DeviceGray cs
1.000000 0.000000 -0.000000 1.000000 25.000000 25.000000 cm
250.000000 125.000000 m
250.000000 55.964401 194.035599 0.000000 125.000000 0.000000 c
55.964405 0.000000 0.000000 55.964401 0.000000 125.000000 c
0.000000 194.035599 55.964405 250.000000 125.000000 250.000000 c
194.035599 250.000000 250.000000 194.035599 250.000000 125.000000 c
h
/Pattern cs
/P1 scn
f
n
endstream
endobj
26 0 obj
396
endobj
27 0 obj
<< /Type /XObject
/Length 28 0 R
/Group << /Type /Group
/S /Transparency
>>
/Subtype /Form
/Resources << /Pattern << /P1 << /Matrix [ 18.000000 -296.999969 296.999969 18.000000 -16.499969 313.000000 ]
/Shading << /Coords [ 0.500000 0.500000 0.000000 0.500000 0.500000 0.500000 ]
/ColorSpace /DeviceRGB
/Function 21 0 R
/Domain [ 0.000000 1.000000 ]
/ShadingType 3
/Extend [ true true ]
>>
/PatternType 2
/Type /Pattern
>> >>
/ExtGState << /E1 << /SMask << /Type /Mask
/G 25 0 R
/S /Luminosity
>>
/Type /ExtGState
>> >>
>>
/BBox [ 0.000000 0.000000 300.000000 300.000000 ]
>>
stream
/DeviceRGB CS
/DeviceRGB cs
q
/E1 gs
1.000000 0.000000 -0.000000 1.000000 25.000000 25.000000 cm
/Pattern cs
/P1 scn
250.000000 125.000000 m
250.000000 55.964401 194.035599 0.000000 125.000000 0.000000 c
55.964405 0.000000 0.000000 55.964401 0.000000 125.000000 c
0.000000 194.035599 55.964405 250.000000 125.000000 250.000000 c
194.035599 250.000000 250.000000 194.035599 250.000000 125.000000 c
h
f
n
Q
endstream
endobj
28 0 obj
405
endobj
29 0 obj
<< /XObject << /X2 7 0 R
/X1 19 0 R
>>
/ExtGState << /E2 << /SMask << /Type /Mask
/G 27 0 R
/S /Alpha
>>
/Type /ExtGState
>>
/E1 << /ca 0.600000 >>
>>
>>
endobj
30 0 obj
<< /Length 31 0 R >>
stream
/DeviceRGB CS
/DeviceRGB cs
q
/E1 gs
/X1 Do
Q
q
/E2 gs
/X2 Do
Q
endstream
endobj
31 0 obj
64
endobj
32 0 obj
<< /Annots []
/Type /Page
/MediaBox [ 0.000000 0.000000 300.000000 300.000000 ]
/Resources 29 0 R
/Contents 30 0 R
/Parent 33 0 R
>>
endobj
33 0 obj
<< /Kids [ 32 0 R ]
/Count 1
/Type /Pages
>>
endobj
34 0 obj
<< /Pages 33 0 R
/Type /Catalog
>>
endobj
xref
0 35
0000000000 65535 f
0000000010 00000 n
0000001142 00000 n
0000001164 00000 n
0000002310 00000 n
0000002332 00000 n
0000003480 00000 n
0000003502 00000 n
0000010873 00000 n
0000010896 00000 n
0000011420 00000 n
0000011443 00000 n
0000011968 00000 n
0000011991 00000 n
0000013296 00000 n
0000013320 00000 n
0000013618 00000 n
0000013641 00000 n
0000015090 00000 n
0000015113 00000 n
0000019782 00000 n
0000019806 00000 n
0000020328 00000 n
0000020351 00000 n
0000020650 00000 n
0000020673 00000 n
0000022119 00000 n
0000022142 00000 n
0000023918 00000 n
0000023941 00000 n
0000024341 00000 n
0000024463 00000 n
0000024485 00000 n
0000024664 00000 n
0000024740 00000 n
trailer
<< /ID [ (some) (id) ]
/Root 34 0 R
/Size 35
>>
startxref
24801
%%EOF
@@ -0,0 +1,25 @@
{
"images" : [
{
"filename" : "OnboardingSplashScreenPage2.pdf",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "OnboardingSplashScreenPage2-Dark.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true
}
}
@@ -0,0 +1,25 @@
{
"images" : [
{
"filename" : "OnboardingSplashScreenPage3.pdf",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "OnboardingSplashScreenPage3-Dark.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true
}
}
@@ -0,0 +1,25 @@
{
"images" : [
{
"filename" : "OnboardingSplashScreenPage4.pdf",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "OnboardingSplashScreenPage4-Dark.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true
}
}
+4 -52
View File
@@ -10,8 +10,6 @@
#endif
// Deprecated typealiases
@available(*, deprecated, renamed: "ColorAsset.Color", message: "This typealias will be removed in SwiftGen 7.0")
internal typealias AssetColorTypeAlias = ColorAsset.Color
@available(*, deprecated, renamed: "ImageAsset.Image", message: "This typealias will be removed in SwiftGen 7.0")
internal typealias AssetImageTypeAlias = ImageAsset.Image
@@ -21,10 +19,11 @@ internal typealias AssetImageTypeAlias = ImageAsset.Image
// swiftlint:disable identifier_name line_length nesting type_body_length type_name
internal enum Asset {
internal enum Colors {
internal static let codeBlockBackground = ColorAsset(name: "Colors/CodeBlockBackground")
}
internal enum Images {
internal static let splashScreenPage1 = ImageAsset(name: "Images/Splash Screen Page 1")
internal static let splashScreenPage2 = ImageAsset(name: "Images/Splash Screen Page 2")
internal static let splashScreenPage3 = ImageAsset(name: "Images/Splash Screen Page 3")
internal static let splashScreenPage4 = ImageAsset(name: "Images/Splash Screen Page 4")
internal static let appLogo = ImageAsset(name: "Images/app-logo")
internal static let closeCircle = ImageAsset(name: "Images/close_circle")
internal static let timelineComposerSendMessage = ImageAsset(name: "Images/timelineComposerSendMessage")
@@ -35,53 +34,6 @@ internal enum Asset {
// MARK: - Implementation Details
internal final class ColorAsset {
internal fileprivate(set) var name: String
#if os(macOS)
internal typealias Color = NSColor
#elseif os(iOS) || os(tvOS) || os(watchOS)
internal typealias Color = UIColor
#endif
@available(iOS 11.0, tvOS 11.0, watchOS 4.0, macOS 10.13, *)
internal private(set) lazy var color: Color = {
guard let color = Color(asset: self) else {
fatalError("Unable to load color asset named \(name).")
}
return color
}()
#if os(iOS) || os(tvOS)
@available(iOS 11.0, tvOS 11.0, *)
internal func color(compatibleWith traitCollection: UITraitCollection) -> Color {
let bundle = BundleToken.bundle
guard let color = Color(named: name, in: bundle, compatibleWith: traitCollection) else {
fatalError("Unable to load color asset named \(name).")
}
return color
}
#endif
fileprivate init(name: String) {
self.name = name
}
}
internal extension ColorAsset.Color {
@available(iOS 11.0, tvOS 11.0, watchOS 4.0, macOS 10.13, *)
convenience init?(asset: ColorAsset) {
let bundle = BundleToken.bundle
#if os(iOS) || os(tvOS)
self.init(named: asset.name, in: bundle, compatibleWith: nil)
#elseif os(macOS)
self.init(named: NSColor.Name(asset.name), bundle: bundle)
#elseif os(watchOS)
self.init(named: asset.name)
#endif
}
}
internal struct ImageAsset {
internal fileprivate(set) var name: String
@@ -140,7 +140,7 @@ struct AttributedStringBuilder: AttributedStringBuilderProtocol {
attributedString.enumerateAttribute(.backgroundColor, in: .init(location: 0, length: attributedString.length), options: []) { value, range, _ in
if let value = value as? UIColor,
value == temporaryCodeBlockMarkingColor {
attributedString.addAttribute(.backgroundColor, value: Asset.Colors.codeBlockBackground.color as Any, range: range)
attributedString.addAttribute(.backgroundColor, value: UIColor.element.quinaryContent as Any, range: range)
}
}
}
@@ -0,0 +1,26 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import SwiftUI
/// A SwiftUI `PreferenceKey` for `CGRect` values such as a view's frame.
struct FramePreferenceKey: PreferenceKey {
static var defaultValue: CGRect = .zero
static func reduce(value: inout CGRect, nextValue: () -> CGRect) {
value = nextValue()
}
}
@@ -0,0 +1,42 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
import SwiftUI
/// Used to calculate the frame of a view.
///
/// Useful in situations as with `ZStack` where you might want to layout views using alignment guides.
/// ```
/// @State private var frame: CGRect = CGRect.zero
/// ...
/// SomeView()
/// .background(ViewFrameReader(frame: $frame))
/// ```
struct ViewFrameReader: View {
@Binding var frame: CGRect
var body: some View {
GeometryReader { geometry in
Color.clear
.preference(key: FramePreferenceKey.self,
value: geometry.frame(in: .local))
}
.onPreferenceChange(FramePreferenceKey.self) {
frame = $0
}
}
}
@@ -0,0 +1,39 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import SwiftUI
/// Metrics used across the entire onboarding flow.
struct OnboardingMetrics {
static let maxContentWidth: CGFloat = 600
static let maxContentHeight: CGFloat = 750
/// The padding used between the top of the main content and the navigation bar.
static let topPaddingToNavigationBar: CGFloat = 16
/// The padding used between the footer and the bottom of the view.
static let actionButtonBottomPadding: CGFloat = 24
/// The width/height used for the main icon shown in most of the screens.
static let iconSize: CGFloat = 90
/// The padding used to the top of the view for breaker screens that don't have a navigation bar.
static let breakerScreenTopPadding: CGFloat = 80
static let breakerScreenIconBottomPadding: CGFloat = 42
/// The height to use for top/bottom spacers to pad the views to fit the `maxContentHeight`.
static func spacerHeight(in geometry: GeometryProxy) -> CGFloat {
max(0, (geometry.size.height - maxContentHeight) / 2)
}
}
@@ -0,0 +1,29 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import SwiftUI
extension String {
func tinting(_ character: Character, color: Color = .accentColor) -> AttributedString {
var string = AttributedString(self)
let characterView = string.characters
for index in characterView.indices where characterView[index] == character {
string[index..<characterView.index(after: index)].foregroundColor = color
}
return string
}
}
@@ -0,0 +1,87 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import SwiftUI
protocol SplashScreenCoordinatorProtocol: Coordinator, Presentable {
var callback: ((SplashScreenCoordinatorAction) -> Void)? { get set }
}
final class SplashScreenCoordinator: SplashScreenCoordinatorProtocol {
// MARK: - Properties
// MARK: Private
private let splashScreenHostingController: UIViewController
private var splashScreenViewModel: SplashScreenViewModelProtocol
private var indicatorPresenter: UserIndicatorTypePresenterProtocol
private var loadingIndicator: UserIndicator?
// MARK: Public
// Must be used only internally
var childCoordinators: [Coordinator] = []
var callback: ((SplashScreenCoordinatorAction) -> Void)?
// MARK: - Setup
init() {
let viewModel = SplashScreenViewModel()
let view = SplashScreen(viewModel: viewModel.context)
splashScreenViewModel = viewModel
splashScreenHostingController = UIHostingController(rootView: view)
indicatorPresenter = UserIndicatorTypePresenter(presentingViewController: splashScreenHostingController)
}
// MARK: - Public
func start() {
MXLog.debug("[SplashScreenCoordinator] did start.")
splashScreenViewModel.callback = { [weak self] action in
MXLog.debug("[SplashScreenCoordinator] SplashScreenViewModel did complete with result: \(action).")
guard let self = self else { return }
switch action {
case .login:
self.callback?(.login)
case .register:
self.callback?(.register)
}
}
}
func toPresentable() -> UIViewController {
return splashScreenHostingController
}
/// Stops any ongoing activities in the coordinator.
func stop() {
stopLoading()
}
// MARK: - Private
/// Show an activity indicator whilst loading.
private func startLoading() {
loadingIndicator = indicatorPresenter.present(.loading(label: ElementL10n.loading, isInteractionBlocking: true))
}
/// Hide the currently displayed activity indicator.
private func stopLoading() {
loadingIndicator = nil
}
}
@@ -0,0 +1,97 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import SwiftUI
// MARK: - Coordinator
enum SplashScreenCoordinatorAction {
case register
case login
}
/// The content displayed in a single splash screen page.
struct SplashScreenPageContent {
let title: AttributedString
let message: String
let image: ImageAsset
let gradient: Gradient
}
// MARK: View model
enum SplashScreenViewModelAction {
case register
case login
}
// MARK: View
struct SplashScreenViewState: BindableState, CustomDebugStringConvertible {
private enum Constants {
static let gradientColors = [
Color(red: 0.95, green: 0.98, blue: 0.96),
Color(red: 0.89, green: 0.96, blue: 0.97),
Color(red: 0.95, green: 0.89, blue: 0.97),
Color(red: 0.81, green: 0.95, blue: 0.91),
Color(red: 0.95, green: 0.98, blue: 0.96)
]
}
/// An array containing all content of the carousel pages
let content: [SplashScreenPageContent]
var bindings: SplashScreenBindings
/// Custom debug description to reduce noise in the logs.
var debugDescription: String {
"SplashScreenViewState at page \(bindings.pageIndex)."
}
init() {
// The pun doesn't translate, so we only use it for English.
let locale = Locale.current
let page4Title = locale.identifier.hasPrefix("en") ? "Cut the slack from teams." : ElementL10n.ftueAuthCarouselWorkplaceTitle
self.content = [
SplashScreenPageContent(title: ElementL10n.ftueAuthCarouselSecureTitle.tinting("."),
message: ElementL10n.ftueAuthCarouselSecureBody,
image: Asset.Images.splashScreenPage1,
gradient: Gradient(colors: [Constants.gradientColors[0], Constants.gradientColors[1]])),
SplashScreenPageContent(title: ElementL10n.ftueAuthCarouselControlTitle.tinting("."),
message: ElementL10n.ftueAuthCarouselControlBody,
image: Asset.Images.splashScreenPage2,
gradient: Gradient(colors: [Constants.gradientColors[1], Constants.gradientColors[2]])),
SplashScreenPageContent(title: ElementL10n.ftueAuthCarouselEncryptedTitle.tinting("."),
message: ElementL10n.ftueAuthCarouselEncryptedBody,
image: Asset.Images.splashScreenPage3,
gradient: Gradient(colors: [Constants.gradientColors[2], Constants.gradientColors[3]])),
SplashScreenPageContent(title: page4Title.tinting("."),
message: ElementL10n.ftueAuthCarouselWorkplaceBody(ElementInfoPlist.cfBundleName),
image: Asset.Images.splashScreenPage4,
gradient: Gradient(colors: [Constants.gradientColors[3], Constants.gradientColors[4]]))
]
self.bindings = SplashScreenBindings()
}
}
struct SplashScreenBindings {
var pageIndex = 0
}
enum SplashScreenViewAction {
case register
case login
}
@@ -0,0 +1,56 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import SwiftUI
import Combine
typealias SplashScreenViewModelType = StateStoreViewModel<SplashScreenViewState, SplashScreenViewAction>
class SplashScreenViewModel: SplashScreenViewModelType, SplashScreenViewModelProtocol {
// MARK: - Properties
// MARK: Private
// MARK: Public
var callback: ((SplashScreenViewModelAction) -> Void)?
// MARK: - Setup
init() {
super.init(initialViewState: SplashScreenViewState())
}
// MARK: - Public
override func process(viewAction: SplashScreenViewAction) async {
switch viewAction {
case .register:
register()
case .login:
login()
}
}
private func register() {
callback?(.register)
}
private func login() {
callback?(.login)
}
}
@@ -0,0 +1,23 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
@MainActor
protocol SplashScreenViewModelProtocol {
var callback: ((SplashScreenViewModelAction) -> Void)? { get set }
var context: SplashScreenViewModelType.Context { get }
}
@@ -0,0 +1,210 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import SwiftUI
/// The splash screen shown at the beginning of the onboarding flow.
struct SplashScreen: View {
// MARK: - Properties
// MARK: Private
@Environment(\.layoutDirection) private var layoutDirection
private var isLeftToRight: Bool { layoutDirection == .leftToRight }
private var pageCount: Int { viewModel.viewState.content.count }
/// The dimensions of the stack with the action buttons and page indicator.
@State private var overlayFrame: CGRect = .zero
/// A timer to automatically animate the pages.
@State private var pageTimer: Timer?
/// The amount of offset to apply when a drag gesture is in progress.
@State private var dragOffset: CGFloat = .zero
// MARK: Public
@ObservedObject var viewModel: SplashScreenViewModel.Context
var body: some View {
GeometryReader { geometry in
ZStack(alignment: .leading) {
// The main content of the carousel
HStack(spacing: 0) {
// Add a hidden page at the start of the carousel duplicating the content of the last page
SplashScreenPage(content: viewModel.viewState.content[pageCount - 1],
overlayHeight: overlayFrame.height + geometry.safeAreaInsets.bottom)
.frame(width: geometry.size.width)
.tag(-1)
ForEach(0..<pageCount, id: \.self) { index in
SplashScreenPage(content: viewModel.viewState.content[index],
overlayHeight: overlayFrame.height + geometry.safeAreaInsets.bottom)
.frame(width: geometry.size.width)
.tag(index)
}
}
.offset(x: (CGFloat(viewModel.pageIndex + 1) * -geometry.size.width) + dragOffset)
.gesture(
DragGesture()
.onChanged(handleDragGestureChange)
.onEnded { handleDragGestureEnded($0, viewSize: geometry.size) }
)
overlay
.frame(width: geometry.size.width)
}
}
.background(Color.element.background.ignoresSafeArea())
.navigationBarHidden(true)
.onAppear(perform: startTimer)
.onDisappear(perform: stopTimer)
}
/// The only part of the UI that isn't inside of the carousel.
var overlay: some View {
VStack(spacing: 50) {
Color.clear
Color.clear
VStack {
SplashScreenPageIndicator(pageCount: pageCount,
pageIndex: viewModel.pageIndex)
Spacer()
buttons
.padding(.horizontal, 16)
.frame(maxWidth: OnboardingMetrics.maxContentWidth)
Spacer()
}
.background(ViewFrameReader(frame: $overlayFrame))
}
}
/// The main action buttons.
var buttons: some View {
VStack(spacing: 12) {
Button { viewModel.send(viewAction: .login) } label: {
Text(ElementL10n.loginSplashSubmit)
}
.buttonStyle(.elementAction(.xLarge))
}
}
// MARK: - Animation
func nextPage() {
// Wrap back round to the first page index when reaching the end.
viewModel.pageIndex = (viewModel.pageIndex + 1) % viewModel.viewState.content.count
}
func previousPage() {
// Prevent the hidden page at index -1 from being shown.
viewModel.pageIndex = max(0, (viewModel.pageIndex - 1))
}
func hiddenPage() {
// Hidden page for a nicer animation when looping back to the start.
viewModel.pageIndex = -1
}
/// Starts the animation timer for an automatic carousel effect.
private func startTimer() {
guard pageTimer == nil else { return }
pageTimer = Timer.scheduledTimer(withTimeInterval: 5, repeats: true) { _ in
if viewModel.pageIndex == pageCount - 1 {
hiddenPage()
withAnimation(.easeInOut(duration: 0.7)) {
nextPage()
}
} else {
withAnimation(.easeInOut(duration: 0.7)) {
nextPage()
}
}
}
}
/// Stops the animation timer for manual interaction.
private func stopTimer() {
guard let pageTimer = pageTimer else { return }
self.pageTimer = nil
pageTimer.invalidate()
}
// MARK: - Gestures
/// Whether or not a drag gesture is valid or not.
/// - Parameter width: The gesture's translation width.
/// - Returns: `true` if there is another page to drag to.
private func shouldSwipeForTranslation(_ width: CGFloat) -> Bool {
if viewModel.pageIndex == 0 {
return isLeftToRight ? width < 0 : width > 0
} else if viewModel.pageIndex == pageCount - 1 {
return isLeftToRight ? width > 0 : width < 0
}
return true
}
/// Updates the `dragOffset` based on the gesture's value.
/// - Parameter drag: The drag gesture value to handle.
private func handleDragGestureChange(_ drag: DragGesture.Value) {
guard shouldSwipeForTranslation(drag.translation.width) else { return }
stopTimer()
// Animate the change over a few frames to smooth out any stuttering.
withAnimation(.linear(duration: 0.05)) {
dragOffset = isLeftToRight ? drag.translation.width : -drag.translation.width
}
}
/// Clears the drag offset and informs the view model to switch to another page if necessary.
/// - Parameter viewSize: The size of the view in which the gesture took place.
private func handleDragGestureEnded(_ drag: DragGesture.Value, viewSize: CGSize) {
guard shouldSwipeForTranslation(drag.predictedEndTranslation.width) else {
// Reset the offset just in case.
withAnimation { dragOffset = 0 }
return
}
withAnimation(.easeInOut(duration: 0.2)) {
if drag.predictedEndTranslation.width < -viewSize.width / 2 {
nextPage()
} else if drag.predictedEndTranslation.width > viewSize.width / 2 {
previousPage()
}
dragOffset = 0
}
}
}
// MARK: - Previews
struct SplashScreen_Previews: PreviewProvider {
static let viewModel = SplashScreenViewModel()
static var previews: some View {
SplashScreen(viewModel: viewModel.context)
.accentColor(.element.accent)
}
}
@@ -0,0 +1,86 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import SwiftUI
struct SplashScreenPage: View {
// MARK: - Properties
// MARK: Private
@Environment(\.colorScheme) private var colorScheme
// MARK: Public
/// The content that this page should display.
let content: SplashScreenPageContent
/// The height of the non-scrollable content in the splash screen.
let overlayHeight: CGFloat
// MARK: - Views
@ViewBuilder
var backgroundGradient: some View {
if colorScheme != .dark {
LinearGradient(gradient: content.gradient, startPoint: .leading, endPoint: .trailing)
.flipsForRightToLeftLayoutDirection(true)
}
}
var body: some View {
VStack {
VStack {
Image(content.image.name)
.resizable()
.scaledToFit()
.frame(maxWidth: 300)
.padding(20)
.accessibilityHidden(true)
VStack(spacing: 8) {
Text(content.title)
.font(.element.title2B)
.foregroundColor(.element.primaryContent)
Text(content.message)
.font(.element.body)
.foregroundColor(.element.secondaryContent)
.multilineTextAlignment(.center)
}
.padding(.bottom)
Spacer()
// Prevent the content from clashing with the overlay content.
Spacer().frame(maxHeight: overlayHeight)
}
.padding(.horizontal, 16)
.frame(maxWidth: OnboardingMetrics.maxContentWidth,
maxHeight: OnboardingMetrics.maxContentHeight)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(backgroundGradient.ignoresSafeArea())
}
}
struct SplashScreenPage_Previews: PreviewProvider {
static let content = SplashScreenViewState().content
static var previews: some View {
ForEach(0..<content.count, id: \.self) { index in
SplashScreenPage(content: content[index], overlayHeight: 200)
}
}
}
@@ -0,0 +1,52 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import SwiftUI
struct SplashScreenPageIndicator: View {
// MARK: - Properties
// MARK: Public
/// The number of pages that are shown.
let pageCount: Int
/// The index of the current page
let pageIndex: Int
// MARK: - Setup
internal init(pageCount: Int, pageIndex: Int) {
self.pageCount = pageCount
// Clamp the page index to handle the hidden page.
if pageIndex == -1 {
self.pageIndex = pageCount - 1
} else {
self.pageIndex = pageIndex % pageCount
}
}
var body: some View {
HStack {
ForEach(0..<pageCount, id: \.self) { index in
Circle()
.frame(width: 8, height: 8)
.foregroundColor(index == pageIndex ? .accentColor : .element.quaternaryContent)
}
}
}
}
@@ -49,15 +49,7 @@ class AuthenticationCoordinator: Coordinator {
let availableAccessTokens = keychainController.accessTokens()
guard let usernameTokenTuple = availableAccessTokens.first else {
startNewLoginFlow { result in
switch result {
case .success:
self.delegate?.authenticationCoordinatorDidSetupClientProxy(self)
case .failure(let error):
self.delegate?.authenticationCoordinator(self, didFailWithError: error)
MXLog.error("Failed logging in user with error: \(error)")
}
}
showSplashScreen()
return
}
@@ -90,16 +82,43 @@ class AuthenticationCoordinator: Coordinator {
// MARK: - Private
private func showSplashScreen() {
let coordinator = SplashScreenCoordinator()
coordinator.callback = { [weak self] action in
guard let self = self else { return }
switch action {
case .login:
self.startNewLoginFlow { result in
switch result {
case .success:
self.delegate?.authenticationCoordinatorDidSetupClientProxy(self)
case .failure(let error):
self.delegate?.authenticationCoordinator(self, didFailWithError: error)
MXLog.error("Failed logging in user with error: \(error)")
}
}
case .register:
fatalError("Not implemented")
}
}
add(childCoordinator: coordinator)
navigationRouter.setRootModule(coordinator)
coordinator.start()
}
private func startNewLoginFlow(_ completion: @escaping (Result<(), AuthenticationCoordinatorError>) -> Void) {
let parameters = LoginScreenCoordinatorParameters()
let coordinator = LoginScreenCoordinator(parameters: parameters)
coordinator.callback = { [weak self, weak coordinator] result in
coordinator.callback = { [weak self, weak coordinator] action in
guard let self = self, let coordinator = coordinator else {
return
}
switch result {
switch action {
case .login(let result):
Task {
switch await self.login(username: result.username, password: result.password) {
+3 -1
View File
@@ -19,6 +19,7 @@ class UITestsAppCoordinator: Coordinator {
mainNavigationController = UINavigationController()
window = UIWindow(frame: UIScreen.main.bounds)
window.rootViewController = mainNavigationController
window.tintColor = .element.accent
let screens = mockScreens()
let rootView = UITestsRootView(mockScreens: screens) { id in
@@ -43,7 +44,8 @@ class UITestsAppCoordinator: Coordinator {
MockScreen(id: "Simple Screen - Upgrade", coordinator: TemplateSimpleScreenCoordinator(parameters: .init(promptType: .upgrade))),
MockScreen(id: "Settings screen", coordinator: SettingsCoordinator(parameters: .init(navigationRouter: NavigationRouter(navigationController: UINavigationController()), bugReportService: MockBugReportService()))),
MockScreen(id: "Bug report screen", coordinator: BugReportCoordinator(parameters: .init(bugReportService: MockBugReportService(), screenshot: nil))),
MockScreen(id: "Bug report screen with screenshot", coordinator: BugReportCoordinator(parameters: .init(bugReportService: MockBugReportService(), screenshot: Asset.Images.appLogo.image)))
MockScreen(id: "Bug report screen with screenshot", coordinator: BugReportCoordinator(parameters: .init(bugReportService: MockBugReportService(), screenshot: Asset.Images.appLogo.image))),
MockScreen(id: "Splash Screen", coordinator: SplashScreenCoordinator())
]
}
}