Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 3D links not work on mobile #3220

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class SanitizeHyperLinkTagInHtmlTransformer extends DomTransformer {
}) async {
final elements = document.querySelectorAll('a');
await Future.wait(elements.map((element) async {
_sanitizeUrlResource(element);
if (useTooltip) {
_addToolTipWhenHoverLink(element);
}
Expand All @@ -26,7 +27,7 @@ class SanitizeHyperLinkTagInHtmlTransformer extends DomTransformer {
}));
}

void _addToolTipWhenHoverLink(Element element) {
void _sanitizeUrlResource(Element element) {
final url = element.attributes['href'] ?? '';

final urlSanitized = _sanitizeUrl.process(url);
Expand All @@ -35,7 +36,10 @@ class SanitizeHyperLinkTagInHtmlTransformer extends DomTransformer {
}

element.attributes['href'] = urlSanitized;
}

void _addToolTipWhenHoverLink(Element element) {
final url = element.attributes['href'] ?? '';
final text = element.text;
final children = element.children;
if (children.isEmpty && text.isNotEmpty) {
Expand Down
17 changes: 17 additions & 0 deletions lib/features/base/upgradeable/upgrade_hive_database_steps_v12.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

import 'package:tmail_ui_user/features/base/upgradeable/upgrade_database_steps.dart';
import 'package:tmail_ui_user/features/caching/caching_manager.dart';

class UpgradeHiveDatabaseStepsV12 extends UpgradeDatabaseSteps {

final CachingManager _cachingManager;

UpgradeHiveDatabaseStepsV12(this._cachingManager);

@override
Future<void> onUpgrade(int oldVersion, int newVersion) async {
if (oldVersion > 0 && oldVersion < newVersion && newVersion == 12) {
await _cachingManager.clearEmailCacheAndAllStateCache();
}
}
}
4 changes: 4 additions & 0 deletions lib/features/caching/caching_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,17 @@ class CachingManager {
return Future.wait([
_stateCacheClient.deleteItem(StateType.email.getTupleKeyStored(accountId, session.username)),
_emailCacheClient.clearAllData(),
if (PlatformInfo.isMobile)
clearAllFileInStorage(),
], eagerError: true);
}

Future<void> clearEmailCacheAndAllStateCache() {
return Future.wait([
_stateCacheClient.clearAllData(),
_emailCacheClient.clearAllData(),
if (PlatformInfo.isMobile)
clearAllFileInStorage(),
], eagerError: true);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/features/caching/config/cache_version.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

class CacheVersion {
static const int hiveDBVersion = 11;
static const int hiveDBVersion = 12;
}
2 changes: 2 additions & 0 deletions lib/features/caching/config/hive_cache_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:hive/hive.dart';
import 'package:path_provider/path_provider.dart' as path_provider;
import 'package:tmail_ui_user/features/base/upgradeable/upgrade_hive_database_steps_v10.dart';
import 'package:tmail_ui_user/features/base/upgradeable/upgrade_hive_database_steps_v11.dart';
import 'package:tmail_ui_user/features/base/upgradeable/upgrade_hive_database_steps_v12.dart';
import 'package:tmail_ui_user/features/base/upgradeable/upgrade_hive_database_steps_v7.dart';
import 'package:tmail_ui_user/features/caching/caching_manager.dart';
import 'package:tmail_ui_user/features/caching/config/cache_version.dart';
Expand Down Expand Up @@ -67,6 +68,7 @@ class HiveCacheConfig {
await UpgradeHiveDatabaseStepsV7(cachingManager).onUpgrade(oldVersion, newVersion);
await UpgradeHiveDatabaseStepsV10(cachingManager).onUpgrade(oldVersion, newVersion);
await UpgradeHiveDatabaseStepsV11(cachingManager).onUpgrade(oldVersion, newVersion);
await UpgradeHiveDatabaseStepsV12(cachingManager).onUpgrade(oldVersion, newVersion);

if (oldVersion != newVersion) {
await cachingManager.storeCacheVersion(newVersion);
Expand Down
Loading