chore: remove deprecated `app.runningUnderRosettaTranslation()` (#39956)

This commit is contained in:
Milan Burda 2023-10-02 10:55:32 +02:00 коммит произвёл GitHub
Родитель 5643e86956
Коммит d301616f60
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 15 добавлений и 27 удалений

Просмотреть файл

@ -1571,19 +1571,6 @@ This is the user agent that will be used when no user agent is set at the
app has the same user agent. Set to a custom value as early as possible
in your app's initialization to ensure that your overridden value is used.
### `app.runningUnderRosettaTranslation` _macOS_ _Readonly_ _Deprecated_
A `boolean` which when `true` indicates that the app is currently running
under the [Rosetta Translator Environment](https://en.wikipedia.org/wiki/Rosetta_(software)).
You can use this property to prompt users to download the arm64 version of
your application when they are running the x64 version under Rosetta
incorrectly.
**Deprecated:** This property is superceded by the `runningUnderARM64Translation`
property which detects when the app is being translated to ARM64 in both macOS
and Windows.
### `app.runningUnderARM64Translation` _Readonly_ _macOS_ _Windows_
A `boolean` which when `true` indicates that the app is currently running under

Просмотреть файл

@ -63,6 +63,18 @@ The `ipcRenderer.sendTo()` API has been removed. It should be replaced by settin
The `senderId` and `senderIsMainFrame` properties of `IpcRendererEvent` have been removed as well.
### Removed: `app.runningUnderRosettaTranslation`
The `app.runningUnderRosettaTranslation` property has been removed.
Use `app.runningUnderARM64Translation` instead.
```js
// Removed
console.log(app.runningUnderRosettaTranslation)
// Replace with
console.log(app.runningUnderARM64Translation)
```
## Planned Breaking API Changes (27.0)
### Removed: macOS 10.13 / 10.14 support

Просмотреть файл

@ -1767,8 +1767,6 @@ gin::ObjectTemplateBuilder App::GetObjectTemplateBuilder(v8::Isolate* isolate) {
#endif
#if BUILDFLAG(IS_MAC)
.SetProperty("dock", &App::GetDockAPI)
.SetProperty("runningUnderRosettaTranslation",
&App::IsRunningUnderRosettaTranslation)
#endif
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
.SetProperty("runningUnderARM64Translation",

Просмотреть файл

@ -229,7 +229,6 @@ class App : public ElectronBrowserClient::Delegate,
bool MoveToApplicationsFolder(gin_helper::ErrorThrower, gin::Arguments* args);
bool IsInApplicationsFolder();
v8::Local<v8::Value> GetDockAPI(v8::Isolate* isolate);
bool IsRunningUnderRosettaTranslation() const;
v8::Global<v8::Value> dock_;
#endif

Просмотреть файл

@ -60,17 +60,6 @@ void App::SetActivationPolicy(gin_helper::ErrorThrower thrower,
[NSApp setActivationPolicy:activation_policy];
}
bool App::IsRunningUnderRosettaTranslation() const {
node::Environment* env =
node::Environment::GetCurrent(JavascriptEnvironment::GetIsolate());
EmitWarning(env,
"The app.runningUnderRosettaTranslation API is deprecated, use "
"app.runningUnderARM64Translation instead.",
"electron");
return IsRunningUnderARM64Translation();
}
bool App::IsRunningUnderARM64Translation() const {
int proc_translated = 0;
size_t size = sizeof(proc_translated);

Просмотреть файл

@ -427,6 +427,9 @@ win2.once('ready-to-show', () => {
app.relaunch({ args: process.argv.slice(1).concat(['--relaunch']) });
app.exit(0);
// @ts-expect-error Removed API
console.log(app.runningUnderRosettaTranslation);
// auto-updater
// https://github.com/electron/electron/blob/main/docs/api/auto-updater.md