Skip to content

Commit

Permalink
Merge pull request #3847 from SailingSteve/steveWebAppFeb28-11am
Browse files Browse the repository at this point in the history
Disable Sign In with Twitter
  • Loading branch information
DaleMcGrew authored Feb 29, 2024
2 parents d8b2b25 + d34cf40 commit 1373fd1
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 20 deletions.
5 changes: 5 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,18 @@ 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"
initializeFacebookSDK();
}, 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);
Expand Down
10 changes: 5 additions & 5 deletions src/js/common/components/SignIn/SignInOptionsPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
});
Expand Down Expand Up @@ -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.';
}
Expand Down
6 changes: 3 additions & 3 deletions src/js/common/utils/cordovaUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/js/common/utils/isCordovaOrWebApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 6 additions & 8 deletions src/js/components/Search/BaseSearchbox.jsx
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 && <ClearButton onClick={this.handleClear} />}
Expand Down
5 changes: 5 additions & 0 deletions src/js/components/Twitter/TwitterSignInCard.jsx
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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 (
<div>
<div>
Expand Down
3 changes: 2 additions & 1 deletion src/js/config-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 17 additions & 0 deletions src/js/pages/Campaigns/CampaignsHome.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions src/js/startCordova.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 1373fd1

Please sign in to comment.