Closed maporcho closed 2 years ago
@Purus what do you think about this change? Maybe we could use the already existing writeReview
flag to control showing the toast in case you don't want to remove it completely?
is this now removed? because I am still having the toast..
@KeithBacalso well, the PR is still open so... 😉
please merge this asap
@KeithBacalso I moved away from this plugin as implementation is quite easy. You need:
static const platform = const MethodChannel('your.channel.name');
platform.invokeMethod('yourMethodName', {'android_id': 'com.yourapp', 'ios_id':'123'});
MainActivity.kt
)class MainActivity : FlutterActivity() {
private val CHANNEL = "your.channel.name"
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler { call, result ->
if (call.method == "yourMethodName" && call.hasArgument("android_id")) {
val id = call.argument<String>("android_id")
val uri = Uri.parse("https://play.google.com/store/apps/details?id=$id")
context.startActivity(Intent(ACTION_VIEW, uri))
} else {
result.notImplemented()
}
}
}
}
AppDelegate.swift
)@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let controller : FlutterViewController = window?.rootViewController as! FlutterViewController
let flutterMethodChannel = FlutterMethodChannel(name: "your.channel.name", binaryMessenger: controller.binaryMessenger)
flutterMethodChannel.setMethodCallHandler({
[weak self] (call: FlutterMethodCall, result: FlutterResult) -> Void in
guard call.method == "yourMethodName" else {
result(FlutterMethodNotImplemented)
return
}
if let args = call.arguments as? [String: String] {
if let id = args["ios_id"] {
self?.openAppStore(id: id)
}
}
})
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
private func openAppStore(id: String) -> Void{
if let appUrl = URL(string: "https://itunes.apple.com/app/id\(id)") {
UIApplication.shared.open(appUrl, options: [:], completionHandler: nil)
}
}
}
one year and no merged?
Hmm the author of this repo needs to be notified...
Sorry for delay. Had some infra issues at my side.
The toast is not necessary. Besides that, since it shows a message written in English, it can be rather confusing for users if the app is presented in other languages.