(Reuters) - When Apple Inc AAPL.O reports results on Wednesday, Wall Street expects flat fiscal fourth-quarter sales and lower full-year revenue compared with the prior year, mostly because of declining iPhone sales. Yet Apple's stock price has hit all-time highs in recent weeks, and its price-to-forward-earnings valuation is higher than it has been since 2010.

FILE PHOTO: Apple CEO Tim Cook arrives to the global premiere for Apple's "The Morning Show" at the Lincoln Center in the Manhattan borough of New York City, U.S., October 28, 2019. REUTERS/Eduardo Munoz

Investors and analysts told Reuters that much of the explanation lies in Apple Chief Executive Tim Cook’s skillful management of relationships in Washington, Beijing and Wall Street.

Cook has fostered a relationship with U.S. President Donald Trump, dining with him and conveying Apple’s views on tariffs and U.S. manufacturing. He has also kept strong enough relations with Chinese officials to avoid Apple becoming a target of explicit retaliation after the U.S. government moved to cut off Huawei Technologies Co Ltd - Apple’s arch rival in the premium smartphone market in China - from American technology.

Along the way, Cook has persuaded Wall Street that Apple can transition from the iPhone to a broader constellation of products that includes streaming video and even a credit card, along with accessories like AirPods and the Apple Watch.

Even investors who were already impressed by Cook’s business acumen - he masterminded Apple’s supply chain and operations under the late CEO Steve Jobs - have been pleasantly surprised by Cook’s ability to avoid taking fatal arrows from either side in the U.S.-China trade war.

“Who would have thought he would have been able to thread that needle and deal with the president? It’s a show of an incredible amount of nuance and emotional intelligence to do what’s best for the company,” said Hal Eddins, chief economist for Capital Investment Cos, an Apple shareholder.

China remains a challenge for Apple. Sales there fell sharply early in the current fiscal year when currency fluctuations put iPhones out of reach for many Chinese consumers. Apple cut prices, which helped, but rival Huawei has gained share.

Apple’s share of the Chinese market fell to 5.2% in the calendar third quarter versus 7% a year ago, while Huawei, which sells many more low-cost models than Apple does, saw its market share surge to 42.4% from 24.9% the year before, Canalys data showed.

“A year ago, we were talking about the price pushback in China, and (Apple) contended they were overcoming that,” said Tom Plumb, founder of Wisconsin Capital Management, an Apple shareholder. “Now the real question is whether you’re seeing a cultural shift that would bode poorly for Apple.”

But many Apple investors have likely already priced in a loss of China market share to domestic rivals in the long term.

“If the industry is worth being in, you should assume that over the course of time it’s going to be dominated by Chinese national champions,” said Erik Gordon, a professor at the Ross School of Business at the University of Michigan.

Apple shares were down 0.5% to $242 at midday on Wednesday after reports that Chilean officials had canceled a summit at which the United States and China were expected to take major steps toward a trade deal.

Cook has also persuaded investors that services such as Apple TV+, coming next month, will boost sales. Investors are optimistic, but worry that Apple could be drawn into spending battles over Hollywood talent against entrenched rivals such as Walt Disney Co DIS.N.

“We’re not huge advocates of them spending huge amounts of cash reserves on content generation,” said John Ham of New England Investment & Retirement Group Inc, which holds Apple shares. “But as long as they don’t get carried away and start making outsized, egregious deals, then we would support them dabbling in this area.”