Update Social + bump version to 1.0.52+52 (#190)

This commit is contained in:
Neeraj Gupta 2023-08-11 17:24:04 +05:30 committed by GitHub
commit c1097bf251
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 57 additions and 5 deletions

View file

@ -58,6 +58,9 @@
}
},
"contactSupport": "Contact support",
"rateUsOnStore" : "Rate us on {storeName}",
"blog": "Blog",
"merchandise": "Merchandise",
"verifyPassword": "Verify password",
"pleaseWait": "Please wait...",
"generatingEncryptionKeysTitle": "Generating encryption keys...",

View file

@ -9,6 +9,7 @@ import 'package:flutter/foundation.dart';
import 'package:logging/logging.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:tuple/tuple.dart';
class UpdateService {
UpdateService._privateConstructor();
@ -87,6 +88,22 @@ class UpdateService {
return LatestVersionInfo.fromMap(response.data["latestVersion"]);
}
// getRateDetails returns details about the place
Tuple2<String, String> getRateDetails() {
// Note: in auth, currently we don't have a way to identify if the
// app was installed from play store, f-droid or github based on pkg name
if (Platform.isAndroid) {
return const Tuple2(
"AlternativeTo",
"https://alternativeto.net/software/ente-authenticator/about/",
);
}
return const Tuple2(
"App Store",
"https://apps.apple.com/in/app/ente-photos/id6444121398",
);
}
bool isIndependent() {
if (Platform.isIOS) {
return false;

View file

@ -1,4 +1,7 @@
import 'dart:io';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/services/update_service.dart';
import 'package:ente_auth/theme/ente_theme.dart';
import 'package:ente_auth/ui/components/captioned_text_widget.dart';
import 'package:ente_auth/ui/components/expandable_menu_item_widget.dart';
@ -21,8 +24,26 @@ class SocialSectionWidget extends StatelessWidget {
}
Widget _getSectionOptions(BuildContext context) {
final l10n = context.l10n;
final result = UpdateService.instance.getRateDetails();
final String ratePlace = result.item1;
final String rateUrl = result.item2;
final List<Widget> options = [
sectionOptionSpacing,
SocialsMenuItemWidget(l10n.rateUsOnStore(ratePlace), rateUrl),
sectionOptionSpacing,
SocialsMenuItemWidget(
l10n.blog,
"https://ente.io/blog",
launchInExternalApp: !Platform.isAndroid,
),
sectionOptionSpacing,
SocialsMenuItemWidget(
l10n.merchandise,
"https://shop.ente.io",
launchInExternalApp: !Platform.isAndroid,
),
const SocialsMenuItemWidget("Mastodon", "https://mstdn.social/@ente/"),
sectionOptionSpacing,
const SocialsMenuItemWidget("Twitter", "https://twitter.com/enteio"),
@ -40,9 +61,15 @@ class SocialSectionWidget extends StatelessWidget {
class SocialsMenuItemWidget extends StatelessWidget {
final String text;
final String urlSring;
const SocialsMenuItemWidget(this.text, this.urlSring, {Key? key})
: super(key: key);
final String url;
final bool launchInExternalApp;
const SocialsMenuItemWidget(
this.text,
this.url, {
Key? key,
this.launchInExternalApp = true,
}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -54,7 +81,12 @@ class SocialsMenuItemWidget extends StatelessWidget {
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
launchUrlString(urlSring);
launchUrlString(
url,
mode: launchInExternalApp
? LaunchMode.externalApplication
: LaunchMode.platformDefault,
);
},
);
}

View file

@ -1,6 +1,6 @@
name: ente_auth
description: ente two-factor authenticator
version: 1.0.51+51
version: 1.0.52+52
publish_to: none
environment: