Skip to content

Commit

Permalink
Update package for pub.dev (#9)
Browse files Browse the repository at this point in the history
* docs: add CONTRIBUTING.md

* chore: updates for pub.dev publication
  • Loading branch information
Alqueraf committed Oct 30, 2023
1 parent d922bf5 commit 1a7e45a
Show file tree
Hide file tree
Showing 110 changed files with 311 additions and 23,218 deletions.
4 changes: 4 additions & 0 deletions .fvm/fvm_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"flutterSdkVersion": "3.13.4",
"flavors": {}
}
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# They will be requested for review when someone
# opens a pull request.

* @levinriegner-qa
* @alqueraf
64 changes: 14 additions & 50 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,64 +15,28 @@
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
build/
/build/

# Android related
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java
# Web related
lib/generated_plugin_registrant.dart

# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*
**/ios/Flutter/.last_build_id
# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
# Test related
coverage

# Don't ignore auto-generated files for libraries
# *.g.dart
# Fluter version management
**/.fvm/flutter_sdk
32 changes: 24 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
{
// Use Flutter SDK from fvm
"dart.flutterSdkPath": ".fvm/flutter_sdk",
// Remove .fvm files from search
"search.exclude": {
"**/.fvm": true
},
// Remove from file watching
"files.watcherExclude": {
"**/.fvm": true
},
// Exclude files from explorer
"files.exclude": {
// Exclude auto-generated files
"**/*.g.dart": true,
"**/*.freezed.dart": true,
"**/*.gr.dart": true,
// Exclude Flutter stuff
"**/.flutter-plugins": true,
"**/.flutter-plugins-dependencies": true,
"**/.packages": true,
"**/build": true,
"**/.metadata": true,
".flutter-plugins": true,
".flutter-plugins-dependencies": true,
".packages": true,
"build": true,
".metadata": true,
// Exclude Android Studio stuff
"**/.idea": true,
"**/.run": true,
"**/*.iml": true
".idea": true,
".run": true,
"android/.gradle": true,
"android/.idea": true,
"android/gradlew.bat": true,
"android/gradlew": true,
"**/**.iml": true
},
// Fix actions on save
"editor.codeActionsOnSave": {
Expand All @@ -23,4 +37,6 @@
},
// Format on save
"editor.formatOnSave": true,
// XML format
"xml.format.splitAttributes": true,
}
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,34 @@

All notable changes to this project will be documented in this file.

## 1.1.0

### Added

- Documentation for pub.dev.

### Changed

- Updated all dependencies to latest versions.

## 1.0.5

### Changed

- Updated all dependencies to latest versions.

## 1.0.4

### Changed

- Updated all dependencies to latest versions.

## 1.0.3

### Changed

- Updated firebase_remote_config dependency to latest version.

## 1.0.2

### Added
Expand Down
48 changes: 48 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Contributing

## Development Workflow

1. Create a new branch from `master` to work on the new feature or changes.
1. Split your work into multiple atomic commits ([see guidelines](#commit-guidelines)).
1. Add unit tests to cover your changes.
1. Update the appropiate documentation in the [docs/](/docs/) folder if contributions contain project-wide motifications.
1. Open a `Pull Request` to `master` ([see guidelines](#pull-request-guidelines)).
1. Wait for approval and comments (ask teammates for review over slack if needed).
1. Merge the PR with a `merge commit`.

> ❗️ Always prioritize reviewing open PRs over working on your own to avoid blocking other teammates.
## Commit Guidelines

A commit is a message to your team and your future self.

Keep the following guidelines in mind when writing a commit message:

- Keep commit messages clear and concise.
- By reading the commit message, the reviewer should be able to understand what the changes do.
- Commits should be small, atomic and self-contained.
- Do not commit multiple unrelated changes in the same commit.
- Start with a verb in the present tense (ie: "add X to Y" or "replace X for Y").

Use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) to help you create clear and concise commits.

## Pull Request Guidelines

Pull Requests are a communication and review tool that achieve the following goals:

1. Providing visibility of your work.
2. Getting feedback from the team.
3. Challenging the implementation and suggesting improvements.
4. Enforcing code quality and best practices.
5. Detecting and fixing possible bugs before they reach production.

> The reviewer is not responsible for manually testing your code.
Keep the following guidelines in mind when creating a PR:

- PRs should be small, atomic and self-contained.
- Do not create a PR with multiple unrelated changes.
- The PR title should be clear and concise.
- The PR description should contain a summary of the changes and a link to the Jira ticket if applicable.

> Small PRs are easier to review and merge.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Levin & Riegner LLC
Copyright (c) 2023 Levin & Riegner LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
73 changes: 50 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,39 @@
# App Versioning

Prompt users to update the app whenever there are new optional or mandatory updates available.

<p align="center">
<img alt="Available Store Updates" src="doc/static/screenshot_updates.png" width="45%">
&nbsp; &nbsp; &nbsp; &nbsp;
<img alt="Local Version Tracker" src="doc/static/screenshot_tracker.png" width="45%">
</p>
Keep track of app versions and prompt users to update the app whenever there are new updates available.

## Overview

This packages provides a simple yet customisable way to suggest or force updates to Android & iOS apps
It is built on top of the [in_app_update](https://pub.dev/packages/in_app_update) package for Android and [upgrader](https://pub.dev/packages/upgrader) for iOS.
This packages provides a simple yet customisable way to suggest or force updates to Android & iOS apps.
Built on top of the [in_app_update](https://pub.dev/packages/in_app_update) package for Android and [upgrader](https://pub.dev/packages/upgrader) for iOS.

The package also leverages the [version_tracker](https://pub.dev/packages/version_tracker) plugin to track the app versions accross updates.

## Features

- Retrieve information about available updates from the Play Store or App Store.
- Version bomb. Force users to update the app if the update is mandatory by configuring a minimum version using your custom Backend or [Firebase Remote Config](https://firebase.google.com/docs/remote-config).
- Launch Android updates using the native [In-App Updates](https://developer.android.com/guide/playcore/in-app-updates) flows, supporting flexible and immediate updates.
- Request iOS updates by redirecting to the App Store.
- Track version update history using the [Version Tracker](https://pub.dev/packages/version_tracker).
- Request iOS updates by redirecting the user to the App Store.
- Track version update history and launches to trigger onboarding flows, database migrations, and more.

## Get Started

View the [example project](/example/lib/) for a complete working example.

### Installation

Add the following dependency to your `pubspec.yaml` file:

```yaml
dependencies:
app_versioning: latest
```
### Initializing
1. Initialize the `AppVersioning` class with your app's identifiers and minimum version provider.
- The minimum version provider can be an `apiService` from your backend, a `firebaseService` from your remote config or a `customService` that you implement.
1. Initialize the `AppVersioning` class with your app's identifiers and minimum version provider. You can use one of the following factories or create your own implementation of the [AppVersioning](/lib/app_versioning.dart) interface:
- Use the `apiService` factory to retrieve the versioning from your backend.

```dart
final appVersioning = AppVersioning.apiService(
Expand All @@ -46,6 +51,22 @@ View the [example project](/example/lib/) for a complete working example.
);
```

- Use the `firebaseService` factory to retrieve the versioning from Firebase Remote Config.

```dart
final appVersioning = AppVersioning.firebaseService(
remoteConfigKeys: const RemoteConfigKeys(
minimumIosVersionKey: "minimumIosVersion",
minimumAndroidVersionKey: "minimumAndroidVersion",
),
updateConfig: const UpdateConfig(
appStoreAppId: "1234567890",
playStoreAppId: "org.example.versioning",
appstoreCountryCode: 'US',
),
);
```

2. Track the current version when the app is launched.

```dart
Expand All @@ -62,14 +83,21 @@ View the [example project](/example/lib/) for a complete working example.

```dart
if (appUpdateInfo.isUpdateAvailable) {
_showUpdatePopup(appUpdateInfo.updateType == AppUpdateType.Mandatory);
switch (appUpdateInfo.updateType) {
case AppUpdateType.Optional:
_showUpdatePopup(forceUpdate: false);
break;
case AppUpdateType.Mandatory:
_showUpdatePopup(forceUpdate: true);
break;
}
}
```

5. If the user accepts the update, or the update is mandatory, launch the update flow.

```dart
appVersioning.launchUpdate(updateInBackground: !isMandatory)
appVersioning.launchUpdate(updateInBackground: true);
```

### Backend Services
Expand All @@ -79,22 +107,21 @@ This plugin currently supports 2 different backends to set the minimum version s

1. **API**: An arbitrary URL endpoint that returns the minimum versions JSON.
2. **Firebase Remote Config**: Key/value pairs with the minimum versions specified on Firebase.
> This requires the project to include and set up Firebase separately.
> This requires the project to include and set up Firebase separately. You can import the configuration using the [remote_config.json](/doc/remote_config/remote_config.json) file.

## Contributing

Contributions are most welcome! Feel free to open a new issue or pull request to make this project better.
Check the [CONTRIBUTING.md](CONTRIBUTING.md) guide for more information.

### Deployment
## Deployment

1. Set the new version on the [pubspec.yaml](pubspec.yaml) `version` field.
2. Update the [CHANGELOG.md](CHANGELOG.md) file documenting the changes.
3. Update the [README.md](README.md) file if necessary.
4. Run `dart doc` to update the documentation.
5. Run `dart pub publish --dry-run` to ensure the package can be published successfully.
6. Create a new tag with the release version `git tag -a x.y.z -m "x.y.z" && git push --tags`.
7. Navigate to [GitHub Releases](https://github.com/levin-riegner/lr-app-versioning/releases) and create a new release for the previously created tag, including the [CHANGELOG.md](CHANGELOG.md) changes.
8. Finally run `dart pub publish` to deploy the project.
4. Run `dart pub publish --dry-run` to ensure the package can be published successfully.
5. Create a new tag with the release version `git tag -a x.y.z -m "x.y.z" && git push --tags`.
6. Navigate to [GitHub Releases](https://github.com/levin-riegner/app_versioning/releases) and create a new release for the previously created tag, including the [CHANGELOG.md](CHANGELOG.md) changes.
7. Finally run `dart pub publish` to deploy the project.

## Credits

Expand Down
Loading

0 comments on commit 1a7e45a

Please sign in to comment.