Skip to content

rodydavis/auto_updater

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

auto_updater

An auto updating example built for Flutter Desktop that uses Sparkle.

image image

MacOS

Getting Started

You can easily just download the project and replace the feed url if you wish! Or fork the project template.

MacOS Setup

More info here: https://sparkle-project.org/documentation/

Add Sparkle to your MacOS macos/Podfile

target 'Runner' do
  use_frameworks!
  use_modular_headers!
  
  # Extra Pods
  pod 'Sparkle' # <-- Add This Line

Open macos/Runner/info.plist and add the following keys:

<key>SUFeedURL</key>
<string>YOUR_FEED_URL</string>
<key>SUEnableAutomaticChecks</key>
<true/>

Replace YOUR_FEED_URL with your AppCast url. You can test by using this demo feed.

Open macos/Runner/MainFlutterWindow.swift and modify it to look like this:

import Cocoa
import FlutterMacOS

import Sparkle

class MainFlutterWindow: NSWindow {

    @IBAction func checkForUpdates(_ sender: Any) {
        let updater = SUUpdater.shared()
        updater?.feedURL = URL(string: "YOUR_FEED_URL")
        updater?.checkForUpdates(self)
    }

    override func awakeFromNib() {
        let flutterViewController = FlutterViewController.init()
        let windowFrame = self.frame
        self.contentViewController = flutterViewController
        self.setFrame(windowFrame, display: true)

        RegisterGeneratedPlugins(registry: flutterViewController)

        super.awakeFromNib()
    }
}

Open the application worspace macos/Runner.xcworkspace.

Add a menu item:

image image

Add a new opbject:

image

Change the class:

image

Connect the action by holding shift:

image