fix: resolve issues with token punctuation combination and HWL activities (#2051)
This commit is contained in:
parent
8f50bfd4bc
commit
365b7f0a12
3 changed files with 62 additions and 60 deletions
|
|
@ -36,9 +36,6 @@ class MessageTextUtil {
|
|||
final int startIndex = messageCharacters.take(start).length;
|
||||
int endIndex = messageCharacters.take(end).length;
|
||||
|
||||
final hideContent =
|
||||
messageAnalyticsEntry?.isTokenInHiddenWordActivity(token) ?? false;
|
||||
|
||||
final hasHiddenContent =
|
||||
messageAnalyticsEntry?.hasHiddenWordActivity ?? false;
|
||||
|
||||
|
|
@ -80,6 +77,9 @@ class MessageTextUtil {
|
|||
break;
|
||||
}
|
||||
|
||||
final hideContent =
|
||||
messageAnalyticsEntry?.isTokenInHiddenWordActivity(token) ?? false;
|
||||
|
||||
tokenPositions.add(
|
||||
TokenPosition(
|
||||
start: startIndex,
|
||||
|
|
|
|||
|
|
@ -20,38 +20,41 @@ class PangeaLoginView extends StatelessWidget {
|
|||
child: PangeaLoginScaffold(
|
||||
children: [
|
||||
AutofillGroup(
|
||||
child: Column(children: [
|
||||
FullWidthTextField(
|
||||
hintText: L10n.of(context).username,
|
||||
autofillHints: const [AutofillHints.username],
|
||||
autoFocus: true,
|
||||
textInputAction: TextInputAction.next,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return L10n.of(context).pleaseEnterYourUsername;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: controller.usernameController,
|
||||
child: Column(
|
||||
children: [
|
||||
FullWidthTextField(
|
||||
hintText: L10n.of(context).username,
|
||||
autofillHints: const [AutofillHints.username],
|
||||
autoFocus: true,
|
||||
textInputAction: TextInputAction.next,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return L10n.of(context).pleaseEnterYourUsername;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: controller.usernameController,
|
||||
),
|
||||
FullWidthTextField(
|
||||
hintText: L10n.of(context).password,
|
||||
autofillHints: const [AutofillHints.password],
|
||||
autoFocus: true,
|
||||
obscureText: true,
|
||||
textInputAction: TextInputAction.go,
|
||||
onSubmitted: (_) {
|
||||
controller.enabledSignIn ? controller.login() : null;
|
||||
},
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return L10n.of(context).pleaseEnterYourPassword;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: controller.passwordController,
|
||||
),
|
||||
],
|
||||
),
|
||||
FullWidthTextField(
|
||||
hintText: L10n.of(context).password,
|
||||
autofillHints: const [AutofillHints.password],
|
||||
autoFocus: true,
|
||||
obscureText: true,
|
||||
textInputAction: TextInputAction.go,
|
||||
onSubmitted: (_) {
|
||||
controller.enabledSignIn ? controller.login() : null;
|
||||
},
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return L10n.of(context).pleaseEnterYourPassword;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: controller.passwordController,
|
||||
),
|
||||
])),
|
||||
),
|
||||
FullWidthButton(
|
||||
title: L10n.of(context).signIn,
|
||||
icon: PangeaLogoSvg(
|
||||
|
|
|
|||
|
|
@ -235,17 +235,6 @@ class MessageTextWidget extends StatelessWidget {
|
|||
}
|
||||
|
||||
if (tokenPosition.token != null) {
|
||||
if (tokenPosition.hideContent) {
|
||||
return WidgetSpan(
|
||||
child: GestureDetector(
|
||||
onTap: onClick != null
|
||||
? () => onClick?.call(tokenPosition)
|
||||
: null,
|
||||
child: HiddenText(text: substring, style: style),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// if the tokenPosition is a combination of the token and preceding / following punctuation
|
||||
// split them so that only the token itself is highlighted when clicked
|
||||
String start = '';
|
||||
|
|
@ -260,7 +249,7 @@ class MessageTextWidget extends StatelessWidget {
|
|||
end = substring.characters.skip(endSplitIndex).toString();
|
||||
middle = substring.characters
|
||||
.skip(startSplitIndex)
|
||||
.take(endSplitIndex)
|
||||
.take(endSplitIndex - startSplitIndex)
|
||||
.toString();
|
||||
|
||||
return WidgetSpan(
|
||||
|
|
@ -284,20 +273,30 @@ class MessageTextWidget extends StatelessWidget {
|
|||
onOpen: (url) =>
|
||||
UrlLauncher(context, url.url).launchUrl(),
|
||||
),
|
||||
LinkifySpan(
|
||||
text: middle,
|
||||
style: style.merge(
|
||||
TextStyle(
|
||||
backgroundColor: backgroundColor,
|
||||
),
|
||||
),
|
||||
linkStyle: TextStyle(
|
||||
decoration: TextDecoration.underline,
|
||||
color: linkColor,
|
||||
),
|
||||
onOpen: (url) =>
|
||||
UrlLauncher(context, url.url).launchUrl(),
|
||||
),
|
||||
tokenPosition.hideContent
|
||||
? WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: GestureDetector(
|
||||
onTap: onClick != null
|
||||
? () => onClick?.call(tokenPosition)
|
||||
: null,
|
||||
child: HiddenText(text: middle, style: style),
|
||||
),
|
||||
)
|
||||
: LinkifySpan(
|
||||
text: middle,
|
||||
style: style.merge(
|
||||
TextStyle(
|
||||
backgroundColor: backgroundColor,
|
||||
),
|
||||
),
|
||||
linkStyle: TextStyle(
|
||||
decoration: TextDecoration.underline,
|
||||
color: linkColor,
|
||||
),
|
||||
onOpen: (url) =>
|
||||
UrlLauncher(context, url.url).launchUrl(),
|
||||
),
|
||||
if (end.isNotEmpty)
|
||||
LinkifySpan(
|
||||
text: end,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue