-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix attribution dialog presentation (#1982)
MAPSIOS-515: Fix attribution dialog presentation
- Loading branch information
1 parent
b7a9f9b
commit ba7bdc3
Showing
15 changed files
with
102 additions
and
34 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
Sources/MapboxMaps/Foundation/Extensions/UIViewController+Extensions.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import UIKit | ||
|
||
extension UIViewController { | ||
var topmostPresentedViewController: UIViewController { | ||
var result = self | ||
while let presented = result.presentedViewController { | ||
result = presented | ||
} | ||
return result | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
Tests/MapboxMapsTests/Foundation/Extensions/UIViewController+ExtensionsTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
@testable import MapboxMaps | ||
import XCTest | ||
|
||
final class UIViewControllerExtensionsTests: XCTestCase { | ||
func testTopmostPresentedViewController() { | ||
let vc1 = MockViewController() | ||
let vc2 = MockViewController() | ||
let vc3 = MockViewController() | ||
|
||
XCTAssertIdentical(vc1.topmostPresentedViewController, vc1) | ||
|
||
vc1.simulatePresent(vc2) | ||
XCTAssertIdentical(vc1.topmostPresentedViewController, vc2) | ||
|
||
vc2.simulatePresent(vc3) | ||
XCTAssertIdentical(vc1.topmostPresentedViewController, vc3) | ||
} | ||
} | ||
|
||
private class MockViewController: UIViewController { | ||
private var _presentedViewControllerOverride: UIViewController? | ||
override var presentedViewController: UIViewController? { | ||
return _presentedViewControllerOverride | ||
} | ||
func simulatePresent(_ vc: UIViewController) { | ||
_presentedViewControllerOverride = vc | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters