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

This commit is contained in:
Milan Burda 2023-10-02 10:55:32 +02:00 committed by GitHub
parent 5643e86956
commit d301616f60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 27 deletions

View file

@ -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 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. 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_ ### `app.runningUnderARM64Translation` _Readonly_ _macOS_ _Windows_
A `boolean` which when `true` indicates that the app is currently running under A `boolean` which when `true` indicates that the app is currently running under

View file

@ -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. 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) ## Planned Breaking API Changes (27.0)
### Removed: macOS 10.13 / 10.14 support ### Removed: macOS 10.13 / 10.14 support

View file

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

View file

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

View file

@ -60,17 +60,6 @@ void App::SetActivationPolicy(gin_helper::ErrorThrower thrower,
[NSApp setActivationPolicy:activation_policy]; [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 { bool App::IsRunningUnderARM64Translation() const {
int proc_translated = 0; int proc_translated = 0;
size_t size = sizeof(proc_translated); size_t size = sizeof(proc_translated);

View file

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