mirror of
https://github.com/feeddeck/feeddeck.git
synced 2026-05-03 17:48:00 -05:00
* Bump the pub group across 1 directory with 25 updates Bumps the pub group with 23 updates in the /app directory: | Package | From | To | | --- | --- | --- | | [carousel_slider](https://github.com/serenader2014/flutter_carousel_slider) | `5.0.0` | `5.1.1` | | [file_picker](https://github.com/miguelpruivo/flutter_file_picker) | `10.1.2` | `10.2.0` | | [flutter_launcher_icons](https://github.com/fluttercommunity/flutter_launcher_icons) | `0.14.3` | `0.14.4` | | [flutter_lints](https://github.com/flutter/packages/tree/main/packages) | `5.0.0` | `6.0.0` | | [flutter_markdown](https://github.com/flutter/packages/tree/main/packages) | `0.7.6` | `0.7.7+1` | | [flutter_native_splash](https://github.com/jonbhanson/flutter_native_splash) | `2.4.5` | `2.4.6` | | [html](https://github.com/dart-lang/tools/tree/main/pkgs) | `0.15.5` | `0.15.6` | | [http](https://github.com/dart-lang/http/tree/master/pkgs) | `1.3.0` | `1.4.0` | | [intl](https://github.com/dart-lang/i18n/tree/main/pkgs) | `0.19.0` | `0.20.2` | | [just_audio](https://github.com/ryanheise/just_audio) | `0.9.46` | `0.10.4` | | [just_audio_background](https://github.com/ryanheise/just_audio) | `0.0.1-beta.15` | `0.0.1-beta.17` | | [just_audio_media_kit](https://github.com/Pato05/just_audio_media_kit) | `2.0.6` | `2.1.0` | | [media_kit_libs_video](https://github.com/media-kit/media-kit) | `1.0.5` | `1.0.6` | | [media_kit_video](https://github.com/media-kit/media-kit) | `1.2.5` | `1.3.0` | | [msix](https://github.com/YehudaKremer/msix) | `3.16.8` | `3.16.9` | | [provider](https://github.com/rrousselGit/provider) | `6.1.2` | `6.1.5` | | [purchases_flutter](https://github.com/RevenueCat/purchases-flutter) | `8.6.1` | `9.1.0` | | [shared_preferences](https://github.com/flutter/packages/tree/main/packages/shared_preferences) | `2.5.2` | `2.5.3` | | [sign_in_with_apple](https://github.com/aboutyou/dart_packages) | `6.1.4` | `7.0.1` | | [supabase_flutter](https://github.com/supabase/supabase-flutter/tree/main/packages) | `2.8.4` | `2.9.1` | | [url_launcher](https://github.com/flutter/packages/tree/main/packages/url_launcher) | `6.3.1` | `6.3.2` | | [window_manager](https://github.com/leanflutter/window_manager) | `0.4.3` | `0.5.1` | | [youtube_explode_dart](https://github.com/Hexer10/youtube_explode_dart) | `2.3.10` | `2.5.1` | Updates `carousel_slider` from 5.0.0 to 5.1.1 - [Release notes](https://github.com/serenader2014/flutter_carousel_slider/releases) - [Changelog](https://github.com/serenader2014/flutter_carousel_slider/blob/master/CHANGELOG.md) - [Commits](https://github.com/serenader2014/flutter_carousel_slider/commits) Updates `file_picker` from 10.1.2 to 10.2.0 - [Release notes](https://github.com/miguelpruivo/flutter_file_picker/releases) - [Changelog](https://github.com/miguelpruivo/flutter_file_picker/blob/master/CHANGELOG.md) - [Commits](https://github.com/miguelpruivo/flutter_file_picker/commits) Updates `flutter_launcher_icons` from 0.14.3 to 0.14.4 - [Release notes](https://github.com/fluttercommunity/flutter_launcher_icons/releases) - [Changelog](https://github.com/fluttercommunity/flutter_launcher_icons/blob/master/CHANGELOG.md) - [Commits](https://github.com/fluttercommunity/flutter_launcher_icons/commits/v0.14.4) Updates `flutter_lints` from 5.0.0 to 6.0.0 - [Release notes](https://github.com/flutter/packages/releases) - [Commits](https://github.com/flutter/packages/commits/flutter_lints-v6.0.0/packages) Updates `flutter_markdown` from 0.7.6 to 0.7.7+1 - [Release notes](https://github.com/flutter/packages/releases) - [Commits](https://github.com/flutter/packages/commits/flutter_markdown-v0.7.7/packages) Updates `flutter_native_splash` from 2.4.5 to 2.4.6 - [Release notes](https://github.com/jonbhanson/flutter_native_splash/releases) - [Changelog](https://github.com/jonbhanson/flutter_native_splash/blob/master/CHANGELOG.md) - [Commits](https://github.com/jonbhanson/flutter_native_splash/compare/v2.4.5...v2.4.6) Updates `html` from 0.15.5 to 0.15.6 - [Release notes](https://github.com/dart-lang/tools/releases) - [Commits](https://github.com/dart-lang/tools/commits/html-v0.15.6/pkgs) Updates `http` from 1.3.0 to 1.4.0 - [Release notes](https://github.com/dart-lang/http/releases) - [Commits](https://github.com/dart-lang/http/commits/HEAD/pkgs) Updates `intl` from 0.19.0 to 0.20.2 - [Release notes](https://github.com/dart-lang/i18n/releases) - [Commits](https://github.com/dart-lang/i18n/commits/intl-v0.20.2/pkgs) Updates `just_audio` from 0.9.46 to 0.10.4 - [Release notes](https://github.com/ryanheise/just_audio/releases) - [Commits](https://github.com/ryanheise/just_audio/compare/just_audio-v0.9.46...just_audio-v0.10.4) Updates `just_audio_background` from 0.0.1-beta.15 to 0.0.1-beta.17 - [Release notes](https://github.com/ryanheise/just_audio/releases) - [Commits](https://github.com/ryanheise/just_audio/compare/just_audio_background-v0.0.1-beta.15...just_audio_background-v0.0.1-beta.17) Updates `just_audio_media_kit` from 2.0.6 to 2.1.0 - [Changelog](https://github.com/Pato05/just_audio_media_kit/blob/main/CHANGELOG.md) - [Commits](https://github.com/Pato05/just_audio_media_kit/compare/v2.0.6...v2.1.0) Updates `media_kit` from 1.1.11 to 1.2.0 - [Release notes](https://github.com/media-kit/media-kit/releases) - [Changelog](https://github.com/media-kit/media-kit/blob/main/CHANGELOG.md) - [Commits](https://github.com/media-kit/media-kit/commits/media_kit_video-v1.2.0) Updates `media_kit_libs_video` from 1.0.5 to 1.0.6 - [Release notes](https://github.com/media-kit/media-kit/releases) - [Changelog](https://github.com/media-kit/media-kit/blob/main/CHANGELOG.md) - [Commits](https://github.com/media-kit/media-kit/compare/media_kit_libs_ios_audio-v1.0.5...media_kit_libs_macos_audio-v1.0.6) Updates `media_kit_video` from 1.2.5 to 1.3.0 - [Release notes](https://github.com/media-kit/media-kit/releases) - [Changelog](https://github.com/media-kit/media-kit/blob/main/CHANGELOG.md) - [Commits](https://github.com/media-kit/media-kit/commits/media_kit_libs_android_audio-v1.3.0) Updates `msix` from 3.16.8 to 3.16.9 - [Release notes](https://github.com/YehudaKremer/msix/releases) - [Changelog](https://github.com/YehudaKremer/msix/blob/main/CHANGELOG.md) - [Commits](https://github.com/YehudaKremer/msix/compare/v3.16.8...v3.16.9) Updates `provider` from 6.1.2 to 6.1.5 - [Commits](https://github.com/rrousselGit/provider/compare/provider-v6.1.2...provider-v6.1.5) Updates `purchases_flutter` from 8.6.1 to 9.1.0 - [Release notes](https://github.com/RevenueCat/purchases-flutter/releases) - [Changelog](https://github.com/RevenueCat/purchases-flutter/blob/main/CHANGELOG.md) - [Commits](https://github.com/RevenueCat/purchases-flutter/compare/8.6.1...9.1.0) Updates `shared_preferences` from 2.5.2 to 2.5.3 - [Release notes](https://github.com/flutter/packages/releases) - [Commits](https://github.com/flutter/packages/commits/shared_preferences-v2.5.3/packages/shared_preferences) Updates `sign_in_with_apple` from 6.1.4 to 7.0.1 - [Release notes](https://github.com/aboutyou/dart_packages/releases) - [Commits](https://github.com/aboutyou/dart_packages/commits) Updates `supabase_flutter` from 2.8.4 to 2.9.1 - [Changelog](https://github.com/supabase/supabase-flutter/blob/main/CHANGELOG.md) - [Commits](https://github.com/supabase/supabase-flutter/commits/HEAD/packages) Updates `timeago` from 3.7.0 to 3.7.1 - [Commits](https://github.com/andresaraujo/timeago.dart/commits) Updates `url_launcher` from 6.3.1 to 6.3.2 - [Release notes](https://github.com/flutter/packages/releases) - [Commits](https://github.com/flutter/packages/commits/url_launcher-v6.3.2/packages/url_launcher) Updates `window_manager` from 0.4.3 to 0.5.1 - [Release notes](https://github.com/leanflutter/window_manager/releases) - [Commits](https://github.com/leanflutter/window_manager/commits) Updates `youtube_explode_dart` from 2.3.10 to 2.5.1 - [Release notes](https://github.com/Hexer10/youtube_explode_dart/releases) - [Changelog](https://github.com/Hexer10/youtube_explode_dart/blob/master/CHANGELOG.md) - [Commits](https://github.com/Hexer10/youtube_explode_dart/compare/v2.3.10...v2.5.1) --- updated-dependencies: - dependency-name: carousel_slider dependency-version: 5.1.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: pub - dependency-name: file_picker dependency-version: 10.2.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: pub - dependency-name: flutter_launcher_icons dependency-version: 0.14.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: pub - dependency-name: flutter_lints dependency-version: 6.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: pub - dependency-name: flutter_markdown dependency-version: 0.7.7+1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: pub - dependency-name: flutter_native_splash dependency-version: 2.4.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: pub - dependency-name: html dependency-version: 0.15.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: pub - dependency-name: http dependency-version: 1.4.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: pub - dependency-name: intl dependency-version: 0.20.2 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: pub - dependency-name: just_audio dependency-version: 0.10.4 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: pub - dependency-name: just_audio_background dependency-version: 0.0.1-beta.17 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: pub - dependency-name: just_audio_media_kit dependency-version: 2.1.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: pub - dependency-name: media_kit dependency-version: 1.2.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: pub - dependency-name: media_kit_libs_video dependency-version: 1.0.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: pub - dependency-name: media_kit_video dependency-version: 1.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: pub - dependency-name: msix dependency-version: 3.16.9 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: pub - dependency-name: provider dependency-version: 6.1.5 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: pub - dependency-name: purchases_flutter dependency-version: 9.1.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: pub - dependency-name: shared_preferences dependency-version: 2.5.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: pub - dependency-name: sign_in_with_apple dependency-version: 7.0.1 dependency-type: direct:production update-type: version-update:semver-major dependency-group: pub - dependency-name: supabase_flutter dependency-version: 2.9.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: pub - dependency-name: timeago dependency-version: 3.7.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: pub - dependency-name: url_launcher dependency-version: 6.3.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: pub - dependency-name: window_manager dependency-version: 0.5.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: pub - dependency-name: youtube_explode_dart dependency-version: 2.5.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: pub ... Signed-off-by: dependabot[bot] <support@github.com> * Update Flutter Version to 3.32.7 - Update Flutter version to 3.32.7 - Enable Swift Package Manager for iOS and macOS --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: ricoberger <mail@ricoberger.de>
257 lines
8.9 KiB
Dart
257 lines
8.9 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:flutter_markdown/flutter_markdown.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:purchases_flutter/purchases_flutter.dart';
|
|
import 'package:supabase_flutter/supabase_flutter.dart' as supabase;
|
|
|
|
import 'package:feeddeck/models/profile.dart';
|
|
import 'package:feeddeck/repositories/profile_repository.dart';
|
|
import 'package:feeddeck/repositories/settings_repository.dart';
|
|
import 'package:feeddeck/utils/constants.dart';
|
|
import 'package:feeddeck/utils/fd_icons.dart';
|
|
import 'package:feeddeck/widgets/general/elevated_button_progress_indicator.dart';
|
|
|
|
class SettingsPremiumInApp extends StatefulWidget {
|
|
const SettingsPremiumInApp({super.key});
|
|
|
|
@override
|
|
State<SettingsPremiumInApp> createState() => _SettingsPremiumInAppState();
|
|
}
|
|
|
|
class _SettingsPremiumInAppState extends State<SettingsPremiumInApp> {
|
|
late Future<Offering?> _futureFetchOfferings;
|
|
bool _isLoading = false;
|
|
|
|
/// [_fetchOfferings] is used to fetch the Stripe checkout session
|
|
/// link. For that we have to call the `stripe-create-checkout-session-v1`
|
|
/// Supabase edge function. If the link is generated successfully, the
|
|
/// function returns the url, which can then be opened by the user.
|
|
Future<Offering?> _fetchOfferings() async {
|
|
if (Platform.isAndroid) {
|
|
await Purchases.configure(
|
|
PurchasesConfiguration(SettingsRepository().revenueCatGooglePlayKey)
|
|
..appUserID = supabase.Supabase.instance.client.auth.currentUser!.id,
|
|
);
|
|
} else if (Platform.isMacOS || Platform.isIOS) {
|
|
await Purchases.configure(
|
|
PurchasesConfiguration(SettingsRepository().revenueCatAppStoreKey)
|
|
..appUserID = supabase.Supabase.instance.client.auth.currentUser!.id,
|
|
);
|
|
}
|
|
|
|
Offerings offerings = await Purchases.getOfferings();
|
|
if (offerings.current != null) {
|
|
return offerings.current;
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/// [_purchase] is used to purchase the provided [package]. If the purchase
|
|
/// was successful, the user is notified. If the purchase failed, the user is
|
|
/// notified as well.
|
|
Future<void> _purchase(Package package) async {
|
|
try {
|
|
setState(() {
|
|
_isLoading = true;
|
|
});
|
|
|
|
final purchaseResult = await Purchases.purchasePackage(package);
|
|
setState(() {
|
|
_isLoading = false;
|
|
});
|
|
|
|
if (!purchaseResult.customerInfo.entitlements.all.containsKey(
|
|
'FeedDeck Premium',
|
|
)) {
|
|
throw Exception('FeedDeck Premium entitlement not found.');
|
|
}
|
|
|
|
if (purchaseResult
|
|
.customerInfo
|
|
.entitlements
|
|
.all['FeedDeck Premium']!
|
|
.isActive) {
|
|
if (!mounted) return;
|
|
Provider.of<ProfileRepository>(
|
|
context,
|
|
listen: false,
|
|
).setTier(FDProfileTier.premium);
|
|
}
|
|
|
|
if (!mounted) return;
|
|
Navigator.of(context).pop();
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
const SnackBar(
|
|
duration: Duration(seconds: 10),
|
|
backgroundColor: Constants.primary,
|
|
showCloseIcon: true,
|
|
content: Text(
|
|
'FeedDeck Premium was successfully purchased.',
|
|
style: TextStyle(color: Constants.onPrimary),
|
|
),
|
|
),
|
|
);
|
|
} on PlatformException catch (err) {
|
|
final errorCode = PurchasesErrorHelper.getErrorCode(err);
|
|
if (errorCode == PurchasesErrorCode.purchaseCancelledError) {
|
|
setState(() {
|
|
_isLoading = false;
|
|
});
|
|
Navigator.of(context).pop();
|
|
} else {
|
|
setState(() {
|
|
_isLoading = false;
|
|
});
|
|
Navigator.of(context).pop();
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
SnackBar(
|
|
duration: const Duration(seconds: 10),
|
|
backgroundColor: Constants.error,
|
|
showCloseIcon: true,
|
|
content: Text(
|
|
'In-app purchase failed: ${err.message}',
|
|
style: const TextStyle(color: Constants.onError),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} catch (err) {
|
|
setState(() {
|
|
_isLoading = false;
|
|
});
|
|
Navigator.of(context).pop();
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
SnackBar(
|
|
duration: const Duration(seconds: 10),
|
|
backgroundColor: Constants.error,
|
|
showCloseIcon: true,
|
|
content: Text(
|
|
'In-app purchase failed: ${err.toString()}',
|
|
style: const TextStyle(color: Constants.onError),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
@override
|
|
void didChangeDependencies() {
|
|
super.didChangeDependencies();
|
|
setState(() {
|
|
_futureFetchOfferings = _fetchOfferings();
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
automaticallyImplyLeading: false,
|
|
shape: const Border(
|
|
bottom: BorderSide(color: Constants.dividerColor, width: 1),
|
|
),
|
|
title: const Text('FeedDeck Premium'),
|
|
actions: [
|
|
IconButton(
|
|
icon: const Icon(Icons.close),
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
),
|
|
],
|
|
),
|
|
body: SafeArea(
|
|
child: FutureBuilder(
|
|
future: _futureFetchOfferings,
|
|
builder: (BuildContext context, AsyncSnapshot<Offering?> snapshot) {
|
|
return Column(
|
|
children: [
|
|
Expanded(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(Constants.spacingMiddle),
|
|
child: SingleChildScrollView(
|
|
child:
|
|
snapshot.connectionState == ConnectionState.none ||
|
|
snapshot.connectionState ==
|
|
ConnectionState.waiting ||
|
|
snapshot.hasError ||
|
|
snapshot.data == null ||
|
|
snapshot.data?.monthly == null
|
|
? const Text('Loading ...')
|
|
: MarkdownBody(
|
|
selectable: true,
|
|
data:
|
|
'''
|
|
You are currently using the free version of FeedDeck, which allows you to add up
|
|
to 10 sources for the first 7 days. After that trial period your sources will
|
|
not be updated anymore.
|
|
|
|
To use FeedDeck after the trial period with up to 1000 sources, you need to
|
|
upgrade to a premium account. The premium account costs
|
|
${snapshot.data?.monthly?.storeProduct.priceString} per month and can be
|
|
canceled at any time.
|
|
''',
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: Constants.spacingSmall),
|
|
const Divider(
|
|
color: Constants.dividerColor,
|
|
height: 1,
|
|
thickness: 1,
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.all(Constants.spacingMiddle),
|
|
child: ElevatedButton.icon(
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: Constants.primary,
|
|
foregroundColor: Constants.onPrimary,
|
|
maximumSize: const Size.fromHeight(
|
|
Constants.elevatedButtonSize,
|
|
),
|
|
minimumSize: const Size.fromHeight(
|
|
Constants.elevatedButtonSize,
|
|
),
|
|
),
|
|
label: Text(
|
|
snapshot.data?.monthly?.storeProduct.priceString != null
|
|
? 'Subscribe to FeedDeck Premium for ${snapshot.data?.monthly?.storeProduct.priceString}'
|
|
: 'Subscribe to FeedDeck Premium',
|
|
),
|
|
onPressed:
|
|
snapshot.connectionState == ConnectionState.none ||
|
|
snapshot.connectionState ==
|
|
ConnectionState.waiting ||
|
|
snapshot.hasError ||
|
|
snapshot.data == null ||
|
|
snapshot.data?.monthly == null ||
|
|
_isLoading
|
|
? null
|
|
: () => _purchase(snapshot.data!.monthly!),
|
|
icon:
|
|
snapshot.connectionState == ConnectionState.none ||
|
|
snapshot.connectionState ==
|
|
ConnectionState.waiting ||
|
|
snapshot.hasError ||
|
|
snapshot.data == null ||
|
|
snapshot.data?.monthly == null ||
|
|
_isLoading
|
|
? const ElevatedButtonProgressIndicator()
|
|
: const Icon(FDIcons.feeddeck),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
},
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|