Skip to content

Commit a4c2778

Browse files
authored
Fix keyboard avoidance on touchscreens for Ask AI tab (#7670)
* Fix keyboard avoidance on touchscreens for Ask AI tab * Add placementId for in-app analytics Don't show in changelog
1 parent f26e56c commit a4c2778

File tree

27 files changed

+117
-12
lines changed

27 files changed

+117
-12
lines changed

newIDE/app/src/AiGeneration/AiRequestChat/AiRequestChat.module.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,21 @@
3030
justify-content: center;
3131

3232
animation: new-chat-appear 0.5s;
33+
34+
margin-bottom: var(--safe-area-inset-bottom);
35+
}
36+
37+
.aiRequestChatContainer {
38+
display: flex;
39+
margin-left: 8px;
40+
margin-right: 8px;
41+
flex-direction: column;
42+
align-items: stretch;
43+
justify-content: stretch;
44+
flex: 1 1 0%;
45+
min-height: 0px;
46+
47+
margin-bottom: var(--safe-area-inset-bottom);
3348
}
3449

3550
.thinkingText {

newIDE/app/src/AiGeneration/AiRequestChat/index.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import Hammer from '../../UI/CustomSvgIcons/Hammer';
3737
import { ChatMessages } from './ChatMessages';
3838
import Send from '../../UI/CustomSvgIcons/Send';
3939
import { FeedbackBanner } from './FeedbackBanner';
40+
import classNames from 'classnames';
4041

4142
const TOO_MANY_USER_MESSAGES_WARNING_COUNT = 5;
4243
const TOO_MANY_USER_MESSAGES_ERROR_COUNT = 10;
@@ -330,6 +331,7 @@ export const AiRequestChat = React.forwardRef<Props, AiRequestChatInterface>(
330331
const subscriptionBanner =
331332
quota && quota.limitReached && increaseQuotaOffering !== 'none' ? (
332333
<GetSubscriptionCard
334+
placementId="ai-requests"
333335
subscriptionDialogOpeningReason={
334336
increaseQuotaOffering === 'subscribe'
335337
? 'AI requests (subscribe)'
@@ -386,7 +388,13 @@ export const AiRequestChat = React.forwardRef<Props, AiRequestChatInterface>(
386388

387389
if (!aiRequest) {
388390
return (
389-
<div className={classes.newChatContainer}>
391+
<div
392+
className={classNames({
393+
[classes.newChatContainer]: true,
394+
// Move the entire screen up when the soft keyboard is open:
395+
'avoid-soft-keyboard': true,
396+
})}
397+
>
390398
<ColumnStackLayout justifyContent="center" expand>
391399
<Line noMargin justifyContent="center">
392400
<RobotIcon rotating size={40} />
@@ -620,11 +628,10 @@ export const AiRequestChat = React.forwardRef<Props, AiRequestChatInterface>(
620628
) : null;
621629

622630
return (
623-
<Column
624-
expand
625-
alignItems="stretch"
626-
justifyContent="stretch"
627-
useFullHeight
631+
<div
632+
className={classNames({
633+
[classes.aiRequestChatContainer]: true,
634+
})}
628635
>
629636
<ScrollView ref={scrollViewRef} style={styles.chatScrollView}>
630637
<ChatMessages
@@ -663,6 +670,10 @@ export const AiRequestChat = React.forwardRef<Props, AiRequestChatInterface>(
663670
userMessage: userRequestTextPerAiRequestId[aiRequestId] || '',
664671
});
665672
}}
673+
className={classNames({
674+
// Move the form up when the soft keyboard is open:
675+
'avoid-soft-keyboard': true,
676+
})}
666677
>
667678
<ColumnStackLayout
668679
justifyContent="stretch"
@@ -798,7 +809,7 @@ export const AiRequestChat = React.forwardRef<Props, AiRequestChatInterface>(
798809
</Column>
799810
</ColumnStackLayout>
800811
</form>
801-
</Column>
812+
</div>
802813
);
803814
}
804815
);

newIDE/app/src/AssetStore/PrivateAssets/PrivateAssetPackInformationPage.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ const PrivateAssetPackInformationPage = ({
656656
analyticsMetadata: {
657657
reason: 'Claim asset pack',
658658
recommendedPlanId: 'gdevelop_gold',
659+
placementId: 'claim-asset-pack',
659660
},
660661
filter: 'individual',
661662
})

newIDE/app/src/Course/LockedCourseChapterPreview.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ const LockedCourseChapterPreview = React.forwardRef<Props, HTMLDivElement>(
174174
analyticsMetadata: {
175175
reason: 'Unlock course chapter',
176176
recommendedPlanId: 'gdevelop_silver',
177+
placementId: 'unlock-course-chapter',
177178
},
178179
})
179180
}

newIDE/app/src/ExportAndShare/LocalExporters/LocalPreviewLauncher/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ export default class LocalPreviewLauncher extends React.Component<
371371
}
372372
id="Preview over wifi"
373373
title={<Trans>Preview over wifi</Trans>}
374+
placementId="preview-wifi"
374375
mode="try"
375376
isNotShownDuringInAppTutorial
376377
/>
@@ -382,6 +383,7 @@ export default class LocalPreviewLauncher extends React.Component<
382383
title={
383384
<Trans>Live preview (apply changes to the running preview)</Trans>
384385
}
386+
placementId="hot-reloading"
385387
mode="try"
386388
isNotShownDuringInAppTutorial
387389
/>

newIDE/app/src/ExportAndShare/ShareDialog/InviteHome.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ const InviteHome = ({ cloudProjectId }: Props) => {
326326
<GetSubscriptionCard
327327
subscriptionDialogOpeningReason="Add collaborators on project"
328328
recommendedPlanIdIfNoSubscription="gdevelop_startup"
329+
placementId="invite-collaborators"
329330
>
330331
<Text>
331332
<Trans>

newIDE/app/src/GameDashboard/LeaderboardAdmin/LeaderboardAppearanceDialog.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ function LeaderboardAppearanceDialog({
350350
<GetSubscriptionCard
351351
subscriptionDialogOpeningReason="Leaderboard customization"
352352
recommendedPlanIdIfNoSubscription="gdevelop_silver"
353+
placementId="leaderboards-customization"
353354
>
354355
<Line>
355356
<Column noMargin>
@@ -406,6 +407,7 @@ function LeaderboardAppearanceDialog({
406407
<GetSubscriptionCard
407408
subscriptionDialogOpeningReason="Leaderboard customization"
408409
recommendedPlanIdIfNoSubscription="gdevelop_startup"
410+
placementId="leaderboards-customization"
409411
>
410412
<Line>
411413
<Column noMargin>

newIDE/app/src/GameDashboard/LeaderboardAdmin/LeaderboardOptionsDialog.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ function LeaderboardOptionsDialog({
256256
<GetSubscriptionCard
257257
subscriptionDialogOpeningReason="Leaderboard customization"
258258
recommendedPlanIdIfNoSubscription="gdevelop_startup"
259+
placementId="leaderboards-customization"
259260
>
260261
<Line>
261262
<Column noMargin>

newIDE/app/src/GameDashboard/LeaderboardAdmin/MaxLeaderboardCountAlertMessage.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const MaxLeaderboardCountAlertMessage = () => {
4747
<Column expand>
4848
<GetSubscriptionCard
4949
subscriptionDialogOpeningReason="Leaderboard count per game limit reached"
50+
placementId="leaderboards"
5051
label={
5152
!hasValidSubscription ? (
5253
<Trans>Upgrade to GDevelop Premium</Trans>

newIDE/app/src/GameDashboard/Widgets/ServicesWidget.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ const ServicesWidget = ({
9898
analyticsMetadata: {
9999
reason: 'Leaderboard count per game limit reached',
100100
recommendedPlanId: 'gdevelop_silver',
101+
placementId: 'leaderboards',
101102
},
102103
})
103104
}

0 commit comments

Comments
 (0)