Compare commits
No commits in common. "master" and "POS_Sprint_4" have entirely different histories.
master
...
POS_Sprint
@ -12,29 +12,14 @@ using System.Collections.Generic;
|
||||
using System.Security;
|
||||
using System.Net;
|
||||
using System.Linq;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Klient.Droid.Modules;
|
||||
using Android.Provider;
|
||||
using Android.Content;
|
||||
using Android.Graphics;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using Com.Xamarin.Formsviewgroup;
|
||||
using Android.Icu.Text;
|
||||
using System.IO;
|
||||
using Android.Media;
|
||||
using System.Threading.Tasks;
|
||||
using Java.IO;
|
||||
using System.Net.Http.Headers;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Klient.Droid
|
||||
{
|
||||
[Activity(Label = "Klient", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
||||
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
||||
{
|
||||
Bitmap bitmap;
|
||||
ByteArrayContent fileContent;
|
||||
public static int PickImageId = 1000;
|
||||
private static readonly HttpClient client = new HttpClient();
|
||||
public static Android.Content.Intent photo;
|
||||
@ -50,9 +35,7 @@ namespace Klient.Droid
|
||||
|
||||
base.OnCreate(savedInstanceState);
|
||||
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
|
||||
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
|
||||
StrictMode.SetVmPolicy(builder.Build());
|
||||
LoadApplication(new App());
|
||||
LoadApplication(new App());
|
||||
SetContentView(Resource.Layout.ekranStartowy);
|
||||
}
|
||||
|
||||
@ -65,7 +48,7 @@ namespace Klient.Droid
|
||||
|
||||
if (string.IsNullOrWhiteSpace(new NetworkCredential("", Password).Password))
|
||||
{
|
||||
FindViewById<TextView>(Resource.Id.ErrorLogIn).Text = "Hasło nie może być puste ani zawierać spacji!";
|
||||
FindViewById<TextView>(Resource.Id.ErrorLogIn).Text = "Hasło musi mieć od 3 do 12 znaków!";
|
||||
FindViewById<EditText>(Resource.Id.Password).Text = "";
|
||||
}
|
||||
else
|
||||
@ -77,7 +60,7 @@ namespace Klient.Droid
|
||||
};
|
||||
|
||||
var content = new FormUrlEncodedContent(values);
|
||||
var response = await client.PostAsync("https://pixblocksaddition.azurewebsites.net/api/User/SignIn", content);
|
||||
var response = await client.PostAsync("http://10.0.2.2:5001/api/User/SignIn", content);
|
||||
|
||||
if (response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
@ -102,12 +85,6 @@ namespace Klient.Droid
|
||||
}
|
||||
}
|
||||
|
||||
[Java.Interop.Export("HelpLoginScreen")]
|
||||
public void GoToAboutScreen(View v)
|
||||
{
|
||||
SetContentView(Resource.Layout.ekranInformacji);
|
||||
}
|
||||
|
||||
[Java.Interop.Export("SignUp")]
|
||||
async public void SignUp(View v)
|
||||
{
|
||||
@ -120,12 +97,12 @@ namespace Klient.Droid
|
||||
|
||||
if (Login.Length < 3 || Login.Length > 12)
|
||||
{
|
||||
FindViewById<TextView>(Resource.Id.ErrorRegister).Text = "Login musi mieć od 3 do 12 znaków!";
|
||||
FindViewById<TextView>(Resource.Id.ErrorRegister).Text = "Login musi mięć od 3 do 12 znaków!";
|
||||
FindViewById<EditText>(Resource.Id.NewPassword).Text = "";
|
||||
FindViewById<EditText>(Resource.Id.RepeatPassword).Text = "";
|
||||
|
||||
}
|
||||
else if (new NetworkCredential("", Password).Password.Length < 8 || new NetworkCredential("", Password).Password.Length > 20 || string.IsNullOrWhiteSpace(new NetworkCredential("", Password).Password))
|
||||
else if (new NetworkCredential("", Password).Password.Length < 8 || new NetworkCredential("", Password).Password.Length > 20)
|
||||
{
|
||||
FindViewById<TextView>(Resource.Id.ErrorRegister).Text = "Hasło musi mieć od 8 do 20 znaków!";
|
||||
FindViewById<EditText>(Resource.Id.NewPassword).Text = "";
|
||||
@ -159,7 +136,7 @@ namespace Klient.Droid
|
||||
|
||||
var content = new FormUrlEncodedContent(values);
|
||||
|
||||
var response = await client.PostAsync("https://pixblocksaddition.azurewebsites.net/api/User/Register", content);
|
||||
var response = await client.PostAsync("http://10.0.2.2:5001/api/User/Register", content);
|
||||
|
||||
var responseString = await response.Content.ReadAsStringAsync();
|
||||
|
||||
@ -174,24 +151,12 @@ namespace Klient.Droid
|
||||
}
|
||||
}
|
||||
|
||||
[Java.Interop.Export("HelpRegisterScreen")]
|
||||
public void GoToRegisterHelp(View v)
|
||||
{
|
||||
SetContentView(Resource.Layout.ekranPomocRejestracja);
|
||||
}
|
||||
|
||||
|
||||
[Java.Interop.Export("GoToProfile")]
|
||||
public void GoBackToProfile(View v)
|
||||
{
|
||||
SetContentView(Resource.Layout.ekranProfil);
|
||||
}
|
||||
|
||||
[Java.Interop.Export("GoToRegister")]
|
||||
[Java.Interop.Export("HelpLoginScreen")]
|
||||
public void HelpLoginScreen(View v)
|
||||
{
|
||||
SetContentView(Resource.Layout.ekranRejestracji);
|
||||
}
|
||||
|
||||
[Java.Interop.Export("SignInMainScreen")]
|
||||
public void MainScreenSignIn(View v)
|
||||
{
|
||||
@ -204,6 +169,11 @@ namespace Klient.Droid
|
||||
SetContentView(Resource.Layout.ekranRejestracji);
|
||||
}
|
||||
|
||||
[Java.Interop.Export("about")]
|
||||
public void MainScreenAbout(View v)
|
||||
{
|
||||
SetContentView(Resource.Layout.ekranInformacji);
|
||||
}
|
||||
[Java.Interop.Export("GoToMainScreenFromInformation")]
|
||||
public void GoToMainScreenFromInformation(View v)
|
||||
{
|
||||
@ -218,16 +188,6 @@ namespace Klient.Droid
|
||||
|
||||
StartActivityForResult(Android.Content.Intent.CreateChooser(Intent, "Select Picture"), PickImageId);
|
||||
}
|
||||
|
||||
[Java.Interop.Export("LoadFromCamera")]
|
||||
public void LoadFromCamera(View v)
|
||||
{
|
||||
Intent intent = new Intent(MediaStore.ActionImageCapture);
|
||||
StartActivityForResult(intent, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
[Java.Interop.Export("GoToStart")]
|
||||
public void GoToStart(View v)
|
||||
{
|
||||
@ -242,139 +202,37 @@ namespace Klient.Droid
|
||||
protected override void OnActivityResult(int requestCode, Result resultCode, Android.Content.Intent data)
|
||||
{
|
||||
SetContentView(Resource.Layout.ekranPoZdjeciu);
|
||||
FindViewById<TextView>(Resource.Id.ErrorPhoto).Text = "";
|
||||
if (requestCode == 0)
|
||||
{
|
||||
photo = data;
|
||||
base.OnActivityResult(requestCode, resultCode, data);
|
||||
if (data != null)
|
||||
{
|
||||
bitmap = (Bitmap)data.Extras.Get("data");
|
||||
Android.Net.Uri uri = data.Data;
|
||||
photo = data;
|
||||
FindViewById<ImageView>(Resource.Id.Preview).SetImageURI(uri);
|
||||
|
||||
byte[] bitmapData;
|
||||
var stream = new MemoryStream();
|
||||
bitmap.Compress(Bitmap.CompressFormat.Png, 100, stream);
|
||||
bitmapData = stream.ToArray();
|
||||
fileContent = new ByteArrayContent(bitmapData);
|
||||
|
||||
|
||||
FindViewById<ImageView>(Resource.Id.Preview).SetImageBitmap(bitmap);
|
||||
}
|
||||
else SetContentView(Resource.Layout.ekranPoLogowaniu);
|
||||
|
||||
}
|
||||
else if(requestCode == PickImageId)
|
||||
{
|
||||
if(data == null) SetContentView(Resource.Layout.ekranPoLogowaniu);
|
||||
else
|
||||
{
|
||||
Android.Net.Uri uri = data.Data;
|
||||
photo = data;
|
||||
FindViewById<ImageView>(Resource.Id.Preview).SetImageURI(uri);
|
||||
}
|
||||
}
|
||||
else if(data == null)
|
||||
{
|
||||
SetContentView(Resource.Layout.ekranPoLogowaniu);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
[Java.Interop.Export("SendPhoto")]
|
||||
async public void UploadPhoto(View v)
|
||||
{
|
||||
if(photo.Data == null)
|
||||
{
|
||||
fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/octet-stream");
|
||||
fileContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data")
|
||||
{
|
||||
Name = "image",
|
||||
FileName = Guid.NewGuid().ToString()
|
||||
};
|
||||
|
||||
string boundary = "---8d0f01e6b3b5dafaaadaad";
|
||||
MultipartFormDataContent formDataContent = new MultipartFormDataContent(boundary);
|
||||
formDataContent.Add(fileContent);
|
||||
|
||||
var response = await client.PostAsync("https://pixblocksaddition.azurewebsites.net/api/Image/Process", formDataContent);
|
||||
if (response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
var jsonString = await response.Content.ReadAsStringAsync();
|
||||
FindViewById<TextView>(Resource.Id.ErrorPhoto).Text = "Przesłano zdjęcie!";
|
||||
SetContentView(Resource.Layout.ekranZLinkami);
|
||||
var second_response = await client.GetAsync($"https://pixblocksaddition.azurewebsites.net/api/Search/{jsonString}");
|
||||
if (second_response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
var second_jsonString = await response.Content.ReadAsStringAsync();
|
||||
|
||||
List<SearchResult> fullLink = JsonConvert.DeserializeObject<List<SearchResult>>(second_jsonString);
|
||||
|
||||
int end = 10;
|
||||
if (fullLink.Count < 10) end = fullLink.Count;
|
||||
for (int i = 0; i < end; i++)
|
||||
{
|
||||
FindViewById<TextView>(Resource.Id.links).Text = FindViewById<TextView>(Resource.Id.links).Text + fullLink[i].title + ": \n" + fullLink[i].link + "\n\n";
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
FindViewById<TextView>(Resource.Id.links).Text = "Coś poszło nie tak!";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
string msg = await response.Content.ReadAsStringAsync();
|
||||
FindViewById<TextView>(Resource.Id.ErrorPhoto).Text = msg;
|
||||
}
|
||||
}
|
||||
|
||||
using(var imageStream = ContentResolver.OpenInputStream(photo.Data))
|
||||
using(var stramContent = new StreamContent(imageStream))
|
||||
using(var byteArrayContent = new ByteArrayContent(await stramContent.ReadAsByteArrayAsync()))
|
||||
using(var formDataContent = new MultipartFormDataContent())
|
||||
{
|
||||
{
|
||||
formDataContent.Add(byteArrayContent, "image", Guid.NewGuid() + ".jpg");
|
||||
foreach (var content in formDataContent)
|
||||
{
|
||||
content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(ContentResolver.GetType(photo.Data));
|
||||
break;
|
||||
}
|
||||
var response = await client.PostAsync("https://pixblocksaddition.azurewebsites.net/api/Image/Process", formDataContent);
|
||||
var response = await client.PostAsync("http://10.0.2.2:5001/api/Image/Process", formDataContent);
|
||||
if(response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
var jsonString = await response.Content.ReadAsStringAsync();
|
||||
FindViewById<TextView>(Resource.Id.ErrorPhoto).Text = "Przesłano zdjęcie!";
|
||||
SetContentView(Resource.Layout.ekranZLinkami);
|
||||
var second_response = await client.GetAsync($"https://pixblocksaddition.azurewebsites.net/api/Search/{jsonString}");
|
||||
if(second_response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
var second_jsonString = await second_response.Content.ReadAsStringAsync();
|
||||
List<SearchResult> fullLink = JsonConvert.DeserializeObject<List<SearchResult>>(second_jsonString);
|
||||
|
||||
int end = 10;
|
||||
if (fullLink.Count < 10) end = fullLink.Count;
|
||||
for (int i = 0; i < end; i++)
|
||||
{
|
||||
FindViewById<TextView>(Resource.Id.links).Text = FindViewById<TextView>(Resource.Id.links).Text + fullLink[i].title + ": " + fullLink[i].link + "\n\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FindViewById<TextView>(Resource.Id.links).Text = "Coś poszło nie tak!";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
string msg = await response.Content.ReadAsStringAsync();
|
||||
FindViewById<TextView>(Resource.Id.ErrorPhoto).Text = msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Java.Interop.Export("GoToProfil")]
|
||||
@ -415,7 +273,7 @@ namespace Klient.Droid
|
||||
{ "login", savedLogin }
|
||||
};
|
||||
var content = new FormUrlEncodedContent(values);
|
||||
var response = await client.PostAsync("https://pixblocksaddition.azurewebsites.net/api/User/Update", content);
|
||||
var response = await client.PostAsync("http://10.0.2.2:5001/api/User/Update", content);
|
||||
|
||||
if (response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
@ -433,45 +291,5 @@ namespace Klient.Droid
|
||||
FindViewById<TextView>(Resource.Id.NullValueProfile).Text = msg;
|
||||
}
|
||||
}
|
||||
|
||||
[Java.Interop.Export("GetHistory")]
|
||||
public async void GetUserHistory(View v)
|
||||
{
|
||||
SetContentView(Resource.Layout.ekranHistorii);
|
||||
var response = await client.GetAsync("https://pixblocksaddition.azurewebsites.net/api/History");
|
||||
if (response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
var jsonString = await response.Content.ReadAsStringAsync();
|
||||
dynamic jsonObject = JsonConvert.DeserializeObject(jsonString);
|
||||
var hs = (JArray)jsonObject.history;
|
||||
List<string> history = hs.ToObject<List<string>>();
|
||||
int end = 10;
|
||||
int temp;
|
||||
if (history.Count < 10) end = history.Count;
|
||||
for (int i = 0; i < end; i++)
|
||||
{
|
||||
temp = i + 1;
|
||||
FindViewById<TextView>(Resource.Id.history).Text = FindViewById<TextView>(Resource.Id.history).Text + "\n" + temp + ". " + history[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string msg = await response.Content.ReadAsStringAsync();
|
||||
FindViewById<TextView>(Resource.Id.HistoryError).Text = msg;
|
||||
}
|
||||
}
|
||||
|
||||
[Java.Interop.Export("HelpPhoto")]
|
||||
public void GotToHelpPhoto(View v)
|
||||
{
|
||||
SetContentView(Resource.Layout.ekranPomocZdjecie);
|
||||
}
|
||||
|
||||
[Java.Interop.Export("LogOut")]
|
||||
public void LogOut(View v)
|
||||
{
|
||||
SetContentView(Resource.Layout.ekranStartowy);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.OS;
|
||||
using Android.Runtime;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Klient.Droid.Modules
|
||||
{
|
||||
public class SearchResult
|
||||
{
|
||||
public string title { get; set; }
|
||||
public string link { get; set; }
|
||||
public string snippet { get; set; }
|
||||
}
|
||||
}
|
@ -36,7 +36,6 @@
|
||||
<BundleAssemblies>false</BundleAssemblies>
|
||||
<MandroidI18n />
|
||||
<Debugger>Xamarin</Debugger>
|
||||
<AndroidSupportedAbis />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@ -74,7 +73,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MainActivity.cs" />
|
||||
<Compile Include="Modules\SearchResult.cs" />
|
||||
<Compile Include="Resources\Resource.designer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
@ -100,6 +98,7 @@
|
||||
<AndroidResource Include="Resources\mipmap-xxxhdpi\launcher_foreground.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Modules\" />
|
||||
<Folder Include="Resources\drawable-hdpi\" />
|
||||
<Folder Include="Resources\drawable-xhdpi\" />
|
||||
<Folder Include="Resources\drawable-xxhdpi\" />
|
||||
@ -151,38 +150,9 @@
|
||||
</AndroidResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\ekranPomocZdjecie.xml">
|
||||
<AndroidResourceAnalysisConfig Include="Resources\layout\ekranInformacji.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</AndroidResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\ekranHistorii.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</AndroidResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\ekranInformacji.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</AndroidResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\ekranZLinkami.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</AndroidResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\ekranPomocRejestracja.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</AndroidResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\Obraz4.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\xml\file_paths.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\Obraz8.png" />
|
||||
</AndroidResourceAnalysisConfig>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
<ProjectExtensions>
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.Klient.Android" android:installLocation="internalOnly">
|
||||
<uses-sdk android:minSdkVersion="28" android:targetSdkVersion="27" />
|
||||
<application android:label="Klient.Android" android:usesCleartextTraffic="true" android:theme="@style/Base.Theme.AppCompat.Light.DarkActionBar" />
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.Klient.Android" android:installLocation="preferExternal">
|
||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<application android:label="Klient.Android" android:usesCleartextTraffic="true" android:theme="@style/Base.Theme.AppCompat.Light.DarkActionBar" />
|
||||
</manifest>
|
1249
Klient/Klient/Klient.Android/Resources/Resource.designer.cs
generated
1249
Klient/Klient/Klient.Android/Resources/Resource.designer.cs
generated
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 361 B |
Binary file not shown.
Before Width: | Height: | Size: 730 B |
@ -1,69 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#ffbdd7f0">
|
||||
<ImageButton
|
||||
android:src="@drawable/obraz4"
|
||||
android:layout_width="38.5dp"
|
||||
android:layout_height="35.0dp"
|
||||
android:id="@+id/backHistory"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:background="#ffbdd7f0"
|
||||
android:gravity="center"
|
||||
android:onClick="GoToPoLogowaniu" />
|
||||
<TextView
|
||||
android:text="Poszukiwacz 2021"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/text3"
|
||||
android:textColor="#ff000000"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"/>
|
||||
<TextView
|
||||
android:text="Historia wyszukiwań"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/HistoryTitle"
|
||||
android:textStyle="bold"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:textSize="30dp"
|
||||
android:paddingTop="5dp"
|
||||
android:textColor="#ff000000" />
|
||||
<TextView
|
||||
android:text=""
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/history"
|
||||
android:layout_below="@+id/HistoryError"
|
||||
android:textColor="#ff000000"
|
||||
android:paddingBottom="35dp"
|
||||
android:focusableInTouchMode="true"
|
||||
android:isScrollContainer="true"
|
||||
android:fadeScrollbars="true"
|
||||
android:scrollbars="vertical"
|
||||
android:verticalScrollbarPosition="right"
|
||||
android:scrollIndicators="right"
|
||||
android:scrollbarAlwaysDrawVerticalTrack="true"
|
||||
android:textIsSelectable="true"
|
||||
android:paddingTop="10dp"/>
|
||||
<TextView
|
||||
android:text=""
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/HistoryError"
|
||||
android:layout_below="@+id/HistoryTitle"
|
||||
android:textColor="#ffff0000"
|
||||
android:layout_centerInParent="true"
|
||||
android:paddingTop="10dp" />
|
||||
|
||||
</RelativeLayout>
|
@ -18,8 +18,7 @@
|
||||
android:id="@+id/title"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:textSize="50dp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#ff000000" />
|
||||
android:textStyle="bold" />
|
||||
<TextView
|
||||
android:text="Poszukiwacz jest aplikacją mobilną pozwalającą na wyszukiwanie w Internece stron zawierających schematy i tutoriale na podstawie treści zadania. \n Jednocześnie pomaga w nauce, jaki i przyśpiesza proces dokonywania researchu danych. "
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
@ -28,8 +27,7 @@
|
||||
android:id="@+id/textView1"
|
||||
android:layout_below="@id/title"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:textColor="#ff373737" />
|
||||
android:gravity="center_horizontal" />
|
||||
<TextView
|
||||
android:text="Poszukiwacz 2021"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
@ -39,14 +37,15 @@
|
||||
android:textColor="#ff000000"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true" />
|
||||
<ImageButton
|
||||
android:src="@drawable/obraz4"
|
||||
<Button
|
||||
android:text="Back"
|
||||
android:layout_width="38.5dp"
|
||||
android:layout_height="35.0dp"
|
||||
android:id="@+id/backInformation"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:background="#ffbdd7f0"
|
||||
android:background="#ff0b31c8"
|
||||
android:textColor="#fffcfcfc"
|
||||
android:gravity="center"
|
||||
android:onClick="GoToMainScreenFromInformation" />
|
||||
|
||||
@ -55,6 +54,4 @@
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -60,14 +60,26 @@
|
||||
android:text="Zaloguj"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:foregroundGravity="center" />
|
||||
<ImageButton
|
||||
android:src="@drawable/obraz4"
|
||||
<Button
|
||||
android:text="?"
|
||||
android:layout_width="35.0dp"
|
||||
android:layout_height="35.0dp"
|
||||
android:id="@+id/help"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:background="#ff0b31c8"
|
||||
android:textColor="#fffcfcfc"
|
||||
android:gravity="center"
|
||||
android:onClick="HelpLoginScreen" />
|
||||
<Button
|
||||
android:text="Back"
|
||||
android:layout_width="38.5dp"
|
||||
android:layout_height="35.0dp"
|
||||
android:id="@+id/backLogowanie"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:background="#ffbdd7f0"
|
||||
android:background="#ff0b31c8"
|
||||
android:textColor="#fffcfcfc"
|
||||
android:gravity="center"
|
||||
android:onClick="GoToStart"/>
|
||||
<TextView
|
||||
|
@ -21,6 +21,7 @@
|
||||
android:layout_marginLeft="75dp"
|
||||
android:onClick="LoadFromFolder" />
|
||||
<TextView
|
||||
android:text="Poszukiwacz 2021"
|
||||
android:text="Poszukiwacz 2021"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:layout_width="wrap_content"
|
||||
@ -54,15 +55,15 @@
|
||||
android:onClick="LoadFromCamera" />
|
||||
<Button
|
||||
android:text="?"
|
||||
android:layout_width="25.0dp"
|
||||
android:layout_height="25.0dp"
|
||||
android:id="@+id/helpPhoto"
|
||||
android:layout_width="35.0dp"
|
||||
android:layout_height="35.0dp"
|
||||
android:id="@+id/helpRegister"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:background="#ff0b31c8"
|
||||
android:textColor="#fffcfcfc"
|
||||
android:gravity="center"
|
||||
android:onClick="HelpPhoto" />
|
||||
android:onClick="HelpRegisterScreen" />
|
||||
<ImageButton
|
||||
android:src="@drawable/obraz3"
|
||||
android:layout_width="63.5dp"
|
||||
|
@ -27,14 +27,15 @@
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@id/SendPhoto"
|
||||
android:textColor="#ffd60000" />
|
||||
<ImageButton
|
||||
android:src="@drawable/obraz4"
|
||||
<Button
|
||||
android:text="Back"
|
||||
android:layout_width="38.5dp"
|
||||
android:layout_height="35.0dp"
|
||||
android:id="@+id/backZdjecie"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:background="#ffbdd7f0"
|
||||
android:background="#ff0b31c8"
|
||||
android:textColor="#fffcfcfc"
|
||||
android:gravity="center"
|
||||
android:onClick="GoToPoLogowaniu" />
|
||||
<TextView
|
||||
|
@ -1,70 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#ffbdd7f0">
|
||||
<TextView
|
||||
android:text="Login powinien składać się z 3 do 12 znaków!"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="25px"
|
||||
android:minHeight="25px"
|
||||
android:id="@+id/loginTip"
|
||||
android:paddingTop="20dp"
|
||||
android:textColor="#ff000000" />
|
||||
<TextView
|
||||
android:text="Hasło musi się składać z 8 do 20 znaków!"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="25px"
|
||||
android:minHeight="25px"
|
||||
android:id="@+id/passwordTip"
|
||||
android:layout_below="@+id/loginTip"
|
||||
android:paddingTop="10dp"
|
||||
android:textColor="#ff000000" />
|
||||
<TextView
|
||||
android:text="Wszystkie pola formularza są wymagane!"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="25px"
|
||||
android:minHeight="25px"
|
||||
android:id="@+id/GeneralTip"
|
||||
android:layout_below="@+id/passwordTip"
|
||||
android:paddingTop="10dp"
|
||||
android:textColor="#ff000000" />
|
||||
<TextView
|
||||
android:text="To jest pomoc \n w rejestracji \n co miałem \n napisac"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/textView1"
|
||||
android:textColor="#ffb1d5f8"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true" />
|
||||
<TextView
|
||||
android:text="Poszukiwacz 2021"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/text1"
|
||||
android:textColor="#ff000000"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true" />
|
||||
<ImageButton
|
||||
android:src="@drawable/obraz4"
|
||||
android:layout_width="38.5dp"
|
||||
android:layout_height="35.0dp"
|
||||
android:id="@+id/backRegisterHelp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:background="#ffbdd7f0"
|
||||
android:gravity="center"
|
||||
android:onClick="GoToRegister" />
|
||||
|
||||
</RelativeLayout>
|
@ -1,36 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#ffbdd7f0">
|
||||
<TextView
|
||||
android:text="Poszukiwacz 2021"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/text1"
|
||||
android:textColor="#ff000000"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true" />
|
||||
<ImageButton
|
||||
android:src="@drawable/obraz4"
|
||||
android:layout_width="38.5dp"
|
||||
android:layout_height="35.0dp"
|
||||
android:id="@+id/backPomocZdjecie"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:background="#ffbdd7f0"
|
||||
android:gravity="center"
|
||||
android:onClick="GoToPoLogowaniu" />
|
||||
<TextView
|
||||
android:text="W celu załadowania zdjęcia z pamięci telefonu \nwybierz ikonę folderu, w celu zrobienia zdjęcia \nwybierz ikonę aparatu i postępuj jak przy robieniu zdjęcia. \nNa następnym ekranie zostanie wyświtlony \npodgląd załadowanego zdjęcia."
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/textView1"
|
||||
android:textColor="#ff000000" />
|
||||
|
||||
</RelativeLayout>
|
@ -94,6 +94,7 @@
|
||||
android:layout_below="@id/Save"
|
||||
android:textColor="#ffd60000" />
|
||||
<TextView
|
||||
android:text="Poszukiwacz 2021"
|
||||
android:text="Poszukiwacz 2021"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:layout_width="wrap_content"
|
||||
@ -102,31 +103,15 @@
|
||||
android:textColor="#ff000000"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true" />
|
||||
<ImageButton
|
||||
android:src="@drawable/obraz4"
|
||||
<Button
|
||||
android:text="Back"
|
||||
android:layout_width="38.5dp"
|
||||
android:layout_height="35.0dp"
|
||||
android:id="@+id/backProfil"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:background="#ffbdd7f0"
|
||||
android:background="#ff0b31c8"
|
||||
android:textColor="#fffcfcfc"
|
||||
android:gravity="center"
|
||||
android:onClick="GoToPoLogowaniu" />
|
||||
<Button
|
||||
android:text="Historia"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/GetHistory"
|
||||
android:layout_below="@id/Save"
|
||||
android:translationY="45dp"
|
||||
android:onClick="GetHistory" />
|
||||
<ImageButton
|
||||
android:src="@drawable/obraz8"
|
||||
android:layout_width="35.0dp"
|
||||
android:layout_height="35.0dp"
|
||||
android:background="#ffbdd7f0"
|
||||
android:id="@+id/LogOut"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:onClick="LogOut" />
|
||||
</RelativeLayout>
|
||||
|
@ -80,8 +80,6 @@
|
||||
android:layout_height="58.0dp"
|
||||
android:minWidth="25px"
|
||||
android:minHeight="25px"
|
||||
android:textColor="#ff000000"
|
||||
android:textColorHint="#ff6c6767"
|
||||
android:id="@+id/NewPassword"
|
||||
android:inputType="none|textPassword" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
@ -102,8 +100,7 @@
|
||||
android:minHeight="25px"
|
||||
android:id="@+id/RepeatPassword"
|
||||
android:inputType="none|textPassword"
|
||||
android:textColor="#ff000000"
|
||||
android:textColorHint="#ff6c6767" />
|
||||
android:textColor="#ff000000" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/LayoutNewLogin"
|
||||
@ -154,8 +151,8 @@
|
||||
android:layout_centerHorizontal="true" />
|
||||
<Button
|
||||
android:text="?"
|
||||
android:layout_width="25.0dp"
|
||||
android:layout_height="25.0dp"
|
||||
android:layout_width="35.0dp"
|
||||
android:layout_height="35.0dp"
|
||||
android:id="@+id/helpRegister"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
@ -163,14 +160,15 @@
|
||||
android:textColor="#fffcfcfc"
|
||||
android:gravity="center"
|
||||
android:onClick="HelpRegisterScreen" />
|
||||
<ImageButton
|
||||
android:src="@drawable/obraz4"
|
||||
<Button
|
||||
android:text="Back"
|
||||
android:layout_width="38.5dp"
|
||||
android:layout_height="35.0dp"
|
||||
android:id="@+id/backRejestracja"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:background="#ffbdd7f0"
|
||||
android:background="#ff0b31c8"
|
||||
android:textColor="#fffcfcfc"
|
||||
android:gravity="center"
|
||||
android:onClick="GoToStart" />
|
||||
|
||||
|
@ -29,9 +29,9 @@
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true" />
|
||||
<Button
|
||||
android:text="?"
|
||||
android:layout_width="25.0dp"
|
||||
android:layout_height="25.0dp"
|
||||
android:text="i"
|
||||
android:layout_width="35.0dp"
|
||||
android:layout_height="35.0dp"
|
||||
android:id="@+id/about"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
|
@ -1,70 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#ffbdd7f0">
|
||||
<TextView
|
||||
android:text="Proponowane materiały"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="25px"
|
||||
android:minHeight="25px"
|
||||
android:id="@+id/linkTitle"
|
||||
android:textStyle="bold"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:translationY="5dp"
|
||||
android:textColor="#ff000000" />
|
||||
<TextView
|
||||
android:text=""
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/links"
|
||||
android:layout_below="@+id/LinkError"
|
||||
android:textColor="#ff393939"
|
||||
android:linksClickable="true"
|
||||
android:autoLink="web"
|
||||
android:fadeScrollbars="true"
|
||||
android:scrollbars="vertical"
|
||||
android:verticalScrollbarPosition="right"
|
||||
android:scrollIndicators="right"
|
||||
android:paddingBottom="35dp"
|
||||
android:scrollbarAlwaysDrawVerticalTrack="true"
|
||||
android:isScrollContainer="true"
|
||||
android:textIsSelectable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:paddingTop="10dp" />
|
||||
<TextView
|
||||
android:text=""
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/linkTitle"
|
||||
android:id="@+id/LinkError"
|
||||
android:textColor="#ffff0000"
|
||||
android:layout_centerInParent="true"
|
||||
android:paddingTop="10dp" />
|
||||
<ImageButton
|
||||
android:src="@drawable/obraz4"
|
||||
android:layout_width="38.5dp"
|
||||
android:layout_height="35.0dp"
|
||||
android:id="@+id/backToSendPhoto"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:background="#ffbdd7f0"
|
||||
android:gravity="center"
|
||||
android:onClick="GoToPoLogowaniu" />
|
||||
<TextView
|
||||
android:text="Poszukiwacz 2021"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/text1"
|
||||
android:textColor="#ff000000"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true" />
|
||||
</RelativeLayout>
|
@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<cache-path name="my_images"
|
||||
path="path" />
|
||||
</paths>
|
@ -7,12 +7,6 @@
|
||||
"commands": [
|
||||
"dotnet-ef"
|
||||
]
|
||||
},
|
||||
"swashbuckle.aspnetcore.cli": {
|
||||
"version": "5.6.3",
|
||||
"commands": [
|
||||
"swagger"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -32,7 +32,7 @@ namespace Serwer.Api.Framework
|
||||
{
|
||||
var statusCode = HttpStatusCode.BadRequest;
|
||||
context.Response.StatusCode = (int)statusCode;
|
||||
return context.Response.WriteAsync($"Błąd: {exception.Message}");
|
||||
return context.Response.WriteAsync($"Error: {exception.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,80 +0,0 @@
|
||||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"resourceGroupName": {
|
||||
"type": "string",
|
||||
"defaultValue": "PixBlocksAdditionResourceGroup",
|
||||
"metadata": {
|
||||
"_parameterType": "resourceGroup",
|
||||
"description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking."
|
||||
}
|
||||
},
|
||||
"resourceGroupLocation": {
|
||||
"type": "string",
|
||||
"defaultValue": "centralus",
|
||||
"metadata": {
|
||||
"_parameterType": "location",
|
||||
"description": "Location of the resource group. Resource groups could have different location than resources."
|
||||
}
|
||||
},
|
||||
"resourceLocation": {
|
||||
"type": "string",
|
||||
"defaultValue": "[parameters('resourceGroupLocation')]",
|
||||
"metadata": {
|
||||
"_parameterType": "location",
|
||||
"description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there."
|
||||
}
|
||||
}
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.Resources/resourceGroups",
|
||||
"name": "[parameters('resourceGroupName')]",
|
||||
"location": "[parameters('resourceGroupLocation')]",
|
||||
"apiVersion": "2019-10-01"
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Resources/deployments",
|
||||
"name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat('SerwerApi', subscription().subscriptionId)))]",
|
||||
"resourceGroup": "[parameters('resourceGroupName')]",
|
||||
"apiVersion": "2019-10-01",
|
||||
"dependsOn": [
|
||||
"[parameters('resourceGroupName')]"
|
||||
],
|
||||
"properties": {
|
||||
"mode": "Incremental",
|
||||
"template": {
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"resources": [
|
||||
{
|
||||
"name": "SerwerApiapi",
|
||||
"type": "Microsoft.ApiManagement/service",
|
||||
"location": "[parameters('resourceLocation')]",
|
||||
"properties": {},
|
||||
"sku": {
|
||||
"name": "Consumption",
|
||||
"capacity": 0
|
||||
},
|
||||
"identity": null,
|
||||
"apiVersion": "2019-12-01"
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.ApiManagement/service/apis",
|
||||
"name": "SerwerApiapi/SerwerApi",
|
||||
"properties": {},
|
||||
"apiVersion": "2019-12-01",
|
||||
"dependsOn": [
|
||||
"SerwerApiapi"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"_dependencyType": "apis.azure"
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"apis1": {
|
||||
"resourceId": "/subscriptions/[parameters('subscriptionId')]/resourceGroups/[parameters('resourceGroupName')]/providers/Microsoft.ApiManagement/service/SerwerApiapi/apis/SerwerApi",
|
||||
"type": "apis.azure"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"apis1": {
|
||||
"type": "apis"
|
||||
}
|
||||
}
|
||||
}
|
@ -98,19 +98,18 @@ namespace Serwer.Api
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
app.UseCors(builder =>
|
||||
{
|
||||
builder.AllowAnyHeader();
|
||||
builder.AllowAnyMethod();
|
||||
builder.AllowAnyOrigin();
|
||||
});
|
||||
{
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
|
||||
app.UseCors(builder =>
|
||||
{
|
||||
builder.AllowAnyHeader();
|
||||
builder.AllowAnyMethod();
|
||||
builder.AllowAnyOrigin();
|
||||
});
|
||||
app.UseDeveloperExceptionPage();
|
||||
//app.UseSwagger();
|
||||
//app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Serwer.Api v1"));
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Serwer.Api v1"));
|
||||
}
|
||||
app.UseRouting();
|
||||
|
||||
|
@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serwer.Infrastructure.DTO
|
||||
{
|
||||
public class UserHistoryDto
|
||||
{
|
||||
public List<string> History { get; set; }
|
||||
public UserDto User { get; set; }
|
||||
}
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serwer.Infrastructure.Framework
|
||||
{
|
||||
public class OCRResponseData
|
||||
{
|
||||
/// <summary>
|
||||
/// Error message
|
||||
/// </summary>
|
||||
public string ErrorMessage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Available pages
|
||||
/// </summary>
|
||||
public int AvailablePages { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// OCRed text
|
||||
/// </summary>
|
||||
public List<List<string>> OCRText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Output file1 URL
|
||||
/// </summary>
|
||||
public string OutputFileUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Output file2 URL
|
||||
/// </summary>
|
||||
public string OutputFileUrl2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Output file3 URL
|
||||
/// </summary>
|
||||
public string OutputFileUrl3 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Reserved
|
||||
/// </summary>
|
||||
public List<List<string>> Reserved { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// OCRWords
|
||||
/// </summary>
|
||||
public List<List<OCRWSWord>> OCRWords { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Task description
|
||||
/// </summary>
|
||||
public string TaskDescription { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public OCRResponseData()
|
||||
{
|
||||
OCRText = new List<List<string>>();
|
||||
Reserved = new List<List<string>>();
|
||||
OCRWords = new List<List<OCRWSWord>>();
|
||||
}
|
||||
}
|
||||
public class OCRWSWord
|
||||
{
|
||||
public int Top;
|
||||
public int Left;
|
||||
public int Height;
|
||||
public int Width;
|
||||
public string OCRWord;
|
||||
}
|
||||
}
|
@ -15,7 +15,6 @@ namespace Serwer.Infrastructure.Mappers
|
||||
=> new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<User, UserDto>();
|
||||
cfg.CreateMap<UserHistory, UserHistoryDto>();
|
||||
})
|
||||
.CreateMapper();
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
using AutoMapper;
|
||||
using Serwer.Core.Domain;
|
||||
using Serwer.Core.Domain;
|
||||
using Serwer.Core.Repositories;
|
||||
using Serwer.Infrastructure.DTO;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -14,15 +12,13 @@ namespace Serwer.Infrastructure.Services
|
||||
{
|
||||
private readonly IHistoryRepository _historyRepository;
|
||||
private readonly IUserRepository _userRepository;
|
||||
private readonly IMapper _mapper;
|
||||
public HistoryService(IHistoryRepository historyRepository, IUserRepository userRepository, IMapper mapper)
|
||||
public HistoryService(IHistoryRepository historyRepository, IUserRepository userRepository)
|
||||
{
|
||||
_historyRepository = historyRepository;
|
||||
_userRepository = userRepository;
|
||||
_mapper = mapper;
|
||||
}
|
||||
|
||||
public async Task<UserHistoryDto> GetAsync(Guid userId)
|
||||
public async Task<UserHistory> GetAsync(Guid userId)
|
||||
{
|
||||
var user = await _userRepository.GetAsync(userId);
|
||||
if(user == null)
|
||||
@ -30,7 +26,7 @@ namespace Serwer.Infrastructure.Services
|
||||
throw new Exception("Coś poszło nie tak.");
|
||||
}
|
||||
var history = await _historyRepository.GetAsync(user);
|
||||
return _mapper.Map<UserHistoryDto>(history);
|
||||
return history;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
using Serwer.Core.Domain;
|
||||
using Serwer.Infrastructure.DTO;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -10,6 +9,6 @@ namespace Serwer.Infrastructure.Services
|
||||
{
|
||||
public interface IHistoryService
|
||||
{
|
||||
Task<UserHistoryDto> GetAsync(Guid userId);
|
||||
Task<UserHistory> GetAsync(Guid userId);
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,8 @@
|
||||
using Newtonsoft.Json;
|
||||
using Serwer.Core.Domain;
|
||||
using Serwer.Infrastructure.Framework;
|
||||
using Serwer.Core.Domain;
|
||||
using Serwer.Infrastructure.Settings;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Tesseract;
|
||||
@ -22,64 +19,12 @@ namespace Serwer.Infrastructure.Services
|
||||
}
|
||||
public async Task<string> Process(string name, string contentType, byte[] bytes)
|
||||
{
|
||||
string license_code = "FC935C59-F248-48A3-9970-8A6BDB66FA86";
|
||||
string user_name = "poszukiwacz";
|
||||
|
||||
string ocrURL = @"http://www.ocrwebservice.com/restservices/processDocument?gettext=true&outputformat=txt&language=polish";
|
||||
byte[] uploadData = bytes;
|
||||
|
||||
HttpWebRequest request = CreateHttpRequest(ocrURL, user_name, license_code, "POST");
|
||||
request.ContentLength = uploadData.Length;
|
||||
|
||||
// Send request
|
||||
using (System.IO.Stream post = request.GetRequestStream())
|
||||
{
|
||||
post.Write(uploadData, 0, (int)uploadData.Length);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// Get response
|
||||
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
|
||||
{
|
||||
// Parse JSON response
|
||||
string strJSON = new System.IO.StreamReader(response.GetResponseStream()).ReadToEnd();
|
||||
OCRResponseData ocrResponse = JsonConvert.DeserializeObject<OCRResponseData>(strJSON);
|
||||
|
||||
return await Task.FromResult(ocrResponse.OCRText.First().First());
|
||||
|
||||
}
|
||||
}
|
||||
catch (WebException wex)
|
||||
{
|
||||
var x = string.Format("OCR API Error. HTTPCode:{0}", ((HttpWebResponse)wex.Response).StatusCode);
|
||||
throw wex;
|
||||
}
|
||||
/*
|
||||
var engine = new TesseractEngine(System.IO.Path.Combine(_env, "tessdata"),"eng+equ", EngineMode.Default);
|
||||
var img = Pix.LoadFromMemory(bytes);
|
||||
var res = engine.Process(img);
|
||||
var txt = res.GetText();
|
||||
|
||||
return await Task.FromResult(txt);
|
||||
*/
|
||||
|
||||
}
|
||||
private static HttpWebRequest CreateHttpRequest(string address_url, string user_name, string license_code, string http_method)
|
||||
{
|
||||
Uri address = new Uri(address_url);
|
||||
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(address);
|
||||
|
||||
byte[] authBytes = Encoding.UTF8.GetBytes(string.Format("{0}:{1}", user_name, license_code).ToCharArray());
|
||||
request.Headers["Authorization"] = "Basic " + Convert.ToBase64String(authBytes);
|
||||
request.Method = http_method;
|
||||
request.Timeout = 600000;
|
||||
|
||||
// Specify Response format to JSON or XML (application/json or application/xml)
|
||||
request.ContentType = "application/json";
|
||||
|
||||
return request;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,30 +35,6 @@ namespace Serwer.Infrastructure.Services
|
||||
}
|
||||
await _historyRepository.AddAsync(user, query);
|
||||
|
||||
var queries = query.Split('.').ToList();
|
||||
if (queries.Count > 2)
|
||||
{
|
||||
var q0 = queries[0].Split(' ');
|
||||
if (q0.Length < 3)
|
||||
{
|
||||
queries.RemoveAt(0);
|
||||
}
|
||||
if(queries.Last().Length < 5)
|
||||
{
|
||||
queries.RemoveAt(queries.Count - 1);
|
||||
}
|
||||
}
|
||||
query = String.Join(".", queries);
|
||||
var result = await sendRequest(query);
|
||||
if(result.Count == 0)
|
||||
{
|
||||
result = await sendRequest(queries.Last());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
private async Task<List<SearchResultDTO>> sendRequest(string query)
|
||||
{
|
||||
WebRequest webRequest = WebRequest.Create($"https://www.googleapis.com/customsearch/v1?key={apiKey}&cx={searchEngineId}&q={query}");
|
||||
using (var stream = new StreamReader(webRequest.GetResponse().GetResponseStream()))
|
||||
{
|
||||
@ -66,23 +42,16 @@ namespace Serwer.Infrastructure.Services
|
||||
dynamic jsonData = JsonConvert.DeserializeObject(response);
|
||||
|
||||
var results = new List<SearchResultDTO>();
|
||||
try
|
||||
foreach(var item in jsonData.items)
|
||||
{
|
||||
foreach (var item in jsonData.items)
|
||||
results.Add(new SearchResultDTO
|
||||
{
|
||||
results.Add(new SearchResultDTO
|
||||
{
|
||||
Title = item.title,
|
||||
Link = item.link,
|
||||
Snippet = item.snippet
|
||||
});
|
||||
}
|
||||
return results;
|
||||
}
|
||||
catch(Exception)
|
||||
{
|
||||
return results;
|
||||
Title = item.title,
|
||||
Link = item.link,
|
||||
Snippet = item.snippet
|
||||
});
|
||||
}
|
||||
return results;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,44 +1,50 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30717.126
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serwer.Core", "Serwer.Core\Serwer.Core.csproj", "{115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serwer.Infrastructure", "Serwer.Infrastructure\Serwer.Infrastructure.csproj", "{523E9EE6-B8D9-4E08-A9A0-50D7F872C79C}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82} = {115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serwer.Api", "Serwer.Api\Serwer.Api.csproj", "{335159FF-5AB8-48E5-A04C-778A46058204}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82} = {115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82}
|
||||
{523E9EE6-B8D9-4E08-A9A0-50D7F872C79C} = {523E9EE6-B8D9-4E08-A9A0-50D7F872C79C}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{523E9EE6-B8D9-4E08-A9A0-50D7F872C79C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{523E9EE6-B8D9-4E08-A9A0-50D7F872C79C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{523E9EE6-B8D9-4E08-A9A0-50D7F872C79C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{523E9EE6-B8D9-4E08-A9A0-50D7F872C79C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{335159FF-5AB8-48E5-A04C-778A46058204}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{335159FF-5AB8-48E5-A04C-778A46058204}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{335159FF-5AB8-48E5-A04C-778A46058204}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{335159FF-5AB8-48E5-A04C-778A46058204}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {30A333CB-6AC2-4EAD-B05B-926DB9690CED}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30717.126
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serwer.Tests", "Serwer.Tests\Serwer.Tests.csproj", "{4169F6FD-E08D-4329-BF87-A1411A9F1EF4}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serwer.Core", "Serwer.Core\Serwer.Core.csproj", "{115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serwer.Infrastructure", "Serwer.Infrastructure\Serwer.Infrastructure.csproj", "{523E9EE6-B8D9-4E08-A9A0-50D7F872C79C}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82} = {115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serwer.Api", "Serwer.Api\Serwer.Api.csproj", "{335159FF-5AB8-48E5-A04C-778A46058204}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82} = {115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82}
|
||||
{523E9EE6-B8D9-4E08-A9A0-50D7F872C79C} = {523E9EE6-B8D9-4E08-A9A0-50D7F872C79C}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{4169F6FD-E08D-4329-BF87-A1411A9F1EF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4169F6FD-E08D-4329-BF87-A1411A9F1EF4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4169F6FD-E08D-4329-BF87-A1411A9F1EF4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4169F6FD-E08D-4329-BF87-A1411A9F1EF4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{523E9EE6-B8D9-4E08-A9A0-50D7F872C79C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{523E9EE6-B8D9-4E08-A9A0-50D7F872C79C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{523E9EE6-B8D9-4E08-A9A0-50D7F872C79C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{523E9EE6-B8D9-4E08-A9A0-50D7F872C79C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{335159FF-5AB8-48E5-A04C-778A46058204}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{335159FF-5AB8-48E5-A04C-778A46058204}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{335159FF-5AB8-48E5-A04C-778A46058204}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{335159FF-5AB8-48E5-A04C-778A46058204}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {30A333CB-6AC2-4EAD-B05B-926DB9690CED}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
Loading…
Reference in New Issue
Block a user