@@ -33,81 +33,6 @@ struct AppListCell: View {
3333 return attributedString
3434 }
3535
36- @ViewBuilder
37- var cellContextMenu : some View {
38- Button {
39- launch ( )
40- } label: {
41- Label ( NSLocalizedString ( " Launch " , comment: " " ) , systemImage: " command " )
42- }
43-
44- if AppListModel . hasTrollStore && app. isAllowedToAttachOrDetach {
45- if app. isDetached {
46- Button {
47- do {
48- try InjectorV3 ( app. url) . setMetadataDetached ( false )
49- app. reload ( )
50- appList. isRebuildNeeded = true
51- } catch { DDLogError ( " \( error) " , ddlog: InjectorV3 . main. logger) }
52- } label: {
53- Label ( NSLocalizedString ( " Unlock Version " , comment: " " ) , systemImage: " lock.open " )
54- }
55- } else {
56- Button {
57- do {
58- try InjectorV3 ( app. url) . setMetadataDetached ( true )
59- app. reload ( )
60- appList. isRebuildNeeded = true
61- } catch { DDLogError ( " \( error) " , ddlog: InjectorV3 . main. logger) }
62- } label: {
63- Label ( NSLocalizedString ( " Lock Version " , comment: " " ) , systemImage: " lock " )
64- }
65- }
66- }
67-
68- Button {
69- openInFilza ( )
70- } label: {
71- if isFilzaInstalled {
72- Label ( NSLocalizedString ( " Show in Filza " , comment: " " ) , systemImage: " scope " )
73- } else {
74- Label ( NSLocalizedString ( " Filza (URL Scheme) Not Installed " , comment: " " ) , systemImage: " xmark.octagon " )
75- }
76- }
77- . disabled ( !isFilzaInstalled)
78- }
79-
80- @ViewBuilder
81- var cellContextMenuWrapper : some View {
82- if #available( iOS 16 , * ) {
83- // iOS 16
84- cellContextMenu
85- } else {
86- if #available( iOS 15 , * ) { }
87- else {
88- // iOS 14
89- cellContextMenu
90- }
91- }
92- }
93-
94- @ViewBuilder
95- var cellBackground : some View {
96- if #available( iOS 15 , * ) {
97- if #available( iOS 16 , * ) { }
98- else {
99- // iOS 15
100- Color . clear
101- . contextMenu {
102- if !appList. isSelectorMode {
103- cellContextMenu
104- }
105- }
106- . id ( app. isDetached)
107- }
108- }
109- }
110-
11136 var body : some View {
11237 HStack ( spacing: 12 ) {
11338 if #available( iOS 15 , * ) {
@@ -188,6 +113,81 @@ struct AppListCell: View {
188113 . background ( cellBackground)
189114 }
190115
116+ @ViewBuilder
117+ var cellContextMenu : some View {
118+ Button {
119+ launch ( )
120+ } label: {
121+ Label ( NSLocalizedString ( " Launch " , comment: " " ) , systemImage: " command " )
122+ }
123+
124+ if AppListModel . hasTrollStore && app. isAllowedToAttachOrDetach {
125+ if app. isDetached {
126+ Button {
127+ do {
128+ try InjectorV3 ( app. url) . setMetadataDetached ( false )
129+ app. reload ( )
130+ appList. isRebuildNeeded = true
131+ } catch { DDLogError ( " \( error) " , ddlog: InjectorV3 . main. logger) }
132+ } label: {
133+ Label ( NSLocalizedString ( " Unlock Version " , comment: " " ) , systemImage: " lock.open " )
134+ }
135+ } else {
136+ Button {
137+ do {
138+ try InjectorV3 ( app. url) . setMetadataDetached ( true )
139+ app. reload ( )
140+ appList. isRebuildNeeded = true
141+ } catch { DDLogError ( " \( error) " , ddlog: InjectorV3 . main. logger) }
142+ } label: {
143+ Label ( NSLocalizedString ( " Lock Version " , comment: " " ) , systemImage: " lock " )
144+ }
145+ }
146+ }
147+
148+ Button {
149+ openInFilza ( )
150+ } label: {
151+ if isFilzaInstalled {
152+ Label ( NSLocalizedString ( " Show in Filza " , comment: " " ) , systemImage: " scope " )
153+ } else {
154+ Label ( NSLocalizedString ( " Filza (URL Scheme) Not Installed " , comment: " " ) , systemImage: " xmark.octagon " )
155+ }
156+ }
157+ . disabled ( !isFilzaInstalled)
158+ }
159+
160+ @ViewBuilder
161+ var cellContextMenuWrapper : some View {
162+ if #available( iOS 16 , * ) {
163+ // iOS 16
164+ cellContextMenu
165+ } else {
166+ if #available( iOS 15 , * ) { }
167+ else {
168+ // iOS 14
169+ cellContextMenu
170+ }
171+ }
172+ }
173+
174+ @ViewBuilder
175+ var cellBackground : some View {
176+ if #available( iOS 15 , * ) {
177+ if #available( iOS 16 , * ) { }
178+ else {
179+ // iOS 15
180+ Color . clear
181+ . contextMenu {
182+ if !appList. isSelectorMode {
183+ cellContextMenu
184+ }
185+ }
186+ . id ( app. isDetached)
187+ }
188+ }
189+ }
190+
191191 private func launch( ) {
192192 LSApplicationWorkspace . default ( ) . openApplication ( withBundleID: app. id)
193193 }
0 commit comments