Skip to content
This repository was archived by the owner on Jun 4, 2025. It is now read-only.

Commit 8580e69

Browse files
committed
reuse fab button to keep badge state
1 parent 3b37ab2 commit 8580e69

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

WeLoop/Classes/WeLoop.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,10 @@ public class WeLoop: NSObject {
205205
ShakeGestureDetector.shared.startAccelerometers()
206206
ShakeGestureDetector.shared.delegate = self
207207
case .fab:
208-
fabController = FloatingButtonController(position: preferredButtonPosition, settings: settings)
208+
if fabController == nil {
209+
fabController = FloatingButtonController(position: preferredButtonPosition, settings: settings)
210+
}
211+
fabController?.view.isHidden = false
209212
break
210213
default: break
211214
}
@@ -217,8 +220,7 @@ public class WeLoop: NSObject {
217220
ShakeGestureDetector.shared.stopAccelerometers()
218221
ShakeGestureDetector.shared.delegate = nil
219222
case .fab:
220-
fabController?.tearDown()
221-
fabController = nil
223+
fabController?.view.isHidden = true
222224
default: break
223225
}
224226
}

0 commit comments

Comments
 (0)