addAuthorityToState(authority) {
    let authorityIndex = this.state.authoritiesList.findIndex(
      x => Object.keys(x)[0] === authority,
    );

    if (
      this.state.selectedAuthorities.findIndex(x => x.key === authority) === -1
    ) {
      this.setState(
        {
          selectedAuthorities: this.state.selectedAuthorities.concat({
            key: authority,
            url: this.state.authoritiesList[authorityIndex][authority][0].url,
          }),
        },
        () => {
          // Add current settings state to async storage.
          SetStoreData(
            AUTHORITY_SOURCE_SETTINGS,
            this.state.selectedAuthorities,
          );
        },
      );
    } else {
      console.log('Not adding the duplicate to sources list');
    }
  }
// Add selected authorities to state, for display in the FlatList
Add selected authorities to state, for display in the FlatList
Add selected authorities to state for display in the FlatList
addAuthorityToState(authority) {
    let authorityIndex = this.state.authoritiesList.findIndex(
      x => Object.keys(x)[0] === authority,
    );
    if (
      this.state.selectedAuthorities.findIndex(x => x.key === authority) === -1
    ) {
      this.setState(
        {
          selectedAuthorities: this.state.selectedAuthorities.concat({
            key: authority,
            url: this.state.authoritiesList[authorityIndex][authority][0].url,
          }),
        },
        () => {
          SetStoreData(
            AUTHORITY_SOURCE_SETTINGS,
            this.state.selectedAuthorities,
          );
        },
      );
    } else {
      console.log('Not adding the duplicate to sources list');
    }
  }
addAuthorityToState ( authority ) { let authorityIndex = this . state . authoritiesList . findIndex ( x => Object . keys ( x ) [ 0 ] === authority , ) ; if ( this . state . selectedAuthorities . findIndex ( x => x . key === authority ) === - 1 ) { this . setState ( { selectedAuthorities : this . state . selectedAuthorities . concat ( { key : authority , url : this . state . authoritiesList [ authorityIndex ] [ authority ] [ 0 ] . url , } ) , } , ( ) => { SetStoreData ( AUTHORITY_SOURCE_SETTINGS , this . state . selectedAuthorities , ) ; } , ) ; } else { console . log ( 'Not adding the duplicate to sources list' ) ; } }
Add selected authorities to state, for display in the FlatList
Add selected authorities to state for display in the FlatList
// Add current settings state to async storage.