Skip to content

Commit

Permalink
Show that a real iOS device is offline (ie. locked & or not trust cur…
Browse files Browse the repository at this point in the history
…rent computer).

And when building show error message to relaunch a build after unlock or trust
  • Loading branch information
e-marchand committed Sep 16, 2024
1 parent 303c9cc commit dbb9fab
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 2 deletions.
18 changes: 17 additions & 1 deletion Project/Sources/Classes/simctl.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,30 @@ Function plugged($iosDeploymentTarget : Text)->$plugged : Collection

$start:=1

var $offline : Boolean

While (Match regex:C1019("(?m-si)^([^(]*)\\s\\(([^)]*)\\)\\s\\(([[:xdigit:]]{8}-[[:xdigit:]]{16})\\)$"; This:C1470.outputStream; $start; $pos; $len))

If ($str.setText(Substring:C12(This:C1470.outputStream; $pos{2}; $len{2})).versionCompare($minVers)>=0)

var $name : Text
$name:=Substring:C12(This:C1470.outputStream; $pos{1}; $len{1})
If (Position:C15("== Devices Offline =="; $name)>0)

$offline:=True:C214 // now device are offline
$name:=Replace string:C233(Replace string:C233($name; "== Devices Offline =="; ""); "\n"; "")

End if

If ($offline)
$name:="🔒"+$name
End if

$plugged.push(New object:C1471(\
"name"; Substring:C12(This:C1470.outputStream; $pos{1}; $len{1}); \
"name"; $name; \
"version"; Substring:C12(This:C1470.outputStream; $pos{2}; $len{2}); \
"udid"; Substring:C12(This:C1470.outputStream; $pos{3}; $len{3}); \
"offline"; $offline; \
"type"; "device"))

End if
Expand Down
37 changes: 36 additions & 1 deletion Project/Sources/Methods/project_BUILD.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,12 @@ If (Asserted:C1132($project#Null:C1517))

Case of

: (Bool:C1537($data.getDevices))

UI.getDevices() // async (could not work immeditely, maybe see how to relaunch after it a build or just update current project with result)

$data.getDevices:=False:C215

//______________________________________________________
: (Bool:C1537($data.manualInstallation))

Expand All @@ -402,7 +408,9 @@ If (Asserted:C1132($project#Null:C1517))
If ($success)

// Verify that at least one device is plugged
$success:=($cfgutil.plugged(True:C214).length>0)
var $pluggeds : Collection
$pluggeds:=$cfgutil.plugged(True:C214)
$success:=($pluggeds.length>0)

If (Not:C34($success))

Expand All @@ -423,6 +431,33 @@ If (Asserted:C1132($project#Null:C1517))

End if

// check not unlocked
// $pluggeds:=$pluggeds.filter(Formula(Not(Bool($1.value.offline)))) // NOT WORKING for cfgutil, not returned offline param
If (($pluggeds.length=1) && (Bool:C1537($project._device.offline)))
$success:=False:C215
End if

If (Not:C34($success))

$data:=cs:C1710.project.new($data).cleaned()
var $getDevices : Object
$getDevices:=OB Copy:C1225($data)
$getDevices.getDevices:=True:C214
$manual:=OB Copy:C1225($data)

UI.postMessage(New object:C1471(\
"action"; "show"; \
"type"; "confirm"; \
"title"; "noDeviceFound"; \
"additional"; "makeSureThatADeviceIslocked"; \
"ok"; "continue"; \
"okFormula"; Formula:C1597(UI.callMe(Formula:C1597(BUILD).source; $getDevices)); \
"cancel"; "manualInstallation"; \
"cancelFormula"; Formula:C1597(UI.callMe(Formula:C1597(BUILD).source; $manual))\
))

End if

Else

$data:=cs:C1710.project.new($data).cleaned()
Expand Down
4 changes: 4 additions & 0 deletions Resources/en.lproj/Main.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ This may take a few minutes…</target>
<source> Make sure that the device is connected to your computer using a USB cable.</source>
<target> Make sure that the device is connected to your computer using a USB cable.</target>
</trans-unit>
<trans-unit id="JY87r1n69syQSp5dYmXcBe" resname="makeSureThatADeviceIslocked">
<source> Make sure that the connected device is unlocked and trust this computer.</source>
<target> Make sure that the connected device is unlocked and trust this computer.</target>
</trans-unit>
<trans-unit id="0P8BRDlzntJyfCqvVZMM+w" resname="theApplicationHasBeenSuccessfullyInstalled">
<source>The "{app}" application has been successfully installed on the "{device}" device.</source>
<target>The "{app}" application has been successfully installed on the "{device}" device.</target>
Expand Down
4 changes: 4 additions & 0 deletions Resources/fr.lproj/Main.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ Cela peut prendre plusieurs minutes…</target>
<source> Make sure that the device is connected to your computer using a USB cable.</source>
<target>Assurez-vous que l'appareil est connecté à votre ordinateur via un câble USB.</target>
</trans-unit>
<trans-unit id="JY87r1n69syQSp5dYmXcBe" resname="makeSureThatADeviceIslocked">
<source> Make sure that the connected device is unlocked and trust this computer.</source>
<target>Assurez-vous que l'appareil connecté est déverouillé et fait confiance à cet ordinateur.</target>
</trans-unit>
<trans-unit id="0P8BRDlzntJyfCqvVZMM+w" resname="theApplicationHasBeenSuccessfullyInstalled">
<source>The "{app}" application has been successfully installed on the "{device}" device.</source>
<target>L'application "{app}" a été installée avec succès sur l'appareil "{device}".</target>
Expand Down

0 comments on commit dbb9fab

Please sign in to comment.