Skip to content
This repository was archived by the owner on Mar 26, 2024. It is now read-only.

Commit a67c315

Browse files
authored
Remove access to External Storage, Update Packages (#54)
Signed-off-by: x0axz <x0axz@protonmail.com>
1 parent 44d950c commit a67c315

File tree

12 files changed

+50
-36
lines changed

12 files changed

+50
-36
lines changed

src/Hyperledger.Aries.Max.Android/Hyperledger.Aries.Max.Android.csproj

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
1616
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
1717
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
18-
<TargetFrameworkVersion>v9.0</TargetFrameworkVersion>
18+
<TargetFrameworkVersion>v11.0</TargetFrameworkVersion>
1919
<NuGetPackageImportStamp>
2020
</NuGetPackageImportStamp>
2121
</PropertyGroup>
@@ -30,6 +30,10 @@
3030
<AndroidLinkMode>None</AndroidLinkMode>
3131
<AndroidSupportedAbis>armeabi-v7a;x86</AndroidSupportedAbis>
3232
<MandroidI18n />
33+
<AotAssemblies>false</AotAssemblies>
34+
<EnableLLVM>false</EnableLLVM>
35+
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
36+
<BundleAssemblies>false</BundleAssemblies>
3337
</PropertyGroup>
3438
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
3539
<DebugSymbols>false</DebugSymbols>
@@ -106,23 +110,31 @@
106110
<PackageReference Include="UXDivers.GorillaPlayer.SDK">
107111
<Version>1.5.5</Version>
108112
</PackageReference>
113+
<PackageReference Include="Xamarin.AndroidX.AppCompat">
114+
<Version>1.1.0.2</Version>
115+
</PackageReference>
116+
<PackageReference Include="Xamarin.AndroidX.MediaRouter">
117+
<Version>1.2.0</Version>
118+
</PackageReference>
109119
<PackageReference Include="Xamarin.FFImageLoading.Forms">
110120
<Version>2.4.11.982</Version>
111121
</PackageReference>
112-
<PackageReference Include="Xamarin.Forms" Version="4.5.0.617" />
122+
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2083" />
113123
<PackageReference Include="Xamarin.Android.Support.Design" Version="28.0.0.3" />
114124
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="28.0.0.3" />
115125
<PackageReference Include="Xamarin.Android.Support.v4" Version="28.0.0.3" />
116126
<PackageReference Include="Xamarin.Android.Support.v7.CardView" Version="28.0.0.3" />
117127
<PackageReference Include="Xamarin.Android.Support.v7.MediaRouter" Version="28.0.0.3" />
128+
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.1.0.5-rc3" />
129+
<PackageReference Include="Xamarin.AndroidX.Palette" Version="1.0.0.5" />
118130
<PackageReference Include="ZXing.Net.Mobile.Forms">
119131
<Version>2.4.1</Version>
120132
</PackageReference>
121133
<PackageReference Include="Xamarin.FFImageLoading.Transformations">
122134
<Version>2.4.11.982</Version>
123135
</PackageReference>
124136
<PackageReference Include="Xamarin.Essentials">
125-
<Version>1.5.2</Version>
137+
<Version>1.7.0</Version>
126138
</PackageReference>
127139
<PackageReference Include="Rg.Plugins.Popup">
128140
<Version>2.0.0.2</Version>
@@ -192,4 +204,4 @@
192204
<UserProperties TriggeredFromHotReload="False" />
193205
</VisualStudio>
194206
</ProjectExtensions>
195-
</Project>
207+
</Project>

src/Hyperledger.Aries.Max.Android/MainActivity.cs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
using System;
2-
using System.Collections.Generic;
1+
using System.Collections.Generic;
32
using System.Linq;
43
using Android;
54
using Android.App;
65
using Android.Content.PM;
76
using Android.OS;
7+
using Android.Systems;
88
using FFImageLoading.Forms.Platform;
99
using Java.Lang;
1010
using Microsoft.Extensions.DependencyInjection;
1111
using Microsoft.Extensions.Hosting;
12-
using Hyperledger.Aries.Max.Android;
1312
using Xamarin.Forms;
1413
using Resource = Hyperledger.Aries.Max.Android.Resource;
14+
using Xamarin.Essentials;
15+
using Xamarin.Forms.Xaml;
1516

1617
namespace Hyperledger.Aries.Max.Droid
1718
{
18-
[Activity(Label = "AriesMax", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
19+
[Activity(Label = "AriesMax", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, Exported = true)]
20+
[XamlCompilation(XamlCompilationOptions.Compile)]
1921
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
2022
{
2123
protected override void OnCreate(Bundle bundle)
@@ -40,9 +42,11 @@ protected override void OnCreate(Bundle bundle)
4042

4143
// Initializing User Dialogs
4244
// Android requires that we set content root.
43-
var host = Hyperledger.Aries.Max.App.BuildHost(typeof(PlatformModule).Assembly)
44-
.UseContentRoot(System.Environment.GetFolderPath(
45-
System.Environment.SpecialFolder.Personal)).Build();
45+
var host = App.BuildHost(typeof(PlatformModule).Assembly)
46+
.UseContentRoot(System.Environment.GetFolderPath(
47+
System.Environment.SpecialFolder.Personal)).Build();
48+
49+
Os.Setenv("EXTERNAL_STORAGE", FileSystem.AppDataDirectory, true);
4650

4751
//Loading dependent libindy
4852
JavaSystem.LoadLibrary("c++_shared");
@@ -55,8 +59,6 @@ protected override void OnCreate(Bundle bundle)
5559

5660
readonly string[] _permissionsRequired =
5761
{
58-
Manifest.Permission.ReadExternalStorage,
59-
Manifest.Permission.WriteExternalStorage,
6062
Manifest.Permission.Camera
6163
};
6264

@@ -85,9 +87,9 @@ public override void OnRequestPermissionsResult(int requestCode, string[] permis
8587
System.Diagnostics.Debug.WriteLine("All permissions required that werent granted, have now been granted");
8688
else
8789
System.Diagnostics.Debug.WriteLine("Some permissions requested were denied by the user");
88-
89-
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
90-
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
90+
91+
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
92+
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
9193
}
9294
}
9395
}
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="0.1.0" package="com.ariesmax" android:installLocation="internalOnly">
3-
<uses-sdk android:minSdkVersion="25" android:targetSdkVersion="29" />
4-
<application android:requestLegacyExternalStorage="true" android:label="AriesMax"></application>
5-
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
6-
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
7-
<uses-permission android:name="android.permission.CAMERA" />
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:versionCode="1" android:versionName="0.1.0" package="com.ariesmax" android:installLocation="internalOnly">
3+
<uses-sdk android:minSdkVersion="25" android:targetSdkVersion="30" />
4+
<application android:label="AriesMax" android:allowBackup="false" android:fullBackupOnly="false"></application>
5+
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" tools:node="remove" />
6+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:node="remove" />
7+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="remove" />
8+
<uses-permission android:name="android.permission.CAMERA" />
89
</manifest>

src/Hyperledger.Aries.Max.Android/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Reflection;
2-
using System.Runtime.CompilerServices;
32
using System.Runtime.InteropServices;
43
using Android.App;
54

@@ -31,4 +30,3 @@
3130

3231
// Add some common permissions, these can be removed if not needed
3332
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
34-
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]

src/Hyperledger.Aries.Max.iOS/Hyperledger.Aries.Max.iOS.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@
372372
<PackageReference Include="Xamarin.FFImageLoading.Forms">
373373
<Version>2.4.11.982</Version>
374374
</PackageReference>
375-
<PackageReference Include="Xamarin.Forms" Version="4.5.0.617" />
375+
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2083" />
376376
<PackageReference Include="ZXing.Net.Mobile.Forms">
377377
<Version>2.4.1</Version>
378378
</PackageReference>

src/Hyperledger.Aries.Max/Hyperledger.Aries.Max.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
<PackageReference Include="ReactiveUI" Version="11.3.1" />
2828
<PackageReference Include="Rg.Plugins.Popup" Version="2.0.0.2" />
2929
<PackageReference Include="Xamarin.FFImageLoading.Forms" Version="2.4.11.982" />
30-
<PackageReference Include="Xamarin.Forms" Version="4.5.0.617" />
30+
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2083" />
3131
<PackageReference Include="ZXing.Net.Mobile" Version="2.4.1" />
3232
<PackageReference Include="ZXing.Net.Mobile.Forms" Version="2.4.1" />
3333
<PackageReference Include="West.Extensions.XamarinHosting" Version="3.0.0-preview1" />
3434
<PackageReference Include="Xamarin.FFImageLoading.Transformations" Version="2.4.11.982" />
35-
<PackageReference Include="Xamarin.Essentials" Version="1.5.2" />
35+
<PackageReference Include="Xamarin.Essentials" Version="1.7.0" />
3636
<PackageReference Include="Hyperledger.Aries.Routing.Edge" Version="1.6.2" />
3737
</ItemGroup>
3838

src/Hyperledger.Aries.Max/Services/PoolConfigurator.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ public async Task ConfigurePoolsAsync()
3939
try
4040
{
4141
// Path for bundled genesis txn
42-
var filename = Path.Combine(FileSystem.CacheDirectory, "genesis.txn");
42+
var filesDir = FileSystem.AppDataDirectory;
43+
var filename = Path.Combine(filesDir, config.Value);
4344

4445
// Dump file contents to cached filename
4546
using (var stream = await FileSystem.OpenAppPackageFileAsync(config.Value))

src/Hyperledger.Aries.Max/ViewModels/Connections/ConnectionsViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public async Task RefreshConnections()
6161
var records = await _connectionService.ListAsync(context);
6262

6363
IList<ConnectionViewModel> connectionVms = new List<ConnectionViewModel>();
64-
foreach (var record in records)
64+
foreach (var record in records.OrderByDescending(c => c.CreatedAtUtc))
6565
{
6666
var connection = _scope.Resolve<ConnectionViewModel>(new NamedParameter("record", record));
6767
connectionVms.Add(connection);

src/Hyperledger.Aries.Max/ViewModels/CreateInvitation/CreateInvitationViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ private async Task CreateInvitation()
4747
TheirAlias = new ConnectionAlias { Name = "Invitation" },
4848
AutoAcceptConnection = true
4949
});
50-
invitation.label = "AriesMax"
50+
invitation.Label = "AriesMax";
5151
string barcodeValue = invitation.ServiceEndpoint + "?c_i=" + Uri.EscapeDataString(invitation.ToByteArray().ToBase64String());
5252
QrCodeValue = barcodeValue;
5353
}

src/Hyperledger.Aries.Max/ViewModels/Credentials/CredentialViewModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ public CredentialViewModel(IUserDialogs userDialogs,
4848
this._credential = credential;
4949
this._connection = connection;
5050

51-
CredentialName = _credential.SchemaId.ToCredentialName();
51+
CredentialName = _connection.Alias.Name;
5252
CredentialImageUrl = _connection.Alias.ImageUrl;
53-
CredentialSubtitle = _connection.Alias.Name;
53+
CredentialSubtitle = _credential.State.ToString();
5454
CreatedAt = _credential.CreatedAtUtc?.ToLocalTime();
5555
CredentialState = _credential.State;
5656
_isNew = IsCredentialNew(_credential);
@@ -65,7 +65,7 @@ public CredentialViewModel(IUserDialogs userDialogs,
6565
Name = x.Name,
6666
Value = x.Value != null ? x.Value.ToString() : string.Empty,
6767
Type = x.MimeType
68-
}));
68+
}).OrderBy(x => x.Name));
6969
}
7070

7171
//#if DEBUG
@@ -125,7 +125,7 @@ async Task AcceptCredential()
125125
var context = await agentContextProvider.GetContextAsync();
126126

127127
var (request, _) = await credentialService.CreateRequestAsync(context, _credential.Id);
128-
await messageService.SendAsync(context, request, _connection );
128+
await messageService.SendAsync(context, request, _connection);
129129

130130
eventAggregator.Publish(new ApplicationEvent() { Type = ApplicationEventType.CredentialsUpdated });
131131
await NavigationService.PopModalAsync();

0 commit comments

Comments
 (0)