mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 17:48:40 +00:00
showing testing account
This commit is contained in:
parent
856e39f2b5
commit
2cfddace9a
9 changed files with 123 additions and 2 deletions
|
|
@ -328,5 +328,8 @@
|
||||||
"appOutdated": "Deine Version von twonly ist veraltet.",
|
"appOutdated": "Deine Version von twonly ist veraltet.",
|
||||||
"appOutdatedBtn": "Jetzt aktualisieren.",
|
"appOutdatedBtn": "Jetzt aktualisieren.",
|
||||||
"doubleClickToReopen": "Doppelklicken zum\nerneuten Öffnen.",
|
"doubleClickToReopen": "Doppelklicken zum\nerneuten Öffnen.",
|
||||||
"retransmissionRequested": "Wird erneut versucht."
|
"retransmissionRequested": "Wird erneut versucht.",
|
||||||
|
"testPaymentMethode": "twonly befindet sich derzeit in einer Testphase und kann nur mit einem Einladungscode vollständig genutzt werden. Es gibt derzeit keine Zahlungsmethode, um Ihr twonly-Guthaben aufzuladen!",
|
||||||
|
"testingAccountTitle": "Tester-Zugang",
|
||||||
|
"testingAccountBody": "Danke für dein Interesse! Wir werden deine Anfrage prüfen und den Plan so schnell wie möglich aktivieren. Da wir uns jedoch noch in einer Testphase befinden, ist die Anzahl der Tester-Konten begrenzt. Wir werden dich jedoch benachrichtigen, sobald dir ein Platz zugewiesen wurde."
|
||||||
}
|
}
|
||||||
|
|
@ -485,5 +485,8 @@
|
||||||
"appOutdated": "Your version of twonly is out of date.",
|
"appOutdated": "Your version of twonly is out of date.",
|
||||||
"appOutdatedBtn": "Update Now",
|
"appOutdatedBtn": "Update Now",
|
||||||
"doubleClickToReopen": "Double-click\nto open again",
|
"doubleClickToReopen": "Double-click\nto open again",
|
||||||
"retransmissionRequested": "Retransmission requested"
|
"retransmissionRequested": "Retransmission requested",
|
||||||
|
"testPaymentMethode": "twonly is currently in a test phase and can only be used in full with an invitation code. There is currently no payment method to top up your twonly credit!",
|
||||||
|
"testingAccountTitle": "Tester account activation",
|
||||||
|
"testingAccountBody": "Thank you for your interest! We will check your request and activate the plan as soon as possible. However, as we are currently still in a test phase, the number of tester accounts is limited. However, we will notify you as soon as you have been allocated a place."
|
||||||
}
|
}
|
||||||
|
|
@ -2011,6 +2011,24 @@ abstract class AppLocalizations {
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'Retransmission requested'**
|
/// **'Retransmission requested'**
|
||||||
String get retransmissionRequested;
|
String get retransmissionRequested;
|
||||||
|
|
||||||
|
/// No description provided for @testPaymentMethode.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'twonly is currently in a test phase and can only be used in full with an invitation code. There is currently no payment method to top up your twonly credit!'**
|
||||||
|
String get testPaymentMethode;
|
||||||
|
|
||||||
|
/// No description provided for @testingAccountTitle.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Tester account activation'**
|
||||||
|
String get testingAccountTitle;
|
||||||
|
|
||||||
|
/// No description provided for @testingAccountBody.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Thank you for your interest! We will check your request and activate the plan as soon as possible. However, as we are currently still in a test phase, the number of tester accounts is limited. However, we will notify you as soon as you have been allocated a place.'**
|
||||||
|
String get testingAccountBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AppLocalizationsDelegate
|
class _AppLocalizationsDelegate
|
||||||
|
|
|
||||||
|
|
@ -1066,4 +1066,15 @@ class AppLocalizationsDe extends AppLocalizations {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get retransmissionRequested => 'Wird erneut versucht.';
|
String get retransmissionRequested => 'Wird erneut versucht.';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get testPaymentMethode =>
|
||||||
|
'twonly befindet sich derzeit in einer Testphase und kann nur mit einem Einladungscode vollständig genutzt werden. Es gibt derzeit keine Zahlungsmethode, um Ihr twonly-Guthaben aufzuladen!';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get testingAccountTitle => 'Tester-Zugang';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get testingAccountBody =>
|
||||||
|
'Danke für dein Interesse! Wir werden deine Anfrage prüfen und den Plan so schnell wie möglich aktivieren. Da wir uns jedoch noch in einer Testphase befinden, ist die Anzahl der Tester-Konten begrenzt. Wir werden dich jedoch benachrichtigen, sobald dir ein Platz zugewiesen wurde.';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1060,4 +1060,15 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get retransmissionRequested => 'Retransmission requested';
|
String get retransmissionRequested => 'Retransmission requested';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get testPaymentMethode =>
|
||||||
|
'twonly is currently in a test phase and can only be used in full with an invitation code. There is currently no payment method to top up your twonly credit!';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get testingAccountTitle => 'Tester account activation';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get testingAccountBody =>
|
||||||
|
'Thank you for your interest! We will check your request and activate the plan as soon as possible. However, as we are currently still in a test phase, the number of tester accounts is limited. However, we will notify you as soon as you have been allocated a place.';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,9 @@ class UserData {
|
||||||
|
|
||||||
DateTime? signalLastSignedPreKeyUpdated;
|
DateTime? signalLastSignedPreKeyUpdated;
|
||||||
|
|
||||||
|
@JsonKey(defaultValue: false)
|
||||||
|
bool requestedTesterAccount = false;
|
||||||
|
|
||||||
// -- Custom DATA --
|
// -- Custom DATA --
|
||||||
|
|
||||||
@JsonKey(defaultValue: 100_000)
|
@JsonKey(defaultValue: 100_000)
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,8 @@ UserData _$UserDataFromJson(Map<String, dynamic> json) => UserData(
|
||||||
json['signalLastSignedPreKeyUpdated'] == null
|
json['signalLastSignedPreKeyUpdated'] == null
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['signalLastSignedPreKeyUpdated'] as String)
|
: DateTime.parse(json['signalLastSignedPreKeyUpdated'] as String)
|
||||||
|
..requestedTesterAccount =
|
||||||
|
json['requestedTesterAccount'] as bool? ?? false
|
||||||
..currentPreKeyIndexStart =
|
..currentPreKeyIndexStart =
|
||||||
(json['currentPreKeyIndexStart'] as num?)?.toInt() ?? 100000
|
(json['currentPreKeyIndexStart'] as num?)?.toInt() ?? 100000
|
||||||
..currentSignedPreKeyIndexStart =
|
..currentSignedPreKeyIndexStart =
|
||||||
|
|
@ -89,6 +91,7 @@ Map<String, dynamic> _$UserDataToJson(UserData instance) => <String, dynamic>{
|
||||||
'myBestFriendContactId': instance.myBestFriendContactId,
|
'myBestFriendContactId': instance.myBestFriendContactId,
|
||||||
'signalLastSignedPreKeyUpdated':
|
'signalLastSignedPreKeyUpdated':
|
||||||
instance.signalLastSignedPreKeyUpdated?.toIso8601String(),
|
instance.signalLastSignedPreKeyUpdated?.toIso8601String(),
|
||||||
|
'requestedTesterAccount': instance.requestedTesterAccount,
|
||||||
'currentPreKeyIndexStart': instance.currentPreKeyIndexStart,
|
'currentPreKeyIndexStart': instance.currentPreKeyIndexStart,
|
||||||
'currentSignedPreKeyIndexStart': instance.currentSignedPreKeyIndexStart,
|
'currentSignedPreKeyIndexStart': instance.currentSignedPreKeyIndexStart,
|
||||||
'nextTimeToShowBackupNotice':
|
'nextTimeToShowBackupNotice':
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,20 @@ class _SelectPaymentViewState extends State<SelectPaymentView> {
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.all(16),
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.red,
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
),
|
||||||
|
padding: EdgeInsets.all(16),
|
||||||
|
child: Text(
|
||||||
|
context.lang.testPaymentMethode,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:twonly/globals.dart';
|
import 'package:twonly/globals.dart';
|
||||||
|
|
@ -12,6 +13,7 @@ import 'package:twonly/src/providers/connection.provider.dart';
|
||||||
import 'package:twonly/src/utils/log.dart';
|
import 'package:twonly/src/utils/log.dart';
|
||||||
import 'package:twonly/src/utils/misc.dart';
|
import 'package:twonly/src/utils/misc.dart';
|
||||||
import 'package:twonly/src/utils/storage.dart';
|
import 'package:twonly/src/utils/storage.dart';
|
||||||
|
import 'package:twonly/src/views/components/alert_dialog.dart';
|
||||||
import 'package:twonly/src/views/components/better_list_title.dart';
|
import 'package:twonly/src/views/components/better_list_title.dart';
|
||||||
import 'package:twonly/src/views/settings/subscription/additional_users.view.dart';
|
import 'package:twonly/src/views/settings/subscription/additional_users.view.dart';
|
||||||
import 'package:twonly/src/views/settings/subscription/checkout.view.dart';
|
import 'package:twonly/src/views/settings/subscription/checkout.view.dart';
|
||||||
|
|
@ -105,6 +107,7 @@ class SubscriptionView extends StatefulWidget {
|
||||||
|
|
||||||
class _SubscriptionViewState extends State<SubscriptionView> {
|
class _SubscriptionViewState extends State<SubscriptionView> {
|
||||||
bool loaded = false;
|
bool loaded = false;
|
||||||
|
bool testerRequested = true;
|
||||||
Response_PlanBallance? ballance;
|
Response_PlanBallance? ballance;
|
||||||
String? additionalOwnerName;
|
String? additionalOwnerName;
|
||||||
|
|
||||||
|
|
@ -127,9 +130,47 @@ class _SubscriptionViewState extends State<SubscriptionView> {
|
||||||
additionalOwnerName = ownerId.toString();
|
additionalOwnerName = ownerId.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
final user = await getUser();
|
||||||
|
if (user != null) {
|
||||||
|
testerRequested = user.requestedTesterAccount;
|
||||||
|
// if (kDebugMode) {
|
||||||
|
// testerRequested = false;
|
||||||
|
// }
|
||||||
|
}
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _submitTesterRequest() async {
|
||||||
|
final user = await getUser();
|
||||||
|
if (user == null) return;
|
||||||
|
final response = await http.post(
|
||||||
|
Uri.parse('https://twonly.theconnectapp.de/subscribe.twonly.php'),
|
||||||
|
headers: <String, String>{
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
},
|
||||||
|
body: {
|
||||||
|
'feedback': "[TESTER REQUEST] ${user.username} ${user.userId}",
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (!mounted) return;
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
// Handle successful response
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(content: Text("Your request has been submitted.")),
|
||||||
|
);
|
||||||
|
await updateUserdata((u) {
|
||||||
|
u.requestedTesterAccount = true;
|
||||||
|
return u;
|
||||||
|
});
|
||||||
|
initAsync();
|
||||||
|
} else {
|
||||||
|
// Handle error response
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(content: Text('Failed to submit your request.')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Locale myLocale = Localizations.localeOf(context);
|
Locale myLocale = Localizations.localeOf(context);
|
||||||
|
|
@ -222,6 +263,20 @@ class _SubscriptionViewState extends State<SubscriptionView> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (currentPlan != "Tester" && !testerRequested)
|
||||||
|
PlanCard(
|
||||||
|
planId: "Tester",
|
||||||
|
onTap: () async {
|
||||||
|
bool activate = await showAlertDialog(
|
||||||
|
context,
|
||||||
|
context.lang.testingAccountTitle,
|
||||||
|
context.lang.testingAccountBody,
|
||||||
|
);
|
||||||
|
if (activate) {
|
||||||
|
_submitTesterRequest();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
if (currentPlan != "Family" && currentPlan != "Pro")
|
if (currentPlan != "Family" && currentPlan != "Pro")
|
||||||
PlanCard(
|
PlanCard(
|
||||||
planId: "Pro",
|
planId: "Pro",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue