Skip to content

Commit bef03de

Browse files
feat: update Home screen to conditionally render UI components based on feature flag and add analytics logging
1 parent 6eefdc0 commit bef03de

File tree

1 file changed

+45
-40
lines changed

1 file changed

+45
-40
lines changed

src/Screens/Comic/Home/index.js

Lines changed: 45 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {AppendAd} from '../../../InkNest-Externals/Ads/AppendAd';
2828
import AnimeAdbanner from '../../../Components/UIComp/AnimeAdBanner/AnimeAdbanner';
2929
import {clearHistory} from '../../../Redux/Reducers';
3030
import {ComicHostName} from '../../../Utils/APIs';
31-
import { widthPercentageToDP } from 'react-native-responsive-screen';
31+
import {widthPercentageToDP} from 'react-native-responsive-screen';
3232

3333
export function Home({navigation}) {
3434
const flatListRef = useRef(null);
@@ -97,41 +97,50 @@ export function Home({navigation}) {
9797
return (
9898
<SafeAreaView style={styles.container} edges={['top']}>
9999
<ScrollView showsVerticalScrollIndicator={false}>
100-
{/* Temp UI Start for Switch Server */}
101-
<View style={{flex: 1, flexDirection: 'row', gap: 15}}>
102-
<TouchableOpacity
103-
onPress={() => {
104-
setChangeType(!changeType);
105-
crashlytics().log('Comic Host Name Clicked');
106-
}}
107-
style={styles.rectangle}>
108-
<Text
109-
style={{
110-
fontSize: 16,
111-
fontWeight: '700',
112-
color: '#fff',
113-
textAlign: 'left',
114-
}}>
115-
{type}
116-
</Text>
117-
<AntDesign name="down" size={20} color="#fff" />
118-
</TouchableOpacity>
119-
<TouchableOpacity
120-
style={{
121-
borderRadius: 100,
122-
backgroundColor: 'rgba(255, 255, 255, 0.05)',
123-
width: 40,
124-
height: 40,
125-
alignItems: 'center',
126-
justifyContent: 'center',
127-
}}
128-
onPress={() => {
129-
crashlytics().log('Home Search button clicked');
130-
navigation.navigate(NAVIGATION.search);
131-
}}>
132-
<AntDesign name="search1" size={20} color="#fff" />
133-
</TouchableOpacity>
134-
</View>
100+
{getVersion() === forIosValue &&
101+
forIosLoading === false ? null : forIosLoading === false ? (
102+
<>
103+
<View style={{flex: 1, flexDirection: 'row', gap: 15}}>
104+
<TouchableOpacity
105+
onPress={() => {
106+
setChangeType(!changeType);
107+
crashlytics().log('Comic Host Name Clicked');
108+
analytics().logEvent('comic_host_name_clicked', {
109+
hostName: type.toString(),
110+
});
111+
}}
112+
style={styles.rectangle}>
113+
<Text
114+
style={{
115+
fontSize: 16,
116+
fontWeight: '700',
117+
color: '#fff',
118+
textAlign: 'left',
119+
}}>
120+
{type}
121+
</Text>
122+
<AntDesign name="down" size={20} color="#fff" />
123+
</TouchableOpacity>
124+
<TouchableOpacity
125+
style={{
126+
borderRadius: 100,
127+
backgroundColor: 'rgba(255, 255, 255, 0.05)',
128+
width: 40,
129+
height: 40,
130+
alignItems: 'center',
131+
justifyContent: 'center',
132+
}}
133+
onPress={() => {
134+
crashlytics().log('Home Search button clicked');
135+
navigation.navigate(NAVIGATION.search);
136+
}}>
137+
<AntDesign name="search1" size={20} color="#fff" />
138+
</TouchableOpacity>
139+
</View>
140+
141+
<AnimeAdbanner />
142+
</>
143+
) : null}
135144
{changeType ? (
136145
<View
137146
style={{
@@ -217,10 +226,6 @@ export function Home({navigation}) {
217226
</View>
218227
) : null}
219228

220-
{/* Temp UI End for Switch Server */}
221-
222-
<AnimeAdbanner />
223-
224229
{!Object.values(History).length ? null : (
225230
<View style={styles.gameDetailsParent}>
226231
<View

0 commit comments

Comments
 (0)