Add a warning shown when exporting a game with a default package name (#2306)

This commit is contained in:
Arthur Pacaud
2021-02-16 22:45:26 +01:00
committed by GitHub
parent 1e56ba511a
commit 925de35b10
11 changed files with 40 additions and 1 deletions

View File

@@ -52,6 +52,7 @@ export const browserCordovaExportPipeline: ExportPipeline<
CompressionOutput
> = {
name: 'browser-cordova',
packageNameWarningType: 'mobile',
getInitialExportState: () => null,

View File

@@ -52,6 +52,7 @@ export const browserElectronExportPipeline: ExportPipeline<
CompressionOutput
> = {
name: 'browser-electron',
packageNameWarningType: 'desktop',
getInitialExportState: () => null,

View File

@@ -54,6 +54,7 @@ export const browserOnlineCordovaExportPipeline: ExportPipeline<
> = {
name: 'browser-online-cordova',
onlineBuildType: 'cordova-build',
packageNameWarningType: 'mobile',
getInitialExportState: () => null,

View File

@@ -55,6 +55,7 @@ export const browserOnlineElectronExportPipeline: ExportPipeline<
> = {
name: 'browser-online-electron',
onlineBuildType: 'electron-build',
packageNameWarningType: 'desktop',
getInitialExportState: () => ({
targets: ['winExe'],

View File

@@ -1,6 +1,8 @@
// @flow
import React, { Component } from 'react';
import { I18n } from '@lingui/react';
import { t } from '@lingui/macro';
import RaisedButton from '../UI/RaisedButton';
import { sendExportLaunched } from '../Utils/Analytics/EventSender';
import {
@@ -25,6 +27,7 @@ import BuildStepsProgress, {
} from './Builds/BuildStepsProgress';
import { type ExportPipeline } from './ExportPipeline.flow';
import { GameRegistration } from '../GameDashboard/GameRegistration';
import DismissableAlertMessage from '../UI/DismissableAlertMessage';
type State = {|
exportStep: BuildStep,
@@ -245,6 +248,25 @@ export default class ExportLauncher extends Component<Props, State> {
return (
<Column noMargin>
{!!exportPipeline.packageNameWarningType &&
project.getPackageName().indexOf('com.example') !== -1 && (
<Line>
<DismissableAlertMessage
identifier="project-should-have-unique-package-name"
kind="warning"
>
<I18n>
{({ i18n }) =>
i18n._(
exportPipeline.packageNameWarningType === 'mobile'
? t`The package name begins with com.example, make sure you replace it with an unique one to be able to publish your game on app stores.`
: t`The package name begins with com.example, make sure you replace it with an unique one, else installing your game might overwrite other games.`
)
}
</I18n>
</DismissableAlertMessage>
</Line>
)}
<Line>
{exportPipeline.renderHeader({
project,

View File

@@ -1,5 +1,6 @@
// @flow
import * as React from 'react';
import { type MessageDescriptor } from '../Utils/i18n/MessageDescriptor.flow.js';
import { type Build } from '../Utils/GDevelopServices/Build';
import { type UserProfile } from '../Profile/UserProfileContext';
@@ -21,6 +22,7 @@ export type ExportPipeline<
> = {|
name: string,
onlineBuildType?: string,
packageNameWarningType?: 'mobile' | 'desktop',
getInitialExportState: (project: gdProject) => ExportState,

View File

@@ -44,6 +44,7 @@ export const localCordovaExportPipeline: ExportPipeline<
CompressionOutput
> = {
name: 'local-cordova',
packageNameWarningType: 'mobile',
getInitialExportState: (project: gdProject) => ({
outputDir: project.getLastCompilationDirectory(),

View File

@@ -44,6 +44,7 @@ export const localElectronExportPipeline: ExportPipeline<
CompressionOutput
> = {
name: 'local-electron',
packageNameWarningType: 'desktop',
getInitialExportState: (project: gdProject) => ({
outputDir: project.getLastCompilationDirectory(),

View File

@@ -48,6 +48,7 @@ export const localOnlineCordovaExportPipeline: ExportPipeline<
> = {
name: 'local-online-cordova',
onlineBuildType: 'cordova-build',
packageNameWarningType: 'mobile',
getInitialExportState: () => null,

View File

@@ -49,6 +49,7 @@ export const localOnlineElectronExportPipeline: ExportPipeline<
> = {
name: 'local-online-electron',
onlineBuildType: 'electron-build',
packageNameWarningType: 'desktop',
getInitialExportState: () => ({
targets: ['winExe'],

View File

@@ -35,7 +35,8 @@ export type AlertMessageIdentifier =
| 'p2p-broker-recommendation'
| 'command-palette-shortcut'
| 'asset-installed-explanation'
| 'extension-installed-explanation';
| 'extension-installed-explanation'
| 'project-should-have-unique-package-name';
export type EditorMosaicName =
| 'scene-editor'
@@ -146,6 +147,12 @@ export const allAlertMessages: Array<{
<Trans>Explanation after an object is installed from the store</Trans>
),
},
{
key: 'project-should-have-unique-package-name',
label: (
<Trans>Project package names should not begin with com.example</Trans>
),
},
];
/**