Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,8 @@ jobs:
run: |
export NDK_HOME="$ANDROID_NDK_LATEST_HOME"
cargo tauri android init --ci
# The generated project carries Tauri's launcher icon until `tauri icon` writes the brand's into it.
cargo tauri icon ../../assets/brand/tauri-icon.json
cargo tauri android build --apk --debug --target x86_64
# Tauri's own files land in the plugin's copy of the module, never in the crate.
test ! -e ../../android/.tauri
Expand Down Expand Up @@ -605,3 +607,21 @@ jobs:
# An unsigned build applies no entitlements, so check the file the signed build applies.
grep -q "com.apple.developer.aps-environment" examples/tauri/entitlements.plist || { echo "no aps-environment in examples/tauri/entitlements.plist"; exit 1; }
fi
# The plugin's build script adds the push entitlement and the remote-notification background
# mode to the project `tauri ios init` generates, which only an iOS build exercises.
- name: Build the Tauri app for iOS, unsigned, and check the handler, the background mode, the entitlement and the icon
working-directory: examples/tauri
run: |
command -v xcodegen > /dev/null || brew install xcodegen
cargo tauri ios init --ci
cargo tauri icon ../../assets/brand/tauri-icon.json
cargo tauri ios build --debug --target aarch64 --no-sign
app=$(find gen/apple/build -maxdepth 4 -type d -path "*.xcarchive/Products/Applications/*.app" | head -n1)
test -n "$app"
binary="$app/$(/usr/libexec/PlistBuddy -c 'Print :CFBundleExecutable' "$app/Info.plist")"
nm -gU "$binary" | grep -q ___pushups_background_handler || { echo "no background handler in $binary"; exit 1; }
plutil -extract UIBackgroundModes json -o - "$app/Info.plist" | grep -q '"remote-notification"' || { echo "no remote-notification background mode in $app"; exit 1; }
plutil -extract CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconName raw -o - "$app/Info.plist" | grep -qx AppIcon || { echo "no app icon in $app"; exit 1; }
test -f "$app/Assets.car" || { echo "no compiled asset catalog in $app"; exit 1; }
# An unsigned build applies no entitlements, so check the file the signed build applies.
grep -A1 aps-environment gen/apple/*_iOS/*_iOS.entitlements | grep -q development || { echo "no aps-environment in the generated entitlements"; exit 1; }
13 changes: 13 additions & 0 deletions assets/brand/icon-android-foreground.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 14 additions & 1 deletion assets/brand/render.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,17 @@ done
# iOS reads the home screen icon from this link and rounds its corners itself.
rsvg-convert --width 180 --height 180 "$brand/icon.svg" --output "$public/icons/apple-touch-icon.png"

oxipng --quiet --opt max --strip safe "$brand"/png/*.png "$public"/icons/*.png
# The winit example's Android launcher icon, the adaptive foreground at 108dp and the square icon
# at 48dp that Android 7 shows, per density.
res=$brand/../../examples/winit/android/app/src/main/res
for density in mdpi:1 hdpi:1.5 xhdpi:2 xxhdpi:3 xxxhdpi:4; do
name=${density%%:*}
scale=${density#*:}
mkdir -p "$res/mipmap-$name"
foreground=$(python3 -c "print(round(108 * $scale))")
legacy=$(python3 -c "print(round(48 * $scale))")
rsvg-convert --width "$foreground" --height "$foreground" "$brand/icon-android-foreground.svg" --output "$res/mipmap-$name/ic_launcher_foreground.png"
rsvg-convert --width "$legacy" --height "$legacy" "$brand/icon.svg" --output "$res/mipmap-$name/ic_launcher.png"
done

oxipng --quiet --opt max --strip safe "$brand"/png/*.png "$public"/icons/*.png "$res"/mipmap-*/*.png
5 changes: 5 additions & 0 deletions assets/brand/tauri-icon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"default": "icon.svg",
"bg_color": "#0e1824",
"android_fg": "icon-android-foreground.svg"
}
3 changes: 3 additions & 0 deletions assets/brand/variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ def svg(name, width, height, body, view_box=None):
svg("icon-macos.svg", 1024, 1024, f'<rect x="100" y="100" width="824" height="824" rx="185" fill="{NAVY}"/>\n {placed(1024, 0.48)}')
# A maskable web icon, full bleed, with the mark inside the 80% circle Android crops to.
svg("icon-maskable.svg", 1024, 1024, f'<rect width="1024" height="1024" fill="{NAVY}"/>\n {placed(1024, 0.56)}')
# The foreground layer of an Android adaptive icon, transparent on a 108dp canvas, with the mark
# inside the 66dp circle every launcher mask keeps.
svg("icon-android-foreground.svg", 1024, 1024, placed(1024, 0.46))
svg("favicon.svg", 64, 64, f'<rect width="64" height="64" rx="14" fill="{NAVY}"/>\n {placed(64, 0.78)}')
svg(
"social.svg",
Expand Down
1 change: 1 addition & 0 deletions examples/tauri/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/target
/gen
/icons
/google-services.json
/embedded.provisionprofile
2 changes: 1 addition & 1 deletion examples/winit/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application android:label="pushups winit example">
<application android:icon="@mipmap/ic_launcher" android:label="pushups winit example">
<!-- android-activity runs the Rust `android_main` of `libmain.so` in this Activity. winit
handles no events while it is paused, so it shows over the lock screen of a test phone. -->
<activity
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background" />
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
</adaptive-icon>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- The brand's navy, behind the mark of ic_launcher_foreground. -->
<color name="ic_launcher_background">#0E1824</color>
</resources>
Loading