diff --git a/src/App.jsx b/src/App.jsx index 415e05908..bdada897b 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -180,6 +180,7 @@ class App extends Component { if (isAndroid()) { // December 12, 2023: All sorts of problems with sign-in with Facebook on Android, so disabling it here webAppConfig.ENABLE_FACEBOOK = false; // This overrides the config setting for the entire Android app } + if (webAppConfig.ENABLE_FACEBOOK) { setTimeout(() => { // Suspect that this isn't correct anymore: "We need to start this initialization early since there is a delay getting the FB object in place" @@ -187,6 +188,10 @@ class App extends Component { }, 2000); } + if (!webAppConfig.ENABLE_TWITTER) { + webAppConfig.ENABLE_TWITTER = false; // Avoid crashes in Feb/March 2024 in case not in config.js + } + if (isCordova()) { const size = isIOS() ? getIOSSizeString() : getAndroidSize(); console.log('Cordova: device model', window.device.model, ' size: ', size); diff --git a/src/js/common/components/SignIn/SignInOptionsPanel.jsx b/src/js/common/components/SignIn/SignInOptionsPanel.jsx index 89e3c108d..654915c04 100755 --- a/src/js/common/components/SignIn/SignInOptionsPanel.jsx +++ b/src/js/common/components/SignIn/SignInOptionsPanel.jsx @@ -44,8 +44,8 @@ export default class SignInOptionsPanel extends Component { hideAppleSignInButton: false, hideCurrentlySignedInHeader: false, hideDialogForCordova: false, - hideFacebookSignInButton: false, - hideTwitterSignInButton: false, + hideFacebookSignInButton: !webAppConfig.ENABLE_FACEBOOK, + hideTwitterSignInButton: !webAppConfig.ENABLE_TWITTER, hideVoterEmailAddressEntry: false, hideVoterPhoneEntry: false, isInternetExplorer: document.documentMode || false, // Yes, we are talking about that old Microsoft product @@ -287,7 +287,7 @@ export default class SignInOptionsPanel extends Component { this.setState({ hideAppleSignInButton: isInternetExplorer || isAndroid(), hideFacebookSignInButton: !webAppConfig.ENABLE_FACEBOOK, // December 12, 2023: All sorts of problems with sign-in with Facebook on Android - hideTwitterSignInButton: false, + hideTwitterSignInButton: !webAppConfig.ENABLE_TWITTER, // Feb 2024 problems with twitter in all apps and cordova, but ok on api server hideVoterEmailAddressEntry: false, hideVoterPhoneEntry: false, }); @@ -422,10 +422,10 @@ export default class SignInOptionsPanel extends Component { let yourAccountTitle = 'Security & Sign In'; let yourAccountExplanation = ''; if (voterIsSignedIn) { - if (voterIsSignedInFacebook && !voterIsSignedInTwitter && (isOnWeVoteRootUrl || isOnWeVotePartnerSubdomainUrl)) { + if (webAppConfig.ENABLE_TWITTER && voterIsSignedInFacebook && !voterIsSignedInTwitter && (isOnWeVoteRootUrl || isOnWeVotePartnerSubdomainUrl)) { yourAccountTitle = 'Have Twitter Too?'; yourAccountExplanation = 'By adding your Twitter account to your WeVote profile, you get access to the voter guides of everyone you follow.'; - } else if (voterIsSignedInTwitter && !voterIsSignedInFacebook && isOnFacebookSupportedDomainUrl) { + } else if (webAppConfig.ENABLE_FACEBOOK && voterIsSignedInTwitter && !voterIsSignedInFacebook && isOnFacebookSupportedDomainUrl) { yourAccountTitle = 'Have Facebook Too?'; yourAccountExplanation = 'By adding Facebook to your WeVote profile, it is easier for friends to find you.'; } diff --git a/src/js/common/utils/cordovaUtils.js b/src/js/common/utils/cordovaUtils.js index 1e180b4c7..61ddb6bc9 100644 --- a/src/js/common/utils/cordovaUtils.js +++ b/src/js/common/utils/cordovaUtils.js @@ -448,12 +448,12 @@ export function getAndroidSize () { androidSizeString = 'default'; const { visualViewport: { height, width, scale } } = window; const diameter = Math.sqrt(((width * scale) ** 2) + ((height * scale) ** 2)); - console.log('CALCULATED screen diameter: ', diameter); + // console.log('CALCULATED screen diameter: ', diameter); androidPixels = width * height; - const ua = navigator.userAgent; - console.log('Phone user agent: ', ua); + // const ua = navigator.userAgent; + // console.log('Phone user agent: ', ua); if (isAndroidTablet()) { androidSizeString = '--wide'; diff --git a/src/js/common/utils/isCordovaOrWebApp.js b/src/js/common/utils/isCordovaOrWebApp.js index 5b1158d6b..fd7c987c6 100644 --- a/src/js/common/utils/isCordovaOrWebApp.js +++ b/src/js/common/utils/isCordovaOrWebApp.js @@ -19,7 +19,7 @@ export function isAndroidTablet () { const ua = navigator.userAgent; const diameter = Math.sqrt(((width * scale) ** 2) + ((height * scale) ** 2)); const aspectRatio = height / width; - console.log('Phone user agent: ', ua); + // console.log('Phone user agent: ', ua); return (aspectRatio < 1 || (width === 1848 && height === 2960 && diameter === 14.54) || // Galaxy Tab S9 Ultra (2023) diff --git a/src/js/components/Search/BaseSearchbox.jsx b/src/js/components/Search/BaseSearchbox.jsx index 2dce814fa..a6d8a385c 100644 --- a/src/js/components/Search/BaseSearchbox.jsx +++ b/src/js/components/Search/BaseSearchbox.jsx @@ -1,9 +1,9 @@ -import React from 'react'; import PropTypes from 'prop-types'; +import React from 'react'; import styled from 'styled-components'; -import colors from '../../common/components/Style/Colors'; -import searchIcon from '../../../img/global/icons/search.svg'; import closeIcon from '../../../img/global/icons/cross.svg'; +import searchIcon from '../../../img/global/icons/search.svg'; +import colors from '../../common/components/Style/Colors'; const SearchWrapper = styled.div` position: relative; @@ -16,7 +16,7 @@ const SearchIcon = styled.div` top: 50%; right: 10px; transform: translateY(-50%); - color: gray; + color: gray; background-image: url(${searchIcon}); background-repeat: no-repeat; background-position: center; @@ -54,9 +54,7 @@ const SearchInput = styled.input` border-radius: 0.25rem; padding-right: 40px; padding-left: 12px; - border-radius: 0.25rem; - padding-right: 40px; - + &:focus-visible { border: none; @@ -101,7 +99,7 @@ class BaseSearchbox extends React.Component { placeholder={this.props.placeholder} value={this.state.searchText} onChange={this.handleInputChange} - onClear={this.handleClear} + // onClear={this.handleClear} // 2/26/23 temporarily removed, there is no onClear for an HTML input, but using a listener action is possible maxLength={50} /> {this.state.searchText && } diff --git a/src/js/components/Twitter/TwitterSignInCard.jsx b/src/js/components/Twitter/TwitterSignInCard.jsx index 5074cf9c1..94fa6b4b9 100644 --- a/src/js/components/Twitter/TwitterSignInCard.jsx +++ b/src/js/components/Twitter/TwitterSignInCard.jsx @@ -1,6 +1,7 @@ import styled from 'styled-components'; import React, { Component } from 'react'; import { renderLog } from '../../common/utils/logging'; +import webAppConfig from '../../config'; import InfoCircleIcon from '../Widgets/InfoCircleIcon'; import TwitterSignIn from './TwitterSignIn'; @@ -12,6 +13,10 @@ class TwitterSignInCard extends Component { render () { renderLog('TwitterSignInCard'); // Set LOG_RENDER_EVENTS to log all renders + + if (!webAppConfig.ENABLE_TWITTER) { + return ''; + } return (
diff --git a/src/js/config-template.js b/src/js/config-template.js index ebae3e21f..f08cf872f 100644 --- a/src/js/config-template.js +++ b/src/js/config-template.js @@ -34,7 +34,8 @@ module.exports = { text_for_map_search: '', }, - ENABLE_FACEBOOK: true, + ENABLE_FACEBOOK: false, // Temporary 'false' Feb 28, 2024 + ENABLE_TWITTER: false, // Temporary 'false' Feb 28, 2024 ENABLE_PAY_TO_PROMOTE: true, // API Keys, some of these are publishable (not secret) diff --git a/src/js/pages/Campaigns/CampaignsHome.jsx b/src/js/pages/Campaigns/CampaignsHome.jsx index 3c45d3db1..adf84aade 100644 --- a/src/js/pages/Campaigns/CampaignsHome.jsx +++ b/src/js/pages/Campaigns/CampaignsHome.jsx @@ -105,6 +105,7 @@ class CampaignsHome extends Component { const candidateList = CandidateStore.getCandidateList(); // console.log('ComponentDidMount candidateList', candidateList); const { candidateListOnYourBallot, candidateListIsBattleground, candidateListOther } = this.splitUpCandidateList(candidateList); + // console.log('ComponentDidMount candidateListOther', candidateListOther); this.setState({ candidateList, candidateListIsBattleground, @@ -350,6 +351,21 @@ class CampaignsHome extends Component { const weVoteIdsIsBattlegroundRace = extractAttributeValueListFromObjectList('we_vote_id', candidateListIsBattleground); const candidateMinusBattleground = candidateListRemaining.filter((oneCandidate) => !arrayContains(oneCandidate.we_vote_id, weVoteIdsIsBattlegroundRace)); const candidateListOther = candidateMinusBattleground.filter((oneCandidate) => !arrayContains(oneCandidate.politician_we_vote_id, politicianWeVoteIdsAlreadyShown)); + + // Ok to remove once https://wevoteusa.atlassian.net/jira/software/projects/WV/issues/WV-282 is fixed + // console.log('------ candidateList biden: ', candidateList.find((x) => x.ballot_item_display_name === 'Joe Biden')); + // console.log('------ candidateList trump: ', candidateList.find((x) => x.ballot_item_display_name === 'Donald Trump')); + // console.log('candidateListOnYourBallot biden: ', candidateListOnYourBallot.find((x) => x.ballot_item_display_name === 'Joe Biden')?.ballot_item_display_name); + // console.log('weVoteIdsOnYourBallot: ', weVoteIdsOnYourBallot); + // console.log('candidateListRemaining biden: ', candidateListRemaining.find((x) => x.ballot_item_display_name === 'Joe Biden')?.ballot_item_display_name); + // console.log('politicianWeVoteIdsAlreadyShown: ', politicianWeVoteIdsAlreadyShown); + // console.log('candidateMinusBattleground biden: ', candidateMinusBattleground.find((x) => x.ballot_item_display_name === 'Joe Biden')?.ballot_item_display_name); + // console.log('candidateMinusBattleground trump: ', candidateMinusBattleground.find((x) => x.ballot_item_display_name === 'Donald Trump')?.ballot_item_display_name); + // console.log('candidateListOther candidate id biden: ', candidateListOther.find((x) => x.ballot_item_display_name === 'Joe Biden')?.politician_we_vote_id); + // console.log('candidateListOther candidate id trump: ', candidateListOther.find((x) => x.ballot_item_display_name === 'Donald Trump')?.politician_we_vote_id); + // console.log('candidateListOther biden: ', candidateListOther.find((x) => x.ballot_item_display_name === 'Joe Biden')?.ballot_item_display_name); + // console.log('candidateListOther trump: ', candidateListOther.find((x) => x.ballot_item_display_name === 'Donald Trump')?.ballot_item_display_name); + return { candidateListOnYourBallot, candidateListIsBattleground, @@ -358,6 +374,7 @@ class CampaignsHome extends Component { } splitUpRepresentativeList = (representativeList) => { + // console.log('representativeList = ', representativeList); const candidateListOnYourBallot = BallotStore.getAllBallotItemsFlattened(); const politicianWeVoteIdsOnYourBallot = extractAttributeValueListFromObjectList('politician_we_vote_id', candidateListOnYourBallot); const representativeListOnYourBallot = representativeList.filter((oneRepresentative) => arrayContains(oneRepresentative.politician_we_vote_id, politicianWeVoteIdsOnYourBallot)); diff --git a/src/js/startCordova.js b/src/js/startCordova.js index 7b953245e..be6af12ed 100644 --- a/src/js/startCordova.js +++ b/src/js/startCordova.js @@ -144,8 +144,8 @@ export function initializationForCordova (startReact) { } try { - console.log('getVersionNumber() cordova', window.cordova); - console.log('getVersionNumber() cordova.getAppVersion', window.cordova.getAppVersion); + // console.log('getVersionNumber() cordova', window.cordova); + // console.log('getVersionNumber() cordova.getAppVersion', window.cordova.getAppVersion); // Prevent the app from rotating to Landscape -- mostly to simplify layout permutations try {