Anpassungen Detailseite
Auswahlliste Gemeinden und Projekte
This commit is contained in:
@@ -53,6 +53,8 @@ namespace Jugenddienst_Stunden.Models {
|
||||
string apiUrl = args[0]; // Ersetzen Sie dies durch die tatsächliche URL der API
|
||||
string bearerToken = args[1]; // Ersetzen Sie hier durch Ihr tatsächliches Token
|
||||
|
||||
Preferences.Default.Set("apiUrl", apiUrl);
|
||||
|
||||
string data = await GetApiDataWithAuthAsync(apiUrl, bearerToken);
|
||||
|
||||
if (data != null) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Jugenddienst_Stunden.ViewModels;
|
||||
using Newtonsoft.Json;
|
||||
using System.Text;
|
||||
|
||||
@@ -41,25 +42,19 @@ namespace Jugenddienst_Stunden.Models {
|
||||
//throw new Exception("Keine Internetverbindung");
|
||||
} else {
|
||||
var tokendata = new TokenData(apiKey);
|
||||
|
||||
//try {
|
||||
string data = await Auth.GetApiDataWithAuthAsync(tokendata.url, tokendata.apiKey);
|
||||
if (data == "\"Lalala\"") {
|
||||
throw new Exception("Problem mit Token");
|
||||
}
|
||||
if (data != null) {
|
||||
OperatorVar = Newtonsoft.Json.JsonConvert.DeserializeObject<Operator>(data);
|
||||
Preferences.Default.Set("name", OperatorVar.name);
|
||||
Preferences.Default.Set("surname", OperatorVar.surname);
|
||||
}
|
||||
//} catch (Exception e) {
|
||||
// //AlertEvent?.Invoke(this, e.Message);
|
||||
// await App.Current.MainPage.DisplayAlert("Fehler",
|
||||
// e.Message,
|
||||
// "OK");
|
||||
//}
|
||||
|
||||
|
||||
|
||||
string data = await Auth.GetApiDataWithAuthAsync(tokendata.url, tokendata.apiKey);
|
||||
if (data == "\"Lalala\"") {
|
||||
throw new Exception("Problem mit Token");
|
||||
}
|
||||
if (data != null) {
|
||||
OperatorVar = JsonConvert.DeserializeObject<Operator>(data);
|
||||
Preferences.Default.Set("name", OperatorVar.name);
|
||||
Preferences.Default.Set("surname", OperatorVar.surname);
|
||||
Preferences.Default.Set("apiUrl", tokendata.url);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return OperatorVar;
|
||||
|
||||
@@ -12,7 +12,8 @@ using System.Collections.Generic;
|
||||
namespace Jugenddienst_Stunden.Models {
|
||||
internal class Stunde : ObservableObject {
|
||||
|
||||
|
||||
public DateTime Date { get; set; }
|
||||
private static Hours Hours { get; set; }
|
||||
|
||||
//Default-Werte zum Testen
|
||||
|
||||
@@ -25,48 +26,22 @@ namespace Jugenddienst_Stunden.Models {
|
||||
public static string apiKey = Preferences.Default.Get("apiKey", "MTQzfEFlMVRjQXdZMnI4RmpxZ0FSY3A0VEN2bVZYVXxodHRwOi8vaG91cnMuZGF1bmkubWluZS5udTo4MS9hcHBhcGk=");
|
||||
public static string name = Preferences.Default.Get("name", "Christine");
|
||||
public static string surname = Preferences.Default.Get("surname", "Feichter");
|
||||
public static string apiUrl = Preferences.Default.Get("apiUrl", "https://");
|
||||
|
||||
//Damian
|
||||
//public static string apiKey = Preferences.Default.Get("apiKey", "MTU0fGpkQUNYTGkvcjMvVk4rNkMyK0dDQkJmMkFwVXxodHRwOi8vaG91cnMuZGF1bmkubWluZS5udTo4MS9hcHBhcGk=");
|
||||
|
||||
//private static readonly string requestUrl = $"{BaseAddress}/appapi?hours";
|
||||
|
||||
public DateTime Date { get; set; }
|
||||
private static Hours Hours { get; set; }
|
||||
|
||||
|
||||
|
||||
public static async Task<Hours> LoadData() {
|
||||
|
||||
//Temporär fix für virtuelle App
|
||||
//apiKey = "MTAyfEJZZnB1L3VwcnhoVms0dDlLZENPZWtUVy85b3xodHRwOi8vaG91cnMuZGF1bmkubWluZS5udTo4MS9hcHBhcGk=";
|
||||
//name = "Kathi";
|
||||
//surname = "Wegi";
|
||||
|
||||
//apiKey = "MTQzfEFlMVRjQXdZMnI4RmpxZ0FSY3A0VEN2bVZYVXxodHRwOi8vaG91cnMuZGF1bmkubWluZS5udTo4MS9hcHBhcGk=";
|
||||
//name = "Chri";
|
||||
//surname = "Fe";
|
||||
|
||||
//apiKey = "MTI3fDEyYURVdHVZVWRaZk91eDlNcjZDUFlTdmdkNHxodHRwOi8vaG91cnMuZGF1bmkubWluZS5udTo4MS9hcHBhcGk=";
|
||||
//name = "Ju";
|
||||
//surname = "Ze";
|
||||
|
||||
//apiKey = "M3wvK09XQkZod1l4SXlVcGVWazdlUmYrTnBWaUl8aHR0cHM6Ly9ob3Vycy5waWRhLmluZm8vYXBwYXBp";
|
||||
//name = "Le";
|
||||
//surname = "Ma";
|
||||
|
||||
//apiKey = "OXxzTkxVWjJqdmI2VXFrdUhtcktwK1d1YU41cTh8aHR0cDovL2hvdXJzLmRhdW5pLm1pbmUubnU6ODEvYXBwYXBp";
|
||||
//name = "Eli";
|
||||
//surname = "Gap";
|
||||
|
||||
//apiKey = "NXw5eFF0RVQ5TFBMTXFVeFIzQURtd01idHFUb2d8aHR0cDovL2hvdXJzLmRhdW5pLm1pbmUubnU6ODEvYXBwYXBp"; //Johannes Fink
|
||||
|
||||
//Preferences.Default.Set("apiKey", apiKey);
|
||||
//Preferences.Default.Set("name", name);
|
||||
//Preferences.Default.Set("surname", surname);
|
||||
|
||||
|
||||
|
||||
|
||||
Hours hours = new Hours();
|
||||
|
||||
@@ -88,9 +63,6 @@ namespace Jugenddienst_Stunden.Models {
|
||||
}
|
||||
|
||||
hours = JsonConvert.DeserializeObject<Hours>(data);
|
||||
//Preferences.Default.Set("name", hours.operator_api.name);
|
||||
//Preferences.Default.Set("surname", hours.operator_api.surname);
|
||||
|
||||
|
||||
}
|
||||
return hours;
|
||||
@@ -99,7 +71,6 @@ namespace Jugenddienst_Stunden.Models {
|
||||
|
||||
public static async Task<List<DayTime>> LoadDay(DateTime date) {
|
||||
|
||||
|
||||
List<DayTime> daytimes = new List<DayTime>();
|
||||
|
||||
if (Connectivity.Current.NetworkAccess == NetworkAccess.None) {
|
||||
@@ -121,25 +92,23 @@ namespace Jugenddienst_Stunden.Models {
|
||||
|
||||
//daytimes = System.Text.Json.JsonSerializer.Deserialize<List<DayTime>>(data);
|
||||
daytimes = JsonConvert.DeserializeObject<List<DayTime>>(data);
|
||||
//Preferences.Default.Set("name", hours.operator_api.name);
|
||||
//Preferences.Default.Set("surname", hours.operator_api.surname);
|
||||
|
||||
|
||||
}
|
||||
//Hours = hours;
|
||||
return daytimes;
|
||||
}
|
||||
public event EventHandler<string> AlertEvent;
|
||||
|
||||
|
||||
public static async Task<DayTime> LoadEntry(int id) {
|
||||
|
||||
var tokendata = new TokenData(apiKey);
|
||||
|
||||
var data = await Auth.GetApiDataWithAuthAsync(tokendata.url + "?id=" + id, tokendata.apiKey);
|
||||
if(String.IsNullOrEmpty(data))
|
||||
AlertEvent?.Invoke(this, "Auswahl enthält keine Daten");
|
||||
|
||||
//DayTime hours = Hours.daytime.Find(x => x.id == id);
|
||||
DayTime hours = JsonConvert.DeserializeObject<DayTime>(data);
|
||||
hours.TimeSpanVon = hours.begin.ToTimeSpan();
|
||||
hours.TimeSpanBis = hours.end.ToTimeSpan();
|
||||
|
||||
return hours;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user