@@ -173,57 +173,56 @@ extension TweakWindow: FloatingTweaksWindowPresenter {
173
173
174
174
/// Presents a floating TweakGroup over your app's UI, so you don't have to hop in and out of the full-modal Tweak UI.
175
175
internal func presentFloatingTweaksUI( forTweakGroup tweakGroup: TweakGroup ) {
176
- if ( floatingTweakGroupUIWindow == nil ) {
177
- let window = HitTransparentWindow ( )
178
- window. frame = UIScreen . main. bounds
179
- window. backgroundColor = UIColor . clear
180
-
181
- var originY = window. frame. size. height - FloatingTweakGroupViewController. height - FloatingTweakGroupViewController. margins
182
- if #available( iOS 11 . 0 , * ) {
183
- originY = originY - self . safeAreaInsets. bottom
184
- }
176
+ guard floatingTweakGroupUIWindow == nil else { return }
185
177
186
- let floatingTweakGroupFrame = CGRect (
187
- origin: CGPoint (
188
- x: FloatingTweakGroupViewController . margins,
189
- y: originY
190
- ) ,
191
- size: CGSize (
192
- width: window. frame. size. width - FloatingTweakGroupViewController. margins*2,
193
- height: FloatingTweakGroupViewController . height
194
- )
195
- )
178
+ let window = HitTransparentWindow ( )
179
+ window. frame = UIScreen . main. bounds
180
+ window. backgroundColor = UIColor . clear
196
181
197
- let floatingTweaksVC = FloatingTweakGroupViewController ( frame: floatingTweakGroupFrame, tweakStore: tweakStore, presenter: self )
198
- floatingTweaksVC. tweakGroup = tweakGroup
199
- window. rootViewController = floatingTweaksVC
200
- window. addSubview ( floatingTweaksVC. view)
201
-
202
- window. alpha = 0
203
- let initialWindowFrame = window. frame. offsetBy ( dx: 0 , dy: floatingTweaksVC. view. bounds. height)
204
- let destinationWindowFrame = window. frame
205
- window. makeKeyAndVisible ( )
206
- floatingTweakGroupUIWindow = window
207
-
208
- window. frame = initialWindowFrame
209
- UIView . animate (
210
- withDuration: TweakWindow . presentationDuration,
211
- delay: 0 ,
212
- usingSpringWithDamping: TweakWindow . presentationDamping,
213
- initialSpringVelocity: TweakWindow . presentationVelocity,
214
- options: . beginFromCurrentState,
215
- animations: {
216
- window. frame = destinationWindowFrame
217
- window. alpha = 1
218
- } ,
219
- completion: nil
220
- )
182
+ var originY = window. frame. size. height - FloatingTweakGroupViewController. height - FloatingTweakGroupViewController. margins
183
+ if #available( iOS 11 . 0 , * ) {
184
+ originY = originY - self . safeAreaInsets. bottom
221
185
}
186
+
187
+ let floatingTweakGroupFrame = CGRect (
188
+ origin: CGPoint (
189
+ x: FloatingTweakGroupViewController . margins,
190
+ y: originY
191
+ ) ,
192
+ size: CGSize (
193
+ width: window. frame. size. width - FloatingTweakGroupViewController. margins*2,
194
+ height: FloatingTweakGroupViewController . height
195
+ )
196
+ )
197
+
198
+ let floatingTweaksVC = FloatingTweakGroupViewController ( frame: floatingTweakGroupFrame, tweakStore: tweakStore, presenter: self )
199
+ floatingTweaksVC. tweakGroup = tweakGroup
200
+ window. rootViewController = floatingTweaksVC
201
+ window. addSubview ( floatingTweaksVC. view)
202
+
203
+ window. alpha = 0
204
+ let initialWindowFrame = window. frame. offsetBy ( dx: 0 , dy: floatingTweaksVC. view. bounds. height)
205
+ let destinationWindowFrame = window. frame
206
+ window. makeKeyAndVisible ( )
207
+ floatingTweakGroupUIWindow = window
208
+
209
+ window. frame = initialWindowFrame
210
+ UIView . animate (
211
+ withDuration: TweakWindow . presentationDuration,
212
+ delay: 0 ,
213
+ usingSpringWithDamping: TweakWindow . presentationDamping,
214
+ initialSpringVelocity: TweakWindow . presentationVelocity,
215
+ options: . beginFromCurrentState,
216
+ animations: {
217
+ window. frame = destinationWindowFrame
218
+ window. alpha = 1
219
+ } ,
220
+ completion: nil
221
+ )
222
222
}
223
223
224
224
/// Dismisses the floating TweakGroup
225
225
func dismissFloatingTweaksUI( ) {
226
-
227
226
guard let floatingTweakGroupUIWindow = floatingTweakGroupUIWindow else { return }
228
227
229
228
UIView . animate (
@@ -240,4 +239,11 @@ extension TweakWindow: FloatingTweaksWindowPresenter {
240
239
}
241
240
)
242
241
}
242
+
243
+ func resumeDisplayingMainTweaksInterface( ) {
244
+ guard floatingTweakGroupUIWindow != nil else { return }
245
+
246
+ self . dismissFloatingTweaksUI ( )
247
+ self . presentTweaks ( )
248
+ }
243
249
}
0 commit comments