Skip to content

Commit

Permalink
AppUpdateWidget created with relevant UI implementation completed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Milind Mevada committed Jan 3, 2020
1 parent e2f2720 commit 01f2e7d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
4 changes: 4 additions & 0 deletions lib/app_constants.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//TODO Update store URL for update
const androidPlayStoreUrl =
'https://play.app.goo.gl/?link=https://play.google.com/store/apps/details?id=com.app.id&ddl=1&pcampaignid=web_ddl_1';
const iosAppStoreUrl = '';
6 changes: 5 additions & 1 deletion lib/assets/strings/en-US.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"welcome_message": "Welcome to Scaffold Project"
"welcome_message": "Welcome to Scaffold Project",
"flexible_update_msg": "New App Update Available",
"title_immediate_update": "Update available",
"content_immediate_update": "Please update App to new version for better experience.",
"btn_update": "UPDATE"
}
19 changes: 11 additions & 8 deletions lib/src/app_update/app_update.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import 'dart:io' show Platform;

import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_base_project/app_constants.dart';
import 'package:flutter_base_project/src/app_update/app_update_key_provider.dart';
import 'package:flutter_base_project/src/remote_config/remote_config_repository.dart';
import 'package:package_info/package_info.dart';
Expand Down Expand Up @@ -40,9 +42,9 @@ Future<void> promptAppUpdate(BuildContext context) async {
if (update == UpdateMode.FlexibleUpdate) {
Scaffold.of(context).showSnackBar(
SnackBar(
content: Text('New App Update Available'),
content: Text(AppLocalizations.of(context).tr('flexible_update_msg')),
action: SnackBarAction(
label: 'Update',
label: AppLocalizations.of(context).tr('btn_update'),
onPressed: () => openStore(),
),
),
Expand All @@ -55,11 +57,13 @@ Future<void> promptAppUpdate(BuildContext context) async {
barrierDismissible: false,
builder: (context) {
return AlertDialog(
title: Text('New Update available'),
content: Text('Update App to keep using features.'),
title:
Text(AppLocalizations.of(context).tr('title_immediate_update')),
content:
Text(AppLocalizations.of(context).tr('content_immediate_update')),
actions: <Widget>[
FlatButton(
child: Text('UPDATE'),
child: Text(AppLocalizations.of(context).tr('btn_update')),
onPressed: () => openStore(),
)
],
Expand Down Expand Up @@ -105,10 +109,9 @@ Future<String> getCurrentAppVersion() async {
Future<void> openStore() async {
String url;
if (Platform.isAndroid) {
url =
"https://play.app.goo.gl/?link=https://play.google.com/store/apps/details?id=com.eonian.reelo&ddl=1&pcampaignid=web_ddl_1";
url = androidPlayStoreUrl;
} else if (Platform.isIOS) {
url = "https://apps.apple.com/in/app/reelo-get-rewarded/id1195820317";
url = iosAppStoreUrl;
}
if (await canLaunch(url)) {
await launch(url);
Expand Down

0 comments on commit 01f2e7d

Please sign in to comment.