@@ -110,12 +110,17 @@ extension View {
110110 /// according to the provided style. If your custom view requires custom touch handling,
111111 /// make sure to set `style.canTapToHold` to `false`. Otherwise the `customView` won't receive any touches.
112112 ///
113- nonisolated public func notification( title: String , subtitle: String ? = nil , isPresented: Binding < Bool > , style: NotificationStyleClosure ) -> some View {
113+ nonisolated public func notification( title: String ,
114+ subtitle: String ? = nil ,
115+ isPresented: Binding < Bool > ,
116+ isShowingActivity: Binding < Bool > ? = nil ,
117+ progress: Binding < Double > ? = nil ,
118+ style: NotificationStyleClosure ) -> some View {
114119 let styleName = NotificationPresenter . shared. addStyle ( named: SwiftUINotficationState . internalStyleName) { s in
115120 let _ = style ( s)
116121 return s
117122 }
118- return notification ( title: title, subtitle: subtitle, isPresented: isPresented, styleName: styleName, includedStyle: nil )
123+ return notification ( title: title, subtitle: subtitle, isPresented: isPresented, isShowingActivity : isShowingActivity , progress : progress , styleName: styleName, includedStyle: nil )
119124 }
120125
121126
@@ -134,8 +139,13 @@ extension View {
134139 /// according to the provided style. If your custom view requires custom touch handling,
135140 /// make sure to set `style.canTapToHold` to `false`. Otherwise the `customView` won't receive any touches.
136141 ///
137- nonisolated public func notification( title: String , subtitle: String ? = nil , isPresented: Binding < Bool > , includedStyle: IncludedStatusBarNotificationStyle ) -> some View {
138- return notification ( title: title, subtitle: subtitle, isPresented: isPresented, styleName: nil , includedStyle: includedStyle)
142+ nonisolated public func notification( title: String ,
143+ subtitle: String ? = nil ,
144+ isPresented: Binding < Bool > ,
145+ isShowingActivity: Binding < Bool > ? = nil ,
146+ progress: Binding < Double > ? = nil ,
147+ includedStyle: IncludedStatusBarNotificationStyle ) -> some View {
148+ return notification ( title: title, subtitle: subtitle, isPresented: isPresented, isShowingActivity: isShowingActivity, progress: progress, styleName: nil , includedStyle: includedStyle)
139149 }
140150
141151
@@ -155,14 +165,25 @@ extension View {
155165 /// according to the provided style. If your custom view requires custom touch handling,
156166 /// make sure to set `style.canTapToHold` to `false`. Otherwise the `customView` won't receive any touches.
157167 ///
158- nonisolated public func notification( title: String , subtitle: String ? = nil , isPresented: Binding < Bool > , styleName: String ? = nil ) -> some View {
159- return notification ( title: title, subtitle: subtitle, isPresented: isPresented, styleName: styleName, includedStyle: nil )
168+ nonisolated public func notification( title: String ,
169+ subtitle: String ? = nil ,
170+ isPresented: Binding < Bool > ,
171+ isShowingActivity: Binding < Bool > ? = nil ,
172+ progress: Binding < Double > ? = nil ,
173+ styleName: String ? = nil ) -> some View {
174+ return notification ( title: title, subtitle: subtitle, isPresented: isPresented, isShowingActivity: isShowingActivity, progress: progress, styleName: styleName, includedStyle: nil )
160175 }
161176
162177 // MARK: - Internal
163178
164179
165- nonisolated private func notification( title: String , subtitle: String ? = nil , isPresented: Binding < Bool > , styleName: String ? = nil , includedStyle: IncludedStatusBarNotificationStyle ? = nil ) -> some View {
180+ nonisolated private func notification( title: String ,
181+ subtitle: String ? = nil ,
182+ isPresented: Binding < Bool > ,
183+ isShowingActivity: Binding < Bool > ? = nil ,
184+ progress: Binding < Double > ? = nil ,
185+ styleName: String ? = nil ,
186+ includedStyle: IncludedStatusBarNotificationStyle ? = nil ) -> some View {
166187 let np = NotificationPresenter . shared
167188
168189 // dismiss if needed
@@ -180,6 +201,16 @@ extension View {
180201 trackNotificationState ( isPresented: isPresented)
181202 }
182203
204+ // update activity
205+ if let isShowingActivity {
206+ np. displayActivityIndicator ( isShowingActivity. wrappedValue)
207+ }
208+
209+ // update progress bar
210+ if let progress {
211+ np. displayProgressBar ( at: progress. wrappedValue)
212+ }
213+
183214 return self
184215 }
185216
0 commit comments