diff --git a/BetterIServ.Backend/Controllers/IServController.cs b/BetterIServ.Backend/Controllers/IServController.cs index 0f12623..b2af1a5 100644 --- a/BetterIServ.Backend/Controllers/IServController.cs +++ b/BetterIServ.Backend/Controllers/IServController.cs @@ -12,7 +12,7 @@ public class IServController : ControllerBase { [HttpPost("login")] public async Task> GetAuthKeysV2([FromBody] Credentials credentials) { - await using var browser = await Puppeteer.LaunchAsync(new LaunchOptions { Headless = true }); + await using var browser = await Puppeteer.LaunchAsync(new LaunchOptions { Headless = true, Args = new []{"--no-sandbox"} }); await using var page = await browser.NewPageAsync(); await page.GoToAsync($"https://{credentials.Domain}/iserv/auth/login"); @@ -21,7 +21,7 @@ public class IServController : ControllerBase { await page.Keyboard.PressAsync("Tab"); await page.Keyboard.TypeAsync(credentials.Password); await page.ClickAsync("body > div > main > div > div.panel-body > form > div.row > div:nth-child(1) > button"); - await Task.Delay(500); + await Task.Delay(2000); var authKeys = new AuthKeys(); var cookies = await page.GetCookiesAsync(); diff --git a/BetterIServ.Backend/Controllers/MailController.cs b/BetterIServ.Backend/Controllers/MailController.cs index ff967ba..753c8da 100644 --- a/BetterIServ.Backend/Controllers/MailController.cs +++ b/BetterIServ.Backend/Controllers/MailController.cs @@ -68,7 +68,7 @@ public class MailController : ControllerBase { Subject = message.Subject.Replace("(Aspose.Email Evaluation)", ""), Time = message.Date, Read = true, - Message = message.Body.Replace("EVALUATION ONLY. CREATED WITH ASPOSE.EMAIL FOR .NET. COPYRIGHT 2002-2022 ASPOSE PTY LTD. \r\n http://www.aspose.com/corporate/purchase/end-user-license-agreement.aspx: View EULA Online\r\n", ""), + Message = message.Body.Split("View EULA")[1], Attachments = message.Attachments.Select(a => a.Name).ToArray() }; diff --git a/BetterIServ.Backend/Dockerfile b/BetterIServ.Backend/Dockerfile index 474f196..902dead 100644 --- a/BetterIServ.Backend/Dockerfile +++ b/BetterIServ.Backend/Dockerfile @@ -3,12 +3,29 @@ WORKDIR /app EXPOSE 80 EXPOSE 443 +##################### +#PUPPETEER RECIPE +##################### +# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others) +# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer +# installs, work. +RUN apt-get update && apt-get -f install && apt-get -y install wget gnupg2 apt-utils +RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ + && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ + && apt-get update \ + && apt-get install -y google-chrome-unstable --no-install-recommends \ + && rm -rf /var/lib/apt/lists/* +##################### +#END PUPPETEER RECIPE +##################### +ENV PUPPETEER_EXECUTABLE_PATH "/usr/bin/google-chrome-unstable" + FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build WORKDIR /src -COPY ["BetterIServ.Backend/BetterIServ.Backend.csproj", "BetterIServ.Backend/"] -RUN dotnet restore "BetterIServ.Backend/BetterIServ.Backend.csproj" +COPY ["BetterIServ.Backend.csproj", ""] +RUN dotnet restore "BetterIServ.Backend.csproj" COPY . . -WORKDIR "/src/BetterIServ.Backend" +WORKDIR "/src" RUN dotnet build "BetterIServ.Backend.csproj" -c Release -o /app/build FROM build AS publish diff --git a/BetterIServ.Backend/Entities/AuthKeys.cs b/BetterIServ.Backend/Entities/AuthKeys.cs index 5aceeb1..ab276de 100644 --- a/BetterIServ.Backend/Entities/AuthKeys.cs +++ b/BetterIServ.Backend/Entities/AuthKeys.cs @@ -1,11 +1,11 @@ namespace BetterIServ.Backend.Entities; public struct AuthKeys { - public string Session { get; set; } - public string Sat { get; set; } - public string AuthSid { get; set; } - public string SatId { get; set; } - public string AuthSession { get; set; } + public string? Session { get; set; } + public string? Sat { get; set; } + public string? AuthSid { get; set; } + public string? SatId { get; set; } + public string? AuthSession { get; set; } public string ToCookieString() { return $"IServSession={Session}; IServSAT={Sat}; IServAuthSID={AuthSid}; IServSATId={SatId}; IServAuthSession={AuthSession}"; diff --git a/BetterIServ.Backend/Program.cs b/BetterIServ.Backend/Program.cs index 552506a..e333fc9 100644 --- a/BetterIServ.Backend/Program.cs +++ b/BetterIServ.Backend/Program.cs @@ -1,10 +1,13 @@ -using PuppeteerSharp; - -await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultChromiumRevision); - var builder = WebApplication.CreateBuilder(args); // Add services to the container. +builder.Services.AddCors(options => { + options.AddPolicy("BetterIserv", policy => { + policy.WithOrigins("http://localhost", "http://localhost:8100") + .AllowAnyHeader() + .AllowAnyMethod(); + }); +}); builder.Services.AddControllers(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle @@ -19,12 +22,7 @@ if (app.Environment.IsDevelopment()) { app.UseSwaggerUI(); } -app.UseCors(options => { - options.WithOrigins("http://localhost:8100"); - options.AllowCredentials(); - options.AllowAnyHeader(); - options.AllowAnyMethod(); -}); +app.UseCors("BetterIserv"); app.UseAuthorization(); diff --git a/BetterIServ.Mobile/android/.gitignore b/BetterIServ.Mobile/android/.gitignore new file mode 100644 index 0000000..48354a3 --- /dev/null +++ b/BetterIServ.Mobile/android/.gitignore @@ -0,0 +1,101 @@ +# Using Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore + +# Built application files +*.apk +*.aar +*.ap_ +*.aab + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ +out/ +# Uncomment the following line in case you need and you don't have the release build type files in your app +# release/ + +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Android Studio Navigation editor temp files +.navigation/ + +# Android Studio captures folder +captures/ + +# IntelliJ +*.iml +.idea/workspace.xml +.idea/tasks.xml +.idea/gradle.xml +.idea/assetWizardSettings.xml +.idea/dictionaries +.idea/libraries +# Android Studio 3 in .gitignore file. +.idea/caches +.idea/modules.xml +# Comment next line if keeping position of elements in Navigation Editor is relevant for you +.idea/navEditor.xml + +# Keystore files +# Uncomment the following lines if you do not want to check your keystore files in. +#*.jks +#*.keystore + +# External native build folder generated in Android Studio 2.2 and later +.externalNativeBuild +.cxx/ + +# Google Services (e.g. APIs or Firebase) +# google-services.json + +# Freeline +freeline.py +freeline/ +freeline_project_description.json + +# fastlane +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output +fastlane/readme.md + +# Version control +vcs.xml + +# lint +lint/intermediates/ +lint/generated/ +lint/outputs/ +lint/tmp/ +# lint/reports/ + +# Android Profiling +*.hprof + +# Cordova plugins for Capacitor +capacitor-cordova-android-plugins + +# Copied web assets +app/src/main/assets/public + +# Generated Config files +app/src/main/assets/capacitor.config.json +app/src/main/assets/capacitor.plugins.json +app/src/main/res/xml/config.xml diff --git a/BetterIServ.Mobile/android/app/.gitignore b/BetterIServ.Mobile/android/app/.gitignore new file mode 100644 index 0000000..043df80 --- /dev/null +++ b/BetterIServ.Mobile/android/app/.gitignore @@ -0,0 +1,2 @@ +/build/* +!/build/.npmkeep diff --git a/BetterIServ.Mobile/android/app/build.gradle b/BetterIServ.Mobile/android/app/build.gradle new file mode 100644 index 0000000..dc860d1 --- /dev/null +++ b/BetterIServ.Mobile/android/app/build.gradle @@ -0,0 +1,54 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion rootProject.ext.compileSdkVersion + defaultConfig { + applicationId "de.leonhoppe.betteriserv" + minSdkVersion rootProject.ext.minSdkVersion + targetSdkVersion rootProject.ext.targetSdkVersion + versionCode 1 + versionName "1.0" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + aaptOptions { + // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. + // Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61 + ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~' + } + } + buildTypes { + release { + debuggable false + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +repositories { + flatDir{ + dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs' + } +} + +dependencies { + implementation fileTree(include: ['*.jar'], dir: 'libs') + implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion" + implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion" + implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion" + implementation project(':capacitor-android') + testImplementation "junit:junit:$junitVersion" + androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion" + androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion" + implementation project(':capacitor-cordova-android-plugins') +} + +apply from: 'capacitor.build.gradle' + +try { + def servicesJSON = file('google-services.json') + if (servicesJSON.text) { + apply plugin: 'com.google.gms.google-services' + } +} catch(Exception e) { + logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work") +} diff --git a/BetterIServ.Mobile/android/app/capacitor.build.gradle b/BetterIServ.Mobile/android/app/capacitor.build.gradle new file mode 100644 index 0000000..06a5be4 --- /dev/null +++ b/BetterIServ.Mobile/android/app/capacitor.build.gradle @@ -0,0 +1,22 @@ +// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN + +android { + compileOptions { + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 + } +} + +apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle" +dependencies { + implementation project(':capacitor-app') + implementation project(':capacitor-haptics') + implementation project(':capacitor-keyboard') + implementation project(':capacitor-status-bar') + +} + + +if (hasProperty('postBuildExtras')) { + postBuildExtras() +} diff --git a/BetterIServ.Mobile/android/app/proguard-rules.pro b/BetterIServ.Mobile/android/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/BetterIServ.Mobile/android/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/BetterIServ.Mobile/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java b/BetterIServ.Mobile/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java new file mode 100644 index 0000000..f2c2217 --- /dev/null +++ b/BetterIServ.Mobile/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.getcapacitor.myapp; + +import static org.junit.Assert.*; + +import android.content.Context; +import androidx.test.ext.junit.runners.AndroidJUnit4; +import androidx.test.platform.app.InstrumentationRegistry; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + + assertEquals("com.getcapacitor.app", appContext.getPackageName()); + } +} diff --git a/BetterIServ.Mobile/android/app/src/main/AndroidManifest.xml b/BetterIServ.Mobile/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..a9eabd4 --- /dev/null +++ b/BetterIServ.Mobile/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BetterIServ.Mobile/android/app/src/main/java/de/leonhoppe/betteriserv/MainActivity.java b/BetterIServ.Mobile/android/app/src/main/java/de/leonhoppe/betteriserv/MainActivity.java new file mode 100644 index 0000000..cea22ca --- /dev/null +++ b/BetterIServ.Mobile/android/app/src/main/java/de/leonhoppe/betteriserv/MainActivity.java @@ -0,0 +1,5 @@ +package de.leonhoppe.betteriserv; + +import com.getcapacitor.BridgeActivity; + +public class MainActivity extends BridgeActivity {} diff --git a/BetterIServ.Mobile/android/app/src/main/res/drawable-land-hdpi/splash.png b/BetterIServ.Mobile/android/app/src/main/res/drawable-land-hdpi/splash.png new file mode 100644 index 0000000..49baaf4 Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/drawable-land-hdpi/splash.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/drawable-land-mdpi/splash.png b/BetterIServ.Mobile/android/app/src/main/res/drawable-land-mdpi/splash.png new file mode 100644 index 0000000..e11865c Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/drawable-land-mdpi/splash.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/drawable-land-xhdpi/splash.png b/BetterIServ.Mobile/android/app/src/main/res/drawable-land-xhdpi/splash.png new file mode 100644 index 0000000..a0c943c Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/drawable-land-xhdpi/splash.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/drawable-land-xxhdpi/splash.png b/BetterIServ.Mobile/android/app/src/main/res/drawable-land-xxhdpi/splash.png new file mode 100644 index 0000000..4a27c98 Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/drawable-land-xxhdpi/splash.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/drawable-land-xxxhdpi/splash.png b/BetterIServ.Mobile/android/app/src/main/res/drawable-land-xxxhdpi/splash.png new file mode 100644 index 0000000..b326e46 Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/drawable-land-xxxhdpi/splash.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/drawable-port-hdpi/splash.png b/BetterIServ.Mobile/android/app/src/main/res/drawable-port-hdpi/splash.png new file mode 100644 index 0000000..19bd2f1 Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/drawable-port-hdpi/splash.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/drawable-port-mdpi/splash.png b/BetterIServ.Mobile/android/app/src/main/res/drawable-port-mdpi/splash.png new file mode 100644 index 0000000..64d0f06 Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/drawable-port-mdpi/splash.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/drawable-port-xhdpi/splash.png b/BetterIServ.Mobile/android/app/src/main/res/drawable-port-xhdpi/splash.png new file mode 100644 index 0000000..9f3824d Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/drawable-port-xhdpi/splash.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/drawable-port-xxhdpi/splash.png b/BetterIServ.Mobile/android/app/src/main/res/drawable-port-xxhdpi/splash.png new file mode 100644 index 0000000..b266fd0 Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/drawable-port-xxhdpi/splash.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/drawable-port-xxxhdpi/splash.png b/BetterIServ.Mobile/android/app/src/main/res/drawable-port-xxxhdpi/splash.png new file mode 100644 index 0000000..ce3011f Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/drawable-port-xxxhdpi/splash.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/BetterIServ.Mobile/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..c7bd21d --- /dev/null +++ b/BetterIServ.Mobile/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/BetterIServ.Mobile/android/app/src/main/res/drawable/ic_launcher_background.xml b/BetterIServ.Mobile/android/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..d5fccc5 --- /dev/null +++ b/BetterIServ.Mobile/android/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BetterIServ.Mobile/android/app/src/main/res/drawable/splash.png b/BetterIServ.Mobile/android/app/src/main/res/drawable/splash.png new file mode 100644 index 0000000..e11865c Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/drawable/splash.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/layout/activity_main.xml b/BetterIServ.Mobile/android/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..b5ad138 --- /dev/null +++ b/BetterIServ.Mobile/android/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,12 @@ + + + + + diff --git a/BetterIServ.Mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/BetterIServ.Mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..80b730f --- /dev/null +++ b/BetterIServ.Mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/BetterIServ.Mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/BetterIServ.Mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..036d09b --- /dev/null +++ b/BetterIServ.Mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/BetterIServ.Mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/BetterIServ.Mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..1acf5a7 Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/BetterIServ.Mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..1acf5a7 Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/BetterIServ.Mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..1acf5a7 Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/BetterIServ.Mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..dccaee2 Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/BetterIServ.Mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..dccaee2 Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/BetterIServ.Mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..dccaee2 Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/BetterIServ.Mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..a8117cf Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/BetterIServ.Mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..a8117cf Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/BetterIServ.Mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..a8117cf Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/BetterIServ.Mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..a11c17d Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/BetterIServ.Mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..a11c17d Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/BetterIServ.Mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..a11c17d Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/BetterIServ.Mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..ff92e5e Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/BetterIServ.Mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..ff92e5e Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/BetterIServ.Mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..ff92e5e Binary files /dev/null and b/BetterIServ.Mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/BetterIServ.Mobile/android/app/src/main/res/values/ic_launcher_background.xml b/BetterIServ.Mobile/android/app/src/main/res/values/ic_launcher_background.xml new file mode 100644 index 0000000..c5d5899 --- /dev/null +++ b/BetterIServ.Mobile/android/app/src/main/res/values/ic_launcher_background.xml @@ -0,0 +1,4 @@ + + + #FFFFFF + \ No newline at end of file diff --git a/BetterIServ.Mobile/android/app/src/main/res/values/strings.xml b/BetterIServ.Mobile/android/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..8fb2156 --- /dev/null +++ b/BetterIServ.Mobile/android/app/src/main/res/values/strings.xml @@ -0,0 +1,7 @@ + + + BetterIServ + BetterIServ + de.leonhoppe.betteriserv + de.leonhoppe.betteriserv + diff --git a/BetterIServ.Mobile/android/app/src/main/res/values/styles.xml b/BetterIServ.Mobile/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..be874e5 --- /dev/null +++ b/BetterIServ.Mobile/android/app/src/main/res/values/styles.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/BetterIServ.Mobile/android/app/src/main/res/xml/file_paths.xml b/BetterIServ.Mobile/android/app/src/main/res/xml/file_paths.xml new file mode 100644 index 0000000..bd0c4d8 --- /dev/null +++ b/BetterIServ.Mobile/android/app/src/main/res/xml/file_paths.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/BetterIServ.Mobile/android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java b/BetterIServ.Mobile/android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java new file mode 100644 index 0000000..0297327 --- /dev/null +++ b/BetterIServ.Mobile/android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java @@ -0,0 +1,18 @@ +package com.getcapacitor.myapp; + +import static org.junit.Assert.*; + +import org.junit.Test; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} diff --git a/BetterIServ.Mobile/android/build.gradle b/BetterIServ.Mobile/android/build.gradle new file mode 100644 index 0000000..fe3625e --- /dev/null +++ b/BetterIServ.Mobile/android/build.gradle @@ -0,0 +1,29 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + + repositories { + google() + mavenCentral() + } + dependencies { + classpath 'com.android.tools.build:gradle:7.2.1' + classpath 'com.google.gms:google-services:4.3.13' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +apply from: "variables.gradle" + +allprojects { + repositories { + google() + mavenCentral() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/BetterIServ.Mobile/android/capacitor.settings.gradle b/BetterIServ.Mobile/android/capacitor.settings.gradle new file mode 100644 index 0000000..bd35873 --- /dev/null +++ b/BetterIServ.Mobile/android/capacitor.settings.gradle @@ -0,0 +1,15 @@ +// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN +include ':capacitor-android' +project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor') + +include ':capacitor-app' +project(':capacitor-app').projectDir = new File('../node_modules/@capacitor/app/android') + +include ':capacitor-haptics' +project(':capacitor-haptics').projectDir = new File('../node_modules/@capacitor/haptics/android') + +include ':capacitor-keyboard' +project(':capacitor-keyboard').projectDir = new File('../node_modules/@capacitor/keyboard/android') + +include ':capacitor-status-bar' +project(':capacitor-status-bar').projectDir = new File('../node_modules/@capacitor/status-bar/android') diff --git a/BetterIServ.Mobile/android/gradle.properties b/BetterIServ.Mobile/android/gradle.properties new file mode 100644 index 0000000..0566c22 --- /dev/null +++ b/BetterIServ.Mobile/android/gradle.properties @@ -0,0 +1,24 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx1536m + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true + +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app's APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Automatically convert third-party libraries to use AndroidX +android.enableJetifier=true diff --git a/BetterIServ.Mobile/android/gradle/wrapper/gradle-wrapper.jar b/BetterIServ.Mobile/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..41d9927 Binary files /dev/null and b/BetterIServ.Mobile/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/BetterIServ.Mobile/android/gradle/wrapper/gradle-wrapper.properties b/BetterIServ.Mobile/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..92f06b5 --- /dev/null +++ b/BetterIServ.Mobile/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/BetterIServ.Mobile/android/gradlew b/BetterIServ.Mobile/android/gradlew new file mode 100644 index 0000000..1b6c787 --- /dev/null +++ b/BetterIServ.Mobile/android/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/BetterIServ.Mobile/android/gradlew.bat b/BetterIServ.Mobile/android/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/BetterIServ.Mobile/android/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/BetterIServ.Mobile/android/settings.gradle b/BetterIServ.Mobile/android/settings.gradle new file mode 100644 index 0000000..3b4431d --- /dev/null +++ b/BetterIServ.Mobile/android/settings.gradle @@ -0,0 +1,5 @@ +include ':app' +include ':capacitor-cordova-android-plugins' +project(':capacitor-cordova-android-plugins').projectDir = new File('./capacitor-cordova-android-plugins/') + +apply from: 'capacitor.settings.gradle' \ No newline at end of file diff --git a/BetterIServ.Mobile/android/variables.gradle b/BetterIServ.Mobile/android/variables.gradle new file mode 100644 index 0000000..777bd7e --- /dev/null +++ b/BetterIServ.Mobile/android/variables.gradle @@ -0,0 +1,16 @@ +ext { + minSdkVersion = 22 + compileSdkVersion = 32 + targetSdkVersion = 32 + androidxActivityVersion = '1.4.0' + androidxAppCompatVersion = '1.4.2' + androidxCoordinatorLayoutVersion = '1.2.0' + androidxCoreVersion = '1.8.0' + androidxFragmentVersion = '1.4.1' + coreSplashScreenVersion = '1.0.0-rc01' + androidxWebkitVersion = '1.4.0' + junitVersion = '4.13.2' + androidxJunitVersion = '1.1.3' + androidxEspressoCoreVersion = '3.4.0' + cordovaAndroidVersion = '10.1.1' +} \ No newline at end of file diff --git a/BetterIServ.Mobile/capacitor.config.ts b/BetterIServ.Mobile/capacitor.config.ts index 57d9940..4097cda 100644 --- a/BetterIServ.Mobile/capacitor.config.ts +++ b/BetterIServ.Mobile/capacitor.config.ts @@ -1,8 +1,8 @@ import { CapacitorConfig } from '@capacitor/cli'; const config: CapacitorConfig = { - appId: 'io.ionic.starter', - appName: 'BetterIServ.Mobile', + appId: 'de.leonhoppe.betteriserv', + appName: 'BetterIServ', webDir: 'www', bundledWebRuntime: false }; diff --git a/BetterIServ.Mobile/package-lock.json b/BetterIServ.Mobile/package-lock.json index 17790a6..e1defa2 100644 --- a/BetterIServ.Mobile/package-lock.json +++ b/BetterIServ.Mobile/package-lock.json @@ -15,6 +15,7 @@ "@angular/platform-browser-dynamic": "^15.0.0", "@angular/router": "^15.0.0", "@awesome-cordova-plugins/file": "^6.3.0", + "@capacitor/android": "4.7.3", "@capacitor/app": "4.1.1", "@capacitor/core": "4.7.3", "@capacitor/haptics": "4.1.0", @@ -2408,6 +2409,14 @@ "node": ">=6.9.0" } }, + "node_modules/@capacitor/android": { + "version": "4.7.3", + "resolved": "https://registry.npmjs.org/@capacitor/android/-/android-4.7.3.tgz", + "integrity": "sha512-TmVg7vbAt6Iw0FWc51dLlW1gRMtSeIQ6qVLFJ1/sl2SYLXpgCHh8v/LfhqQ93NurgM+6SKFxOycGgg1FIBaLGw==", + "peerDependencies": { + "@capacitor/core": "^4.7.0" + } + }, "node_modules/@capacitor/app": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/@capacitor/app/-/app-4.1.1.tgz", diff --git a/BetterIServ.Mobile/package.json b/BetterIServ.Mobile/package.json index 6a06441..819d0e2 100644 --- a/BetterIServ.Mobile/package.json +++ b/BetterIServ.Mobile/package.json @@ -21,6 +21,7 @@ "@angular/platform-browser-dynamic": "^15.0.0", "@angular/router": "^15.0.0", "@awesome-cordova-plugins/file": "^6.3.0", + "@capacitor/android": "4.7.3", "@capacitor/app": "4.1.1", "@capacitor/core": "4.7.3", "@capacitor/haptics": "4.1.0", diff --git a/BetterIServ.Mobile/resources/android/icon/drawable-hdpi-icon.png b/BetterIServ.Mobile/resources/android/icon/drawable-hdpi-icon.png new file mode 100644 index 0000000..1acf5a7 Binary files /dev/null and b/BetterIServ.Mobile/resources/android/icon/drawable-hdpi-icon.png differ diff --git a/BetterIServ.Mobile/resources/android/icon/drawable-ldpi-icon.png b/BetterIServ.Mobile/resources/android/icon/drawable-ldpi-icon.png new file mode 100644 index 0000000..58aba61 Binary files /dev/null and b/BetterIServ.Mobile/resources/android/icon/drawable-ldpi-icon.png differ diff --git a/BetterIServ.Mobile/resources/android/icon/drawable-mdpi-icon.png b/BetterIServ.Mobile/resources/android/icon/drawable-mdpi-icon.png new file mode 100644 index 0000000..dccaee2 Binary files /dev/null and b/BetterIServ.Mobile/resources/android/icon/drawable-mdpi-icon.png differ diff --git a/BetterIServ.Mobile/resources/android/icon/drawable-xhdpi-icon.png b/BetterIServ.Mobile/resources/android/icon/drawable-xhdpi-icon.png new file mode 100644 index 0000000..a8117cf Binary files /dev/null and b/BetterIServ.Mobile/resources/android/icon/drawable-xhdpi-icon.png differ diff --git a/BetterIServ.Mobile/resources/android/icon/drawable-xxhdpi-icon.png b/BetterIServ.Mobile/resources/android/icon/drawable-xxhdpi-icon.png new file mode 100644 index 0000000..a11c17d Binary files /dev/null and b/BetterIServ.Mobile/resources/android/icon/drawable-xxhdpi-icon.png differ diff --git a/BetterIServ.Mobile/resources/android/icon/drawable-xxxhdpi-icon.png b/BetterIServ.Mobile/resources/android/icon/drawable-xxxhdpi-icon.png new file mode 100644 index 0000000..ff92e5e Binary files /dev/null and b/BetterIServ.Mobile/resources/android/icon/drawable-xxxhdpi-icon.png differ diff --git a/BetterIServ.Mobile/resources/android/splash/drawable-land-hdpi-screen.png b/BetterIServ.Mobile/resources/android/splash/drawable-land-hdpi-screen.png new file mode 100644 index 0000000..49baaf4 Binary files /dev/null and b/BetterIServ.Mobile/resources/android/splash/drawable-land-hdpi-screen.png differ diff --git a/BetterIServ.Mobile/resources/android/splash/drawable-land-ldpi-screen.png b/BetterIServ.Mobile/resources/android/splash/drawable-land-ldpi-screen.png new file mode 100644 index 0000000..2b1a019 Binary files /dev/null and b/BetterIServ.Mobile/resources/android/splash/drawable-land-ldpi-screen.png differ diff --git a/BetterIServ.Mobile/resources/android/splash/drawable-land-mdpi-screen.png b/BetterIServ.Mobile/resources/android/splash/drawable-land-mdpi-screen.png new file mode 100644 index 0000000..e11865c Binary files /dev/null and b/BetterIServ.Mobile/resources/android/splash/drawable-land-mdpi-screen.png differ diff --git a/BetterIServ.Mobile/resources/android/splash/drawable-land-xhdpi-screen.png b/BetterIServ.Mobile/resources/android/splash/drawable-land-xhdpi-screen.png new file mode 100644 index 0000000..a0c943c Binary files /dev/null and b/BetterIServ.Mobile/resources/android/splash/drawable-land-xhdpi-screen.png differ diff --git a/BetterIServ.Mobile/resources/android/splash/drawable-land-xxhdpi-screen.png b/BetterIServ.Mobile/resources/android/splash/drawable-land-xxhdpi-screen.png new file mode 100644 index 0000000..4a27c98 Binary files /dev/null and b/BetterIServ.Mobile/resources/android/splash/drawable-land-xxhdpi-screen.png differ diff --git a/BetterIServ.Mobile/resources/android/splash/drawable-land-xxxhdpi-screen.png b/BetterIServ.Mobile/resources/android/splash/drawable-land-xxxhdpi-screen.png new file mode 100644 index 0000000..b326e46 Binary files /dev/null and b/BetterIServ.Mobile/resources/android/splash/drawable-land-xxxhdpi-screen.png differ diff --git a/BetterIServ.Mobile/resources/android/splash/drawable-port-hdpi-screen.png b/BetterIServ.Mobile/resources/android/splash/drawable-port-hdpi-screen.png new file mode 100644 index 0000000..19bd2f1 Binary files /dev/null and b/BetterIServ.Mobile/resources/android/splash/drawable-port-hdpi-screen.png differ diff --git a/BetterIServ.Mobile/resources/android/splash/drawable-port-ldpi-screen.png b/BetterIServ.Mobile/resources/android/splash/drawable-port-ldpi-screen.png new file mode 100644 index 0000000..ae3ae54 Binary files /dev/null and b/BetterIServ.Mobile/resources/android/splash/drawable-port-ldpi-screen.png differ diff --git a/BetterIServ.Mobile/resources/android/splash/drawable-port-mdpi-screen.png b/BetterIServ.Mobile/resources/android/splash/drawable-port-mdpi-screen.png new file mode 100644 index 0000000..64d0f06 Binary files /dev/null and b/BetterIServ.Mobile/resources/android/splash/drawable-port-mdpi-screen.png differ diff --git a/BetterIServ.Mobile/resources/android/splash/drawable-port-xhdpi-screen.png b/BetterIServ.Mobile/resources/android/splash/drawable-port-xhdpi-screen.png new file mode 100644 index 0000000..9f3824d Binary files /dev/null and b/BetterIServ.Mobile/resources/android/splash/drawable-port-xhdpi-screen.png differ diff --git a/BetterIServ.Mobile/resources/android/splash/drawable-port-xxhdpi-screen.png b/BetterIServ.Mobile/resources/android/splash/drawable-port-xxhdpi-screen.png new file mode 100644 index 0000000..b266fd0 Binary files /dev/null and b/BetterIServ.Mobile/resources/android/splash/drawable-port-xxhdpi-screen.png differ diff --git a/BetterIServ.Mobile/resources/android/splash/drawable-port-xxxhdpi-screen.png b/BetterIServ.Mobile/resources/android/splash/drawable-port-xxxhdpi-screen.png new file mode 100644 index 0000000..ce3011f Binary files /dev/null and b/BetterIServ.Mobile/resources/android/splash/drawable-port-xxxhdpi-screen.png differ diff --git a/BetterIServ.Mobile/resources/icon.png b/BetterIServ.Mobile/resources/icon.png new file mode 100644 index 0000000..d7f58c2 Binary files /dev/null and b/BetterIServ.Mobile/resources/icon.png differ diff --git a/BetterIServ.Mobile/resources/splash.png b/BetterIServ.Mobile/resources/splash.png new file mode 100644 index 0000000..acb99f3 Binary files /dev/null and b/BetterIServ.Mobile/resources/splash.png differ diff --git a/BetterIServ.Mobile/src/app/api/iserv.service.ts b/BetterIServ.Mobile/src/app/api/iserv.service.ts index 39d1622..3806f91 100644 --- a/BetterIServ.Mobile/src/app/api/iserv.service.ts +++ b/BetterIServ.Mobile/src/app/api/iserv.service.ts @@ -2,6 +2,8 @@ import { Injectable } from '@angular/core'; import {HttpClient} from "@angular/common/http"; import {Userdata, AuthKeys} from "../entities/userdata"; import {firstValueFrom} from "rxjs"; +import {environment} from "../../environments/environment"; +import {Course} from "../entities/course"; @Injectable({ providedIn: 'root', @@ -10,7 +12,7 @@ export class IServService { public userdata?: Userdata; public keys?: AuthKeys; - public backend: string = "http://localhost:5273"; + public backend: string = environment.backend; public courseNames: {[id: string]: string} = { ["Bi"]: "Biologie", @@ -32,6 +34,14 @@ export class IServService { ["Sf"]: "Seminarfach", ["DS"]: "Darstellendes Spiel", }; + public colors: {name: string; val: string}[] = [ + {name: "Blau", val: "primary"}, + {name: "Hellblau", val: "secondary"}, + {name: "Lila", val: "tertiary"}, + {name: "Grün", val: "success"}, + {name: "Gelb", val: "warning"}, + {name: "Rot", val: "danger"} + ]; constructor(private client: HttpClient) { const data = localStorage.getItem("userdata"); @@ -83,7 +93,13 @@ export class IServService { } } - public async getCoursesAndClass(groups?: string[]): Promise<{class: string, courses: string[]}> { + public async getCoursesAndClass(groups?: string[]): Promise<{class: string, courses: Course[]}> { + if (localStorage.getItem("courses") && localStorage.getItem("class")) { + const courses = JSON.parse(localStorage.getItem("courses")) as Course[]; + const className = localStorage.getItem("class"); + return {courses, class: className}; + } + if (groups == undefined) { groups = await this.getGroups(); } @@ -99,13 +115,37 @@ export class IServService { result.class = grades[0].replace("Jahrgang ", "").toUpperCase(); } } + localStorage.setItem("class", result.class); for (let group of groups) { if (!group.includes(".") || !group.toLowerCase().startsWith("q")) continue; result.courses.push(group.split(".")[1]); } - return result; + if (result.class.startsWith("Q")) { + const courses: Course[] = []; + for (let course of result.courses) { + const short = course.substring(1, 3); + const name = this.courseNames[short]; + if (name == undefined) continue; + courses.push({ + id: course, + short: short.toUpperCase(), + name: name, + color: this.colors[Math.floor(Math.random() * this.colors.length)].val + }); + } + courses.sort((a, b) => { + if (a.name < b.name) return -1; + if (a.name > b.name) return 1; + return 0; + }); + + localStorage.setItem("courses", JSON.stringify(courses)); + return {class: result.class, courses}; + } + + return {class: result.class, courses: []}; } } diff --git a/BetterIServ.Mobile/src/app/app.component.ts b/BetterIServ.Mobile/src/app/app.component.ts index 032887d..32c561f 100644 --- a/BetterIServ.Mobile/src/app/app.component.ts +++ b/BetterIServ.Mobile/src/app/app.component.ts @@ -16,7 +16,6 @@ export class AppComponent { { title: 'Übersicht', url: '/home', icon: 'home' }, { title: 'E-Mail', url: '/mails', icon: 'mail' }, { title: 'Dateien', url: '/files', icon: 'folder' }, - { title: 'Aufgaben', url: '/tasks', icon: 'clipboard' }, { title: 'Stundenplan', url: '/schedule', icon: 'grid' }, { title: 'Vertretungsplan', url: '/substitution', icon: 'list' }, ]; diff --git a/BetterIServ.Mobile/src/app/app.routes.ts b/BetterIServ.Mobile/src/app/app.routes.ts index a47c425..37e55f0 100644 --- a/BetterIServ.Mobile/src/app/app.routes.ts +++ b/BetterIServ.Mobile/src/app/app.routes.ts @@ -23,12 +23,12 @@ export const routes: Routes = [ loadComponent: () => import('./pages/mails/mails.page').then( m => m.MailsPage) }, { - path: 'substitution', - loadComponent: () => import('./pages/substitution/substitution.page').then( m => m.SubstitutionPage) + path: 'mails/:id', + loadComponent: () => import('./pages/mails/mails.page').then( m => m.MailsPage) }, { - path: 'tasks', - loadComponent: () => import('./pages/tasks/tasks.page').then( m => m.TasksPage) + path: 'substitution', + loadComponent: () => import('./pages/substitution/substitution.page').then( m => m.SubstitutionPage) }, { path: 'schedule', diff --git a/BetterIServ.Mobile/src/app/components/lesson/lesson.component.html b/BetterIServ.Mobile/src/app/components/lesson/lesson.component.html new file mode 100644 index 0000000..b70b9df --- /dev/null +++ b/BetterIServ.Mobile/src/app/components/lesson/lesson.component.html @@ -0,0 +1,13 @@ + + + + {{findCourse(lesson?.course)?.short || "PH"}} + + + + {{lesson?.room || "⠀ ⠀"}} + + diff --git a/BetterIServ.Mobile/src/app/components/lesson/lesson.component.scss b/BetterIServ.Mobile/src/app/components/lesson/lesson.component.scss new file mode 100644 index 0000000..3ef28dc --- /dev/null +++ b/BetterIServ.Mobile/src/app/components/lesson/lesson.component.scss @@ -0,0 +1,8 @@ +ion-card { + margin: 10px 0 0; + width: 100%; + + ion-card-header, ion-card-content { + padding: 7px; + } +} diff --git a/BetterIServ.Mobile/src/app/components/lesson/lesson.component.ts b/BetterIServ.Mobile/src/app/components/lesson/lesson.component.ts new file mode 100644 index 0000000..1603b24 --- /dev/null +++ b/BetterIServ.Mobile/src/app/components/lesson/lesson.component.ts @@ -0,0 +1,25 @@ +import {Component, Input} from '@angular/core'; +import {IonicModule} from "@ionic/angular"; +import {Course, Lesson} from "../../entities/course"; + +@Component({ + selector: 'lesson', + templateUrl: './lesson.component.html', + styleUrls: ['./lesson.component.scss'], + imports: [ + IonicModule + ], + standalone: true +}) +export class LessonComponent { + + @Input('courses') courses: Course[]; + @Input('lesson') lesson: Lesson; + + public findCourse(id: string): Course { + for (let course of this.courses) + if (course.id == id) return course; + return undefined; + } + +} diff --git a/BetterIServ.Mobile/src/app/components/mail/mail.component.html b/BetterIServ.Mobile/src/app/components/mail/mail.component.html new file mode 100644 index 0000000..70b02d8 --- /dev/null +++ b/BetterIServ.Mobile/src/app/components/mail/mail.component.html @@ -0,0 +1,10 @@ + +
+
+ + {{message.sender.displayName}} + {{message.time.toLocaleDateString()}} +
+ {{message.subject}} +
+
diff --git a/BetterIServ.Mobile/src/app/components/mail/mail.component.scss b/BetterIServ.Mobile/src/app/components/mail/mail.component.scss new file mode 100644 index 0000000..8f27c90 --- /dev/null +++ b/BetterIServ.Mobile/src/app/components/mail/mail.component.scss @@ -0,0 +1,25 @@ +.mail > div { + display: flex; + flex-direction: column; + gap: 7px; + margin-block: 15px; + width: 100%; + + .subject, .date { + font-size: 15px; + } + + & > div { + display: flex; + + ion-icon { + margin-right: 5px; + align-self: center; + color: var(--ion-color-primary); + } + + .date { + margin-left: auto; + } + } +} diff --git a/BetterIServ.Mobile/src/app/components/mail/mail.component.ts b/BetterIServ.Mobile/src/app/components/mail/mail.component.ts new file mode 100644 index 0000000..111f48f --- /dev/null +++ b/BetterIServ.Mobile/src/app/components/mail/mail.component.ts @@ -0,0 +1,20 @@ +import {Component, Input, OnInit} from '@angular/core'; +import {IonicModule} from "@ionic/angular"; +import {MailContent} from "../../entities/mail"; +import {NgIf} from "@angular/common"; + +@Component({ + selector: 'mail', + templateUrl: './mail.component.html', + styleUrls: ['./mail.component.scss'], + imports: [ + IonicModule, + NgIf + ], + standalone: true +}) +export class MailComponent { + + @Input('mail') message: MailContent; + +} diff --git a/BetterIServ.Mobile/src/app/components/substitution/substitution.component.html b/BetterIServ.Mobile/src/app/components/substitution/substitution.component.html new file mode 100644 index 0000000..b0ff428 --- /dev/null +++ b/BetterIServ.Mobile/src/app/components/substitution/substitution.component.html @@ -0,0 +1,11 @@ + + + {{subs?.times.join(" - ")}} +
+ {{subs?.type}} + +
+
+
diff --git a/BetterIServ.Mobile/src/app/components/substitution/substitution.component.scss b/BetterIServ.Mobile/src/app/components/substitution/substitution.component.scss new file mode 100644 index 0000000..5e37543 --- /dev/null +++ b/BetterIServ.Mobile/src/app/components/substitution/substitution.component.scss @@ -0,0 +1,44 @@ +.subs { + ion-card-content { + display: flex; + gap: 15px; + color: #FFF; + + .times { + font-size: 25px; + line-height: 25px; + align-self: center; + } + + div { + margin-left: auto; + display: flex; + flex-direction: column; + align-items: flex-end; + + .type { + font-size: 18px; + } + } + } + + &.Raumtausch { + --background: var(--ion-color-success-shade); + } + + &.bittebeachten, &.stregulärem { + --background: var(--ion-color-tertiary-shade); + } + + &.Vertretung { + --background: var(--ion-color-primary-shade); + } + + &.Entfall, &.Stillarbeit { + --background: var(--ion-color-danger-shade); + } + + &.Verlegung { + --background: var(--ion-color-warning-shade); + } +} diff --git a/BetterIServ.Mobile/src/app/components/substitution/substitution.component.ts b/BetterIServ.Mobile/src/app/components/substitution/substitution.component.ts new file mode 100644 index 0000000..332b2fb --- /dev/null +++ b/BetterIServ.Mobile/src/app/components/substitution/substitution.component.ts @@ -0,0 +1,52 @@ +import {Component, Input, OnInit} from '@angular/core'; +import {Substitution} from "../../entities/substitution"; +import {IonicModule} from "@ionic/angular"; + +@Component({ + selector: 'substitution', + templateUrl: './substitution.component.html', + styleUrls: ['./substitution.component.scss'], + imports: [ + IonicModule + ], + standalone: true +}) +export class SubstitutionComponent { + + @Input('subs') subs: Substitution; + + public getDetails(subs: Substitution): string { + if (subs.type == "bitte beachten") { + const desc = subs.description != " " ? ' - ' + subs.description : ""; + let info = `${subs.lesson} (${subs.teacher}) in ${subs.room}`; + + if (subs.lesson != subs.newLesson) { + info = `${subs.newLesson} (${subs.representative}) statt ${subs.lesson} (${subs.teacher}) in ${subs.room}`; + } + + return info + desc; + } + + switch (subs.type) { + case "Vertretung": + case "st. regulärem Unt.": + return `${subs.lesson} (${subs.representative} statt ${subs.teacher}) in ${subs.room}`; + + case "Raumtausch": + return `${subs.lesson} (${subs.teacher}) in ${subs.room}`; + + case "Entfall": + return `${subs.lesson} (${subs.teacher})`; + + case "Stillarbeit": + return `${subs.lesson} (${subs.teacher}) in ${subs.room}`; + + case "Verlegung": + return `${subs.newLesson} (${subs.representative}) statt ${subs.lesson} (${subs.teacher}) in ${subs.room}`; + + default: + return subs.lesson + ' (' + subs.teacher + ') ' + subs.room; + } + } + +} diff --git a/BetterIServ.Mobile/src/app/pages/home/home.page.html b/BetterIServ.Mobile/src/app/pages/home/home.page.html index f8ab9d5..a6bc40b 100644 --- a/BetterIServ.Mobile/src/app/pages/home/home.page.html +++ b/BetterIServ.Mobile/src/app/pages/home/home.page.html @@ -13,4 +13,64 @@ Übersicht + + + + Willkommen {{iserv.userdata?.username}} + + Du hast {{unreadMails?.length || 0}} ungelesene E-Mails
+ {{classData?.class.startsWith('Q') ? 'Jahrgang' : 'Klasse'}} {{classData?.class}}
+ {{dayName}} der {{today?.toLocaleDateString()}} +
+
+
+ + + + Stundenplan + + + + + Kein Unterricht + + + +
+ +
+
+
+ + + + Vertretungsplan + + + + + Keine Vertretungen + + + + + + + + + + Ungelesene E-Mails + + + + + + Keine ungelesenen E-Mails + + + + + + + diff --git a/BetterIServ.Mobile/src/app/pages/home/home.page.scss b/BetterIServ.Mobile/src/app/pages/home/home.page.scss index 8b13789..e6d6614 100644 --- a/BetterIServ.Mobile/src/app/pages/home/home.page.scss +++ b/BetterIServ.Mobile/src/app/pages/home/home.page.scss @@ -1 +1,9 @@ +.lesson-container { + display: flex; + flex-grow: 1; + gap: 8px; +} +.lesson-content { + overflow-x: scroll; +} diff --git a/BetterIServ.Mobile/src/app/pages/home/home.page.ts b/BetterIServ.Mobile/src/app/pages/home/home.page.ts index 8b73ce8..484c188 100644 --- a/BetterIServ.Mobile/src/app/pages/home/home.page.ts +++ b/BetterIServ.Mobile/src/app/pages/home/home.page.ts @@ -2,18 +2,56 @@ import {Component, OnInit} from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { IonicModule } from '@ionic/angular'; +import {IServService} from "../../api/iserv.service"; +import {MailService} from "../../api/mail.service"; +import {MailContent} from "../../entities/mail"; +import {UnitsService} from "../../api/units.service"; +import {Substitution} from "../../entities/substitution"; +import {SubstitutionComponent} from "../../components/substitution/substitution.component"; +import {MailComponent} from "../../components/mail/mail.component"; +import {Router} from "@angular/router"; +import {Course, Lesson, Timetable} from "../../entities/course"; +import {LessonComponent} from "../../components/lesson/lesson.component"; @Component({ selector: 'app-home', templateUrl: './home.page.html', styleUrls: ['./home.page.scss'], standalone: true, - imports: [IonicModule, CommonModule, FormsModule] + imports: [IonicModule, CommonModule, FormsModule, SubstitutionComponent, MailComponent, LessonComponent] }) export class HomePage implements OnInit { - ngOnInit() { + public unreadMails: MailContent[]; + public today: Date; + public dayName: string; + public subs: Substitution[]; + public classData: {class: string, courses: Course[]}; + public lessons: Lesson[]; + public constructor(public iserv: IServService, public mails: MailService, public units: UnitsService, public router: Router) {} + + async ngOnInit() { + this.today = new Date(); + this.dayName = ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"][this.today.getDay()]; + const scheduleDay = [undefined, "mon", "tue", "wed", "thu", "fri", undefined][this.today.getDay()]; + + const mailPromise = this.mails.getMails("INBOX", 0); + const classPromise = this.iserv.getCoursesAndClass(); + const subsPromise = this.units.getSubstitutionPlan("today"); + await Promise.all([mailPromise, classPromise, subsPromise]); + + this.unreadMails = (await mailPromise).filter(mail => !mail.read); + this.classData = await classPromise; + this.subs = (await subsPromise).substitutions.filter(subs => subs.classes.includes(this.classData.class)); + + if (this.classData.class.startsWith("Q")) { + this.subs = this.subs.filter(subs => this.classData.courses.filter(course => course.id == subs.lesson).length > 0); + } + + if (scheduleDay != undefined && localStorage.getItem("timetable")) { + this.lessons = (JSON.parse(localStorage.getItem("timetable")) as Timetable)[scheduleDay].filter(lesson => lesson != undefined); + } } } diff --git a/BetterIServ.Mobile/src/app/pages/login/login.page.html b/BetterIServ.Mobile/src/app/pages/login/login.page.html index 1f89b7b..a0c023f 100644 --- a/BetterIServ.Mobile/src/app/pages/login/login.page.html +++ b/BetterIServ.Mobile/src/app/pages/login/login.page.html @@ -11,9 +11,11 @@ IServ Anmeldedaten - - - Einloggen +
+ + + Einloggen +
diff --git a/BetterIServ.Mobile/src/app/pages/login/login.page.ts b/BetterIServ.Mobile/src/app/pages/login/login.page.ts index 68b8c8f..3108fb6 100644 --- a/BetterIServ.Mobile/src/app/pages/login/login.page.ts +++ b/BetterIServ.Mobile/src/app/pages/login/login.page.ts @@ -23,7 +23,9 @@ export class LoginPage implements OnInit { if (email == undefined || password == undefined) return; if (await this.iservApi.login(email, password)) { - await this.router.navigate(['home']); + setTimeout(async () => { + await this.router.navigate(['home']); + }, 500); }else { const alert = await this.alerts.create({ header: "Fehler", diff --git a/BetterIServ.Mobile/src/app/pages/mails/mails.page.html b/BetterIServ.Mobile/src/app/pages/mails/mails.page.html index f1b7641..8560ebd 100644 --- a/BetterIServ.Mobile/src/app/pages/mails/mails.page.html +++ b/BetterIServ.Mobile/src/app/pages/mails/mails.page.html @@ -53,16 +53,7 @@ - -
-
- - {{message.sender.displayName}} - {{message.time.toLocaleDateString()}} -
- {{message.subject}} -
-
+
@@ -81,9 +72,9 @@
- {{currentMail?.subject}} + {{currentMail?.subject}}
{{currentMail?.time.toLocaleDateString()}} - + {{attachment}} diff --git a/BetterIServ.Mobile/src/app/pages/mails/mails.page.scss b/BetterIServ.Mobile/src/app/pages/mails/mails.page.scss index 27d19f0..76797d0 100644 --- a/BetterIServ.Mobile/src/app/pages/mails/mails.page.scss +++ b/BetterIServ.Mobile/src/app/pages/mails/mails.page.scss @@ -1,44 +1,3 @@ -.mail > div { - display: flex; - flex-direction: column; - gap: 7px; - margin-block: 15px; - width: 100%; - - .subject, .date { - font-size: 15px; - } - - & > div { - display: flex; - - ion-icon { - margin-right: 5px; - color: var(--ion-color-primary); - } - - .date { - margin-left: auto; - } - } -} - -.current-mail { - .header { - display: flex; - flex-direction: column; - gap: 10px; - - .subject { - font-weight: bold; - } - - .time { - font-size: 15px; - } - } -} - .new-email { display: flex; flex-direction: column; diff --git a/BetterIServ.Mobile/src/app/pages/mails/mails.page.ts b/BetterIServ.Mobile/src/app/pages/mails/mails.page.ts index 5bc1dff..e40561d 100644 --- a/BetterIServ.Mobile/src/app/pages/mails/mails.page.ts +++ b/BetterIServ.Mobile/src/app/pages/mails/mails.page.ts @@ -1,20 +1,22 @@ -import {Component, OnInit} from '@angular/core'; +import {Component, OnInit, ViewChild} from '@angular/core'; import {CommonModule} from '@angular/common'; import {FormsModule} from '@angular/forms'; -import {InfiniteScrollCustomEvent, IonicModule, IonModal, Platform, ToastController} from '@ionic/angular'; +import {IonicModule, IonModal, Platform, ToastController} from '@ionic/angular'; import {MailService} from "../../api/mail.service"; import {MailContent, MailFolder} from "../../entities/mail"; import {marked} from "marked"; -import {HttpDownloadProgressEvent, HttpEventType} from "@angular/common/http"; +import {HttpEventType} from "@angular/common/http"; import {File} from "@awesome-cordova-plugins/file/ngx"; import {saveAs} from "file-saver"; +import {MailComponent} from "../../components/mail/mail.component"; +import {ActivatedRoute} from "@angular/router"; @Component({ selector: 'app-mails', templateUrl: './mails.page.html', styleUrls: ['./mails.page.scss'], standalone: true, - imports: [IonicModule, CommonModule, FormsModule] + imports: [IonicModule, CommonModule, FormsModule, MailComponent] }) export class MailsPage implements OnInit { @@ -25,7 +27,9 @@ export class MailsPage implements OnInit { private currentPage = 0; private currentFolder: MailFolder; - constructor(private mail: MailService, private platform: Platform, private toasts: ToastController) { } + @ViewChild('mailModal') mailModal: IonModal; + + constructor(private mail: MailService, private platform: Platform, private toasts: ToastController, private route: ActivatedRoute) { } async ngOnInit() { this.showLoading = true; @@ -38,6 +42,14 @@ export class MailsPage implements OnInit { this.currentFolder = this.folders.filter(folder => folder.name == "INBOX")[0]; this.showLoading = false; + + this.route.params.subscribe((params: {id: string}) => { + if (params.id != undefined) { + const id = Number(params.id); + const email = this.mails.filter(mail => mail.id == id)[0]; + this.selectMail(email, this.mailModal); + } + }) } public async changeFolder(folder: MailFolder) { diff --git a/BetterIServ.Mobile/src/app/pages/schedule/schedule.page.html b/BetterIServ.Mobile/src/app/pages/schedule/schedule.page.html index 77aad98..c8ff73b 100644 --- a/BetterIServ.Mobile/src/app/pages/schedule/schedule.page.html +++ b/BetterIServ.Mobile/src/app/pages/schedule/schedule.page.html @@ -24,8 +24,8 @@ Farbe - - + + {{color.name}} @@ -124,7 +124,7 @@ {{course.short}} @@ -146,19 +146,7 @@ Do Fr - - - - {{findCourse(lesson?.course)?.short || "⠀ ⠀"}} - - - - {{lesson?.room || "⠀ ⠀"}} - - +
diff --git a/BetterIServ.Mobile/src/app/pages/schedule/schedule.page.scss b/BetterIServ.Mobile/src/app/pages/schedule/schedule.page.scss index d697a25..38429d5 100644 --- a/BetterIServ.Mobile/src/app/pages/schedule/schedule.page.scss +++ b/BetterIServ.Mobile/src/app/pages/schedule/schedule.page.scss @@ -2,19 +2,6 @@ margin-bottom: 16px; } - -.icon { - margin-inline: auto; - aspect-ratio: 1; - width: max-content; - padding: 10px; - border-radius: 50%; - line-height: 20px; - - background-color: var(--background); - color: var(--foreground); -} - .courses { ion-item { --background: transparent; @@ -48,15 +35,6 @@ flex-basis: 0; padding-block: 16px; } - - ion-card { - margin: 10px 0 0; - width: 100%; - - ion-card-header, ion-card-content { - padding: 7px; - } - } } .hide { diff --git a/BetterIServ.Mobile/src/app/pages/schedule/schedule.page.ts b/BetterIServ.Mobile/src/app/pages/schedule/schedule.page.ts index d8e3b53..1e85b28 100644 --- a/BetterIServ.Mobile/src/app/pages/schedule/schedule.page.ts +++ b/BetterIServ.Mobile/src/app/pages/schedule/schedule.page.ts @@ -5,13 +5,14 @@ import {IonicModule, IonModal} from '@ionic/angular'; import {IServService} from "../../api/iserv.service"; import {Course, Lesson, Timetable} from "../../entities/course"; import {WeekPipe} from "../../pipes/week.pipe"; +import {LessonComponent} from "../../components/lesson/lesson.component"; @Component({ selector: 'app-schedule', templateUrl: './schedule.page.html', styleUrls: ['./schedule.page.scss'], standalone: true, - imports: [IonicModule, CommonModule, FormsModule, WeekPipe] + imports: [IonicModule, CommonModule, FormsModule, WeekPipe, LessonComponent] }) export class SchedulePage implements OnInit { @@ -20,48 +21,14 @@ export class SchedulePage implements OnInit { public currentCourse: Course; public timetable: Timetable = {mon: [], tue: [], wed: [], thu: [], fri: []}; public currentLesson: {lesson: Lesson, day: string, time: number}; - public rerender: boolean = false; - public colors: {name: string; val: string}[] = [ - {name: "Blau", val: "primary"}, - {name: "Hellblau", val: "secondary"}, - {name: "Lila", val: "tertiary"}, - {name: "Grün", val: "success"}, - {name: "Gelb", val: "warning"}, - {name: "Rot", val: "danger"} - ]; @ViewChild('courseModal') courseModal: IonModal; @ViewChild('tableModal') tableModal: IonModal; - constructor(private iserv: IServService) { } + constructor(public iserv: IServService) { } async ngOnInit() { - if (localStorage.getItem("courses") == undefined) { - const data = await this.iserv.getCoursesAndClass(); - - if (data.class.startsWith("Q")) { - for (let course of data.courses) { - const short = course.substring(1, 3); - const name = this.iserv.courseNames[short]; - if (name == undefined) continue; - this.courses.push({ - id: course, - short: short.toUpperCase(), - name: name, - color: this.colors[Math.floor(Math.random() * this.colors.length)].val - }); - } - this.courses.sort((a, b) => { - if (a.name < b.name) return -1; - if (a.name > b.name) return 1; - return 0; - }); - - localStorage.setItem("courses", JSON.stringify(this.courses)); - } - }else { - this.courses = JSON.parse(localStorage.getItem("courses")); - } + this.courses = (await this.iserv.getCoursesAndClass()).courses; if (localStorage.getItem("timetable") == undefined) { for (let day of ['mon', 'tue', 'wed', 'thu', 'fri']) { @@ -120,10 +87,4 @@ export class SchedulePage implements OnInit { location.reload(); } - public findCourse(id: string): Course { - for (let course of this.courses) - if (course.id == id) return course; - return undefined; - } - } diff --git a/BetterIServ.Mobile/src/app/pages/substitution/substitution.page.html b/BetterIServ.Mobile/src/app/pages/substitution/substitution.page.html index e69e5ce..041f5cf 100644 --- a/BetterIServ.Mobile/src/app/pages/substitution/substitution.page.html +++ b/BetterIServ.Mobile/src/app/pages/substitution/substitution.page.html @@ -42,19 +42,7 @@ Nur eigene Kurse anzeigen - - - {{subs.times.join(" - ")}} -
- {{subs.type}} - -
-
-
+ diff --git a/BetterIServ.Mobile/src/app/pages/substitution/substitution.page.scss b/BetterIServ.Mobile/src/app/pages/substitution/substitution.page.scss index b9345dc..aaa3d95 100644 --- a/BetterIServ.Mobile/src/app/pages/substitution/substitution.page.scss +++ b/BetterIServ.Mobile/src/app/pages/substitution/substitution.page.scss @@ -1,48 +1,3 @@ -.subs { - ion-card-content { - display: flex; - gap: 15px; - color: #FFF; - - .times { - font-size: 25px; - line-height: 25px; - align-self: center; - } - - div { - margin-left: auto; - display: flex; - flex-direction: column; - align-items: flex-end; - - .type { - font-size: 18px; - } - } - } - - &.Raumtausch { - --background: var(--ion-color-success-shade); - } - - &.bittebeachten, &.stregulärem { - --background: var(--ion-color-tertiary-shade); - } - - &.Vertretung { - --background: var(--ion-color-primary-shade); - } - - &.Entfall, &.Stillarbeit { - --background: var(--ion-color-danger-shade); - } - - &.Verlegung { - --background: var(--ion-color-warning-shade); - } - - &.hide { - display: none; - } +.hide { + display: none; } diff --git a/BetterIServ.Mobile/src/app/pages/substitution/substitution.page.ts b/BetterIServ.Mobile/src/app/pages/substitution/substitution.page.ts index d6667e4..3f6adcb 100644 --- a/BetterIServ.Mobile/src/app/pages/substitution/substitution.page.ts +++ b/BetterIServ.Mobile/src/app/pages/substitution/substitution.page.ts @@ -1,18 +1,18 @@ -import { Component, OnInit } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; +import {Component, OnInit} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {FormsModule} from '@angular/forms'; import {AlertController, IonicModule} from '@ionic/angular'; import {UnitsService} from "../../api/units.service"; -import {Substitution, UnitsData} from "../../entities/substitution"; +import {UnitsData} from "../../entities/substitution"; import {IServService} from "../../api/iserv.service"; -import {Course} from "../../entities/course"; +import {SubstitutionComponent} from "../../components/substitution/substitution.component"; @Component({ selector: 'app-substitution', templateUrl: './substitution.page.html', styleUrls: ['./substitution.page.scss'], standalone: true, - imports: [IonicModule, CommonModule, FormsModule] + imports: [IonicModule, CommonModule, FormsModule, SubstitutionComponent] }) export class SubstitutionPage implements OnInit { @@ -42,29 +42,23 @@ export class SubstitutionPage implements OnInit { this.data = await this.units.getSubstitutionPlan("today"); const data = await this.iserv.getCoursesAndClass(); - if (localStorage.getItem("class") == null) { - if (!data.class.startsWith("Q")) { - this.changeClass(data.class); - }else { - this.changeClass(data.class); + if (data.class.startsWith("Q")) { + for (let course of data.courses) { + this.courses.push(course.id); + } + + if (localStorage.getItem("filterByClasses") == null) { this.showOnlyCourses(true); this.filterByClasses = true; - } - } - if (data.class.startsWith("Q")) { - if (localStorage.getItem("courses") != undefined) { - const courses = JSON.parse(localStorage.getItem("courses")) as Course[]; - for (let course of courses) { - this.courses.push(course.id); + if (data.courses.length == 0) { + const alert = await this.alerts.create({ + header: "Achtung", + message: "Füge deine Kurse im Stundenplan hinzu um sie hier zu filtern!", + buttons: ["Ok"] + }); + await alert.present(); } - }else { - const alert = await this.alerts.create({ - header: "Achtung", - message: "Füge deine Kurse im Stundenplan hinzu um sie hier zu filtern!", - buttons: ["Ok"] - }); - await alert.present(); } } } @@ -81,40 +75,6 @@ export class SubstitutionPage implements OnInit { this.showOnlyCourses(false); } - public getDetails(subs: Substitution): string { - if (subs.type == "bitte beachten") { - const desc = subs.description != " " ? ' - ' + subs.description : ""; - let info = `${subs.lesson} (${subs.teacher}) in ${subs.room}`; - - if (subs.lesson != subs.newLesson) { - info = `${subs.newLesson} (${subs.representative}) statt ${subs.lesson} (${subs.teacher}) in ${subs.room}`; - } - - return info + desc; - } - - switch (subs.type) { - case "Vertretung": - case "st. regulärem Unt.": - return `${subs.lesson} (${subs.representative} statt ${subs.teacher}) in ${subs.room}`; - - case "Raumtausch": - return `${subs.lesson} (${subs.teacher}) in ${subs.room}`; - - case "Entfall": - return `${subs.lesson} (${subs.teacher})`; - - case "Stillarbeit": - return `${subs.lesson} (${subs.teacher}) in ${subs.room}`; - - case "Verlegung": - return `${subs.newLesson} (${subs.representative}) statt ${subs.lesson} (${subs.teacher}) in ${subs.room}`; - - default: - return subs.lesson + ' (' + subs.teacher + ') ' + subs.room; - } - } - public showOnlyCourses(toggle: boolean) { localStorage.setItem("filterByClasses", toggle.toString()); } diff --git a/BetterIServ.Mobile/src/app/pages/tasks/tasks.page.html b/BetterIServ.Mobile/src/app/pages/tasks/tasks.page.html deleted file mode 100644 index de2908d..0000000 --- a/BetterIServ.Mobile/src/app/pages/tasks/tasks.page.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - Aufgaben - - - - - - - Aufgaben - - - Coming soon! - - - - - - - - - - Aktuelle Aufgaben - - - - - - Vergangene Aufgaben - - - - - - diff --git a/BetterIServ.Mobile/src/app/pages/tasks/tasks.page.scss b/BetterIServ.Mobile/src/app/pages/tasks/tasks.page.scss deleted file mode 100644 index e69de29..0000000 diff --git a/BetterIServ.Mobile/src/app/pages/tasks/tasks.page.ts b/BetterIServ.Mobile/src/app/pages/tasks/tasks.page.ts deleted file mode 100644 index f4b60e2..0000000 --- a/BetterIServ.Mobile/src/app/pages/tasks/tasks.page.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; -import { IonicModule } from '@ionic/angular'; - -@Component({ - selector: 'app-tasks', - templateUrl: './tasks.page.html', - styleUrls: ['./tasks.page.scss'], - standalone: true, - imports: [IonicModule, CommonModule, FormsModule] -}) -export class TasksPage implements OnInit { - - constructor() { } - - ngOnInit() { - } - -} diff --git a/BetterIServ.Mobile/src/assets/icon/favicon.ico b/BetterIServ.Mobile/src/assets/icon/favicon.ico new file mode 100644 index 0000000..91bb857 Binary files /dev/null and b/BetterIServ.Mobile/src/assets/icon/favicon.ico differ diff --git a/BetterIServ.Mobile/src/assets/icon/favicon.png b/BetterIServ.Mobile/src/assets/icon/favicon.png deleted file mode 100644 index 51888a7..0000000 Binary files a/BetterIServ.Mobile/src/assets/icon/favicon.png and /dev/null differ diff --git a/BetterIServ.Mobile/src/environments/environment.prod.ts b/BetterIServ.Mobile/src/environments/environment.prod.ts index 3612073..bf9c795 100644 --- a/BetterIServ.Mobile/src/environments/environment.prod.ts +++ b/BetterIServ.Mobile/src/environments/environment.prod.ts @@ -1,3 +1,4 @@ export const environment = { - production: true + production: true, + backend: "https://iserv.leon-hoppe.de" }; diff --git a/BetterIServ.Mobile/src/environments/environment.ts b/BetterIServ.Mobile/src/environments/environment.ts index f56ff47..e615c64 100644 --- a/BetterIServ.Mobile/src/environments/environment.ts +++ b/BetterIServ.Mobile/src/environments/environment.ts @@ -3,7 +3,8 @@ // The list of file replacements can be found in `angular.json`. export const environment = { - production: false + production: false, + backend: "http://localhost:5273" }; /* diff --git a/BetterIServ.Mobile/src/global.scss b/BetterIServ.Mobile/src/global.scss index fd64f61..92a71eb 100644 --- a/BetterIServ.Mobile/src/global.scss +++ b/BetterIServ.Mobile/src/global.scss @@ -36,3 +36,15 @@ ion-menu-button { .active { color: var(--ion-color-primary); } + +.lesson-icon { + margin-inline: auto; + aspect-ratio: 1; + width: 45px; + padding: 10px; + border-radius: 50%; + line-height: 25px; + + background-color: var(--background); + color: var(--foreground); +} diff --git a/BetterIServ.Mobile/src/index.html b/BetterIServ.Mobile/src/index.html index 3b0aae1..14e5313 100644 --- a/BetterIServ.Mobile/src/index.html +++ b/BetterIServ.Mobile/src/index.html @@ -12,7 +12,7 @@ - +