Fix double border on custom feed posts (web)
Add missing visibility check for ageAssuranceBanner on non-discover feeds. The banner was being added to the feedItems array without checking ageAssuranceBannerState.visible, causing the first post's rowIndex to be 1 instead of 0, which prevented hideTopBorder from being set correctly. This was particularly visible on web when directly navigating to a custom feed URL.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import uuid from 'react-native-uuid';
|
||||
import { onAppStateChange } from '#/lib/appState';
|
||||
import { isSessionIdExpired } from '#/analytics/identifiers/util';
|
||||
import { device } from '#/storage';
|
||||
var sessionId = (function () {
|
||||
var existing = device.get(['nativeSessionId']);
|
||||
var lastEvent = device.get(['nativeSessionIdLastEventAt']);
|
||||
var id = existing && !isSessionIdExpired(lastEvent) ? existing : uuid.v4();
|
||||
device.set(['nativeSessionId'], id);
|
||||
device.set(['nativeSessionIdLastEventAt'], Date.now());
|
||||
return id;
|
||||
})();
|
||||
export function getInitialSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
export function useSessionId() {
|
||||
var _a = useState(function () { return sessionId; }), id = _a[0], setId = _a[1];
|
||||
useEffect(function () {
|
||||
var sub = onAppStateChange(function (state) {
|
||||
if (state === 'active') {
|
||||
var lastEvent = device.get(['nativeSessionIdLastEventAt']);
|
||||
if (isSessionIdExpired(lastEvent)) {
|
||||
sessionId = uuid.v4();
|
||||
device.set(['nativeSessionId'], sessionId);
|
||||
setId(sessionId);
|
||||
}
|
||||
}
|
||||
device.set(['nativeSessionIdLastEventAt'], Date.now());
|
||||
});
|
||||
return function () { return sub.remove(); };
|
||||
}, []);
|
||||
return id;
|
||||
}
|
||||
Reference in New Issue
Block a user