Purus / launch_review

A Flutter plugin to assist in leaving user reviews/ratings in the Google Play Store. Supports both Android and iOS.
https://pub.dartlang.org/packages/launch_review
MIT License
181 stars 130 forks source link

Removing the toast #33

Closed maporcho closed 2 years ago

maporcho commented 3 years ago

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.

maciejp commented 3 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?

KeithBacalso commented 3 years ago

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

maciejp commented 3 years ago

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

KeithBacalso commented 3 years ago

please merge this asap

maciejp commented 3 years ago

@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)
        }
    }
}
raheemadamboev commented 2 years ago

one year and no merged?

hwr12 commented 2 years ago

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

Purus commented 2 years ago

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