Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor WMFLocationManager to Swift #3

Open
wants to merge 19 commits into
base: develop
from
Open
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Move the `LocationManager.isAuthorized` check from the cell

  • Loading branch information
jantimar authored and VojtaStavik committed Feb 28, 2020
commit 584965e18114db7a56b16c60d753975a88bc24c5
@@ -41,9 +41,6 @@ class ArticleLocationAuthorizationCollectionViewCell: ArticleLocationExploreColl
}

public func updateForLocationEnabled() {
guard WMFLocationManager.isAuthorized() else {
return
}
authorizeButton.setTitle(WMFLocalizedString("places-location-enabled", value: "Location enabled", comment: "Title for button informing user that they successfully enabled location services"), for: .normal)
authorizeButton.removeTarget(self, action: #selector(authorizeButtonPressed(_:)), for: .touchUpInside)
authorizeButton.isEnabled = false
@@ -663,7 +663,7 @@ extension ExploreCardViewController: WMFLocationManagerDelegate {
func locationManager(_ controller: WMFLocationManager, didChangeEnabledState enabled: Bool) {
UserDefaults.standard.wmf_setLocationAuthorized(enabled)
for cell in collectionView.visibleCells {
guard let cell = cell as? ArticleLocationAuthorizationCollectionViewCell else {
guard let cell = cell as? ArticleLocationAuthorizationCollectionViewCell, WMFLocationManager.isAuthorized() else {
return
}
cell.updateForLocationEnabled()
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.