mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-21 13:53:37 +00:00
[ios] Change how authorization check after editing is handled
Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com>
This commit is contained in:
@@ -382,7 +382,10 @@ NSString *const kAboutSegue = @"Map2About";
|
|||||||
[self updateStatusBarStyle];
|
[self updateStatusBarStyle];
|
||||||
GetFramework().SetRenderingEnabled();
|
GetFramework().SetRenderingEnabled();
|
||||||
GetFramework().InvalidateRendering();
|
GetFramework().InvalidateRendering();
|
||||||
[self checkAuthorization];
|
[self showViralAlertIfNeeded];
|
||||||
|
if (Profile.needsReauthorization) {
|
||||||
|
[self checkAuthorization];
|
||||||
|
}
|
||||||
[MWMRouter updateRoute];
|
[MWMRouter updateRoute];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -542,6 +545,12 @@ NSString *const kAboutSegue = @"Map2About";
|
|||||||
[[MWMBookmarksManager sharedManager] addObserver:self];
|
[[MWMBookmarksManager sharedManager] addObserver:self];
|
||||||
[[MWMBookmarksManager sharedManager] loadBookmarks];
|
[[MWMBookmarksManager sharedManager] loadBookmarks];
|
||||||
[MWMFrameworkListener addObserver:self];
|
[MWMFrameworkListener addObserver:self];
|
||||||
|
|
||||||
|
[NSNotificationCenter.defaultCenter addObserverForName:@"EditingFinishedNotififcation" object:nil queue:nil usingBlock:^(NSNotification * _Nonnull notification) {
|
||||||
|
if (!Profile.isExisting || Profile.needsReauthorization) {
|
||||||
|
[self checkAuthorization];
|
||||||
|
}
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
@@ -631,13 +640,9 @@ NSString *const kAboutSegue = @"Map2About";
|
|||||||
#pragma mark - Authorization
|
#pragma mark - Authorization
|
||||||
|
|
||||||
- (void)checkAuthorization {
|
- (void)checkAuthorization {
|
||||||
BOOL const isAfterEditing = Profile.needsReauthorization && !Profile.isExisting;
|
if (!Platform::IsConnected())
|
||||||
if (isAfterEditing) {
|
return;
|
||||||
[Profile requestReauthorizationWithShouldReauthorize:NO];
|
[self presentViewController:BridgeControllers.profileAsAlert animated:YES completion:nil];
|
||||||
if (!Platform::IsConnected())
|
|
||||||
return;
|
|
||||||
[self presentViewController:BridgeControllers.profileAsAlert animated:YES completion:nil];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - 3d touch
|
#pragma mark - 3d touch
|
||||||
|
|||||||
@@ -123,13 +123,6 @@ import OSMEditor
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Request reauthorization of the OpenStreetMap profile
|
|
||||||
/// - Parameter shouldReauthorize: If the profile should be reauthorized
|
|
||||||
@objc static func requestReauthorization(shouldReauthorize: Bool = true) {
|
|
||||||
UserDefaults.standard.set(shouldReauthorize, forKey: userDefaultsNeedsReauthorization)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Reload the OpenStreetMap profile data
|
/// Reload the OpenStreetMap profile data
|
||||||
/// - Returns: Optional profile data
|
/// - Returns: Optional profile data
|
||||||
static private func reloadUserPreferences() async -> osm.UserPreferences? {
|
static private func reloadUserPreferences() async -> osm.UserPreferences? {
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ void registerCellsForTableView(std::vector<MWMEditorCellID> const & cells, UITab
|
|||||||
[self showNotesQueuedToast];
|
[self showNotesQueuedToast];
|
||||||
break;
|
break;
|
||||||
case osm::Editor::SaveResult::SavedSuccessfully:
|
case osm::Editor::SaveResult::SavedSuccessfully:
|
||||||
[Profile requestReauthorizationWithShouldReauthorize:YES];
|
[NSNotificationCenter.defaultCenter postNotificationName:@"EditingFinishedNotififcation" object:nil];
|
||||||
f.UpdatePlacePageInfoForCurrentSelection();
|
f.UpdatePlacePageInfoForCurrentSelection();
|
||||||
[self.navigationController popToRootViewControllerAnimated:YES];
|
[self.navigationController popToRootViewControllerAnimated:YES];
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user