forked from organicmaps/organicmaps
Backurl fixes (#3193)
* Switch from canOpenURL to openURL Signed-off-by: keithconger <keith.conger@blackboxembedded.com> * Fix backurl support Signed-off-by: keithconger <keith.conger@blackboxembedded.com> * Return nil if backURL is not valid Signed-off-by: keithconger <keith.conger@blackboxembedded.com> Signed-off-by: keithconger <keith.conger@blackboxembedded.com>
This commit is contained in:
parent
f834411d14
commit
3b2b3070c2
4 changed files with 18 additions and 10 deletions
|
@ -123,7 +123,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
{
|
||||
public static final String EXTRA_TASK = "map_task";
|
||||
public static final String EXTRA_LAUNCH_BY_DEEP_LINK = "launch_by_deep_link";
|
||||
public static final String EXTRA_BACK_URL = "back_url";
|
||||
public static final String EXTRA_BACK_URL = "backurl";
|
||||
private static final String EXTRA_CONSUMED = "mwm.extra.intent.processed";
|
||||
|
||||
private static final String[] DOCKED_FRAGMENTS = { SearchFragment.class.getName(),
|
||||
|
|
|
@ -206,6 +206,15 @@ public class Factory
|
|||
if (!result.isSuccess())
|
||||
return false;
|
||||
|
||||
final Uri uri = Uri.parse(getUrl());
|
||||
final String backUrl = uri.getQueryParameter("backurl");
|
||||
if (!TextUtils.isEmpty(backUrl))
|
||||
{
|
||||
Intent intent = target.getIntent();
|
||||
if (intent != null)
|
||||
intent.putExtra(MwmActivity.EXTRA_BACK_URL, backUrl);
|
||||
}
|
||||
|
||||
switch (result.getUrlType())
|
||||
{
|
||||
case ParsingResult.TYPE_INCORRECT:
|
||||
|
|
|
@ -719,11 +719,10 @@ NSString *const kPP2BookmarkEditingSegue = @"PP2BookmarkEditing";
|
|||
}
|
||||
|
||||
- (void)goBack {
|
||||
NSString *backURL = [DeepLinkHandler.shared getBackUrl];
|
||||
BOOL canOpenURL = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:backURL]];
|
||||
if (canOpenURL){
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:backURL] options:@{} completionHandler:nil];
|
||||
}
|
||||
NSString *backURL = [DeepLinkHandler.shared getBackUrl];
|
||||
if (backURL != nil) {
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: backURL] options:@{} completionHandler:nil];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -33,10 +33,10 @@
|
|||
url = nil
|
||||
}
|
||||
|
||||
func getBackUrl() -> String {
|
||||
guard let urlString = url?.absoluteString else { return "" }
|
||||
guard let url = URLComponents(string: urlString) else { return "" }
|
||||
return (url.queryItems?.first(where: { $0.name == "backurl" })?.value ?? "")
|
||||
func getBackUrl() -> String? {
|
||||
guard let urlString = url?.absoluteString else { return nil }
|
||||
guard let url = URLComponents(string: urlString) else { return nil }
|
||||
return (url.queryItems?.first(where: { $0.name == "backurl" })?.value ?? nil)
|
||||
}
|
||||
|
||||
func handleDeepLink() -> Bool {
|
||||
|
|
Loading…
Add table
Reference in a new issue