diff --git a/lib/Exd/Gui.pm b/lib/Exd/Gui.pm
index 8506ea1..d5735e4 100644
--- a/lib/Exd/Gui.pm
+++ b/lib/Exd/Gui.pm
@@ -128,7 +128,6 @@ sub start($self) {
$self->_activate(undef);
}
);
- print Data::Dumper::Dumper $app;
$app->run( [ $0, @ARGV ] );
}
@@ -231,14 +230,16 @@ sub _on_get_price( $self, $instance_id ) {
warn 'Server error retrieving price';
exit;
}
- my ( $price, $discount ) = $price_json->@{ 'price', 'discount' };
+ my ( $price, $discount, $starting_price ) =
+ $price_json->@{ 'price', 'discount', 'starting_price' };
$self->send_packet_to_window(
$instance_id,
{
type => 'price',
data => {
- price => $price,
- discount => $discount,
+ price => $price,
+ discount => $discount,
+ starting_price => $starting_price,
}
}
);
diff --git a/lib/Exd/Gui/Instance.pm b/lib/Exd/Gui/Instance.pm
index eb9aacf..e807962 100644
--- a/lib/Exd/Gui/Instance.pm
+++ b/lib/Exd/Gui/Instance.pm
@@ -31,6 +31,7 @@ has _last_valid_preview_file => ( is => 'rw' );
has _is_showing_paywall => ( is => 'rw' );
has _price => ( is => 'rw' );
has _discount => ( is => 'rw' );
+has _starting_price => ( is => 'rw' );
has file_format => (
is => 'rw',
default => sub {
@@ -299,8 +300,8 @@ sub _show_paywall( $self, $overlay ) {
my $inner_paywall_box = Gtk4::Box->new( 'vertical', 10 );
my $title = Gtk4::Label->new;
$title->set_markup('This program is not activated');
- my $activate = Gtk4::Button->new_with_label('Pay and activate');
- my $about = Gtk4::Button->new_with_label('More about the program');
+ my $activate = Gtk4::Button->new_with_label('Pay and activate');
+ my $about = Gtk4::Button->new_with_label('More about the program');
my $remind_me_later = Gtk4::Button->new_with_label('Remind me later');
$about->signal_connect(
clicked => sub {
@@ -332,15 +333,17 @@ sub _show_paywall( $self, $overlay ) {
my $debug_message = Gtk4::Label->new(
'This is debug compilation, do not use your real payment data but a Stripe test card'
);
-# $inner_paywall_box->append($debug_message);
+
+ # $inner_paywall_box->append($debug_message);
}
my $window_price_discount = Gtk4::ScrolledWindow->new;
$window_price_discount->set_hexpand(1);
- $window_price_discount->set_property('width-request', 600);
+ $window_price_discount->set_property( 'width-request', 600 );
$self->_window_price_discount($window_price_discount);
if ( defined $self->_price ) {
$self->_on_receive_price;
- } else {
+ }
+ else {
$self->_send_get_price;
}
$inner_paywall_box->append($window_price_discount);
@@ -694,8 +697,9 @@ sub _run_script( $self, $device = undef, $verbose = 1 ) {
}
sub _on_receive_price($self) {
- my $price = $self->_price;
- my $discount = $self->_discount;
+ my $price = $self->_price;
+ my $discount = $self->_discount;
+ my $starting_price = $self->_starting_price;
if ( !$self->_is_showing_paywall ) {
return;
}
@@ -703,19 +707,27 @@ sub _on_receive_price($self) {
if ( !defined $window_price_discount ) {
return;
}
- my $box = Gtk4::Box->new( 'horizontal', 10 );
+ my $box = Gtk4::Box->new( 'horizontal', 10 );
$box->set_halign('center');
my $discount_label = Gtk4::Label->new(undef);
- $discount_label->set_markup("-$discount% Cheaper than usual");
+ $discount_label->set_markup("-$discount%");
+ $starting_price =~ s/^(.)$/0$1/;
+ $starting_price =~ s/(..)$/.$1/;
+ $starting_price =~ s/^\./0./;
+ $price =~ s/^(.)$/0$1/;
+ $price =~ s/(..)$/.$1/;
+ $price =~ s/^\./0./;
+ my $starting_price_label = Gtk4::Label->new;
+ $starting_price_label->set_markup("$starting_price€");
$discount_label->add_css_class('discount');
+
if ( !defined $price ) {
return;
}
- $price =~ s/(..)$/.$1/;
- $price =~ s/^\./0./;
my $price_label = Gtk4::Label->new(undef);
- $price_label->set_markup("Activate now for: $price€");
+ $price_label->set_markup("$price€");
$box->append($price_label);
+ $box->append($starting_price_label);
if ( $discount > 2 ) {
$box->append($discount_label);
}
@@ -725,9 +737,11 @@ sub _on_receive_price($self) {
sub receive_packet( $self, $packet ) {
if ( $packet->{type} eq 'price' ) {
my $data = $packet->{data};
- my ( $price, $discount ) = $data->@{ 'price', 'discount' };
+ my ( $price, $discount, $starting_price ) =
+ $data->@{ 'price', 'discount', 'starting_price' };
$self->_price($price);
$self->_discount($discount);
+ $self->_starting_price($starting_price);
$self->_on_receive_price;
return;
}
@@ -1034,7 +1048,7 @@ sub _save_action($self) {
);
}
-sub _send_get_price( $self ) {
+sub _send_get_price($self) {
$self->app->send_packet_to_daemon(
$self,
{