using Android.App;
using Android.Content;
using Android.Views;
using TouchyTickets;
using Uri = Android.Net.Uri;

namespace Android; 

public class AndroidPlatform : Platform {

    private readonly Activity activity;

    public AndroidPlatform(Activity activity) {
        this.activity = activity;
    }

    public override void SetKeepScreenOn(bool keep) {
        if (keep) {
            this.activity.Window.AddFlags(WindowManagerFlags.KeepScreenOn);
        } else {
            this.activity.Window.ClearFlags(WindowManagerFlags.KeepScreenOn);
        }
    }

    public override void OpenRateLink() {
        this.activity.StartActivity(new Intent(Intent.ActionView, Uri.Parse("https://play.google.com/store/apps/details?id=de.ellpeck.touchytickets")));
    }

}