Skip to content

Commit

Permalink
hideAds in certain pages
Browse files Browse the repository at this point in the history
Former-commit-id: b96a232
  • Loading branch information
HenryQuan committed Apr 7, 2019
1 parent c056298 commit 2ce5893
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 18 deletions.
4 changes: 2 additions & 2 deletions WoWsInfo/src/component/common/WoWsInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ class WoWsInfo extends Component {

render() {
const { container, safeView, child } = styles;
const { children, style } = this.props;
const { children, hideAds, style } = this.props;

let show = DATA[LOCAL.showBanner];
return (
<Surface style={[container, style, ThemeBackColour()]}>
<SafeAreaView style={safeView}>
<StatusBar barStyle={DARKMODE ? 'light-content' : 'dark-content'}
backgroundColor={ThemeColour()}/>
{ show && hideAds != true ? <AdmobBanner /> : null }
<Surface style={child}>
{ show ? <AdmobBanner /> : null }
{ children }
</Surface>
{ this.renderFooter() }
Expand Down
6 changes: 4 additions & 2 deletions WoWsInfo/src/page/home/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ class Menu extends PureComponent {
constructor(props) {
super(props);

AdMobInterstitial.setAdUnitID('ca-app-pub-5048098651344514/3013393881');
let unitID = 'ca-app-pub-5048098651344514/1247820419';
if (isAndroid) unitID = 'ca-app-pub-5048098651344514/3013393881';
AdMobInterstitial.setAdUnitID(unitID);
AdMobInterstitial.setTestDevices([AdMobInterstitial.simulatorId]);

let first = getFirstLaunch();
Expand Down Expand Up @@ -154,7 +156,7 @@ class Menu extends PureComponent {
}} spacing={0}/>
<SectionTitle title={lang.extra_section_title}/>
<List.Item title={lang.extra_support_wowsinfo} description={lang.extra_support_wowsinfo_subtitle} onPress={() => SafeAction('SupportMe')}/>
<List.Item title='RS Beta' description='Realtime Statistics Beta' onPress={() => SafeAction('RS')}/>
<List.Item title='RS Beta' description={lang.extra_rs_beta} onPress={() => SafeAction('RS')}/>
<List.Section title={lang.website_title} >
<FlatGrid items={this.websites} itemDimension={300} renderItem={({item}) => {
return <List.Item title={item.t} description={item.d} key={item.t}
Expand Down
3 changes: 2 additions & 1 deletion WoWsInfo/src/page/home/RS.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { SafeFetch, roundTo, Guard, getOverallRating, SafeAction, SafeValue, Saf
import { WoWsAPI } from '../../value/api';
import { getCurrDomain, SAVED, LOCAL, getCurrServer, setLastLocation } from '../../value/data';
import { FlatGrid } from 'react-native-super-grid';
import { lang } from '../../value/lang';

class RS extends Component {
constructor(props) {
Expand Down Expand Up @@ -51,7 +52,7 @@ class RS extends Component {
onChangeText={t => this.setState({ip: t})}
onEndEditing={() => this.validIP(ip)}/>
<Button uppercase={false} onPress={() => Linking.openURL('https://github.com/HenryQuan/WoWs-RS/releases/latest')}>
Download RS on your computer
{ lang.extra_rs_beta_download }
</Button>
</KeyboardAvoidingView> : this.renderPlayer() }
{ this.renderMapInfo(rs) }
Expand Down
2 changes: 1 addition & 1 deletion WoWsInfo/src/page/home/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Search extends Component {
const { search, online } = this.state;
const { searchBar, scroll } = styles;
return (
<WoWsInfo title={lang.menu_footer} onPress={() => this.refs['search'].focus()}>
<WoWsInfo hideAds title={lang.menu_footer} onPress={() => this.refs['search'].focus()}>
<Anime.View animation='fadeInDown' useNativeDriver duration={500}>
<Searchbar ref='search' value={search} style={searchBar} placeholder={`${this.prefix.toUpperCase()} - ${online} ${lang.search_player_online}`}
onChangeText={this.searchAll} autoCorrect={false} autoCapitalize='none' />
Expand Down
2 changes: 1 addition & 1 deletion WoWsInfo/src/page/home/Setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Setup extends Component {
render() {
const { loading, server, selected_server, langList, langData, selected_lang } = this.state;
return (
<WoWsInfo title={lang.setup_done_button}
<WoWsInfo title={lang.setup_done_button} hideAds
noRight noLeft onPress={loading ? null : () => this.finishSetup()}>
<ScrollView>
<SectionTitle title={lang.settings_api_settings}/>
Expand Down
2 changes: 1 addition & 1 deletion WoWsInfo/src/page/player/PlayerShip.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class PlayerShip extends PureComponent {
{n: lang.record_max_xp, v: 'pvp.max_xp'}, {n: lang.record_max_frags_battle, v: 'pvp.max_frags_battle'}];

return (
<WoWsInfo title={`${lang.wiki_warship_footer} - ${data.length}`} onPress={() => SafeAction('WarshipFilter', {applyFunc: this.updateShip})}>
<WoWsInfo hideAds title={`${lang.wiki_warship_footer} - ${data.length}`} onPress={() => SafeAction('WarshipFilter', {applyFunc: this.updateShip})}>
<RatingButton rating={rating}/>
<FlatGrid itemDimension={150} items={data} renderItem={({item}) => this.renderShip(item)}
showsVerticalScrollIndicator={false}/>
Expand Down
2 changes: 1 addition & 1 deletion WoWsInfo/src/page/settings/About.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class About extends Component {
let imageWidth = width > height ? height * 0.5 : width * 0.5;

return (
<WoWsInfo>
<WoWsInfo hideAds>
<Touchable style={touch} onPress={() => Linking.openURL(lang.abour_github_link)}>
<Anime.View animation={animation} iterationCount='infinite' easing='ease' useNativeDriver>
<Image style={{tintColor: TintColour()[500], height: imageWidth, width: imageWidth }}
Expand Down
2 changes: 1 addition & 1 deletion WoWsInfo/src/page/settings/License.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const libraries = [{name: 'react', link: 'https://github.com/facebook/react'},
class License extends Component {
render() {
return (
<WoWsInfo>
<WoWsInfo hideAds>
<FlatGrid items={libraries} renderItem={({item}) => {
return <List.Item key={item.name} title={item.name} description={item.link}
onPress={() => Linking.openURL(item.link)}/>
Expand Down
10 changes: 5 additions & 5 deletions WoWsInfo/src/page/settings/SupportMe.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { StyleSheet } from 'react-native';
import { StyleSheet, Linking } from 'react-native';
import { List, Checkbox } from 'react-native-paper';
import { Donation, WoWsInfo } from '../../component';
import { lang } from '../../value/lang';
Expand All @@ -26,18 +26,18 @@ class SupportMe extends Component {
render() {
const { banner, fullscreen } = this.state;
return (
<WoWsInfo>
<WoWsInfo hideAds>
<List.Section title={lang.extra_support_wowsinfo}>
<Donation />
{ this.support.map(item => { return (
<List.Item title={item.t} description={item.d} key={item.t}
onPress={() => Linking.openURL(item.d)}/>
)})}
</List.Section>
<List.Section title='Ads Settings'>
<List.Item title={'Show Ads'} onPress={() => this.updateBanner(!banner)}
<List.Section title={lang.support_ads}>
<List.Item title={lang.support_ads_banner} onPress={() => this.updateBanner(!banner)}
right={() => <Checkbox status={banner ? 'checked' : 'unchecked'}/>}/>
<List.Item title={'Show Ads on launch'} onPress={() => this.updateFullscreen(!fullscreen)}
<List.Item title={lang.support_ads_fullscreen} onPress={() => this.updateFullscreen(!fullscreen)}
right={() => <Checkbox status={fullscreen ? 'checked' : 'unchecked'}/>}/>
</List.Section>
</WoWsInfo>
Expand Down
2 changes: 1 addition & 1 deletion WoWsInfo/src/page/wiki/WarshipFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class WarshipFilter extends Component {
Object.keys(types).forEach(k => typeList.push(types[k]));

return (
<WoWsInfo title={lang.wiki_warship_filter_placeholder} onPress={() => this.refs['search'].focus()}>
<WoWsInfo hideAds title={lang.wiki_warship_filter_placeholder} onPress={() => this.refs['search'].focus()}>
<TextInput label={lang.wiki_warship_filter_placeholder} ref='search' autoCorrect={false}
theme={{roundness: 0}} onChangeText={t => this.setState({name: t})} onEndEditing={() => {
// Do not go back if it is still empty
Expand Down
2 changes: 1 addition & 1 deletion WoWsInfo/src/page/wiki/WarshipModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class WarshipModule extends Component {
render() {
const { section } = this.state;
return (
<WoWsInfo title={lang.warship_apply_module} onPress={() => this.apply()}>
<WoWsInfo hideAds title={lang.warship_apply_module} onPress={() => this.apply()}>
<FlatList data={section} showsVerticalScrollIndicator={false} renderItem={({item}) => {
return (
<View key={item.title}>
Expand Down
27 changes: 26 additions & 1 deletion WoWsInfo/src/value/lang.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,15 @@ export const lang = new LocalizedStrings({
// Extra
extra_section_title: 'Extra',
extra_support_wowsinfo: 'Support WoWs Info',
extra_rs_beta: 'Realtime Statistics Beta',
extra_rs_beta_download: 'Download RS on your computer',
extra_support_wowsinfo_subtitle: 'Donations and Ads',
support_paypal: 'PayPal',
support_patreon: 'Patreon',
support_wechat: 'WeChat',
support_ads: 'Ads Settings',
support_ads_banner: 'Show Ads',
support_ads_fullscreen: 'Show Ads on launch',
// Websites
website_title: 'Websites',
website_official_site: 'World of Warships',
Expand Down Expand Up @@ -369,10 +374,15 @@ export const lang = new LocalizedStrings({
// Extra
extra_section_title: '其他',
extra_support_wowsinfo: '支持WoWs Info',
extra_rs_beta: '实时数据 Beta',
extra_rs_beta_download: '在电脑上下载RS',
extra_support_wowsinfo_subtitle: '捐助以及广告',
support_paypal: '贝宝',
support_patreon: 'Patreon',
support_wechat: '微信',
support_ads: '广告设置',
support_ads_banner: '显示广告',
support_ads_fullscreen: '启动APP时显示广告',
// Websites
website_title: '网站',
website_official_site: '战舰世界官网',
Expand Down Expand Up @@ -621,10 +631,15 @@ export const lang = new LocalizedStrings({
// Extra
extra_section_title: '其他',
extra_support_wowsinfo: '支持WoWs Info',
extra_support_wowsinfo_subtitle: '捐助以及廣告',
extra_rs_beta: '實時數據 Beta',
extra_rs_beta_download: 'Download RS on your computer',
extra_support_wowsinfo_subtitle: '在電腦上下載RS',
support_paypal: 'PayPal',
support_patreon: 'Patreon',
support_wechat: '微信',
support_ads: '廣告設置',
support_ads_banner: '顯示廣告',
support_ads_fullscreen: '啟動APP時顯示廣告',
// Websites
website_title: '網站',
website_official_site: '戰艦世界官網',
Expand Down Expand Up @@ -873,10 +888,15 @@ export const lang = new LocalizedStrings({
// Extra
extra_section_title: 'その他',
extra_support_wowsinfo: 'WoWs Infoへの支援',
extra_rs_beta: 'リアルタイム統計 Beta',
extra_rs_beta_download: 'パソコンでダウンロード',
extra_support_wowsinfo_subtitle: 'ドネーションと広告',
support_paypal: 'ペイパル PayPal',
support_patreon: 'パトレオン Patreon',
support_wechat: '微信 WeChat',
support_ads: '広告の設定',
support_ads_banner: '広告を見せる',
support_ads_fullscreen: 'アプリを開く時に広告を見せる',
// Websites
website_title: 'ウェブサイト',
website_official_site: 'World of Warships',
Expand Down Expand Up @@ -1125,10 +1145,15 @@ export const lang = new LocalizedStrings({
// Extra
extra_section_title: 'Extra',
extra_support_wowsinfo: 'Support WoWs Info',
extra_rs_beta: 'Realtime Statistics Beta',
extra_rs_beta_download: 'Download RS on your computer',
extra_support_wowsinfo_subtitle: 'Donations and Ads',
support_paypal: 'PayPal',
support_patreon: 'Patreon',
support_wechat: 'WeChat',
support_ads: 'Ads Settings',
support_ads_banner: 'Show Ads',
support_ads_fullscreen: 'Show Ads on launch',
// Websites
website_title: 'Websites',
website_official_site: 'World of Warships',
Expand Down

0 comments on commit 2ce5893

Please sign in to comment.