Coder Social home page Coder Social logo

tauri-plugin-setapp's Introduction

Tauri Setapp Plugin

Integrate Setapp's framework into Tauri Mac apps

Overview

The Setapp framework is automatically loaded when this plugin is initialized. This is achieved by calling a Swift bridge (SetappBridge) from Rust.

Installation

1. Install the plugin

Add to cargo.toml:

[dependencies]
tauri-plugin-setapp = { git = "https://github.com/nlap/tauri-plugin-setapp.git", tag = "v1.0.0" }

2. Register the plugin

fn main() {
  tauri::Builder::default()
    .plugin(tauri_plugin_setapp::init())
    .run(tauri::generate_context!())
    .expect("error while running tauri application");
}

3. Add your Setapp public key

https://docs.setapp.com/docs/add-a-public-key-to-your-app-1

In tauri.conf.json, add:

"resources": ["./setappPublicKey.pem"],

4. Update your Info.plist

https://docs.setapp.com/docs/allow-setapp-to-update-your-app-on-macos-13

In src-tauri/Info.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>NSUpdateSecurityPolicy</key>
    <dict>
        <key>AllowProcesses</key>
        <dict>
        <key>MEHY5QF425</key>
        <array>
            <string>com.setapp.DesktopClient.SetappAgent</string>
        </array>
        </dict>
    </dict>
</dict>
</plist>

5. Disable Tauri's updater

In tauri.conf.json:

{
  "tauri": {
    "updater": {
      "active": false
    }
  }
}

Usage

Regular app usage events are automatically reported by Setapp framework. You can invoke other framework features from Javascript:

  • ask_user_to_share_email
  • show_release_notes_window_if_needed
  • show_release_notes_window
invoke('plugin:setapp|ask_user_to_share_email', { });

Cross-platform considerations

This plugin is cross-platform compatible and can be safely included in builds for any OS. On non-macOS platforms, the plugin remains inactive and has no effect.

License

This code is provided as-is under the Apache License as a convenience for the Tauri community. I am not associated with MacPaw/Setapp.

Contributions are welcome!

tauri-plugin-setapp's People

Contributors

nlap avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

vignshwarar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.