The Duke of Sussex has settled his legal action against the publisher of The Sun over allegations of unlawful information-gathering shortly before the start of a weeks-long trial.