Skip to content

Conversation

@DmitrySvetlichny
Copy link
Contributor

No description provided.

@DmitrySvetlichny DmitrySvetlichny mentioned this pull request Dec 15, 2025
12 tasks
@DmitrySvetlichny DmitrySvetlichny linked an issue Dec 15, 2025 that may be closed by this pull request
12 tasks
let metadata = LPLinkMetadata()
metadata.originalURL = url
metadata.url = url
if let title = title, !title.isEmpty {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

metadata.title = title
}

if let icon = icon, icon.size.width > 0, icon.size.height > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

int zoom = _mapView.zoomLevel;
NSString *poiName = [self.customController encodedPoiNameForLink];;
NSString *poiType = [self.customController encodedPoiTypeForLink];
NSString *httpUrlString = [self buildSharePoiUrlWithPoiName:poiName poiType:poiType lat:lat lon:lon zoom:zoom];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

urlString

NSString *poiName = [self.customController encodedPoiNameForLink];;
NSString *poiType = [self.customController encodedPoiTypeForLink];
NSString *httpUrlString = [self buildSharePoiUrlWithPoiName:poiName poiType:poiType lat:lat lon:lon zoom:zoom];
NSURL *httpUrl = [NSURL URLWithString:httpUrlString];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

url

if (amenity == nil)
return NO;

OATargetPoint*targetPoint=[_rootViewController.mapPanel.mapViewController.mapLayers.poiLayer getTargetPoint:[amenity syntheticAmenity]];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you run out of spaces on your keyboard? )


- (NSString *)encodedPoiTypeForLink
{
NSString *shareType = @"";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

up

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented in OAPOIViewController since it complies with Android.
Methods should also be overridden in OAFavoriteViewController

#define kLastMapUsedTime @"kLastMapUsedTime"

#define kShareLinkTemplate @"https://osmand.net/map?pin=%.6f,%.6f#%d/%.4f/%.4f\nThe location was shared with you by OsmAnd"
#define kSharePoiBaseUrl @"https://osmand.net/map/poi/"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use static NSString * const

for (OAPOI *amenity in amenities)
{
if (amenity.obfId > 0)
if (amenity.obfId != 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i saw a similar change somewhere by @nnngrach. We need to check if there’s a conflict

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find an identical check in the project.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OAFavoriteItem *point = [OAFavoritesHelper getVisibleFavByLat:lat lon:lon];
if (point && [name isEqualToString:[point getName]])
{
OATargetPoint*targetPoint = [_rootViewController.mapPanel.mapViewController.mapLayers.favoritesLayer getTargetPoint:point];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

up

return NO;
}

- (BOOL)handleIncomingMapPoiURL:(NSURL *)url
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There shouldn’t be any link-parsing code in the SceneDelegate class. All parsing should be moved to the DeepLinkParser class

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to introduce the following structure:

@objcMembers
final class DeepLinkManager: NSObject {
    static let shared = DeepLinkManager()

    private let deepLinkParser = DeepLinkParser()

    func handleDeepLink(url: URL) -> Bool {
        deepLinkParser.parseDeepLink(url)
    }
}

This logic should be moved into DeepLinkParser:

return [self handleIncomingFileURL:url]
    || [self handleIncomingActionsURL:url]
    || [self handleIncomingNavigationURL:url]
    || [self handleIncomingSetPinOnMapURL:url]
    || [self handleIncomingMoveMapToLocationURL:url]
    || [self handleIncomingOpenLocationMenuURL:url]
    || [self handleIncomingTileSourceURL:url]
    || [self handleIncomingOsmAndCloudURL:url];


#import <Foundation/Foundation.h>

@class OAFavoriteItem;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

if (wikidata.length == 0)
return @"";

if ([wikidata hasPrefix:@"Q"] || [wikidata hasPrefix:@"q"])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unichar firstChar = [wikidata characterAtIndex:0];
if (firstChar == 'Q' || firstChar == 'q') {}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or use lowercase for wikidata


- (BOOL)handleIncomingSetPinOnMapURL:(NSURL *)url
{
if ([DeepLinkParser handleIncomingMapPoiURL:url rootViewController:_rootViewController])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can move all this logic into DeepLinkParser


if ([OAUtilities isOsmAndSite:url] && [OAUtilities isPathPrefix:url pathPrefix:@"/map/poi"])
{
__weak __typeof(self) weakSelf = self;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor to the following pattern:

__weak typeof(self) weakSelf = self;
dispatch_async(dispatch_get_main_queue(), ^{
    [weakSelf someMethod];
});


#import <Foundation/Foundation.h>

@class OARootViewController, OATargetPoint;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use NS_ASSUME_NONNULL_

}

let startLatLon: CLLocation? = {
guard let startParam = startLatLonParam, !startParam.isEmpty else { return nil }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

}

let appMode = OAApplicationMode.value(ofStringKey: appModeKeyParam, def: nil)
if let key = appModeKeyParam, !key.isEmpty, appMode == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

|| ?

let vc = rootViewController.navigationController?.visibleViewController
if let verificationVC = vc as? OACloudAccountVerificationViewController {
let isValidToken: Bool = {
guard let token = tokenParam else { return false }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

return BackupUtils.isTokenValid(token)
}()

if isValidToken, let token = tokenParam {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

return rootViewController.handleIncomingURL(url)
}

private func handleIncomingActionsURL(_ url: URL, rootViewController: OARootViewController?) -> Bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You lost the example URL. It needs to be migrated as well

… POI_share_link

# Conflicts:
#	Sources/OsmAnd Maps-Bridging-Header.h
@alex-dev-neo alex-dev-neo merged commit d4775a6 into master Dec 18, 2025
@alex-dev-neo alex-dev-neo deleted the POI_share_link branch December 18, 2025 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

POI share link

4 participants