Skip to content

Commit

Permalink
use xamarin essentials + readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jamie-mh committed Apr 15, 2019
1 parent 4c68f3a commit 61290d3
Show file tree
Hide file tree
Showing 70 changed files with 608 additions and 7,528 deletions.
1 change: 0 additions & 1 deletion AuthenticatorPro/.editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Rules in this file were initially inferred by Visual Studio IntelliCode from the C:\Development\ProAuth\ProAuth\ codebase based on best match to current usage at 23/08/2018
# You can modify the rules from these initially generated values to suit your own policies
# You can learn more about editorconfig here: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
[*.cs]
Expand Down
16 changes: 7 additions & 9 deletions AuthenticatorPro/AuthenticatorPro.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
<AndroidLinkMode>Full</AndroidLinkMode>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<AndroidSupportedAbis>armeabi;armeabi-v7a;x86;x86_64;arm64-v8a</AndroidSupportedAbis>
<AotAssemblies>true</AotAssemblies>
<EnableLLVM>true</EnableLLVM>
<AndroidSupportedAbis>armeabi-v7a;x86;x86_64;arm64-v8a</AndroidSupportedAbis>
<AotAssemblies>false</AotAssemblies>
<EnableLLVM>false</EnableLLVM>
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
<EnableProguard>false</EnableProguard>
<BundleAssemblies>true</BundleAssemblies>
<BundleAssemblies>false</BundleAssemblies>
<AndroidCreatePackagePerAbi>true</AndroidCreatePackagePerAbi>
</PropertyGroup>
<ItemGroup>
Expand Down Expand Up @@ -128,11 +128,6 @@
</ItemGroup>
<ItemGroup>
<None Include=".editorconfig" />
<AndroidNativeLibrary Include="lib\arm64-v8a\libProAuthKey.so" />
<AndroidNativeLibrary Include="lib\armeabi-v7a\libProAuthKey.so" />
<AndroidNativeLibrary Include="lib\x86\libProAuthKey.so" />
<AndroidNativeLibrary Include="lib\x86_64\libProAuthKey.so" />
<AndroidNativeLibrary Include="lib\armeabi\libProAuthKey.so" />
<None Include="Resources\AboutResources.txt" />
<None Include="Properties\AndroidManifest.xml">
<SubType>Designer</SubType>
Expand Down Expand Up @@ -188,6 +183,9 @@
<PackageReference Include="Xamarin.Android.Support.v7.RecyclerView">
<Version>28.0.0.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.Essentials">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="ZXing.Net.Mobile">
<Version>2.4.1</Version>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions AuthenticatorPro/Properties/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.3.1" package="me.jmh.authenticatorpro" android:installLocation="auto" android:versionCode="12">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.4.0" package="me.jmh.authenticatorpro" android:installLocation="auto" android:versionCode="13">
<uses-sdk android:minSdkVersion="21" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Expand Down
942 changes: 583 additions & 359 deletions AuthenticatorPro/Resources/Resource.Designer.cs

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions AuthenticatorPro/Source/Activities/ActivityMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,14 @@ protected override void OnPostCreate(Bundle savedInstanceState)
protected override void OnResume()
{
base.OnResume();

_sharedPrefs = PreferenceManager.GetDefaultSharedPreferences(this);
//bool firstLaunch = _sharedPrefs.GetBoolean("firstLaunch", true);
bool firstLaunch = _sharedPrefs.GetBoolean("firstLaunch", true);

//if(firstLaunch)
//{
// StartActivity(typeof(ActivityIntro));
// return;
//}
if(firstLaunch)
{
StartActivity(typeof(ActivityIntro));
return;
}

if((DateTime.Now - _pauseTime).TotalMinutes >= 1 && PerformLogin()) return;

Expand Down
16 changes: 10 additions & 6 deletions AuthenticatorPro/Source/Utilities/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,29 @@
using System.Threading.Tasks;
using AuthenticatorPro.Data;
using SQLite;
using Xamarin.Essentials;

namespace AuthenticatorPro.Utilities
{
internal static class Database
{
[DllImport("libProAuthKey", EntryPoint = "get_key")]
private static extern string GetDatabaseKey();

public static async Task<SQLiteAsyncConnection> Connect()
{
var key = GetDatabaseKey();
var databaseKey = await SecureStorage.GetAsync("database_key");

if(databaseKey == null)
{
databaseKey = Hash.SHA1(Guid.NewGuid().ToString());
await SecureStorage.SetAsync("database_key", databaseKey);
}

var dbPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.Personal),
"proauth.db3"
);

var connection = new SQLiteAsyncConnection(dbPath, true, key);
await connection.QueryAsync<int>($@"PRAGMA key='{key}'");
var connection = new SQLiteAsyncConnection(dbPath, true, databaseKey);
await connection.QueryAsync<int>($@"PRAGMA key='{databaseKey}'");

await connection.CreateTableAsync<Authenticator>();
await connection.CreateTableAsync<Category>();
Expand Down
16 changes: 0 additions & 16 deletions AuthenticatorPro/Source/Utilities/StringExt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,5 @@ public static string Truncate(this string value, int maxLength)
if(String.IsNullOrEmpty(value)) return value;
return value.Length <= maxLength ? value : value.Substring(0, maxLength);
}

public static string GetSlug(this string value)
{
value = value.ToLower();

// Remove apostrophes
value = value.Replace("'", "");
// Replace any non alphanumerics with a dash
value = Regex.Replace(value, "[^a-zA-Z0-9]", "-");
// Remove lonely dashes at the start or end of the string
value = Regex.Replace(value, "([-]$|^[-])", "");
// Remove multiple dashes
value = Regex.Replace(value, "([-]{2,})", "-");

return value;
}
}
}
Binary file removed AuthenticatorPro/lib/arm64-v8a/libProAuthKey.so
Binary file not shown.
Binary file removed AuthenticatorPro/lib/armeabi-v7a/libProAuthKey.so
Binary file not shown.
Binary file removed AuthenticatorPro/lib/armeabi/libProAuthKey.so
Binary file not shown.
Binary file removed AuthenticatorPro/lib/x86_64/libProAuthKey.so
Binary file not shown.
15 changes: 0 additions & 15 deletions AuthenticatorProKey/AuthenticatorProKey.cpp

This file was deleted.

165 changes: 0 additions & 165 deletions AuthenticatorProKey/AuthenticatorProKey.vcxproj

This file was deleted.

11 changes: 0 additions & 11 deletions AuthenticatorProKey/AuthenticatorProKey.vcxproj.filters

This file was deleted.

Loading

0 comments on commit 61290d3

Please sign in to comment.