launch_review icon indicating copy to clipboard operation
launch_review copied to clipboard

Removing the toast

Open maporcho opened this issue 4 years ago • 7 comments
trafficstars

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.

maporcho avatar Apr 01 '21 17:04 maporcho

@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?

maciejp avatar May 10 '21 09:05 maciejp

is this now removed? because I am still having the toast..

KeithBacalso avatar May 17 '21 05:05 KeithBacalso

@KeithBacalso well, the PR is still open so... 😉

maciejp avatar May 17 '21 06:05 maciejp

please merge this asap

KeithBacalso avatar May 17 '21 08:05 KeithBacalso

@KeithBacalso I moved away from this plugin as implementation is quite easy. You need:

the flutter part

static const platform = const MethodChannel('your.channel.name');
platform.invokeMethod('yourMethodName', {'android_id': 'com.yourapp', 'ios_id':'123'});

the Android part (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()
            }
        }
    }
}

the iOS part (in 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)
        }
    }
}

maciejp avatar May 18 '21 08:05 maciejp

one year and no merged?

raheemadamboev avatar May 24 '22 09:05 raheemadamboev

Hmm the author of this repo needs to be notified...

hwr12 avatar Jun 01 '22 06:06 hwr12

Sorry for delay. Had some infra issues at my side.

Purus avatar Aug 15 '22 08:08 Purus