mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 06:28:41 +00:00
fix #348
Some checks are pending
Flutter analyze & test / flutter_analyze_and_test (push) Waiting to run
Some checks are pending
Flutter analyze & test / flutter_analyze_and_test (push) Waiting to run
This commit is contained in:
parent
82f4c9af9f
commit
027871290d
11 changed files with 151 additions and 122 deletions
10
lib/app.dart
10
lib/app.dart
|
|
@ -1,4 +1,5 @@
|
|||
import 'dart:async';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
|
@ -157,11 +158,13 @@ class _AppMainWidgetState extends State<AppMainWidget> {
|
|||
bool _showOnboarding = true;
|
||||
bool _isLoaded = false;
|
||||
bool _skipBackup = false;
|
||||
int _initialPage = 0;
|
||||
|
||||
(Future<int>?, bool) _proofOfWork = (null, false);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_initialPage = widget.initialPage;
|
||||
initAsync();
|
||||
super.initState();
|
||||
}
|
||||
|
|
@ -173,6 +176,9 @@ class _AppMainWidgetState extends State<AppMainWidget> {
|
|||
if (gUser.appVersion < 62) {
|
||||
_showDatabaseMigration = true;
|
||||
}
|
||||
if (!gUser.startWithCameraOpen) {
|
||||
_initialPage = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_isUserCreated && !_showDatabaseMigration) {
|
||||
|
|
@ -205,7 +211,7 @@ class _AppMainWidgetState extends State<AppMainWidget> {
|
|||
if (_showDatabaseMigration) {
|
||||
child = const DatabaseMigrationView();
|
||||
} else if (_isUserCreated) {
|
||||
if (gUser.twonlySafeBackup == null && !_skipBackup) {
|
||||
if (gUser.twonlySafeBackup == null && !_skipBackup && kReleaseMode) {
|
||||
child = TwonlyIdentityBackupView(
|
||||
callBack: () {
|
||||
_skipBackup = true;
|
||||
|
|
@ -214,7 +220,7 @@ class _AppMainWidgetState extends State<AppMainWidget> {
|
|||
);
|
||||
} else {
|
||||
child = HomeView(
|
||||
initialPage: widget.initialPage,
|
||||
initialPage: _initialPage,
|
||||
);
|
||||
}
|
||||
} else if (_showOnboarding) {
|
||||
|
|
|
|||
|
|
@ -7111,10 +7111,7 @@ class $GroupHistoriesTable extends GroupHistories
|
|||
@override
|
||||
late final GeneratedColumn<int> affectedContactId = GeneratedColumn<int>(
|
||||
'affected_contact_id', aliasedName, true,
|
||||
type: DriftSqlType.int,
|
||||
requiredDuringInsert: false,
|
||||
defaultConstraints:
|
||||
GeneratedColumn.constraintIsAlways('REFERENCES contacts (user_id)'));
|
||||
type: DriftSqlType.int, requiredDuringInsert: false);
|
||||
static const VerificationMeta _oldGroupNameMeta =
|
||||
const VerificationMeta('oldGroupName');
|
||||
@override
|
||||
|
|
@ -7896,6 +7893,22 @@ final class $$ContactsTableReferences
|
|||
return ProcessedTableManager(
|
||||
manager.$state.copyWith(prefetchedData: cache));
|
||||
}
|
||||
|
||||
static MultiTypedResultKey<$GroupHistoriesTable, List<GroupHistory>>
|
||||
_groupHistoriesRefsTable(_$TwonlyDB db) =>
|
||||
MultiTypedResultKey.fromTable(db.groupHistories,
|
||||
aliasName: $_aliasNameGenerator(
|
||||
db.contacts.userId, db.groupHistories.contactId));
|
||||
|
||||
$$GroupHistoriesTableProcessedTableManager get groupHistoriesRefs {
|
||||
final manager = $$GroupHistoriesTableTableManager($_db, $_db.groupHistories)
|
||||
.filter(
|
||||
(f) => f.contactId.userId.sqlEquals($_itemColumn<int>('user_id')!));
|
||||
|
||||
final cache = $_typedResult.readTableOrNull(_groupHistoriesRefsTable($_db));
|
||||
return ProcessedTableManager(
|
||||
manager.$state.copyWith(prefetchedData: cache));
|
||||
}
|
||||
}
|
||||
|
||||
class $$ContactsTableFilterComposer
|
||||
|
|
@ -8078,6 +8091,27 @@ class $$ContactsTableFilterComposer
|
|||
));
|
||||
return f(composer);
|
||||
}
|
||||
|
||||
Expression<bool> groupHistoriesRefs(
|
||||
Expression<bool> Function($$GroupHistoriesTableFilterComposer f) f) {
|
||||
final $$GroupHistoriesTableFilterComposer composer = $composerBuilder(
|
||||
composer: this,
|
||||
getCurrentColumn: (t) => t.userId,
|
||||
referencedTable: $db.groupHistories,
|
||||
getReferencedColumn: (t) => t.contactId,
|
||||
builder: (joinBuilder,
|
||||
{$addJoinBuilderToRootComposer,
|
||||
$removeJoinBuilderFromRootComposer}) =>
|
||||
$$GroupHistoriesTableFilterComposer(
|
||||
$db: $db,
|
||||
$table: $db.groupHistories,
|
||||
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||
joinBuilder: joinBuilder,
|
||||
$removeJoinBuilderFromRootComposer:
|
||||
$removeJoinBuilderFromRootComposer,
|
||||
));
|
||||
return f(composer);
|
||||
}
|
||||
}
|
||||
|
||||
class $$ContactsTableOrderingComposer
|
||||
|
|
@ -8311,6 +8345,27 @@ class $$ContactsTableAnnotationComposer
|
|||
));
|
||||
return f(composer);
|
||||
}
|
||||
|
||||
Expression<T> groupHistoriesRefs<T extends Object>(
|
||||
Expression<T> Function($$GroupHistoriesTableAnnotationComposer a) f) {
|
||||
final $$GroupHistoriesTableAnnotationComposer composer = $composerBuilder(
|
||||
composer: this,
|
||||
getCurrentColumn: (t) => t.userId,
|
||||
referencedTable: $db.groupHistories,
|
||||
getReferencedColumn: (t) => t.contactId,
|
||||
builder: (joinBuilder,
|
||||
{$addJoinBuilderToRootComposer,
|
||||
$removeJoinBuilderFromRootComposer}) =>
|
||||
$$GroupHistoriesTableAnnotationComposer(
|
||||
$db: $db,
|
||||
$table: $db.groupHistories,
|
||||
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||
joinBuilder: joinBuilder,
|
||||
$removeJoinBuilderFromRootComposer:
|
||||
$removeJoinBuilderFromRootComposer,
|
||||
));
|
||||
return f(composer);
|
||||
}
|
||||
}
|
||||
|
||||
class $$ContactsTableTableManager extends RootTableManager<
|
||||
|
|
@ -8330,7 +8385,8 @@ class $$ContactsTableTableManager extends RootTableManager<
|
|||
bool groupMembersRefs,
|
||||
bool receiptsRefs,
|
||||
bool signalContactPreKeysRefs,
|
||||
bool signalContactSignedPreKeysRefs})> {
|
||||
bool signalContactSignedPreKeysRefs,
|
||||
bool groupHistoriesRefs})> {
|
||||
$$ContactsTableTableManager(_$TwonlyDB db, $ContactsTable table)
|
||||
: super(TableManagerState(
|
||||
db: db,
|
||||
|
|
@ -8411,7 +8467,8 @@ class $$ContactsTableTableManager extends RootTableManager<
|
|||
groupMembersRefs = false,
|
||||
receiptsRefs = false,
|
||||
signalContactPreKeysRefs = false,
|
||||
signalContactSignedPreKeysRefs = false}) {
|
||||
signalContactSignedPreKeysRefs = false,
|
||||
groupHistoriesRefs = false}) {
|
||||
return PrefetchHooks(
|
||||
db: db,
|
||||
explicitlyWatchedTables: [
|
||||
|
|
@ -8421,7 +8478,8 @@ class $$ContactsTableTableManager extends RootTableManager<
|
|||
if (receiptsRefs) db.receipts,
|
||||
if (signalContactPreKeysRefs) db.signalContactPreKeys,
|
||||
if (signalContactSignedPreKeysRefs)
|
||||
db.signalContactSignedPreKeys
|
||||
db.signalContactSignedPreKeys,
|
||||
if (groupHistoriesRefs) db.groupHistories
|
||||
],
|
||||
addJoins: null,
|
||||
getPrefetchedDataCallback: (items) async {
|
||||
|
|
@ -8501,6 +8559,19 @@ class $$ContactsTableTableManager extends RootTableManager<
|
|||
referencedItemsForCurrentItem:
|
||||
(item, referencedItems) => referencedItems
|
||||
.where((e) => e.contactId == item.userId),
|
||||
typedResults: items),
|
||||
if (groupHistoriesRefs)
|
||||
await $_getPrefetchedData<Contact, $ContactsTable,
|
||||
GroupHistory>(
|
||||
currentTable: table,
|
||||
referencedTable: $$ContactsTableReferences
|
||||
._groupHistoriesRefsTable(db),
|
||||
managerFromTypedResult: (p0) =>
|
||||
$$ContactsTableReferences(db, table, p0)
|
||||
.groupHistoriesRefs,
|
||||
referencedItemsForCurrentItem:
|
||||
(item, referencedItems) => referencedItems
|
||||
.where((e) => e.contactId == item.userId),
|
||||
typedResults: items)
|
||||
];
|
||||
},
|
||||
|
|
@ -8526,7 +8597,8 @@ typedef $$ContactsTableProcessedTableManager = ProcessedTableManager<
|
|||
bool groupMembersRefs,
|
||||
bool receiptsRefs,
|
||||
bool signalContactPreKeysRefs,
|
||||
bool signalContactSignedPreKeysRefs})>;
|
||||
bool signalContactSignedPreKeysRefs,
|
||||
bool groupHistoriesRefs})>;
|
||||
typedef $$GroupsTableCreateCompanionBuilder = GroupsCompanion Function({
|
||||
required String groupId,
|
||||
Value<bool> isGroupAdmin,
|
||||
|
|
@ -13600,21 +13672,6 @@ final class $$GroupHistoriesTableReferences
|
|||
return ProcessedTableManager(
|
||||
manager.$state.copyWith(prefetchedData: [item]));
|
||||
}
|
||||
|
||||
static $ContactsTable _affectedContactIdTable(_$TwonlyDB db) =>
|
||||
db.contacts.createAlias($_aliasNameGenerator(
|
||||
db.groupHistories.affectedContactId, db.contacts.userId));
|
||||
|
||||
$$ContactsTableProcessedTableManager? get affectedContactId {
|
||||
final $_column = $_itemColumn<int>('affected_contact_id');
|
||||
if ($_column == null) return null;
|
||||
final manager = $$ContactsTableTableManager($_db, $_db.contacts)
|
||||
.filter((f) => f.userId.sqlEquals($_column));
|
||||
final item = $_typedResult.readTableOrNull(_affectedContactIdTable($_db));
|
||||
if (item == null) return manager;
|
||||
return ProcessedTableManager(
|
||||
manager.$state.copyWith(prefetchedData: [item]));
|
||||
}
|
||||
}
|
||||
|
||||
class $$GroupHistoriesTableFilterComposer
|
||||
|
|
@ -13630,6 +13687,10 @@ class $$GroupHistoriesTableFilterComposer
|
|||
column: $table.groupHistoryId,
|
||||
builder: (column) => ColumnFilters(column));
|
||||
|
||||
ColumnFilters<int> get affectedContactId => $composableBuilder(
|
||||
column: $table.affectedContactId,
|
||||
builder: (column) => ColumnFilters(column));
|
||||
|
||||
ColumnFilters<String> get oldGroupName => $composableBuilder(
|
||||
column: $table.oldGroupName, builder: (column) => ColumnFilters(column));
|
||||
|
||||
|
|
@ -13688,26 +13749,6 @@ class $$GroupHistoriesTableFilterComposer
|
|||
));
|
||||
return composer;
|
||||
}
|
||||
|
||||
$$ContactsTableFilterComposer get affectedContactId {
|
||||
final $$ContactsTableFilterComposer composer = $composerBuilder(
|
||||
composer: this,
|
||||
getCurrentColumn: (t) => t.affectedContactId,
|
||||
referencedTable: $db.contacts,
|
||||
getReferencedColumn: (t) => t.userId,
|
||||
builder: (joinBuilder,
|
||||
{$addJoinBuilderToRootComposer,
|
||||
$removeJoinBuilderFromRootComposer}) =>
|
||||
$$ContactsTableFilterComposer(
|
||||
$db: $db,
|
||||
$table: $db.contacts,
|
||||
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||
joinBuilder: joinBuilder,
|
||||
$removeJoinBuilderFromRootComposer:
|
||||
$removeJoinBuilderFromRootComposer,
|
||||
));
|
||||
return composer;
|
||||
}
|
||||
}
|
||||
|
||||
class $$GroupHistoriesTableOrderingComposer
|
||||
|
|
@ -13723,6 +13764,10 @@ class $$GroupHistoriesTableOrderingComposer
|
|||
column: $table.groupHistoryId,
|
||||
builder: (column) => ColumnOrderings(column));
|
||||
|
||||
ColumnOrderings<int> get affectedContactId => $composableBuilder(
|
||||
column: $table.affectedContactId,
|
||||
builder: (column) => ColumnOrderings(column));
|
||||
|
||||
ColumnOrderings<String> get oldGroupName => $composableBuilder(
|
||||
column: $table.oldGroupName,
|
||||
builder: (column) => ColumnOrderings(column));
|
||||
|
|
@ -13781,26 +13826,6 @@ class $$GroupHistoriesTableOrderingComposer
|
|||
));
|
||||
return composer;
|
||||
}
|
||||
|
||||
$$ContactsTableOrderingComposer get affectedContactId {
|
||||
final $$ContactsTableOrderingComposer composer = $composerBuilder(
|
||||
composer: this,
|
||||
getCurrentColumn: (t) => t.affectedContactId,
|
||||
referencedTable: $db.contacts,
|
||||
getReferencedColumn: (t) => t.userId,
|
||||
builder: (joinBuilder,
|
||||
{$addJoinBuilderToRootComposer,
|
||||
$removeJoinBuilderFromRootComposer}) =>
|
||||
$$ContactsTableOrderingComposer(
|
||||
$db: $db,
|
||||
$table: $db.contacts,
|
||||
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||
joinBuilder: joinBuilder,
|
||||
$removeJoinBuilderFromRootComposer:
|
||||
$removeJoinBuilderFromRootComposer,
|
||||
));
|
||||
return composer;
|
||||
}
|
||||
}
|
||||
|
||||
class $$GroupHistoriesTableAnnotationComposer
|
||||
|
|
@ -13815,6 +13840,9 @@ class $$GroupHistoriesTableAnnotationComposer
|
|||
GeneratedColumn<String> get groupHistoryId => $composableBuilder(
|
||||
column: $table.groupHistoryId, builder: (column) => column);
|
||||
|
||||
GeneratedColumn<int> get affectedContactId => $composableBuilder(
|
||||
column: $table.affectedContactId, builder: (column) => column);
|
||||
|
||||
GeneratedColumn<String> get oldGroupName => $composableBuilder(
|
||||
column: $table.oldGroupName, builder: (column) => column);
|
||||
|
||||
|
|
@ -13871,26 +13899,6 @@ class $$GroupHistoriesTableAnnotationComposer
|
|||
));
|
||||
return composer;
|
||||
}
|
||||
|
||||
$$ContactsTableAnnotationComposer get affectedContactId {
|
||||
final $$ContactsTableAnnotationComposer composer = $composerBuilder(
|
||||
composer: this,
|
||||
getCurrentColumn: (t) => t.affectedContactId,
|
||||
referencedTable: $db.contacts,
|
||||
getReferencedColumn: (t) => t.userId,
|
||||
builder: (joinBuilder,
|
||||
{$addJoinBuilderToRootComposer,
|
||||
$removeJoinBuilderFromRootComposer}) =>
|
||||
$$ContactsTableAnnotationComposer(
|
||||
$db: $db,
|
||||
$table: $db.contacts,
|
||||
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||
joinBuilder: joinBuilder,
|
||||
$removeJoinBuilderFromRootComposer:
|
||||
$removeJoinBuilderFromRootComposer,
|
||||
));
|
||||
return composer;
|
||||
}
|
||||
}
|
||||
|
||||
class $$GroupHistoriesTableTableManager extends RootTableManager<
|
||||
|
|
@ -13904,8 +13912,7 @@ class $$GroupHistoriesTableTableManager extends RootTableManager<
|
|||
$$GroupHistoriesTableUpdateCompanionBuilder,
|
||||
(GroupHistory, $$GroupHistoriesTableReferences),
|
||||
GroupHistory,
|
||||
PrefetchHooks Function(
|
||||
{bool groupId, bool contactId, bool affectedContactId})> {
|
||||
PrefetchHooks Function({bool groupId, bool contactId})> {
|
||||
$$GroupHistoriesTableTableManager(_$TwonlyDB db, $GroupHistoriesTable table)
|
||||
: super(TableManagerState(
|
||||
db: db,
|
||||
|
|
@ -13974,8 +13981,7 @@ class $$GroupHistoriesTableTableManager extends RootTableManager<
|
|||
$$GroupHistoriesTableReferences(db, table, e)
|
||||
))
|
||||
.toList(),
|
||||
prefetchHooksCallback: (
|
||||
{groupId = false, contactId = false, affectedContactId = false}) {
|
||||
prefetchHooksCallback: ({groupId = false, contactId = false}) {
|
||||
return PrefetchHooks(
|
||||
db: db,
|
||||
explicitlyWatchedTables: [],
|
||||
|
|
@ -14014,17 +14020,6 @@ class $$GroupHistoriesTableTableManager extends RootTableManager<
|
|||
.userId,
|
||||
) as T;
|
||||
}
|
||||
if (affectedContactId) {
|
||||
state = state.withJoin(
|
||||
currentTable: table,
|
||||
currentColumn: table.affectedContactId,
|
||||
referencedTable: $$GroupHistoriesTableReferences
|
||||
._affectedContactIdTable(db),
|
||||
referencedColumn: $$GroupHistoriesTableReferences
|
||||
._affectedContactIdTable(db)
|
||||
.userId,
|
||||
) as T;
|
||||
}
|
||||
|
||||
return state;
|
||||
},
|
||||
|
|
@ -14047,8 +14042,7 @@ typedef $$GroupHistoriesTableProcessedTableManager = ProcessedTableManager<
|
|||
$$GroupHistoriesTableUpdateCompanionBuilder,
|
||||
(GroupHistory, $$GroupHistoriesTableReferences),
|
||||
GroupHistory,
|
||||
PrefetchHooks Function(
|
||||
{bool groupId, bool contactId, bool affectedContactId})>;
|
||||
PrefetchHooks Function({bool groupId, bool contactId})>;
|
||||
|
||||
class $TwonlyDBManager {
|
||||
final _$TwonlyDB _db;
|
||||
|
|
|
|||
|
|
@ -456,5 +456,6 @@
|
|||
"linkFromUsernameLong": "Wenn du den Link von der Person direkt erhalten hast, kannst du den Kontakt als verifiziert markieren, da der öffentliche Schlüssel im Link mit dem bereits für diesen Benutzer gespeicherten öffentlichen Schlüssel übereinstimmt.",
|
||||
"gotLinkFromFriend": "Ja, der Link kommt direkt von der Person.",
|
||||
"couldNotVerifyUsername": "{username} konnte nicht verifiziert werden",
|
||||
"linkPubkeyDoesNotMatch": "Der öffentliche Schlüssel im Link stimmt nicht mit dem für diesen Kontakt gespeicherten öffentlichen Schlüssel überein. Triff die Person persönlich und scanne den QR-Code direkt!"
|
||||
"linkPubkeyDoesNotMatch": "Der öffentliche Schlüssel im Link stimmt nicht mit dem für diesen Kontakt gespeicherten öffentlichen Schlüssel überein. Triff die Person persönlich und scanne den QR-Code direkt!",
|
||||
"startWithCameraOpen": "Mit geöffneter Kamera starten"
|
||||
}
|
||||
|
|
@ -486,5 +486,6 @@
|
|||
"linkFromUsernameLong": "If you received the link from your friend, you can mark the user as verified, as the public key in the link matches the public key already stored for that user?",
|
||||
"gotLinkFromFriend": "Yes, I got the link from my friend!",
|
||||
"couldNotVerifyUsername": "Could not verify {username}",
|
||||
"linkPubkeyDoesNotMatch": "The public key in the link does not match the public key stored for this contact. Try to meet your friend in person and scan the QR code directly!"
|
||||
"linkPubkeyDoesNotMatch": "The public key in the link does not match the public key stored for this contact. Try to meet your friend in person and scan the QR code directly!",
|
||||
"startWithCameraOpen": "Start with camera open"
|
||||
}
|
||||
|
|
@ -2839,6 +2839,12 @@ abstract class AppLocalizations {
|
|||
/// In en, this message translates to:
|
||||
/// **'The public key in the link does not match the public key stored for this contact. Try to meet your friend in person and scan the QR code directly!'**
|
||||
String get linkPubkeyDoesNotMatch;
|
||||
|
||||
/// No description provided for @startWithCameraOpen.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Start with camera open'**
|
||||
String get startWithCameraOpen;
|
||||
}
|
||||
|
||||
class _AppLocalizationsDelegate
|
||||
|
|
|
|||
|
|
@ -1570,4 +1570,7 @@ class AppLocalizationsDe extends AppLocalizations {
|
|||
@override
|
||||
String get linkPubkeyDoesNotMatch =>
|
||||
'Der öffentliche Schlüssel im Link stimmt nicht mit dem für diesen Kontakt gespeicherten öffentlichen Schlüssel überein. Triff die Person persönlich und scanne den QR-Code direkt!';
|
||||
|
||||
@override
|
||||
String get startWithCameraOpen => 'Mit geöffneter Kamera starten';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1560,4 +1560,7 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||
@override
|
||||
String get linkPubkeyDoesNotMatch =>
|
||||
'The public key in the link does not match the public key stored for this contact. Try to meet your friend in person and scan the QR code directly!';
|
||||
|
||||
@override
|
||||
String get startWithCameraOpen => 'Start with camera open';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,9 @@ class UserData {
|
|||
@JsonKey(defaultValue: true)
|
||||
bool showFeedbackShortcut = true;
|
||||
|
||||
@JsonKey(defaultValue: true)
|
||||
bool startWithCameraOpen = true;
|
||||
|
||||
List<String>? preSelectedEmojies;
|
||||
|
||||
Map<String, List<String>>? autoDownloadOptions;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ UserData _$UserDataFromJson(Map<String, dynamic> json) => UserData(
|
|||
..requestedAudioPermission =
|
||||
json['requestedAudioPermission'] as bool? ?? false
|
||||
..showFeedbackShortcut = json['showFeedbackShortcut'] as bool? ?? true
|
||||
..startWithCameraOpen = json['startWithCameraOpen'] as bool? ?? true
|
||||
..preSelectedEmojies = (json['preSelectedEmojies'] as List<dynamic>?)
|
||||
?.map((e) => e as String)
|
||||
.toList()
|
||||
|
|
@ -61,7 +62,7 @@ UserData _$UserDataFromJson(Map<String, dynamic> json) => UserData(
|
|||
..lastChangeLogHash = (json['lastChangeLogHash'] as List<dynamic>?)
|
||||
?.map((e) => (e as num).toInt())
|
||||
.toList()
|
||||
..hideChangeLog = json['hideChangeLog'] as bool? ?? false
|
||||
..hideChangeLog = json['hideChangeLog'] as bool? ?? true
|
||||
..updateFCMToken = json['updateFCMToken'] as bool? ?? true
|
||||
..nextTimeToShowBackupNotice = json['nextTimeToShowBackupNotice'] == null
|
||||
? null
|
||||
|
|
@ -93,6 +94,7 @@ Map<String, dynamic> _$UserDataToJson(UserData instance) => <String, dynamic>{
|
|||
'defaultShowTime': instance.defaultShowTime,
|
||||
'requestedAudioPermission': instance.requestedAudioPermission,
|
||||
'showFeedbackShortcut': instance.showFeedbackShortcut,
|
||||
'startWithCameraOpen': instance.startWithCameraOpen,
|
||||
'preSelectedEmojies': instance.preSelectedEmojies,
|
||||
'autoDownloadOptions': instance.autoDownloadOptions,
|
||||
'storeMediaFilesInGallery': instance.storeMediaFilesInGallery,
|
||||
|
|
|
|||
|
|
@ -230,10 +230,10 @@ class HomeViewState extends State<HomeView> {
|
|||
final notificationAppLaunchDetails =
|
||||
await flutterLocalNotificationsPlugin.getNotificationAppLaunchDetails();
|
||||
|
||||
if (notificationAppLaunchDetails != null) {
|
||||
if (notificationAppLaunchDetails.didNotificationLaunchApp) {
|
||||
globalUpdateOfHomeViewPageIndex(0);
|
||||
}
|
||||
if (widget.initialPage == 0 ||
|
||||
(notificationAppLaunchDetails != null &&
|
||||
notificationAppLaunchDetails.didNotificationLaunchApp)) {
|
||||
globalUpdateOfHomeViewPageIndex(0);
|
||||
}
|
||||
|
||||
final draftMedia = await twonlyDB.mediaFilesDao.getDraftMediaFile();
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import 'dart:async';
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:twonly/globals.dart';
|
||||
import 'package:twonly/src/providers/settings.provider.dart';
|
||||
import 'package:twonly/src/utils/misc.dart';
|
||||
import 'package:twonly/src/utils/storage.dart';
|
||||
|
|
@ -15,20 +16,9 @@ class AppearanceView extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _AppearanceViewState extends State<AppearanceView> {
|
||||
bool showFeedbackShortcut = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
unawaited(initAsync());
|
||||
}
|
||||
|
||||
Future<void> initAsync() async {
|
||||
final user = await getUser();
|
||||
if (user == null) return;
|
||||
setState(() {
|
||||
showFeedbackShortcut = user.showFeedbackShortcut;
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _showSelectThemeMode(BuildContext context) async {
|
||||
|
|
@ -87,7 +77,19 @@ class _AppearanceViewState extends State<AppearanceView> {
|
|||
u.showFeedbackShortcut = !u.showFeedbackShortcut;
|
||||
return u;
|
||||
});
|
||||
await initAsync();
|
||||
setState(() {
|
||||
// gUser
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> toggleStartWithCameraOpen() async {
|
||||
await updateUserdata((u) {
|
||||
u.startWithCameraOpen = !u.startWithCameraOpen;
|
||||
return u;
|
||||
});
|
||||
setState(() {
|
||||
// gUser
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
@ -113,10 +115,18 @@ class _AppearanceViewState extends State<AppearanceView> {
|
|||
title: Text(context.lang.contactUsShortcut),
|
||||
onTap: toggleShowFeedbackIcon,
|
||||
trailing: Switch(
|
||||
value: !showFeedbackShortcut,
|
||||
value: !gUser.showFeedbackShortcut,
|
||||
onChanged: (a) => toggleShowFeedbackIcon(),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text(context.lang.startWithCameraOpen),
|
||||
onTap: toggleStartWithCameraOpen,
|
||||
trailing: Switch(
|
||||
value: gUser.startWithCameraOpen,
|
||||
onChanged: (a) => toggleStartWithCameraOpen(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue