Skip to content

Commit

Permalink
Aded auto update system for macos
Browse files Browse the repository at this point in the history
  • Loading branch information
kekko7072 committed Mar 6, 2023
1 parent 585382c commit bc77d37
Show file tree
Hide file tree
Showing 16 changed files with 107 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .firebase/hosting.ZGlzdA.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
appcast.xml,1678105638114,bcd41c0e8a9dd4428f860f890480cbcb08bfdfbadc1d15ee08f46fac537f4029
0.0.4+6/lms-0.0.4+6-macos.zip,1678105357935,50793871095b5db3d05f9a9b183d1fc6c02dea3139096c274360c5638181dc23
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "link-management-system"
}
}
Binary file added dist/0.0.4+6/lms-0.0.4+6-macos.zip
Binary file not shown.
34 changes: 34 additions & 0 deletions dist/appcast.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
<channel>
<title>LMS - Link Management System</title>
<description>Most recent updates to LMS</description>
<language>en</language>
<item>
<title>Version 1.1.0</title>
<sparkle:releaseNotesLink>
https://your_domain/your_path/release_notes.html
</sparkle:releaseNotesLink>
<pubDate>Mon, 6 Mar 2023 12:00:00 +0800</pubDate>
<enclosure url="0.0.4+6/lms-0.0.4+6-macos.zip"
sparkle:edSignature="cJA5AlmJTVfhOIbvCRC8pS1lrqu9iJ2hVZDyNu0AqhuyID3LXwiwZSg8+katIo57oU1iM6ihE0gEXk8pQaz7Ag=="
length="60473483"
sparkle:version="0.0.4"
sparkle:os="macos"
type="application/octet-stream" />
</item>
<item>
<title>Version 0.0.4</title>
<sparkle:releaseNotesLink>
https://your_domain/your_path/release_notes.html
</sparkle:releaseNotesLink>
<pubDate>Mon, 6 Mar 2023 12:00:00 +0800</pubDate>
<enclosure url="1.1.0+2/auto_updater_example-1.1.0+2-windows.exe"
sparkle:dsaSignature="MEUCIQCVbVzVID7H3aUzAY5znpi+ySZKznkukV8whlMFzKh66AIgREUGOmvavlcg6hwAwkb2o4IqVE/D56ipIBshIqCH8rk="
sparkle:version="1.1.0"
sparkle:os="windows"
length="0"
type="application/octet-stream" />
</item>
</channel>
</rss>
19 changes: 19 additions & 0 deletions distribute_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
output: dist/
releases:
- name: dev
jobs:
- name: release-macos
package:
platform: macos
target: zip
build_args:
dart-define:
APP_ENV: dev
# See full documentation: https://distributor.leanflutter.org/configuration/makers/exe
- name: release-windows
package:
platform: windows
target: exe
build_args:
dart-define:
APP_ENV: dev
10 changes: 10 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"hosting": {
"public": "dist/",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}
2 changes: 2 additions & 0 deletions lib/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ const String kDBPath = 'database_app';
const String kDBConfigured = 'db_configured';
const int kDBVersion = 7;
const String kDBTable = 'contents';

String kFeedURL = 'https://link-management-system.web.app/appcast.xml';
4 changes: 4 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import 'package:flutter/cupertino.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();

await autoUpdater.setFeedURL(kFeedURL);
await autoUpdater.checkForUpdates();
await autoUpdater.setScheduledCheckInterval(3600);

sqfliteFfiInit();

runApp(const MyApp());
Expand Down
1 change: 1 addition & 0 deletions lib/services/imports.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export 'package:package_info_plus/package_info_plus.dart';
export 'package:flutter/material.dart';
export 'package:flutter_easyloading/flutter_easyloading.dart';
export 'package:url_launcher/url_launcher_string.dart';
export 'package:auto_updater/auto_updater.dart';

export 'package:lms/constants.dart';

Expand Down
2 changes: 2 additions & 0 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
import FlutterMacOS
import Foundation

import auto_updater
import dynamic_color
import macos_ui
import package_info_plus
import shared_preferences_foundation
import url_launcher_macos

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AutoUpdaterPlugin.register(with: registry.registrar(forPlugin: "AutoUpdaterPlugin"))
DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin"))
MacOSUiPlugin.register(with: registry.registrar(forPlugin: "MacOSUiPlugin"))
FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin"))
Expand Down
13 changes: 13 additions & 0 deletions macos/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
PODS:
- auto_updater (0.0.1):
- FlutterMacOS
- Sparkle
- dynamic_color (0.0.2):
- FlutterMacOS
- FlutterMacOS (1.0.0)
Expand All @@ -9,18 +12,26 @@ PODS:
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- Sparkle (2.3.2)
- url_launcher_macos (0.0.1):
- FlutterMacOS

DEPENDENCIES:
- auto_updater (from `Flutter/ephemeral/.symlinks/plugins/auto_updater/macos`)
- dynamic_color (from `Flutter/ephemeral/.symlinks/plugins/dynamic_color/macos`)
- FlutterMacOS (from `Flutter/ephemeral`)
- macos_ui (from `Flutter/ephemeral/.symlinks/plugins/macos_ui/macos`)
- package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`)
- shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/macos`)
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)

SPEC REPOS:
trunk:
- Sparkle

EXTERNAL SOURCES:
auto_updater:
:path: Flutter/ephemeral/.symlinks/plugins/auto_updater/macos
dynamic_color:
:path: Flutter/ephemeral/.symlinks/plugins/dynamic_color/macos
FlutterMacOS:
Expand All @@ -35,11 +46,13 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos

SPEC CHECKSUMS:
auto_updater: d3c03e9e5f2a00ec78572d9f7473cb8c9a6c0273
dynamic_color: 2eaa27267de1ca20d879fbd6e01259773fb1670f
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
macos_ui: 6229a8922cd97bafb7d9636c8eb8dfb0744183ca
package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce
shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472
Sparkle: b36a51855e81585a1c38e32e53101d36c00f4304
url_launcher_macos: 5335912b679c073563f29d89d33d10d459f95451

PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7
Expand Down
2 changes: 2 additions & 0 deletions macos/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@
<array>
<dict/>
</array>
<key>SUPublicEDKey</key>
<string>+rS6QvXnn4JvhWg5p7elnDdB7wNqZ9Mp8Y5qZUuOF6U=</string>
</dict>
</plist>
8 changes: 8 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.10.0"
auto_updater:
dependency: "direct main"
description:
name: auto_updater
sha256: bd7525c70ec7a0ff2da32325cc1a5c87e0466f8f8d586ccf9e672e6b3d51bf4f
url: "https://pub.dev"
source: hosted
version: "0.1.6"
boolean_selector:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dependencies:
#launch_at_startup: ^0.2.1
#auto_updater: ^0.1.6 NEED ADDITIONAL REQUIREMENT
flutter_easyloading: ^3.0.5
auto_updater: ^0.1.6

dev_dependencies:
flutter_test:
Expand Down
3 changes: 3 additions & 0 deletions windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@

#include "generated_plugin_registrant.h"

#include <auto_updater/auto_updater_plugin.h>
#include <dynamic_color/dynamic_color_plugin_c_api.h>
#include <url_launcher_windows/url_launcher_windows.h>

void RegisterPlugins(flutter::PluginRegistry* registry) {
AutoUpdaterPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("AutoUpdaterPlugin"));
DynamicColorPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
UrlLauncherWindowsRegisterWithRegistrar(
Expand Down
1 change: 1 addition & 0 deletions windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#

list(APPEND FLUTTER_PLUGIN_LIST
auto_updater
dynamic_color
url_launcher_windows
)
Expand Down

0 comments on commit bc77d37

Please sign in to comment.