Add package in_app_purchase
(not implemented - but otherwise google-play wont verify)
This commit is contained in:
parent
f39bfe6106
commit
beff4d980b
@ -1,11 +1,5 @@
|
|||||||
|
|
||||||
|
|
||||||
# Setup
|
|
||||||
#
|
|
||||||
# flutter config --jdk-dir "/usr/lib/jvm/default-runtime/bin"
|
|
||||||
# sudo archlinux-java set java-17-openjdk
|
|
||||||
#
|
|
||||||
|
|
||||||
HASH=$(shell git rev-parse HEAD)
|
HASH=$(shell git rev-parse HEAD)
|
||||||
VERS=$(shell cat pubspec.yaml | grep -oP '(?<=version: ).*') # lazy evaluated!
|
VERS=$(shell cat pubspec.yaml | grep -oP '(?<=version: ).*') # lazy evaluated!
|
||||||
|
|
||||||
@ -38,11 +32,21 @@ install-release: java gen
|
|||||||
build-release: java gen
|
build-release: java gen
|
||||||
flutter build apk --release
|
flutter build apk --release
|
||||||
cp build/app/outputs/flutter-apk/app-release.apk "_releases/v$(VERS)-release.apk"
|
cp build/app/outputs/flutter-apk/app-release.apk "_releases/v$(VERS)-release.apk"
|
||||||
|
@echo ""
|
||||||
|
@echo "--> copied APK to _releases ( Version: $(VERS) )"
|
||||||
|
@echo ""
|
||||||
flutter build appbundle --release
|
flutter build appbundle --release
|
||||||
cp build/app/outputs/bundle/release/app-release.aab "_releases/v$(VERS)-release.aab"
|
cp build/app/outputs/bundle/release/app-release.aab "_releases/v$(VERS)-release.aab"
|
||||||
|
@echo ""
|
||||||
|
@echo "--> copied AAB to _releases ( Version: $(VERS) )"
|
||||||
|
@echo ""
|
||||||
flutter build linux --release
|
flutter build linux --release
|
||||||
cp -r build/linux/x64/release/bundle "_releases/v$(VERS)-linux-release"
|
cp -r build/linux/x64/release/bundle "_releases/v$(VERS)-linux-release"
|
||||||
tar -czf "_releases/v$(VERS)-linux-release.tar.gz" -C build/linux/x64/release/bundle .
|
tar -czf "_releases/v$(VERS)-linux-release.tar.gz" -C build/linux/x64/release/bundle .
|
||||||
|
@echo ""
|
||||||
|
@echo "--> copied linux-binary to _releases ( Version: $(VERS) )"
|
||||||
|
@echo ""
|
||||||
|
@echo "Done."
|
||||||
|
|
||||||
test:
|
test:
|
||||||
dart analyze
|
dart analyze
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||||
|
import 'package:in_app_purchase/in_app_purchase.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:simplecloudnotifier/main_messaging.dart';
|
import 'package:simplecloudnotifier/main_messaging.dart';
|
||||||
import 'package:simplecloudnotifier/main_utils.dart';
|
import 'package:simplecloudnotifier/main_utils.dart';
|
||||||
@ -151,11 +153,48 @@ void main() async {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class SCNApp extends StatelessWidget {
|
class SCNApp extends StatefulWidget {
|
||||||
SCNApp({super.key});
|
SCNApp({super.key});
|
||||||
|
|
||||||
static var materialKey = GlobalKey<NavigatorState>();
|
static var materialKey = GlobalKey<NavigatorState>();
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<SCNApp> createState() => _SCNAppState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SCNAppState extends State<SCNApp> {
|
||||||
|
StreamSubscription<List<PurchaseDetails>>? _purchaseSubscription;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
_purchaseSubscription = InAppPurchase.instance.purchaseStream.listen(
|
||||||
|
purchaseUpdated,
|
||||||
|
onDone: () => _purchaseSubscription?.cancel(),
|
||||||
|
onError: purchaseError,
|
||||||
|
);
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_purchaseSubscription?.cancel();
|
||||||
|
_purchaseSubscription = null;
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
void purchaseUpdated(List<PurchaseDetails> purchaseDetailsList) {
|
||||||
|
// see https://pub.dev/packages/in_app_purchase
|
||||||
|
|
||||||
|
for (var purchaseDetails in purchaseDetailsList) {
|
||||||
|
ApplicationLog.debug('Purchase ${purchaseDetails.productID} is ${purchaseDetails.status.toString()}'); //TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void purchaseError(dynamic error) {
|
||||||
|
// TODO handle error here.
|
||||||
|
ApplicationLog.error('Purchase error: ${error.toString()}', trace: StackTrace.current);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ToastificationWrapper(
|
return ToastificationWrapper(
|
||||||
|
@ -9,6 +9,7 @@ import device_info_plus
|
|||||||
import firebase_core
|
import firebase_core
|
||||||
import firebase_messaging
|
import firebase_messaging
|
||||||
import flutter_local_notifications
|
import flutter_local_notifications
|
||||||
|
import in_app_purchase_storekit
|
||||||
import mobile_scanner
|
import mobile_scanner
|
||||||
import package_info_plus
|
import package_info_plus
|
||||||
import path_provider_foundation
|
import path_provider_foundation
|
||||||
@ -21,6 +22,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
|||||||
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
|
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
|
||||||
FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin"))
|
FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin"))
|
||||||
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
|
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
|
||||||
|
InAppPurchasePlugin.register(with: registry.registrar(forPlugin: "InAppPurchasePlugin"))
|
||||||
MobileScannerPlugin.register(with: registry.registrar(forPlugin: "MobileScannerPlugin"))
|
MobileScannerPlugin.register(with: registry.registrar(forPlugin: "MobileScannerPlugin"))
|
||||||
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
|
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
|
||||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
|
@ -540,6 +540,38 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.5.4"
|
version: "4.5.4"
|
||||||
|
in_app_purchase:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: in_app_purchase
|
||||||
|
sha256: "5cddd7f463f3bddb1d37a72b95066e840d5822d66291331d7f8f05ce32c24b6c"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.2.3"
|
||||||
|
in_app_purchase_android:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: in_app_purchase_android
|
||||||
|
sha256: fd76e5612da6facadcfe8a3477da092908227260a9f6ec7db9a66dd989c69b02
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.4.0+2"
|
||||||
|
in_app_purchase_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: in_app_purchase_platform_interface
|
||||||
|
sha256: "1d353d38251da5b9fea6635c0ebfc6bb17a2d28d0e86ea5e083bf64244f1fb4c"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.4.0"
|
||||||
|
in_app_purchase_storekit:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: in_app_purchase_storekit
|
||||||
|
sha256: "9c2b438aa8ef95ac1c1f5ab1aaace8d6edd0ba3745b8b8df832f7baa2e7492f7"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.4.1"
|
||||||
infinite_scroll_pagination:
|
infinite_scroll_pagination:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -2,7 +2,7 @@ name: simplecloudnotifier
|
|||||||
description: "Receive push messages"
|
description: "Receive push messages"
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 2.0.1+490
|
version: 2.0.1+491
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.2.6 <4.0.0'
|
sdk: '>=3.2.6 <4.0.0'
|
||||||
@ -42,6 +42,7 @@ dependencies:
|
|||||||
git_stamp: ^5.10.0
|
git_stamp: ^5.10.0
|
||||||
action_slider: ^0.7.0
|
action_slider: ^0.7.0
|
||||||
mutex: ^3.1.0
|
mutex: ^3.1.0
|
||||||
|
in_app_purchase: ^3.2.3
|
||||||
dependency_overrides:
|
dependency_overrides:
|
||||||
font_awesome_flutter:
|
font_awesome_flutter:
|
||||||
path: deps/font_awesome_flutter
|
path: deps/font_awesome_flutter
|
||||||
|
Loading…
x
Reference in New Issue
Block a user