Politico: Trump didn't fire Wray for not doing enough to investigate Obama's spying because Barr threatened to quit over it
https://www.dailymail.co.uk/news/article-9600871/Trump-didnt-fire-FBI-Director-Wray-Barr-threatened-quit.html
https://www.politico.com/news/2021/05/20/trump-wray-fbi-chief-489725
In April 2020 Trump came the closest to ousting Wray, who he felt was weak. Wray frustrated Trump whenever he defended the Foreign Intelligence Surveillance Act, which the ex-president felt enabled 'spying' on his 2016 campaign.
Trump wished to replace Wray with counterintelligence head William Evanina, Politico said. In a more controversial posting, Trump wanted Evanina's deputy to be Kash Patel, a former aide of Rep. Devin Nunes, one of the president's top Congressional allies.
The attorney general learned of Trump's plans to replace Wray with Evanina and Patel. At that, Barr told Meadows and Cipollone he would have to quit if the plan was enacted. Politico also noted that Cipollone agreed with Barr, only having learned of the scheme earlier that day. With that, the White House ultimately kept Wray in place, where he remains today.