Skip to content

Commit cdf5962

Browse files
authored
Merge pull request #431 from Countly/fix_stop_views
Fix stop views
2 parents 78e52f4 + 4c45ca2 commit cdf5962

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
## 24.7.7
2+
* Mitigated an issue where an automaticly closed autostopped view's duration could have increased when opening new views
23
* Mitigated an issue where, on Android 35 and above, the navigation bar was overlapping with the content display.
34

45
## 24.7.6

sdk/src/main/java/ly/count/android/sdk/ModuleViews.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,12 @@ Map<String, Object> CreateViewEventSegmentation(@NonNull ViewData vd, boolean fi
150150

151151
void autoCloseRequiredViews(boolean closeAllViews, @Nullable Map<String, Object> customViewSegmentation) {
152152
L.d("[ModuleViews] autoCloseRequiredViews");
153-
List<String> viewsToRemove = new ArrayList<>(1);
153+
List<ViewData> viewsToRemove = new ArrayList<>(1);
154154

155155
for (Map.Entry<String, ViewData> entry : viewDataMap.entrySet()) {
156156
ViewData vd = entry.getValue();
157-
if (closeAllViews || vd.isAutoStoppedView) {
158-
viewsToRemove.add(vd.viewID);
157+
if (closeAllViews || (!vd.willStartAgain && vd.isAutoStoppedView)) {
158+
viewsToRemove.add(vd);
159159
}
160160
}
161161

@@ -164,7 +164,13 @@ void autoCloseRequiredViews(boolean closeAllViews, @Nullable Map<String, Object>
164164
}
165165

166166
for (int a = 0; a < viewsToRemove.size(); a++) {
167-
stopViewWithIDInternal(viewsToRemove.get(a), customViewSegmentation);
167+
ViewData vd = viewsToRemove.get(a);
168+
if (!vd.willStartAgain) {
169+
stopViewWithIDInternal(vd.viewID, customViewSegmentation);
170+
} else if (closeAllViews) {
171+
//if we are closing all views, we should remove the view from the cache
172+
viewDataMap.remove(vd.viewID);
173+
}
168174
}
169175
}
170176

0 commit comments

Comments
 (0)