upgrader 0.4.2 copy "upgrader: ^0.4.2" to clipboard
upgrader: ^0.4.2 copied to clipboard

outdated

Flutter package for prompting users to upgrade when there is a newer version of the app in the store.

Upgrader #

Flutter package for prompting users to upgrade when there is a newer version of the app in the store.

Build Status CircleCI codecov pub package

Become a Patron!

A simple prompt widget is displayed when a newer app version is availabe in the store. With today's modern app stores, there is little need to persuade users to upgrade because most of them are already using the auto upgrade feature. However, there may be times when an app needs to be updated more quickly than usual, and nagging a user to upgrade will entice the upgrade sooner. Also, with Flutter supporting more than just Android and iOS app stores in the future, it will become more likely that users on other app stores need to be nagged about upgrading.

Example #

Just wrap your body widget in the UpgradeAlert widget, and it will handle the rest.

import 'package:flutter/material.dart';
import 'package:upgrader/upgrader.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  MyApp({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Upgrader Example',
      home: Scaffold(
          appBar: AppBar(
            title: Text('Upgrader Example'),
          ),
          body: UpgradeAlert(
            child: Center(child: Text('Checking...')),
          )
      ),
    );
  }
}

Screenshot #

image

Customization #

The UpgradeAlert widget can be customized by setting parameters in the constructor of the UpgradeAlert widget.

  • buttonTitleIgnore: the ignore button title, which defaults to Ignore

  • buttonTitleLater: the later button title, which defaults to Later

  • buttonTitleUpdate: the update button title, which defaults to Update Now

  • daysUntilAlertAgain: days until alerting user again, which defaults to 3

  • debugEnabled: Enable print statements for debugging, which defaults to false

  • onIgnore: Called when the ignore button is tapped, defaults to null

  • onLater: Called when the ignore button is tapped, defaults to null

  • onUpdate: Called when the ignore button is tapped, defaults to null

  • prompt: the call to action message, which defaults to Would you like to update it now?

  • title: the alert dialog title, which defaults to Update App?

Limitations #

This widget works on both Android and iOS. When running on iOS the App Store will provide the latest app version and will display the prompt at the appropriate times.

On Android, this widget does nothing as there is no easy way to query the Google Play Store for metadata about an app. Without the metadata, the widget cannot compare the app version with the latest Play Store version. It will not disrupt the widget tree and can be included in an Android without any issues. Support for Android coming soon.

iTunes Search API #

There is a class in this Flutter package used by the UpgradeAlert widget to download app details from the iTunes Search API. The class ITunesSearchAPI can be used standalone with the UpgradeAlert widget to query iTunes for app details.

final iTunes = ITunesSearchAPI();
final resultsFuture = iTunes.lookupByBundleId('com.google.Maps');
resultsFuture.then((results) {
    print('results: $results');
});

Results #

image

Appcast #

The class Appcast, in this Flutter package, is used by the Upgrader widgets to download app details from an appcast, based on the Sparkle framework by Andy Matuschak. You can read the Sparkle documentation here: https://sparkle-project.org/documentation/publishing/.

An appcast is an RSS feed with one channel that has a collection of items that each describe one app version. The appcast will decscribe each app version and will provide the latest app version to Upgrader that indicates when an upgrade should be recommended.

The appcast must be hosted on a server that can be reached by everyone from the app. The appcast XML file can be autogenerated during the release process, or just manually updated after a release is available on the app store.

The Appcast class can be used stand alone or as part of Upgrader.

Example - Stand alone #

final appcast = Appcast();
final items = await appcast.parseAppcastItemsFromUri('https://raw.githubusercontent.com/larryaasen/upgrader/master/test/testappcast.xml');
final bestItem = appcast.bestItem();

Appcast Sample File #

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
    <channel>
        <title>Debt Now App - Appcast</title>
        <item>
            <title>Version 1.15.0</title>
            <description>desc</description>
            <pubDate>Sun, 30 Dec 2018 12:00:00 +0000</pubDate>
            <enclosure url="https://play.google.com/store/apps/details?id=com.moonwink.treasury" sparkle:version="1.15.0" sparkle:os="android" />
        </item>
    </channel>
</rss>

Contributing #

All comments and pull requests are welcome.

1847
likes
0
pub points
99%
popularity

Publisher

verified publisherlarryaasen.com

Flutter package for prompting users to upgrade when there is a newer version of the app in the store.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

device_info, flutter, http, package_info, shared_preferences, url_launcher, version, xml

More

Packages that depend on upgrader