You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,12 @@
1
1
# Change log
2
2
3
+
-Simple Stack 2.6.2 (2021-06-07)
4
+
--------------------------------
5
+
6
+
- ADDED: `Backstack.canSetScopeProviders()`.
7
+
8
+
This is in conjunction with the 2.6.1 change, while making it safe to use them without extra checks such as `if(lastNonConfigurationInstance == null) {`.
Copy file name to clipboardExpand all lines: simple-stack/src/main/java/com/zhuinden/simplestack/Backstack.java
+17-7Lines changed: 17 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -242,15 +242,26 @@ public void setStateClearStrategy(@Nonnull StateClearStrategy stateClearStrategy
242
242
this.stateClearStrategy = stateClearStrategy;
243
243
}
244
244
245
+
/**
246
+
* Specifies if setting a scope provider, such as either {@link Backstack#setScopedServices(ScopedServices)} or {@link Backstack#setGlobalServices(GlobalServices)} is allowed.
247
+
* <p>
248
+
* This can be useful in case of deferred initialization, as scope providers shouldn't be set and aren't allowed once the initial state change happens.
249
+
*
250
+
* @return true if scope provider can be set
251
+
*/
252
+
publicfinalbooleancanSetScopeProviders() {
253
+
return !didRunInitialStateChange;
254
+
}
255
+
245
256
/**
246
257
* Specifies a {@link ScopedServices} to allow handling the creation of scoped services.
247
258
* <p>
248
-
* Must be called before the initial state change.
259
+
* Must be called before the initial state change. Call {@link Backstack#canSetScopeProviders()} to see if it's allowed.
249
260
*
250
261
* @param scopedServices the {@link ScopedServices}.
0 commit comments