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

>> changed openurl to open #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions ios/Classes/LaunchexternalappPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,27 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
} else if ([@"openApp" isEqualToString:call.method]) {
@try {
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:call.arguments[@"package_name"]]]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:call.arguments[@"package_name"]]];
result(@("app_opened"));
// [[UIApplication sharedApplication] openURL:[NSURL URLWithString:call.arguments[@"package_name"]]];
[[UIApplication sharedApplication]
openURL:[NSURL URLWithString:call.arguments[@"package_name"]] options:@{}
completionHandler:^(BOOL success) {
NSLog(@"Open %d",success);
}
];
result(@("app_opened"));
} else
{
NSLog(@"Is reaching here1");
if(![@"false" isEqualToString: call.arguments[@"open_store"]]) {
NSLog(@"Is reaching here2 %@", call.arguments[@"app_store_link"]);

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:call.arguments[@"app_store_link"]]];
[[UIApplication sharedApplication]
openURL:[NSURL URLWithString:call.arguments[@"package_name"]] options:@{}
completionHandler:^(BOOL success) {
NSLog(@"Open %d",success);
}
];
result(@("navigated_to_store"));
}
result(@("App not found in the device"));
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: external_app_launcher
description: A Flutter plugin which helps you to open another app from your app
version: 4.0.1
version: 4.0.2
homepage: https://geekyants.com/
repository: https://github.com/GeekyAnts/external_app_launcher

Expand Down