The 1688 Glorious Revolution replaced James II and VII with his Protestant daughter Mary II and her husband William III and II. Since neither Mary or her sister Anne had surviving children, the 1701 Act of Settlement ensured a Protestant successor by excluding Catholics from the English and Irish thrones, and that of Great Britain after the 1707 Act of Union. When Anne became the last Stuart monarch in 1702, her heir was the distantly related but Protestant Sophia of Hanover, not her Catholic half-brother James Francis Edward. Sophia died two months before Anne in August 1714; her son became George I and the pro-Hanoverian Whigs controlled government for the next 30 years.

Answer this question based on the article: What happened second, Act of Settlement  or Act of Union?
Act of Union