diff --git a/android/src/main/java/zhuoyuan/li/fluttershareme/FlutterShareMePlugin.java b/android/src/main/java/zhuoyuan/li/fluttershareme/FlutterShareMePlugin.java index 770e17c..d261c35 100644 --- a/android/src/main/java/zhuoyuan/li/fluttershareme/FlutterShareMePlugin.java +++ b/android/src/main/java/zhuoyuan/li/fluttershareme/FlutterShareMePlugin.java @@ -256,16 +256,15 @@ private void shareWhatsApp(String imagePath, String msg, Result result, boolean private void shareToTelegram(String msg, Result result) { try { - String message = call.argument("msg"); Intent telegramIntent = new Intent(Intent.ACTION_SEND); telegramIntent.setType("text/plain"); telegramIntent.setPackage("org.telegram.messenger"); - telegramIntent.putExtra(Intent.EXTRA_TEXT, message); + telegramIntent.putExtra(Intent.EXTRA_TEXT, msg); try { - startActivity(telegramIntent); + activity.startActivity(telegramIntent); result.success("true"); } catch (Exception ex) { - result.success("false"); + result.success("false:Telegram app is not installed on your device"); } } catch (Exception var9) { result.error("error", var9.toString(), ""); diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist index 14ad1e2..4e97be2 100644 --- a/example/ios/Runner/Info.plist +++ b/example/ios/Runner/Info.plist @@ -21,6 +21,7 @@ 343254889799245 LSApplicationQueriesSchemes + tg instagram twitter fbauth2 diff --git a/ios/Classes/SwiftFlutterShareMePlugin.swift b/ios/Classes/SwiftFlutterShareMePlugin.swift index 7f7befb..b05594a 100644 --- a/ios/Classes/SwiftFlutterShareMePlugin.swift +++ b/ios/Classes/SwiftFlutterShareMePlugin.swift @@ -72,7 +72,7 @@ public class SwiftFlutterShareMePlugin: NSObject, FlutterPlugin, SharingDelegate } else if(call.method.elementsEqual(_methodTelegramShare)){ let args = call.arguments as? Dictionary - shareToTelegram(message: args!["msg"] as! String ) + shareToTelegram(message: args!["msg"] as! String, result: result ) } else{ let args = call.arguments as? Dictionary @@ -238,7 +238,7 @@ public class SwiftFlutterShareMePlugin: NSObject, FlutterPlugin, SharingDelegate } else { - result(FlutterError(code: "Not found", message: "WhatsAppBusiness is not found", details: "WhatsAppBusiness not intalled or Check url scheme.")); + result(FlutterError(code: "Not found", message: "telegram is not found", details: "telegram not intalled or Check url scheme.")); } }