Skip to content

Commit

Permalink
Merge branch 'master' into pr/config_raw_param_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
robertlong13 authored Mar 5, 2024
2 parents 901351b + 065f88a commit eb302bb
Show file tree
Hide file tree
Showing 105 changed files with 17,526 additions and 9,765 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
!**.apk
!**.so
!**.aab
!**.dll
key: ${{ runner.os }}-buildAAB

- name: Build
Expand All @@ -46,6 +47,8 @@ jobs:
$manifest.Save($current.Path + "\ExtLibs\Xamarin\Xamarin.Android\Properties\AndroidManifest.xml")
choco install microsoft-openjdk --version=11.0.11.9
msbuild -v:m -restore -t:SignAndroidPackage -p:Configuration=Release "ExtLibs\Xamarin\Xamarin.Android\Xamarin.Android.csproj"
del ExtLibs\Xamarin\Xamarin.Android\bin\Release\com.michaeloborne.MissionPlanner-Signed.aab
Expand Down Expand Up @@ -100,6 +103,7 @@ jobs:
!**.apk
!**.so
!**.aab
!**.dll
key: ${{ runner.os }}-buildAPK
- name: Build
shell: pwsh
Expand All @@ -121,6 +125,8 @@ jobs:
Set-Content -Path ExtLibs\Xamarin\Xamarin.Android\Xamarin.Android.csproj -Value (Get-Content -Path ExtLibs\Xamarin\Xamarin.Android\Xamarin.Android.csproj -Raw).Replace("<AndroidPackageFormat>aab</AndroidPackageFormat>","<AndroidPackageFormat>apk</AndroidPackageFormat>")
Set-Content -Path ExtLibs\Xamarin\Xamarin.Android\Xamarin.Android.csproj -Value (Get-Content -Path ExtLibs\Xamarin\Xamarin.Android\Xamarin.Android.csproj -Raw).Replace("<AotAssemblies>true</AotAssemblies>","<AotAssemblies>false</AotAssemblies>")
choco install microsoft-openjdk --version=11.0.11.9
msbuild -v:m -restore -t:SignAndroidPackage -p:Configuration=Release "ExtLibs\Xamarin\Xamarin.Android\Xamarin.Android.csproj"
Expand All @@ -131,7 +137,7 @@ jobs:
ForEach($i in $apks) {
echo $i.FullName
Move-Item -path $i.FullName temp.apk
C:\Android\android-sdk\build-tools\29.0.3\zipalign.exe -p -f -v 4 temp.apk $i.FullName
C:\Android\android-sdk\build-tools\31.0.0\zipalign.exe -p -f -v 4 temp.apk $i.FullName
Remove-Item temp.apk
}
Expand All @@ -145,6 +151,8 @@ jobs:
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "31.0.0"

- uses: actions/upload-artifact@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static GMapMarker getMAVMarker(MAVState MAV, GMapOverlay overlay = null)
itemp.Cog = MAV.cs.groundcourse;
itemp.Target = MAV.cs.target_bearing;
itemp.Nav_bearing = MAV.cs.nav_bearing;
itemp.Radius = MAV.cs.radius * CurrentState.multiplierdist;
itemp.Radius = (float)CurrentState.fromDistDisplayUnit(MAV.cs.radius);
return null;
}
else if (item is GMapMarkerQuad)
Expand Down Expand Up @@ -76,7 +76,7 @@ public static GMapMarker getMAVMarker(MAVState MAV, GMapOverlay overlay = null)
{
return (new GMapMarkerPlane(MAV.sysid - 1, portlocation, MAV.cs.yaw,
MAV.cs.groundcourse, MAV.cs.nav_bearing, MAV.cs.target_bearing,
MAV.cs.radius * CurrentState.multiplierdist)
(float)CurrentState.toDistDisplayUnit(MAV.cs.radius))
{
ToolTipText = ArduPilot.Common.speechConversion(MAV, "" + Settings.Instance["mapicondesc"]),
ToolTipMode = String.IsNullOrEmpty(Settings.Instance["mapicondesc"]) ? MarkerTooltipMode.Never : MarkerTooltipMode.Always,
Expand Down
13 changes: 10 additions & 3 deletions ExtLibs/AltitudeAngelWings.Plugin/ControlOverlayMessageDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,22 @@ public void RemoveMessage(Message message)
if (!_parent.Visible) return;
_parent.SuspendLayout();
var labels = GetMessageLabels();
var removed = false;
foreach (var label in labels)
{
if (label.Tag != message) continue;
_parent.Controls.Remove(label);
labels.Remove(label);
label.Dispose();
removed = true;
break;
}
LayoutLabels(labels);
if (removed)
{
LayoutLabels(labels);
}
_parent.ResumeLayout();
});
}
Expand Down Expand Up @@ -110,7 +117,7 @@ private static Color GetColorForMessage(Message message)
}
}

private void LayoutLabels(ICollection<Label> labels)
private void LayoutLabels(IEnumerable<Label> labels)
{
var totalHeight = 0;
foreach (var label in labels)
Expand All @@ -122,4 +129,4 @@ private void LayoutLabels(ICollection<Label> labels)

private IList<Label> GetMessageLabels() => _parent.Controls.OfType<Label>().Where(l => l.Tag is Message).ToList();
}
}
}
2 changes: 1 addition & 1 deletion ExtLibs/AltitudeAngelWings/AltitudeAngelWings.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<PackageReference Include="Flurl.Http" Version="3.2.0" />
<PackageReference Include="GeoJSON.Net" Version="1.1.64" />
<PackageReference Include="Polly" Version="7.2.4" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.31.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.2.0" />
<PackageReference Include="System.Reactive" Version="4.0.0" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
Expand Down Expand Up @@ -43,7 +44,7 @@ public static string[] AccessTokenScopes(this TokenResponse tokenResponse)
scopes.AddRange(values.Select(item => item.ToString()));
break;
default:
scopes.Add(JsonExtensions.SerializeToJson(value));
scopes.Add(JsonConvert.SerializeObject(value));
break;
}

Expand Down
4 changes: 2 additions & 2 deletions ExtLibs/AltitudeAngelWings/ObservableProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace AltitudeAngelWings
{
public class ObservableProperty<T> : INotifyPropertyChanged, IObservable<T>, IDisposable
{
private readonly ISubject<T> _subject;
private readonly ReplaySubject<T> _subject;
private T _value;

public ObservableProperty()
Expand Down Expand Up @@ -68,7 +68,7 @@ protected virtual void Dispose(bool disposing)
{
if (disposing)
{
((IDisposable)_subject)?.Dispose();
_subject?.Dispose();
}
}

Expand Down
6 changes: 4 additions & 2 deletions ExtLibs/AltitudeAngelWings/Service/AltitudeAngelService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,17 @@ private void ProcessFeatures(IMap map)

case GeoJSONObjectType.MultiPolygon:
// TODO: This does not work for polygons with holes and just does the outer polygon
foreach (var poly in ((MultiPolygon)feature.Geometry).Coordinates)
for (var index = 0; index < ((MultiPolygon)feature.Geometry).Coordinates.Count; index++)
{
var poly = ((MultiPolygon)feature.Geometry).Coordinates[index];
var coordinates =
poly.Coordinates[0].Coordinates.OfType<Position>()
.Select(c => new LatLong(c.Latitude, c.Longitude))
.ToList();

var colorInfo = properties.ToColorInfo(_settings.MapOpacityAdjust);
overlayFeatures.Add(new OverlayFeature(feature.Id, OverlayFeatureType.Line, coordinates, colorInfo, feature));
overlayFeatures.Add(new OverlayFeature($"{feature.Id}-{index}", OverlayFeatureType.Line,
coordinates, colorInfo, feature));
}

break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ namespace AltitudeAngelWings.Service.Messaging
{
public interface IMessagesService
{
ObservableProperty<Message> Messages { get; }
Task AddMessageAsync(Message message);
}
}
41 changes: 15 additions & 26 deletions ExtLibs/AltitudeAngelWings/Service/Messaging/MessagesService.cs
Original file line number Diff line number Diff line change
@@ -1,43 +1,32 @@
using System;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Threading.Tasks;
using AltitudeAngelWings.Model;

namespace AltitudeAngelWings.Service.Messaging
{
public class MessagesService : IMessagesService, IDisposable
public class MessagesService : IMessagesService
{
private readonly CompositeDisposable _disposer = new CompositeDisposable();
private readonly IMessageDisplay _messageDisplay;

public MessagesService(IMessageDisplay messageDisplay)
{
Messages = new ObservableProperty<Message>(0);
_disposer.Add(Messages);
_disposer.Add(Messages
.Do(messageDisplay.AddMessage)
.SelectMany(m => Observable.Interval(TimeSpan.FromMilliseconds(100))
.SkipWhile(i => !m.HasExpired())
.Select(i => m))
.Subscribe(messageDisplay.RemoveMessage));
_messageDisplay = messageDisplay;
}

public ObservableProperty<Message> Messages { get; }

public Task AddMessageAsync(Message message) => Task.Factory.StartNew(() => Messages.Value = message);

public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}

protected virtual void Dispose(bool disposing)
public Task AddMessageAsync(Message message) => Task.Factory.StartNew(async () =>
{
if (disposing)
try
{
_disposer?.Dispose();
_messageDisplay.AddMessage(message);
do
{
await Task.Delay(TimeSpan.FromMilliseconds(200)).ConfigureAwait(false);
} while (!message.HasExpired());
}
}
finally
{
_messageDisplay.RemoveMessage(message);
}
});
}
}
Loading

0 comments on commit eb302bb

Please sign in to comment.