@@ -18,99 +18,124 @@ struct ModuleAdditionSettingsView: View {
1818 var moduleUrl : String
1919
2020 var body : some View {
21- ScrollView {
22- VStack {
23- if let metadata = moduleMetadata {
24- VStack ( spacing: 25 ) {
25- VStack ( spacing: 15 ) {
26- KFImage ( URL ( string: metadata. iconUrl) )
27- . resizable ( )
28- . aspectRatio ( contentMode: . fit)
29- . frame ( width: 120 , height: 120 )
30- . clipShape ( Circle ( ) )
31- . shadow ( radius: 5 )
32- . transition ( . scale)
21+ VStack {
22+ ScrollView {
23+ VStack {
24+ if let metadata = moduleMetadata {
25+ VStack ( spacing: 25 ) {
26+ VStack ( spacing: 15 ) {
27+ KFImage ( URL ( string: metadata. iconUrl) )
28+ . resizable ( )
29+ . aspectRatio ( contentMode: . fit)
30+ . frame ( width: 120 , height: 120 )
31+ . clipShape ( Circle ( ) )
32+ . shadow ( radius: 5 )
33+ . transition ( . scale)
34+
35+ Text ( metadata. sourceName)
36+ . font ( . system( size: 28 , weight: . bold) )
37+ . multilineTextAlignment ( . center)
38+ }
39+ . padding ( . top)
3340
34- Text ( metadata. sourceName)
35- . font ( . system( size: 28 , weight: . bold) )
36- . multilineTextAlignment ( . center)
37- }
38- . padding ( . top)
39-
40- Divider ( )
41-
42- HStack ( spacing: 15 ) {
43- KFImage ( URL ( string: metadata. author. icon) )
44- . resizable ( )
45- . aspectRatio ( contentMode: . fill)
46- . frame ( width: 60 , height: 60 )
47- . clipShape ( Circle ( ) )
48- . shadow ( radius: 3 )
41+ Divider ( )
42+
43+ HStack ( spacing: 15 ) {
44+ KFImage ( URL ( string: metadata. author. icon) )
45+ . resizable ( )
46+ . aspectRatio ( contentMode: . fill)
47+ . frame ( width: 60 , height: 60 )
48+ . clipShape ( Circle ( ) )
49+ . shadow ( radius: 3 )
50+
51+ VStack ( alignment: . leading, spacing: 4 ) {
52+ Text ( metadata. author. name)
53+ . font ( . headline)
54+ Text ( " Author " )
55+ . font ( . subheadline)
56+ . foregroundColor ( . secondary)
57+ }
58+ Spacer ( )
59+ }
60+ . padding ( . horizontal)
4961
50- VStack ( alignment: . leading, spacing: 4 ) {
51- Text ( metadata. author. name)
52- . font ( . headline)
53- Text ( " Author " )
54- . font ( . subheadline)
55- . foregroundColor ( . secondary)
62+ Divider ( )
63+
64+ VStack ( alignment: . leading, spacing: 12 ) {
65+ InfoRow ( title: " Version " , value: metadata. version)
66+ InfoRow ( title: " Language " , value: metadata. language)
67+ InfoRow ( title: " Quality " , value: metadata. quality)
68+ InfoRow ( title: " Stream Typed " , value: metadata. streamType)
69+ InfoRow ( title: " Base URL " , value: metadata. baseUrl)
70+ . onLongPressGesture {
71+ UIPasteboard . general. string = metadata. baseUrl
72+ DropManager . shared. showDrop ( title: " Copied to Clipboard " , subtitle: " " , duration: 1.0 , icon: UIImage ( systemName: " doc.on.clipboard.fill " ) )
73+ }
74+ InfoRow ( title: " Script URL " , value: metadata. scriptUrl)
75+ . onLongPressGesture {
76+ UIPasteboard . general. string = metadata. scriptUrl
77+ DropManager . shared. showDrop ( title: " Copied to Clipboard " , subtitle: " " , duration: 1.0 , icon: UIImage ( systemName: " doc.on.clipboard.fill " ) )
78+ }
5679 }
57- Spacer ( )
80+ . padding ( . horizontal )
5881 }
59- . padding ( . horizontal)
6082
6183 Divider ( )
6284
63- VStack ( alignment: . leading, spacing: 12 ) {
64- InfoRow ( title: " Version " , value: metadata. version)
65- InfoRow ( title: " Language " , value: metadata. language)
66- InfoRow ( title: " Base URL " , value: metadata. baseUrl)
67- InfoRow ( title: " Script URL " , value: metadata. scriptUrl)
85+ } else if isLoading {
86+ VStack ( spacing: 20 ) {
87+ ProgressView ( )
88+ . scaleEffect ( 1.5 )
89+ Text ( " Loading module information... " )
90+ . foregroundColor ( . secondary)
6891 }
69- . padding ( . horizontal)
70- }
71-
72- Divider ( )
73-
74- Button ( action: addModule) {
75- HStack {
76- Image ( systemName: " plus.circle.fill " )
77- Text ( " Add Module " )
92+ . frame ( maxHeight: . infinity)
93+ . padding ( . top, 100 )
94+ } else if let errorMessage = errorMessage {
95+ VStack ( spacing: 20 ) {
96+ Image ( systemName: " exclamationmark.triangle.fill " )
97+ . font ( . system( size: 50 ) )
98+ . foregroundColor ( . red)
99+ Text ( errorMessage)
100+ . foregroundColor ( . red)
101+ . multilineTextAlignment ( . center)
78102 }
79- . font ( . headline)
80- . foregroundColor ( . white)
81- . frame ( maxWidth: . infinity)
82- . padding ( )
83- . background (
84- RoundedRectangle ( cornerRadius: 15 )
85- . fill ( Color . accentColor)
86- )
87- . padding ( . horizontal)
103+ . frame ( maxHeight: . infinity)
104+ . padding ( . top, 100 )
88105 }
89- . disabled ( isLoading)
90- . opacity ( isLoading ? 0.6 : 1 )
91-
92- } else if isLoading {
93- VStack ( spacing: 20 ) {
94- ProgressView ( )
95- . scaleEffect ( 1.5 )
96- Text ( " Loading module information... " )
97- . foregroundColor ( . secondary)
98- }
99- . frame ( maxHeight: . infinity)
100- . padding ( . top, 100 )
101- } else if let errorMessage = errorMessage {
102- VStack ( spacing: 20 ) {
103- Image ( systemName: " exclamationmark.triangle.fill " )
104- . font ( . system( size: 50 ) )
105- . foregroundColor ( . red)
106- Text ( errorMessage)
107- . foregroundColor ( . red)
108- . multilineTextAlignment ( . center)
106+ }
107+ }
108+
109+ Spacer ( )
110+
111+ VStack {
112+ Button ( action: addModule) {
113+ HStack {
114+ Image ( systemName: " plus.circle.fill " )
115+ Text ( " Add Module " )
109116 }
110- . frame ( maxHeight: . infinity)
111- . padding ( . top, 100 )
117+ . font ( . headline)
118+ . foregroundColor ( . white)
119+ . frame ( maxWidth: . infinity)
120+ . padding ( )
121+ . background (
122+ RoundedRectangle ( cornerRadius: 15 )
123+ . fill ( Color . accentColor)
124+ )
125+ . padding ( . horizontal)
126+ }
127+ . disabled ( isLoading)
128+ . opacity ( isLoading ? 0.6 : 1 )
129+
130+ Button ( action: {
131+ self . presentationMode. wrappedValue. dismiss ( )
132+ } ) {
133+ Text ( " Cancel " )
134+ . foregroundColor ( . accentColor)
135+ . padding ( . top, 10 )
112136 }
113137 }
138+ . padding ( . bottom, 20 )
114139 }
115140 . navigationTitle ( " Add Module " )
116141 . onAppear ( perform: fetchModuleMetadata)
0 commit comments