From 03022742d88ed789b436a4d9c84d6a354bf5254d Mon Sep 17 00:00:00 2001 From: Andrei Smirnov Date: Mon, 6 Sep 2021 11:58:54 +0300 Subject: [PATCH] =?UTF-8?q?=EF=BB=BFfeat(@desktop/Windows):=20status-im://?= =?UTF-8?q?=20protocol=20support=20and=20installer=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nim_status_client.nim | 2 +- src/nim_windows_launcher.nim | 9 +++++++-- status.iss | 12 +++++++----- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/nim_status_client.nim b/src/nim_status_client.nim index dfdbda8f7..5dc961a27 100644 --- a/src/nim_status_client.nim +++ b/src/nim_status_client.nim @@ -135,7 +135,7 @@ proc mainProc() = defer: wallet2.delete() engine.setRootContextProperty("walletV2Model", wallet2.variant) - var chat = chat.newController(status, appService) + var chat = chat.newController(status, appService, OPENURI) defer: chat.delete() engine.setRootContextProperty("chatsModel", chat.variant) diff --git a/src/nim_windows_launcher.nim b/src/nim_windows_launcher.nim index 1930923ff..a5ca697fd 100644 --- a/src/nim_windows_launcher.nim +++ b/src/nim_windows_launcher.nim @@ -1,12 +1,17 @@ -from os import getAppDir, joinPath +from os import getAppDir, joinPath, commandLineParams from winlean import Handle, shellExecuteW +proc restoreParamsString(strings: seq[string]): string = + result = "" + for str in strings: + result = result & " " & str + const NULL: Handle = 0 let launcherDir = getAppDir() let workDir_str = joinPath(launcherDir, "bin") let exePath_str = joinPath(workDir_str, "Status.exe") let open_str = "open" -let params_str = "" +let params_str = restoreParamsString(commandLineParams()) let workDir = newWideCString(workDir_str) let exePath = newWideCString(exePath_str) let open = newWideCString(open_str) diff --git a/status.iss b/status.iss index 59cb730fb..ab5929e2c 100644 --- a/status.iss +++ b/status.iss @@ -17,11 +17,12 @@ AppSupportURL={#URL} AppUpdatesURL={#URL} DefaultDirName={localappdata}\{#Name}App UsePreviousAppDir=no -PrivilegesRequired=lowest +PrivilegesRequired=admin WizardStyle=modern UninstallDisplayIcon={app}\{#ExeName} DefaultGroupName={#Name} CloseApplications=yes +ArchitecturesInstallIn64BitMode=x64 ; output dir for installer OutputBaseFileName={#BaseName} @@ -64,6 +65,7 @@ Name: "{group}\Uninstall {#Name}"; Filename: "{uninstallexe}" Name: "{userdesktop}\{#Name}"; Filename: "{app}\{#ExeName}"; IconFilename: "{app}\resources\{#IcoName}"; Tasks: desktopicon [Run] +Filename: "{app}\vendor\vc_redist.x64.exe"; Parameters: "/install /quiet /norestart"; StatusMsg: "Installing VS2017 redistributable package (64 Bit)"; Filename: "{app}\{#ExeName}"; Description: {cm:LaunchProgram,{#Name}}; Flags: nowait postinstall skipifsilent [UninstallDelete] @@ -72,10 +74,10 @@ Type: files; Name: "{userdesktop}\{#Name}" Type: files; Name: "{commondesktop}\{#Name}" [Registry] -Root: HKCU; Subkey: "Software\Classes\status-im"; ValueType: "string"; ValueData: "URL:status-im protocol"; Flags: uninsdeletekey -Root: HKCU; Subkey: "Software\Classes\status-im"; ValueType: "string"; ValueName: "URL Protocol"; ValueData: "" -Root: HKCU; Subkey: "Software\Classes\status-im\DefaultIcon"; ValueType: "string"; ValueData: "{app}\Status.exe,1" -Root: HKCU; Subkey: "Software\Classes\status-im\shell\open\command"; ValueType: "string"; ValueData: """{app}\Status.exe"" ""--url=""%1""" +Root: HKCR; Subkey: "status-im"; ValueType: "string"; ValueData: "URL:status-im Protocol"; Flags: uninsdeletekey +Root: HKCR; Subkey: "status-im"; ValueType: "string"; ValueName: "URL Protocol"; ValueData: "" +Root: HKCR; Subkey: "status-im\DefaultIcon"; ValueType: "string"; ValueData: "{app}\Status.exe,1" +Root: HKCR; Subkey: "status-im\shell\open\command"; ValueType: "string"; ValueData: """{app}\bin\Status.exe"" ""--uri=%1""" [Code] function IsAppRunning(const FileName : string): Boolean;