forked from NRCan/GSC-Field-Application
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
157 changed files
with
28,578 additions
and
2,672 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# VISUAL STUDIO | ||
|
||
## Build errors | ||
|
||
### Hitting a Zip exception | ||
|
||
It happens when an Android emulator has been launched, it seems to lock some files. Restarting VS will fix this and the emulator | ||
can still be kept opened while VS restarts. | ||
|
||
--- | ||
|
||
# ANDROID | ||
## Useful commands in Adb | ||
|
||
### Accessing the device (plugged in android phone or emulator) | ||
|
||
Apply this command while the device is running | ||
`adb shell` | ||
|
||
### Accessing app files | ||
|
||
For security purposes all the app files are found within the app own folder behind some permission. | ||
|
||
#### Enabling permission | ||
|
||
Not doing this will result in a "permission denied" message. | ||
|
||
`run-as GSCFieldApp.GSCFieldApp` | ||
|
||
#### Accessing/Reading the files | ||
|
||
This is how we can see if the geopackage have been written properly within the app folder. | ||
|
||
`cd files` | ||
`ls` | ||
|
||
#### Copying files into PC | ||
|
||
`adb pull /storage/self/primary/download/asd_DSA.gpkg W:\Transit\Gab` | ||
|
||
#### Copying files to Android | ||
|
||
`adb push "C:\Users\ghuotvez\AppData\Local\Xamarin\Mono for Android\Archives\GSCFieldApp.GSCFieldApp.apk" /storage/self/primary/download` | ||
|
||
## Publishing | ||
|
||
App needs to be deployed and build first. | ||
|
||
In debug mode, app package has around 150Mb. | ||
In release with coding trimming and code shrinker it goes down to 42Mb. | ||
In release mode with ahead of time enabled to goes up to 56Mb, but the code should be faster. | ||
|
||
### Pub Android | ||
Password is gscfieldapp for current key | ||
|
||
## Coding style | ||
|
||
Usually class names should use CamelCasing, but for some reasons the model class in which CamalCasing is used, | ||
do not work well with the observableProperty inside the viewmodels. EM is a good example, passing the whole | ||
class to refill the form wasn't working until I removed the capital case M in the class name. | ||
|
||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="coverlet.collector" Version="6.0.0" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" /> | ||
<PackageReference Include="xunit" Version="2.5.3" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Using Include="Xunit" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace GSCFieldApp.Testing | ||
{ | ||
public class UnitTest1 | ||
{ | ||
[Fact] | ||
public void Test1() | ||
{ | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,69 @@ | ||
namespace GSCFieldApp; | ||
using GSCFieldApp.Services; | ||
|
||
namespace GSCFieldApp; | ||
|
||
public partial class App : Application | ||
{ | ||
public App() | ||
public LocalizationResourceManager LocalizationResourceManager | ||
=> LocalizationResourceManager.Instance; // Will be used for in code dynamic local strings | ||
|
||
public App() | ||
{ | ||
InitializeComponent(); | ||
|
||
MainPage = new AppShell(); | ||
} | ||
|
||
//MainPage.Loaded += MainPage_Loaded; | ||
|
||
} | ||
|
||
/// <summary> | ||
/// Track loaded event and ask for desired permission before moving on. | ||
/// </summary> | ||
/// <param name="sender"></param> | ||
/// <param name="e"></param> | ||
private async void MainPage_Loaded(object sender, EventArgs e) | ||
{ | ||
await CheckAndRequestLocationPermission(); | ||
} | ||
|
||
/// <summary> | ||
/// TODO Make sure to properly ask for permission | ||
/// https://learn.microsoft.com/en-us/dotnet/maui/platform-integration/appmodel/permissions?view=net-maui-8.0&tabs=android | ||
/// For now this method doesn't show anything on screen that would help | ||
/// user to actually enable location in settings. | ||
/// </summary> | ||
/// <returns></returns> | ||
public async Task<PermissionStatus> CheckAndRequestLocationPermission() | ||
{ | ||
|
||
PermissionStatus status = await Permissions.CheckStatusAsync<Permissions.LocationWhenInUse>(); | ||
|
||
if (status == PermissionStatus.Granted) | ||
return status; | ||
|
||
if (status == PermissionStatus.Denied && DeviceInfo.Platform == DevicePlatform.iOS) | ||
{ | ||
// Prompt the user to turn on in settings | ||
// On iOS once a permission has been denied it may not be requested again from the application | ||
return status; | ||
} | ||
|
||
if (Permissions.ShouldShowRationale<Permissions.LocationWhenInUse>()) | ||
{ | ||
// Prompt the user with additional information as to why the permission is needed | ||
bool answer = await Shell.Current.DisplayAlert(LocalizationResourceManager["DisplayAlertGPSDenied"].ToString(), | ||
LocalizationResourceManager["DisplayAlertGPSMessage"].ToString(), | ||
LocalizationResourceManager["GenericButtonYes"].ToString(), | ||
LocalizationResourceManager["GenericButtonNo"].ToString()); | ||
} | ||
|
||
await MainThread.InvokeOnMainThreadAsync(async () => | ||
{ | ||
status = await Permissions.RequestAsync<Permissions.LocationWhenInUse>(); | ||
|
||
}); | ||
|
||
return status; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace GSCFieldApp.Controls | ||
{ | ||
public class ComboBox | ||
{ | ||
public List<ComboBoxItem> cboxItems | ||
{ | ||
get; | ||
set; | ||
} | ||
public int cboxDefaultItemIndex { get; set; } | ||
|
||
public ComboBox() | ||
{ | ||
cboxItems = new List<ComboBoxItem>(); | ||
} | ||
} | ||
} |
Oops, something went wrong.