Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply 21st Capital changes to Liana v9 #12

Merged
37 changes: 37 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion contrib/release/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
set -ex

VERSION="${VERSION:-"9.0"}"
LIANA_PREFIX="liana-$VERSION"
LIANA_PREFIX="liana-$VERSION-21st-capital"
LINUX_DIR_NAME="$LIANA_PREFIX-x86_64-linux-gnu"
LINUX_ARCHIVE="$LINUX_DIR_NAME.tar.gz"

Expand Down Expand Up @@ -54,6 +54,8 @@ NIX_BUILD_DIR="$(nix path-info .#release)"
mv "$LINUX_ARCHIVE" "$RELEASE_DIR"

unzip ../contrib/release/debian/package.zip
# Use retailer icon
cp ../contrib/retailer.png ./package/usr/share/icons/liana-icon.png
sed -i "s/VERSION_PLACEHOLDER/$VERSION/g" ./package/DEBIAN/control
cp "$BUILD_DIR/x86_64-unknown-linux-gnu/release/lianad" "$BUILD_DIR/x86_64-unknown-linux-gnu/release/liana-cli" "$BUILD_DIR/x86_64-unknown-linux-gnu/release/liana-gui" ../README.md ./package/usr/bin/
DIRNAME="liana_$VERSION-1_amd64"
Expand Down Expand Up @@ -82,6 +84,8 @@ NIX_BUILD_DIR="$(nix path-info .#release)"
mv "$LIANA_PREFIX-aarch64-apple-darwin.tar.gz" "$RELEASE_DIR"

unzip ../contrib/release/macos/Liana.app.zip
# Use retailer icon
cp ../contrib/retailer.icns ./Liana.app/Contents/Resources/Liana.icns
sed -i "s/VERSION_PLACEHOLDER/$VERSION/g" ./Liana.app/Contents/Info.plist
cp "$NIX_BUILD_DIR/universal2-apple-darwin/liana-gui" ./Liana.app/Contents/MacOS/Liana
zip_archive "Liana-$VERSION-noncodesigned.zip" Liana.app
Expand Down
Binary file added contrib/retailer.icns
Binary file not shown.
Binary file added contrib/retailer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions liana-gui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ reqwest = { version = "0.11", default-features=false, features = ["json", "rustl
rust-ini = "0.19.0"
rfd = "0.15.1"

# Used for opening URLs in browser
open = "5.3"

[target.'cfg(windows)'.dependencies]
zip = { version = "0.6", default-features=false, features = ["bzip2", "deflate"] }
Expand Down
6 changes: 6 additions & 0 deletions liana-gui/src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,12 @@ impl App {
)
}
Message::View(view::Message::Menu(menu)) => self.set_current_panel(menu),
Message::View(view::Message::OpenUrl(url)) => {
if let Err(e) = open::that_detached(&url) {
tracing::error!("Error opening '{}': {}", url, e);
}
Command::none()
}
Message::View(view::Message::Clipboard(text)) => clipboard::write(text),
_ => self
.panels
Expand Down
18 changes: 17 additions & 1 deletion liana-gui/src/app/view/home.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ use crate::{
daemon::model::{HistoryTransaction, Payment, PaymentKind, TransactionKind},
};

const RETAILER_BUTTON_TEXT: &str = "PRIORITY SUPPORT";
const RETAILER_BUTTON_URL: &str = "https://21stcapital.com/priority/";

#[allow(clippy::too_many_arguments)]
pub fn home_view<'a>(
balance: &'a bitcoin::Amount,
Expand All @@ -38,7 +41,20 @@ pub fn home_view<'a>(
sync_status: &SyncStatus,
) -> Element<'a, Message> {
Column::new()
.push(h3("Balance"))
.push(
Row::new().push(h3("Balance").width(Length::Fill)).push(
Button::new(
text(RETAILER_BUTTON_TEXT)
.bold()
.vertical_alignment(alignment::Vertical::Center)
.horizontal_alignment(alignment::Horizontal::Center),
)
.height(Length::Fixed(50.0))
.width(Length::Fixed(200.0))
.on_press(Message::OpenUrl(RETAILER_BUTTON_URL.to_string()))
.style(theme::Button::Retailer),
),
)
.push(
Column::new()
.push(if sync_status.is_synced() {
Expand Down
1 change: 1 addition & 0 deletions liana-gui/src/app/view/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub enum Message {
CreateRbf(CreateRbfMessage),
ShowQrCode(usize),
Export(ExportMessage),
OpenUrl(String),
}

#[derive(Debug, Clone)]
Expand Down
6 changes: 3 additions & 3 deletions liana-gui/src/app/view/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ pub fn sidebar<'a>(menu: &Menu, cache: &'a Cache) -> Container<'a, Message> {
Column::new()
.push(
Container::new(
liana_grey_logo()
.height(Length::Fixed(120.0))
.width(Length::Fixed(60.0)),
retailer_logo()
.height(Length::Fixed(200.0))
.width(Length::Fixed(200.0)),
)
.padding(10),
)
Expand Down
5 changes: 4 additions & 1 deletion liana-gui/src/app/view/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,10 @@ pub fn about_section<'a>(
.push(
Row::new().push(Space::with_width(Length::Fill)).push(
Column::new()
.push(text(format!("liana-gui v{}", crate::VERSION)))
.push(text(format!(
"liana-gui Smart Vault - v{}",
crate::RETAILER_VERSION
)))
.push_maybe(
lianad_version
.map(|version| text(format!("lianad v{}", version))),
Expand Down
5 changes: 4 additions & 1 deletion liana-gui/src/launcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,11 @@ impl Launcher {
.push(
Row::new()
.spacing(20)
.push(Container::new(
image::liana_brand_grey().width(Length::Fixed(200.0)),
))
.push(
Container::new(image::liana_brand_grey().width(Length::Fixed(200.0)))
Container::new(image::retailer_logo().width(Length::Fixed(200.0)))
.width(Length::Fill),
)
.push(
Expand Down
13 changes: 13 additions & 0 deletions liana-gui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,16 @@ pub const VERSION: Version = Version {
minor: 0,
patch: 0,
};

const RETAILER_NAME: &str = "21st Capital";

#[derive(Debug, Clone)]
pub struct RetailerVersion(Version);

impl std::fmt::Display for RetailerVersion {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{} - {}", self.0, RETAILER_NAME)
}
}

pub const RETAILER_VERSION: RetailerVersion = RetailerVersion(VERSION);
8 changes: 4 additions & 4 deletions liana-gui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use liana_gui::{
},
loader::{self, Loader},
logger::Logger,
VERSION,
RETAILER_VERSION as VERSION,
};

#[derive(Debug, PartialEq)]
Expand Down Expand Up @@ -147,8 +147,8 @@ impl Application for GUI {

fn title(&self) -> String {
match self.state {
State::Installer(_) => format!("Liana v{} Installer", VERSION),
_ => format!("Liana v{}", VERSION),
State::Installer(_) => format!("Smart Vault - Liana v{} Installer", VERSION),
_ => format!("Smart Vault - Liana v{}", VERSION),
}
}

Expand Down Expand Up @@ -570,7 +570,7 @@ fn main() -> Result<(), Box<dyn Error>> {
setup_panic_hook();

let mut settings = Settings::with_flags((config, log_level));
settings.window.icon = Some(image::liana_app_icon());
settings.window.icon = Some(image::retailer_app_icon());
settings.window.min_size = Some(Size {
width: 1000.0,
height: 650.0,
Expand Down
6 changes: 6 additions & 0 deletions liana-ui/src/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,9 @@ pub const BLUE: Color = Color::from_rgb(
0xD3 as f32 / 255.0,
0xFC as f32 / 255.0,
);

pub const RETAILER: Color = Color::from_rgb(
0xDA as f32 / 255.0,
0xF7 as f32 / 255.0,
0xA6 as f32 / 255.0,
);
12 changes: 12 additions & 0 deletions liana-ui/src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ const LIANA_LOGO_GREY: &[u8] = include_bytes!("../static/logos/LIANA_SYMBOL_Gray
const LIANA_BRAND_GREY: &[u8] = include_bytes!("../static/logos/LIANA_BRAND_Gray.svg");
const WIZARDSARDINE_LETTERING: &[u8] = include_bytes!("../static/logos/logo-wizardsardine.svg");

const RETAILER_ICON: &[u8] = include_bytes!("../static/logos/21st-capital-app-icon.png");
const RETAILER_LOGO: &[u8] = include_bytes!("../static/logos/21ST_CAPITAL_White.svg");

pub fn liana_app_icon() -> icon::Icon {
icon::from_file_data(LIANA_APP_ICON, None).unwrap()
}
Expand All @@ -15,6 +18,15 @@ pub fn liana_grey_logo() -> Svg {
Svg::new(h)
}

pub fn retailer_logo() -> Svg {
let h = Handle::from_memory(RETAILER_LOGO.to_vec());
Svg::new(h)
}

pub fn retailer_app_icon() -> icon::Icon {
icon::from_file_data(RETAILER_ICON, None).unwrap()
}

pub fn liana_brand_grey() -> Svg {
let h = Handle::from_memory(LIANA_BRAND_GREY.to_vec());
Svg::new(h)
Expand Down
17 changes: 17 additions & 0 deletions liana-ui/src/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ use iced::{

use super::color;

fn retailer_button_appearance() -> button::Appearance {
button::Appearance {
shadow_offset: iced::Vector::default(),
background: Some(color::RETAILER.into()),
text_color: color::BLACK,
border: iced::Border {
color: color::TRANSPARENT,
width: 1.0,
radius: 5.0.into(),
},
..button::Appearance::default()
}
}

#[derive(Debug, Copy, Clone, Eq, PartialEq, Default)]
pub enum Theme {
#[default]
Expand Down Expand Up @@ -627,6 +641,7 @@ pub enum Button {
#[default]
Primary,
Secondary,
Retailer,
Destructive,
SecondaryDestructive,
Transparent,
Expand Down Expand Up @@ -666,6 +681,7 @@ impl button::StyleSheet for Theme {
..button::Appearance::default()
}
}
Button::Retailer => retailer_button_appearance(),
Button::Destructive => button::Appearance {
shadow_offset: iced::Vector::default(),
background: Some(color::GREY_6.into()),
Expand Down Expand Up @@ -756,6 +772,7 @@ impl button::StyleSheet for Theme {
},
..button::Appearance::default()
},
Button::Retailer => retailer_button_appearance(),
Button::Destructive | Button::SecondaryDestructive => button::Appearance {
shadow_offset: iced::Vector::default(),
background: Some(color::RED.into()),
Expand Down
29 changes: 29 additions & 0 deletions liana-ui/static/logos/21ST_CAPITAL_White.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added liana-ui/static/logos/21st-capital-app-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading