Compare commits
7 Commits
develop-wi
...
feature-hi
Author | SHA1 | Date | |
---|---|---|---|
5d264f7651 | |||
a6f7c09671 | |||
eaf6d9f547 | |||
5b34afd6cb | |||
25d901d093 | |||
6237a2e9cf | |||
c4f5be2205 |
16
.gitignore
vendored
@ -48,14 +48,14 @@ lib/generated_plugin_registrant.dart
|
|||||||
#pubspec.lock
|
#pubspec.lock
|
||||||
|
|
||||||
# Android related
|
# Android related
|
||||||
materials/screenshots/android/**/gradle-wrapper.jar
|
**/android/**/gradle-wrapper.jar
|
||||||
materials/screenshots/android/.gradle
|
**/android/.gradle
|
||||||
materials/screenshots/android/captures/
|
**/android/captures/
|
||||||
materials/screenshots/android/gradlew
|
**/android/gradlew
|
||||||
materials/screenshots/android/gradlew.bat
|
**/android/gradlew.bat
|
||||||
materials/screenshots/android/key.properties
|
**/android/key.properties
|
||||||
materials/screenshots/android/local.properties
|
**/android/local.properties
|
||||||
materials/screenshots/android/**/GeneratedPluginRegistrant.java
|
**/android/**/GeneratedPluginRegistrant.java
|
||||||
|
|
||||||
# iOS/XCode related
|
# iOS/XCode related
|
||||||
**/ios/**/*.mode1v3
|
**/ios/**/*.mode1v3
|
||||||
|
@ -9,10 +9,6 @@
|
|||||||
# packages, and plugins designed to encourage good coding practices.
|
# packages, and plugins designed to encourage good coding practices.
|
||||||
include: package:flutter_lints/flutter.yaml
|
include: package:flutter_lints/flutter.yaml
|
||||||
|
|
||||||
analyzer:
|
|
||||||
errors:
|
|
||||||
invalid_annotation_target: ignore
|
|
||||||
|
|
||||||
linter:
|
linter:
|
||||||
# The lint rules applied to this project can be customized in the
|
# The lint rules applied to this project can be customized in the
|
||||||
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
||||||
@ -32,13 +28,6 @@ linter:
|
|||||||
prefer_relative_imports: true
|
prefer_relative_imports: true
|
||||||
unnecessary_lambdas: true
|
unnecessary_lambdas: true
|
||||||
prefer_single_quotes: true
|
prefer_single_quotes: true
|
||||||
prefer_if_elements_to_conditional_expressions: true
|
|
||||||
prefer_expression_function_bodies: true
|
|
||||||
omit_local_variable_types: true
|
|
||||||
eol_at_end_of_file: true
|
|
||||||
cast_nullable_to_non_nullable: true
|
|
||||||
avoid_void_async: true
|
|
||||||
avoid_multiple_declarations_per_line: true
|
|
||||||
|
|
||||||
# Additional information about this file can be found at
|
# Additional information about this file can be found at
|
||||||
# https://dart.dev/guides/language/analysis-options
|
# https://dart.dev/guides/language/analysis-options
|
||||||
|
@ -25,10 +25,9 @@ if (flutterVersionName == null) {
|
|||||||
android {
|
android {
|
||||||
namespace "eu.mhsl.marianum.mobile.client"
|
namespace "eu.mhsl.marianum.mobile.client"
|
||||||
compileSdk flutter.compileSdkVersion
|
compileSdk flutter.compileSdkVersion
|
||||||
ndkVersion "27.0.12077973"
|
ndkVersion flutter.ndkVersion
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
coreLibraryDesugaringEnabled true
|
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
@ -42,8 +41,11 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
|
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||||
applicationId "eu.mhsl.marianum.mobile.client"
|
applicationId "eu.mhsl.marianum.mobile.client"
|
||||||
minSdkVersion 26
|
// You can update the following values to match your application needs.
|
||||||
|
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
||||||
|
minSdkVersion 19
|
||||||
targetSdkVersion flutter.targetSdkVersion
|
targetSdkVersion flutter.targetSdkVersion
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
@ -57,9 +59,6 @@ android {
|
|||||||
signingConfig signingConfigs.debug
|
signingConfig signingConfigs.debug
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buildFeatures {
|
|
||||||
viewBinding true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
flutter {
|
flutter {
|
||||||
@ -67,6 +66,5 @@ flutter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.android.support:multidex:2.0.1'
|
implementation 'com.android.support:multidex:1.0.3'
|
||||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3'
|
|
||||||
}
|
}
|
||||||
|
0
android/app/proguard-rules.pro
vendored
@ -1,73 +1,45 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<manifest
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Required to query activities that can process text, see:
|
|
||||||
https://developer.android.com/training/package-visibility?hl=en and
|
|
||||||
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
|
|
||||||
|
|
||||||
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin.
|
|
||||||
-->
|
|
||||||
<queries>
|
|
||||||
<intent>
|
|
||||||
<action android:name="android.intent.action.PROCESS_TEXT" />
|
|
||||||
|
|
||||||
<data android:mimeType="text/plain" />
|
|
||||||
</intent>
|
|
||||||
</queries>
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
tools:replace="android:label"
|
android:label="Marianum Fulda"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher">
|
||||||
android:label="Marianum Fulda">
|
|
||||||
<receiver
|
|
||||||
android:name=".TimetableWidget"
|
|
||||||
android:exported="false">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
<meta-data
|
|
||||||
android:name="android.appwidget.provider"
|
|
||||||
android:resource="@xml/timetable_widget_info" />
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:hardwareAccelerated="true"
|
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:theme="@style/LaunchTheme"
|
android:theme="@style/LaunchTheme"
|
||||||
|
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||||
|
android:hardwareAccelerated="true"
|
||||||
android:windowSoftInputMode="adjustResize">
|
android:windowSoftInputMode="adjustResize">
|
||||||
|
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||||
<!--
|
|
||||||
Specifies an Android theme to apply to this Activity as soon as
|
|
||||||
the Android process has started. This theme is visible to the user
|
the Android process has started. This theme is visible to the user
|
||||||
while the Flutter UI initializes. After that, this theme continues
|
while the Flutter UI initializes. After that, this theme continues
|
||||||
to determine the Window background behind the Flutter UI.
|
to determine the Window background behind the Flutter UI. -->
|
||||||
-->
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="io.flutter.embedding.android.NormalTheme"
|
android:name="io.flutter.embedding.android.NormalTheme"
|
||||||
android:resource="@style/NormalTheme" />
|
android:resource="@style/NormalTheme"
|
||||||
|
/>
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<!--
|
<!-- Don't delete the meta-data below.
|
||||||
Don't delete the meta-data below.
|
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java
|
|
||||||
-->
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="flutterEmbedding"
|
android:name="flutterEmbedding"
|
||||||
android:value="2" />
|
android:value="2" />
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
<!-- Required to query activities that can process text, see:
|
||||||
|
https://developer.android.com/training/package-visibility?hl=en and
|
||||||
|
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
|
||||||
|
|
||||||
|
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
|
||||||
|
<queries>
|
||||||
|
<intent>
|
||||||
|
<action android:name="android.intent.action.PROCESS_TEXT"/>
|
||||||
|
<data android:mimeType="text/plain"/>
|
||||||
|
</intent>
|
||||||
|
</queries>
|
||||||
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
|
</manifest>
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
package eu.mhsl.marianum.mobile.client
|
|
||||||
|
|
||||||
import android.app.PendingIntent
|
|
||||||
import android.appwidget.AppWidgetManager
|
|
||||||
import android.appwidget.AppWidgetProvider
|
|
||||||
import android.content.Context
|
|
||||||
import android.graphics.Bitmap
|
|
||||||
import android.graphics.BitmapFactory
|
|
||||||
import android.widget.RemoteViews
|
|
||||||
|
|
||||||
import es.antonborri.home_widget.HomeWidgetPlugin
|
|
||||||
import android.util.Base64
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implementation of App Widget functionality.
|
|
||||||
*/
|
|
||||||
class TimetableWidget : AppWidgetProvider() {
|
|
||||||
override fun onUpdate(
|
|
||||||
context: Context,
|
|
||||||
appWidgetManager: AppWidgetManager,
|
|
||||||
appWidgetIds: IntArray,
|
|
||||||
) {
|
|
||||||
for (appWidgetId in appWidgetIds) {
|
|
||||||
val widgetData = HomeWidgetPlugin.getData(context)
|
|
||||||
val views = RemoteViews(context.packageName, R.layout.timetable_widget).apply {
|
|
||||||
val imageBase64 = widgetData.getString("screen", null) ?: return@apply
|
|
||||||
val imageBytes = Base64.decode(imageBase64, Base64.DEFAULT);
|
|
||||||
val imageBitmap: Bitmap = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.size)
|
|
||||||
setImageViewBitmap(R.id.widget_image, imageBitmap)
|
|
||||||
}
|
|
||||||
|
|
||||||
val launchIntent = context.packageManager.getLaunchIntentForPackage(context.packageName)
|
|
||||||
val pendingIntent = PendingIntent.getActivity(context, 0, launchIntent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
|
||||||
views.setOnClickPendingIntent(R.id.background, pendingIntent)
|
|
||||||
|
|
||||||
appWidgetManager.updateAppWidget(appWidgetId, views)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Before Width: | Height: | Size: 98 KiB |
Before Width: | Height: | Size: 48 KiB |
@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?><!--
|
|
||||||
Background for widgets to make the rounded corners based on the
|
|
||||||
appWidgetRadius attribute value
|
|
||||||
-->
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:shape="rectangle">
|
|
||||||
|
|
||||||
<corners android:radius="?attr/appWidgetRadius" />
|
|
||||||
<solid android:color="?android:attr/colorBackground" />
|
|
||||||
</shape>
|
|
@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?><!--
|
|
||||||
Background for views inside widgets to make the rounded corners based on the
|
|
||||||
appWidgetInnerRadius attribute value
|
|
||||||
-->
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:shape="rectangle">
|
|
||||||
|
|
||||||
<corners android:radius="?attr/appWidgetInnerRadius" />
|
|
||||||
<solid android:color="?android:attr/colorAccent" />
|
|
||||||
</shape>
|
|
@ -1,26 +0,0 @@
|
|||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/background"
|
|
||||||
style="@style/Widget.Android.AppWidget.Container"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@android:color/transparent"
|
|
||||||
android:padding="0dp"
|
|
||||||
android:theme="@style/Theme.Android.AppWidgetContainer">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/widget_image"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_marginLeft="0dp"
|
|
||||||
android:layout_marginTop="0dp"
|
|
||||||
android:layout_marginBottom="0dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:adjustViewBounds="false"
|
|
||||||
android:background="@android:color/transparent"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:src="@drawable/timetable_widget_default"
|
|
||||||
android:visibility="visible"
|
|
||||||
tools:visibility="visible" />
|
|
||||||
</RelativeLayout>
|
|
@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<!--
|
|
||||||
Having themes.xml for night-v31 because of the priority order of the resource qualifiers.
|
|
||||||
-->
|
|
||||||
<style name="Theme.Android.AppWidgetContainerParent" parent="@android:style/Theme.DeviceDefault.DayNight">
|
|
||||||
<item name="appWidgetRadius">@android:dimen/system_app_widget_background_radius</item>
|
|
||||||
<item name="appWidgetInnerRadius">@android:dimen/system_app_widget_inner_radius</item>
|
|
||||||
</style>
|
|
||||||
</resources>
|
|
@ -1,14 +0,0 @@
|
|||||||
<resources>
|
|
||||||
|
|
||||||
<style name="Widget.Android.AppWidget.Container" parent="android:Widget">
|
|
||||||
<item name="android:id">@android:id/background</item>
|
|
||||||
<item name="android:padding">?attr/appWidgetPadding</item>
|
|
||||||
<item name="android:background">@drawable/app_widget_background</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="Widget.Android.AppWidget.InnerView" parent="android:Widget">
|
|
||||||
<item name="android:padding">?attr/appWidgetPadding</item>
|
|
||||||
<item name="android:background">@drawable/app_widget_inner_view_background</item>
|
|
||||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
|
||||||
</style>
|
|
||||||
</resources>
|
|
@ -18,18 +18,4 @@
|
|||||||
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||||
<item name="android:windowBackground">?android:colorBackground</item>
|
<item name="android:windowBackground">?android:colorBackground</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Widget.Android.AppWidget.Container" parent="android:Widget">
|
|
||||||
<item name="android:id">@android:id/background</item>
|
|
||||||
<item name="android:padding">?attr/appWidgetPadding</item>
|
|
||||||
<item name="android:background">@drawable/app_widget_background</item>
|
|
||||||
<item name="android:clipToOutline">true</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="Widget.Android.AppWidget.InnerView" parent="android:Widget">
|
|
||||||
<item name="android:padding">?attr/appWidgetPadding</item>
|
|
||||||
<item name="android:background">@drawable/app_widget_inner_view_background</item>
|
|
||||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
|
||||||
<item name="android:clipToOutline">true</item>
|
|
||||||
</style>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<!--
|
|
||||||
Having themes.xml for v31 variant because @android:dimen/system_app_widget_background_radius
|
|
||||||
and @android:dimen/system_app_widget_internal_padding requires API level 31
|
|
||||||
-->
|
|
||||||
<style name="Theme.Android.AppWidgetContainerParent" parent="@android:style/Theme.DeviceDefault.DayNight">
|
|
||||||
<item name="appWidgetRadius">@android:dimen/system_app_widget_background_radius</item>
|
|
||||||
<item name="appWidgetInnerRadius">@android:dimen/system_app_widget_inner_radius</item>
|
|
||||||
</style>
|
|
||||||
</resources>
|
|
@ -1,7 +0,0 @@
|
|||||||
<resources>
|
|
||||||
<declare-styleable name="AppWidgetAttrs">
|
|
||||||
<attr name="appWidgetPadding" format="dimension" />
|
|
||||||
<attr name="appWidgetInnerRadius" format="dimension" />
|
|
||||||
<attr name="appWidgetRadius" format="dimension" />
|
|
||||||
</declare-styleable>
|
|
||||||
</resources>
|
|
@ -1,6 +0,0 @@
|
|||||||
<resources>
|
|
||||||
<color name="light_blue_50">#FFE1F5FE</color>
|
|
||||||
<color name="light_blue_200">#FF81D4FA</color>
|
|
||||||
<color name="light_blue_600">#FF039BE5</color>
|
|
||||||
<color name="light_blue_900">#FF01579B</color>
|
|
||||||
</resources>
|
|
@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Refer to App Widget Documentation for margin information
|
|
||||||
http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout
|
|
||||||
-->
|
|
||||||
<dimen name="widget_margin">0dp</dimen>
|
|
||||||
|
|
||||||
</resources>
|
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<string name="appwidget_text">Marianum Vertretungsplan</string>
|
|
||||||
<string name="add_widget">Hinzufügen</string>
|
|
||||||
<string name="app_widget_description">Übersicht zum Vertretungsplan</string>
|
|
||||||
</resources>
|
|
@ -19,14 +19,4 @@
|
|||||||
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||||
<item name="android:windowBackground">?android:colorBackground</item>
|
<item name="android:windowBackground">?android:colorBackground</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Widget.Android.AppWidget.Container" parent="android:Widget">
|
|
||||||
<item name="android:id">@android:id/background</item>
|
|
||||||
<item name="android:background">?android:attr/colorBackground</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="Widget.Android.AppWidget.InnerView" parent="android:Widget">
|
|
||||||
<item name="android:background">?android:attr/colorBackground</item>
|
|
||||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
|
||||||
</style>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
<resources>
|
|
||||||
|
|
||||||
<style name="Theme.Android.AppWidgetContainerParent" parent="@android:style/Theme.DeviceDefault">
|
|
||||||
<!-- Radius of the outer bound of widgets to make the rounded corners -->
|
|
||||||
<item name="appWidgetRadius">16dp</item>
|
|
||||||
<!--
|
|
||||||
Radius of the inner view's bound of widgets to make the rounded corners.
|
|
||||||
It needs to be 8dp or less than the value of appWidgetRadius
|
|
||||||
-->
|
|
||||||
<item name="appWidgetInnerRadius">8dp</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="Theme.Android.AppWidgetContainer" parent="Theme.Android.AppWidgetContainerParent">
|
|
||||||
<!-- Apply padding to avoid the content of the widget colliding with the rounded corners -->
|
|
||||||
<item name="appWidgetPadding">16dp</item>
|
|
||||||
</style>
|
|
||||||
</resources>
|
|
@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:description="@string/app_widget_description"
|
|
||||||
android:initialKeyguardLayout="@layout/timetable_widget"
|
|
||||||
android:initialLayout="@layout/timetable_widget"
|
|
||||||
android:minWidth="220dp"
|
|
||||||
android:minHeight="294dp"
|
|
||||||
android:minResizeWidth="110dp"
|
|
||||||
android:minResizeHeight="147dp"
|
|
||||||
android:previewImage="@drawable/timetable_widget_preview"
|
|
||||||
android:previewLayout="@layout/timetable_widget"
|
|
||||||
android:resizeMode="horizontal|vertical"
|
|
||||||
android:targetCellWidth="3"
|
|
||||||
android:targetCellHeight="4"
|
|
||||||
android:updatePeriodMillis="86400000"
|
|
||||||
android:widgetCategory="home_screen" />
|
|
@ -2,21 +2,6 @@ allprojects {
|
|||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
||||||
// [required] background_fetch
|
|
||||||
maven {
|
|
||||||
url "${project(':background_fetch').projectDir}/libs"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
buildscript {
|
|
||||||
repositories {
|
|
||||||
google()
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
org.gradle.jvmargs=-Xmx4G
|
org.gradle.jvmargs=-Xmx4G
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
android.defaults.buildfeatures.buildconfig=true
|
|
||||||
android.nonTransitiveRClass=false
|
|
||||||
android.nonFinalResIds=false
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -19,8 +19,8 @@ pluginManagement {
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
||||||
id "com.android.application" version '8.7.3' apply false
|
id "com.android.application" version "7.3.0" apply false
|
||||||
id "org.jetbrains.kotlin.android" version "1.8.10" apply false
|
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
include ":app"
|
include ":app"
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
MIIFBTCCAu2gAwIBAgIQS6hSk/eaL6JzBkuoBI110DANBgkqhkiG9w0BAQsFADBP
|
|
||||||
MQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFy
|
|
||||||
Y2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBYMTAeFw0yNDAzMTMwMDAwMDBa
|
|
||||||
Fw0yNzAzMTIyMzU5NTlaMDMxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBF
|
|
||||||
bmNyeXB0MQwwCgYDVQQDEwNSMTAwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
|
|
||||||
AoIBAQDPV+XmxFQS7bRH/sknWHZGUCiMHT6I3wWd1bUYKb3dtVq/+vbOo76vACFL
|
|
||||||
YlpaPAEvxVgD9on/jhFD68G14BQHlo9vH9fnuoE5CXVlt8KvGFs3Jijno/QHK20a
|
|
||||||
/6tYvJWuQP/py1fEtVt/eA0YYbwX51TGu0mRzW4Y0YCF7qZlNrx06rxQTOr8IfM4
|
|
||||||
FpOUurDTazgGzRYSespSdcitdrLCnF2YRVxvYXvGLe48E1KGAdlX5jgc3421H5KR
|
|
||||||
mudKHMxFqHJV8LDmowfs/acbZp4/SItxhHFYyTr6717yW0QrPHTnj7JHwQdqzZq3
|
|
||||||
DZb3EoEmUVQK7GH29/Xi8orIlQ2NAgMBAAGjgfgwgfUwDgYDVR0PAQH/BAQDAgGG
|
|
||||||
MB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDATASBgNVHRMBAf8ECDAGAQH/
|
|
||||||
AgEAMB0GA1UdDgQWBBS7vMNHpeS8qcbDpHIMEI2iNeHI6DAfBgNVHSMEGDAWgBR5
|
|
||||||
tFnme7bl5AFzgAiIyBpY9umbbjAyBggrBgEFBQcBAQQmMCQwIgYIKwYBBQUHMAKG
|
|
||||||
Fmh0dHA6Ly94MS5pLmxlbmNyLm9yZy8wEwYDVR0gBAwwCjAIBgZngQwBAgEwJwYD
|
|
||||||
VR0fBCAwHjAcoBqgGIYWaHR0cDovL3gxLmMubGVuY3Iub3JnLzANBgkqhkiG9w0B
|
|
||||||
AQsFAAOCAgEAkrHnQTfreZ2B5s3iJeE6IOmQRJWjgVzPw139vaBw1bGWKCIL0vIo
|
|
||||||
zwzn1OZDjCQiHcFCktEJr59L9MhwTyAWsVrdAfYf+B9haxQnsHKNY67u4s5Lzzfd
|
|
||||||
u6PUzeetUK29v+PsPmI2cJkxp+iN3epi4hKu9ZzUPSwMqtCceb7qPVxEbpYxY1p9
|
|
||||||
1n5PJKBLBX9eb9LU6l8zSxPWV7bK3lG4XaMJgnT9x3ies7msFtpKK5bDtotij/l0
|
|
||||||
GaKeA97pb5uwD9KgWvaFXMIEt8jVTjLEvwRdvCn294GPDF08U8lAkIv7tghluaQh
|
|
||||||
1QnlE4SEN4LOECj8dsIGJXpGUk3aU3KkJz9icKy+aUgA+2cP21uh6NcDIS3XyfaZ
|
|
||||||
QjmDQ993ChII8SXWupQZVBiIpcWO4RqZk3lr7Bz5MUCwzDIA359e57SSq5CCkY0N
|
|
||||||
4B6Vulk7LktfwrdGNVI5BsC9qqxSwSKgRJeZ9wygIaehbHFHFhcBaMDKpiZlBHyz
|
|
||||||
rsnnlFXCb5s8HKn5LsUgGvB24L7sGNZP2CX7dhHov+YhD+jozLW2p9W4959Bz2Ei
|
|
||||||
RmqDtmiXLnzqTpXbI+suyCsohKRg6Un0RC47+cpiVwHiXZAW+cn8eiNIjqbVgXLx
|
|
||||||
KPpdzvvtTnOPlC7SQZSYmdunr3Bf9b77AiC/ZidstK36dRILKz7OA54=
|
|
||||||
-----END CERTIFICATE-----
|
|
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 108 KiB |
@ -1,7 +0,0 @@
|
|||||||
targets:
|
|
||||||
$default:
|
|
||||||
builders:
|
|
||||||
json_serializable:
|
|
||||||
options:
|
|
||||||
explicit_to_json: false
|
|
||||||
generic_argument_factories: true
|
|
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 94 KiB |
BIN
google-play/mobile-screenshot.png
Normal file
After Width: | Height: | Size: 185 KiB |
BIN
google-play/mobile-screenshot2.png
Normal file
After Width: | Height: | Size: 154 KiB |
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 100 KiB |
@ -4,5 +4,7 @@ class ApiError {
|
|||||||
ApiError(this.message);
|
ApiError(this.message);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'ApiError: $message';
|
String toString() {
|
||||||
}
|
return 'ApiError: $message';
|
||||||
|
}
|
||||||
|
}
|
@ -1,3 +1,3 @@
|
|||||||
class ApiParams {
|
class ApiParams {
|
||||||
|
|
||||||
}
|
}
|
@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
class ApiRequest {
|
class ApiRequest {
|
||||||
|
|
||||||
}
|
}
|
@ -5,5 +5,5 @@ abstract class ApiResponse {
|
|||||||
late http.Response rawResponse;
|
late http.Response rawResponse;
|
||||||
|
|
||||||
@JsonKey(includeIfNull: false)
|
@JsonKey(includeIfNull: false)
|
||||||
Map<String, String>? headers;
|
late Map<String, String>? headers;
|
||||||
}
|
}
|
@ -1,16 +1,18 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
import 'getHolidaysResponse.dart';
|
import 'getHolidaysResponse.dart';
|
||||||
|
|
||||||
class GetHolidays {
|
class GetHolidays {
|
||||||
Future<GetHolidaysResponse> query() async {
|
Future<GetHolidaysResponse> query() async {
|
||||||
var response = (await http.get(Uri.parse('https://ferien-api.de/api/v1/holidays/HE'))).body;
|
String response = (await http.get(Uri.parse('https://ferien-api.de/api/v1/holidays/HE'))).body;
|
||||||
var data = jsonDecode(response) as List<dynamic>;
|
|
||||||
return GetHolidaysResponse(
|
return GetHolidaysResponse(
|
||||||
List<GetHolidaysResponseObject>.from(
|
List<GetHolidaysResponseObject>.from(
|
||||||
data.map<GetHolidaysResponseObject>((e) => GetHolidaysResponseObject.fromJson(e as Map<String, dynamic>))
|
jsonDecode(response).map<GetHolidaysResponseObject>(
|
||||||
|
GetHolidaysResponseObject.fromJson
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,21 +6,24 @@ import 'getHolidaysResponse.dart';
|
|||||||
|
|
||||||
class GetHolidaysCache extends RequestCache<GetHolidaysResponse> {
|
class GetHolidaysCache extends RequestCache<GetHolidaysResponse> {
|
||||||
GetHolidaysCache({onUpdate, renew}) : super(RequestCache.cacheDay, onUpdate, renew: renew) {
|
GetHolidaysCache({onUpdate, renew}) : super(RequestCache.cacheDay, onUpdate, renew: renew) {
|
||||||
start('state-holidays');
|
start('MarianumMobile', 'state-holidays');
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
GetHolidaysResponse onLocalData(String json) {
|
GetHolidaysResponse onLocalData(String json) {
|
||||||
List<dynamic> parsedListJson = jsonDecode(json)['data'];
|
List<dynamic> parsedListJson = jsonDecode(json)['data'];
|
||||||
return GetHolidaysResponse(
|
return GetHolidaysResponse(
|
||||||
List<GetHolidaysResponseObject>.from(
|
List<GetHolidaysResponseObject>.from(
|
||||||
parsedListJson.map<GetHolidaysResponseObject>(
|
parsedListJson.map<GetHolidaysResponseObject>(
|
||||||
(i) => GetHolidaysResponseObject.fromJson(i as Map<String, dynamic>)
|
// ignore: unnecessary_lambdas
|
||||||
|
(dynamic i) => GetHolidaysResponseObject.fromJson(i)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<GetHolidaysResponse> onLoad() => GetHolidays().query();
|
Future<GetHolidaysResponse> onLoad() {
|
||||||
}
|
return GetHolidays().query();
|
||||||
|
}
|
||||||
|
}
|
@ -35,4 +35,4 @@ class GetHolidaysResponseObject {
|
|||||||
|
|
||||||
factory GetHolidaysResponseObject.fromJson(Map<String, dynamic> json) => _$GetHolidaysResponseObjectFromJson(json);
|
factory GetHolidaysResponseObject.fromJson(Map<String, dynamic> json) => _$GetHolidaysResponseObjectFromJson(json);
|
||||||
Map<String, dynamic> toJson() => _$GetHolidaysResponseObjectToJson(this);
|
Map<String, dynamic> toJson() => _$GetHolidaysResponseObjectToJson(this);
|
||||||
}
|
}
|
@ -16,19 +16,26 @@ GetHolidaysResponse _$GetHolidaysResponseFromJson(Map<String, dynamic> json) =>
|
|||||||
(k, e) => MapEntry(k, e as String),
|
(k, e) => MapEntry(k, e as String),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$GetHolidaysResponseToJson(
|
Map<String, dynamic> _$GetHolidaysResponseToJson(GetHolidaysResponse instance) {
|
||||||
GetHolidaysResponse instance) =>
|
final val = <String, dynamic>{};
|
||||||
<String, dynamic>{
|
|
||||||
if (instance.headers case final value?) 'headers': value,
|
void writeNotNull(String key, dynamic value) {
|
||||||
'data': instance.data.map((e) => e.toJson()).toList(),
|
if (value != null) {
|
||||||
};
|
val[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
writeNotNull('headers', instance.headers);
|
||||||
|
val['data'] = instance.data.map((e) => e.toJson()).toList();
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
GetHolidaysResponseObject _$GetHolidaysResponseObjectFromJson(
|
GetHolidaysResponseObject _$GetHolidaysResponseObjectFromJson(
|
||||||
Map<String, dynamic> json) =>
|
Map<String, dynamic> json) =>
|
||||||
GetHolidaysResponseObject(
|
GetHolidaysResponseObject(
|
||||||
start: json['start'] as String,
|
start: json['start'] as String,
|
||||||
end: json['end'] as String,
|
end: json['end'] as String,
|
||||||
year: (json['year'] as num).toInt(),
|
year: json['year'] as int,
|
||||||
stateCode: json['stateCode'] as String,
|
stateCode: json['stateCode'] as String,
|
||||||
name: json['name'] as String,
|
name: json['name'] as String,
|
||||||
slug: json['slug'] as String,
|
slug: json['slug'] as String,
|
||||||
|
@ -2,6 +2,7 @@ import 'dart:convert';
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:http/http.dart';
|
||||||
|
|
||||||
import '../../../model/accountData.dart';
|
import '../../../model/accountData.dart';
|
||||||
import '../../../model/endpointData.dart';
|
import '../../../model/endpointData.dart';
|
||||||
@ -9,7 +10,7 @@ import 'autocompleteResponse.dart';
|
|||||||
|
|
||||||
class AutocompleteApi {
|
class AutocompleteApi {
|
||||||
Future<AutocompleteResponse> find(String query) async {
|
Future<AutocompleteResponse> find(String query) async {
|
||||||
var getParameters = <String, dynamic>{
|
Map<String, dynamic> getParameters = {
|
||||||
'search': query,
|
'search': query,
|
||||||
'itemType': ' ',
|
'itemType': ' ',
|
||||||
'itemId': ' ',
|
'itemId': ' ',
|
||||||
@ -17,16 +18,16 @@ class AutocompleteApi {
|
|||||||
'limit': '10',
|
'limit': '10',
|
||||||
};
|
};
|
||||||
|
|
||||||
var headers = <String, String>{};
|
Map<String, String> headers = {};
|
||||||
headers.putIfAbsent('Accept', () => 'application/json');
|
headers.putIfAbsent('Accept', () => 'application/json');
|
||||||
headers.putIfAbsent('OCS-APIRequest', () => 'true');
|
headers.putIfAbsent('OCS-APIRequest', () => 'true');
|
||||||
|
|
||||||
var endpoint = Uri.https('${AccountData().buildHttpAuthString()}@${EndpointData().nextcloud().domain}', '${EndpointData().nextcloud().path}/ocs/v2.php/core/autocomplete/get', getParameters);
|
Uri endpoint = Uri.https('${AccountData().buildHttpAuthString()}@${EndpointData().nextcloud().domain}', '${EndpointData().nextcloud().path}/ocs/v2.php/core/autocomplete/get', getParameters);
|
||||||
|
|
||||||
var response = await http.get(endpoint, headers: headers);
|
Response response = await http.get(endpoint, headers: headers);
|
||||||
if(response.statusCode != HttpStatus.ok) throw Exception('Api call failed with ${response.statusCode}: ${response.body}');
|
if(response.statusCode != HttpStatus.ok) throw Exception('Api call failed with ${response.statusCode}: ${response.body}');
|
||||||
var result = response.body;
|
String result = response.body;
|
||||||
return AutocompleteResponse.fromJson(jsonDecode(result)['ocs']);
|
return AutocompleteResponse.fromJson(jsonDecode(result)['ocs']);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -27,4 +27,4 @@ class AutocompleteResponseObject {
|
|||||||
|
|
||||||
factory AutocompleteResponseObject.fromJson(Map<String, dynamic> json) => _$AutocompleteResponseObjectFromJson(json);
|
factory AutocompleteResponseObject.fromJson(Map<String, dynamic> json) => _$AutocompleteResponseObjectFromJson(json);
|
||||||
Map<String, dynamic> toJson() => _$AutocompleteResponseObjectToJson(this);
|
Map<String, dynamic> toJson() => _$AutocompleteResponseObjectToJson(this);
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:http/http.dart';
|
||||||
|
|
||||||
import '../../../model/accountData.dart';
|
import '../../../model/accountData.dart';
|
||||||
import '../../../model/endpointData.dart';
|
import '../../../model/endpointData.dart';
|
||||||
@ -8,15 +9,15 @@ import 'fileSharingApiParams.dart';
|
|||||||
|
|
||||||
class FileSharingApi {
|
class FileSharingApi {
|
||||||
Future<void> share(FileSharingApiParams query) async {
|
Future<void> share(FileSharingApiParams query) async {
|
||||||
var headers = <String, String>{};
|
Map<String, String> headers = {};
|
||||||
headers.putIfAbsent('Accept', () => 'application/json');
|
headers.putIfAbsent('Accept', () => 'application/json');
|
||||||
headers.putIfAbsent('OCS-APIRequest', () => 'true');
|
headers.putIfAbsent('OCS-APIRequest', () => 'true');
|
||||||
|
|
||||||
var endpoint = Uri.https('${AccountData().buildHttpAuthString()}@${EndpointData().nextcloud().domain}', '${EndpointData().nextcloud().path}/ocs/v2.php/apps/files_sharing/api/v1/shares', query.toJson().map((key, value) => MapEntry(key, value.toString())));
|
Uri endpoint = Uri.https('${AccountData().buildHttpAuthString()}@${EndpointData().nextcloud().domain}', '${EndpointData().nextcloud().path}/ocs/v2.php/apps/files_sharing/api/v1/shares', query.toJson().map((key, value) => MapEntry(key, value.toString())));
|
||||||
var response = await http.post(endpoint, headers: headers);
|
Response response = await http.post(endpoint, headers: headers);
|
||||||
|
|
||||||
if(response.statusCode != HttpStatus.ok) {
|
if(response.statusCode != HttpStatus.ok) {
|
||||||
throw Exception('Api call failed with ${response.statusCode}: ${response.body}');
|
throw Exception('Api call failed with ${response.statusCode}: ${response.body}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -20,4 +20,4 @@ class FileSharingApiParams {
|
|||||||
|
|
||||||
factory FileSharingApiParams.fromJson(Map<String, dynamic> json) => _$FileSharingApiParamsFromJson(json);
|
factory FileSharingApiParams.fromJson(Map<String, dynamic> json) => _$FileSharingApiParamsFromJson(json);
|
||||||
Map<String, dynamic> toJson() => _$FileSharingApiParamsToJson(this);
|
Map<String, dynamic> toJson() => _$FileSharingApiParamsToJson(this);
|
||||||
}
|
}
|
@ -9,7 +9,7 @@ part of 'fileSharingApiParams.dart';
|
|||||||
FileSharingApiParams _$FileSharingApiParamsFromJson(
|
FileSharingApiParams _$FileSharingApiParamsFromJson(
|
||||||
Map<String, dynamic> json) =>
|
Map<String, dynamic> json) =>
|
||||||
FileSharingApiParams(
|
FileSharingApiParams(
|
||||||
shareType: (json['shareType'] as num).toInt(),
|
shareType: json['shareType'] as int,
|
||||||
shareWith: json['shareWith'] as String,
|
shareWith: json['shareWith'] as String,
|
||||||
path: json['path'] as String,
|
path: json['path'] as String,
|
||||||
referenceId: json['referenceId'] as String?,
|
referenceId: json['referenceId'] as String?,
|
||||||
|
@ -14,9 +14,13 @@ class GetChat extends TalkApi<GetChatResponse> {
|
|||||||
GetChat(this.chatToken, this.params) : super('v1/chat/$chatToken', null, getParameters: params.toJson());
|
GetChat(this.chatToken, this.params) : super('v1/chat/$chatToken', null, getParameters: params.toJson());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
assemble(String raw) => GetChatResponse.fromJson(jsonDecode(raw)['ocs']);
|
assemble(String raw) {
|
||||||
|
return GetChatResponse.fromJson(jsonDecode(raw)['ocs']);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Response> request(Uri uri, Object? body, Map<String, String>? headers) => http.get(uri, headers: headers);
|
Future<Response> request(Uri uri, Object? body, Map<String, String>? headers) {
|
||||||
|
return http.get(uri, headers: headers);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -9,11 +9,12 @@ class GetChatCache extends RequestCache<GetChatResponse> {
|
|||||||
String chatToken;
|
String chatToken;
|
||||||
|
|
||||||
GetChatCache({required onUpdate, required this.chatToken}) : super(RequestCache.cacheNothing, onUpdate) {
|
GetChatCache({required onUpdate, required this.chatToken}) : super(RequestCache.cacheNothing, onUpdate) {
|
||||||
start('nc-chat-$chatToken');
|
start('MarianumMobile', 'nc-chat-$chatToken');
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<GetChatResponse> onLoad() => GetChat(
|
Future<GetChatResponse> onLoad() {
|
||||||
|
return GetChat(
|
||||||
chatToken,
|
chatToken,
|
||||||
GetChatParams(
|
GetChatParams(
|
||||||
lookIntoFuture: GetChatParamsSwitch.off,
|
lookIntoFuture: GetChatParamsSwitch.off,
|
||||||
@ -21,8 +22,11 @@ class GetChatCache extends RequestCache<GetChatResponse> {
|
|||||||
limit: 200,
|
limit: 200,
|
||||||
)
|
)
|
||||||
).run();
|
).run();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
GetChatResponse onLocalData(String json) => GetChatResponse.fromJson(jsonDecode(json));
|
GetChatResponse onLocalData(String json) {
|
||||||
|
return GetChatResponse.fromJson(jsonDecode(json));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -31,4 +31,4 @@ class GetChatParams extends ApiParams {
|
|||||||
enum GetChatParamsSwitch {
|
enum GetChatParamsSwitch {
|
||||||
@JsonValue(1) on,
|
@JsonValue(1) on,
|
||||||
@JsonValue(0) off,
|
@JsonValue(0) off,
|
||||||
}
|
}
|
@ -10,32 +10,37 @@ GetChatParams _$GetChatParamsFromJson(Map<String, dynamic> json) =>
|
|||||||
GetChatParams(
|
GetChatParams(
|
||||||
lookIntoFuture:
|
lookIntoFuture:
|
||||||
$enumDecode(_$GetChatParamsSwitchEnumMap, json['lookIntoFuture']),
|
$enumDecode(_$GetChatParamsSwitchEnumMap, json['lookIntoFuture']),
|
||||||
limit: (json['limit'] as num?)?.toInt(),
|
limit: json['limit'] as int?,
|
||||||
lastKnownMessageId: (json['lastKnownMessageId'] as num?)?.toInt(),
|
lastKnownMessageId: json['lastKnownMessageId'] as int?,
|
||||||
lastCommonReadId: (json['lastCommonReadId'] as num?)?.toInt(),
|
lastCommonReadId: json['lastCommonReadId'] as int?,
|
||||||
timeout: (json['timeout'] as num?)?.toInt(),
|
timeout: json['timeout'] as int?,
|
||||||
setReadMarker: $enumDecodeNullable(
|
setReadMarker: $enumDecodeNullable(
|
||||||
_$GetChatParamsSwitchEnumMap, json['setReadMarker']),
|
_$GetChatParamsSwitchEnumMap, json['setReadMarker']),
|
||||||
includeLastKnown: $enumDecodeNullable(
|
includeLastKnown: $enumDecodeNullable(
|
||||||
_$GetChatParamsSwitchEnumMap, json['includeLastKnown']),
|
_$GetChatParamsSwitchEnumMap, json['includeLastKnown']),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$GetChatParamsToJson(GetChatParams instance) =>
|
Map<String, dynamic> _$GetChatParamsToJson(GetChatParams instance) {
|
||||||
<String, dynamic>{
|
final val = <String, dynamic>{
|
||||||
'lookIntoFuture': _$GetChatParamsSwitchEnumMap[instance.lookIntoFuture]!,
|
'lookIntoFuture': _$GetChatParamsSwitchEnumMap[instance.lookIntoFuture]!,
|
||||||
if (instance.limit case final value?) 'limit': value,
|
};
|
||||||
if (instance.lastKnownMessageId case final value?)
|
|
||||||
'lastKnownMessageId': value,
|
void writeNotNull(String key, dynamic value) {
|
||||||
if (instance.lastCommonReadId case final value?)
|
if (value != null) {
|
||||||
'lastCommonReadId': value,
|
val[key] = value;
|
||||||
if (instance.timeout case final value?) 'timeout': value,
|
}
|
||||||
if (_$GetChatParamsSwitchEnumMap[instance.setReadMarker]
|
}
|
||||||
case final value?)
|
|
||||||
'setReadMarker': value,
|
writeNotNull('limit', instance.limit);
|
||||||
if (_$GetChatParamsSwitchEnumMap[instance.includeLastKnown]
|
writeNotNull('lastKnownMessageId', instance.lastKnownMessageId);
|
||||||
case final value?)
|
writeNotNull('lastCommonReadId', instance.lastCommonReadId);
|
||||||
'includeLastKnown': value,
|
writeNotNull('timeout', instance.timeout);
|
||||||
};
|
writeNotNull(
|
||||||
|
'setReadMarker', _$GetChatParamsSwitchEnumMap[instance.setReadMarker]);
|
||||||
|
writeNotNull('includeLastKnown',
|
||||||
|
_$GetChatParamsSwitchEnumMap[instance.includeLastKnown]);
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
const _$GetChatParamsSwitchEnumMap = {
|
const _$GetChatParamsSwitchEnumMap = {
|
||||||
GetChatParamsSwitch.on: 1,
|
GetChatParamsSwitch.on: 1,
|
||||||
|
@ -16,7 +16,7 @@ class GetChatResponse extends ApiResponse {
|
|||||||
Map<String, dynamic> toJson() => _$GetChatResponseToJson(this);
|
Map<String, dynamic> toJson() => _$GetChatResponseToJson(this);
|
||||||
|
|
||||||
List<GetChatResponseObject> sortByTimestamp() {
|
List<GetChatResponseObject> sortByTimestamp() {
|
||||||
var sorted = data.toList();
|
List<GetChatResponseObject> sorted = data.toList();
|
||||||
sorted.sort((a, b) => a.timestamp.compareTo(b.timestamp));
|
sorted.sort((a, b) => a.timestamp.compareTo(b.timestamp));
|
||||||
return sorted;
|
return sorted;
|
||||||
}
|
}
|
||||||
@ -38,7 +38,6 @@ class GetChatResponseObject {
|
|||||||
Map<String, int>? reactions;
|
Map<String, int>? reactions;
|
||||||
List<String>? reactionsSelf;
|
List<String>? reactionsSelf;
|
||||||
@JsonKey(fromJson: _fromJson) Map<String, RichObjectString>? messageParameters;
|
@JsonKey(fromJson: _fromJson) Map<String, RichObjectString>? messageParameters;
|
||||||
GetChatResponseObject? parent;
|
|
||||||
|
|
||||||
GetChatResponseObject(
|
GetChatResponseObject(
|
||||||
this.id,
|
this.id,
|
||||||
@ -54,19 +53,19 @@ class GetChatResponseObject {
|
|||||||
this.message,
|
this.message,
|
||||||
this.messageParameters,
|
this.messageParameters,
|
||||||
this.reactions,
|
this.reactions,
|
||||||
this.reactionsSelf,
|
this.reactionsSelf
|
||||||
this.parent,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
factory GetChatResponseObject.fromJson(Map<String, dynamic> json) => _$GetChatResponseObjectFromJson(json);
|
factory GetChatResponseObject.fromJson(Map<String, dynamic> json) => _$GetChatResponseObjectFromJson(json);
|
||||||
Map<String, dynamic> toJson() => _$GetChatResponseObjectToJson(this);
|
Map<String, dynamic> toJson() => _$GetChatResponseObjectToJson(this);
|
||||||
|
|
||||||
static GetChatResponseObject getDateDummy(int timestamp) {
|
static GetChatResponseObject getDateDummy(int timestamp) {
|
||||||
var elementDate = DateTime.fromMillisecondsSinceEpoch(timestamp * 1000);
|
DateTime elementDate = DateTime.fromMillisecondsSinceEpoch(timestamp * 1000);
|
||||||
return getTextDummy(Jiffy.parseFromDateTime(elementDate).format(pattern: 'dd.MM.yyyy'));
|
return getTextDummy(Jiffy.parseFromDateTime(elementDate).format(pattern: 'dd.MM.yyyy'));
|
||||||
}
|
}
|
||||||
|
|
||||||
static GetChatResponseObject getTextDummy(String text) => GetChatResponseObject(
|
static GetChatResponseObject getTextDummy(String text) {
|
||||||
|
return GetChatResponseObject(
|
||||||
0,
|
0,
|
||||||
'',
|
'',
|
||||||
GetRoomResponseObjectMessageActorType.user,
|
GetRoomResponseObjectMessageActorType.user,
|
||||||
@ -80,15 +79,15 @@ class GetChatResponseObject {
|
|||||||
text,
|
text,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null
|
||||||
null,
|
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, RichObjectString>? _fromJson(json) {
|
Map<String, RichObjectString>? _fromJson(json) {
|
||||||
if(json is Map<String, dynamic>) {
|
if(json is Map<String, dynamic>) {
|
||||||
var data = <String, RichObjectString>{};
|
Map<String, RichObjectString> data = {};
|
||||||
for (var element in json.keys) {
|
for (var element in json.keys) {
|
||||||
data.putIfAbsent(element, () => RichObjectString.fromJson(json[element]));
|
data.putIfAbsent(element, () => RichObjectString.fromJson(json[element]));
|
||||||
}
|
}
|
||||||
@ -120,4 +119,4 @@ enum RichObjectStringObjectType {
|
|||||||
@JsonValue('guest') guest,
|
@JsonValue('guest') guest,
|
||||||
@JsonValue('highlight') highlight,
|
@JsonValue('highlight') highlight,
|
||||||
@JsonValue('talk-poll') talkPoll,
|
@JsonValue('talk-poll') talkPoll,
|
||||||
}
|
}
|
@ -15,22 +15,30 @@ GetChatResponse _$GetChatResponseFromJson(Map<String, dynamic> json) =>
|
|||||||
(k, e) => MapEntry(k, e as String),
|
(k, e) => MapEntry(k, e as String),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$GetChatResponseToJson(GetChatResponse instance) =>
|
Map<String, dynamic> _$GetChatResponseToJson(GetChatResponse instance) {
|
||||||
<String, dynamic>{
|
final val = <String, dynamic>{};
|
||||||
if (instance.headers case final value?) 'headers': value,
|
|
||||||
'data': instance.data.map((e) => e.toJson()).toList(),
|
void writeNotNull(String key, dynamic value) {
|
||||||
};
|
if (value != null) {
|
||||||
|
val[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
writeNotNull('headers', instance.headers);
|
||||||
|
val['data'] = instance.data.map((e) => e.toJson()).toList();
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
GetChatResponseObject _$GetChatResponseObjectFromJson(
|
GetChatResponseObject _$GetChatResponseObjectFromJson(
|
||||||
Map<String, dynamic> json) =>
|
Map<String, dynamic> json) =>
|
||||||
GetChatResponseObject(
|
GetChatResponseObject(
|
||||||
(json['id'] as num).toInt(),
|
json['id'] as int,
|
||||||
json['token'] as String,
|
json['token'] as String,
|
||||||
$enumDecode(
|
$enumDecode(
|
||||||
_$GetRoomResponseObjectMessageActorTypeEnumMap, json['actorType']),
|
_$GetRoomResponseObjectMessageActorTypeEnumMap, json['actorType']),
|
||||||
json['actorId'] as String,
|
json['actorId'] as String,
|
||||||
json['actorDisplayName'] as String,
|
json['actorDisplayName'] as String,
|
||||||
(json['timestamp'] as num).toInt(),
|
json['timestamp'] as int,
|
||||||
json['systemMessage'] as String,
|
json['systemMessage'] as String,
|
||||||
$enumDecode(
|
$enumDecode(
|
||||||
_$GetRoomResponseObjectMessageTypeEnumMap, json['messageType']),
|
_$GetRoomResponseObjectMessageTypeEnumMap, json['messageType']),
|
||||||
@ -39,15 +47,11 @@ GetChatResponseObject _$GetChatResponseObjectFromJson(
|
|||||||
json['message'] as String,
|
json['message'] as String,
|
||||||
_fromJson(json['messageParameters']),
|
_fromJson(json['messageParameters']),
|
||||||
(json['reactions'] as Map<String, dynamic>?)?.map(
|
(json['reactions'] as Map<String, dynamic>?)?.map(
|
||||||
(k, e) => MapEntry(k, (e as num).toInt()),
|
(k, e) => MapEntry(k, e as int),
|
||||||
),
|
),
|
||||||
(json['reactionsSelf'] as List<dynamic>?)
|
(json['reactionsSelf'] as List<dynamic>?)
|
||||||
?.map((e) => e as String)
|
?.map((e) => e as String)
|
||||||
.toList(),
|
.toList(),
|
||||||
json['parent'] == null
|
|
||||||
? null
|
|
||||||
: GetChatResponseObject.fromJson(
|
|
||||||
json['parent'] as Map<String, dynamic>),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$GetChatResponseObjectToJson(
|
Map<String, dynamic> _$GetChatResponseObjectToJson(
|
||||||
@ -70,7 +74,6 @@ Map<String, dynamic> _$GetChatResponseObjectToJson(
|
|||||||
'reactionsSelf': instance.reactionsSelf,
|
'reactionsSelf': instance.reactionsSelf,
|
||||||
'messageParameters':
|
'messageParameters':
|
||||||
instance.messageParameters?.map((k, e) => MapEntry(k, e.toJson())),
|
instance.messageParameters?.map((k, e) => MapEntry(k, e.toJson())),
|
||||||
'parent': instance.parent?.toJson(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const _$GetRoomResponseObjectMessageActorTypeEnumMap = {
|
const _$GetRoomResponseObjectMessageActorTypeEnumMap = {
|
||||||
|
@ -11,4 +11,4 @@ class RichObjectStringProcessor {
|
|||||||
|
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,7 +10,9 @@ class CreateRoom extends TalkApi {
|
|||||||
CreateRoom(this.params) : super('v4/room', params);
|
CreateRoom(this.params) : super('v4/room', params);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
assemble(String raw) => null;
|
assemble(String raw) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Response>? request(Uri uri, Object? body, Map<String, String>? headers) {
|
Future<Response>? request(Uri uri, Object? body, Map<String, String>? headers) {
|
||||||
@ -20,4 +22,4 @@ class CreateRoom extends TalkApi {
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -24,4 +24,4 @@ class CreateRoomParams extends ApiParams {
|
|||||||
|
|
||||||
factory CreateRoomParams.fromJson(Map<String, dynamic> json) => _$CreateRoomParamsFromJson(json);
|
factory CreateRoomParams.fromJson(Map<String, dynamic> json) => _$CreateRoomParamsFromJson(json);
|
||||||
Map<String, dynamic> toJson() => _$CreateRoomParamsToJson(this);
|
Map<String, dynamic> toJson() => _$CreateRoomParamsToJson(this);
|
||||||
}
|
}
|
@ -8,7 +8,7 @@ part of 'createRoomParams.dart';
|
|||||||
|
|
||||||
CreateRoomParams _$CreateRoomParamsFromJson(Map<String, dynamic> json) =>
|
CreateRoomParams _$CreateRoomParamsFromJson(Map<String, dynamic> json) =>
|
||||||
CreateRoomParams(
|
CreateRoomParams(
|
||||||
roomType: (json['roomType'] as num).toInt(),
|
roomType: json['roomType'] as int,
|
||||||
invite: json['invite'] as String,
|
invite: json['invite'] as String,
|
||||||
source: json['source'] as String?,
|
source: json['source'] as String?,
|
||||||
roomName: json['roomName'] as String?,
|
roomName: json['roomName'] as String?,
|
||||||
|
@ -10,9 +10,13 @@ class DeleteMessage extends TalkApi {
|
|||||||
DeleteMessage(this.chatToken, this.messageId) : super('v1/chat/$chatToken/$messageId', null);
|
DeleteMessage(this.chatToken, this.messageId) : super('v1/chat/$chatToken/$messageId', null);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
assemble(String raw) => null;
|
assemble(String raw) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Response>? request(Uri uri, ApiParams? body, Map<String, String>? headers) => http.delete(uri, headers: headers);
|
Future<Response>? request(Uri uri, ApiParams? body, Map<String, String>? headers) {
|
||||||
|
return http.delete(uri, headers: headers);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -11,7 +11,9 @@ class DeleteReactMessage extends TalkApi {
|
|||||||
DeleteReactMessage({required this.chatToken, required this.messageId, required DeleteReactMessageParams params}) : super('v1/reaction/$chatToken/$messageId', params);
|
DeleteReactMessage({required this.chatToken, required this.messageId, required DeleteReactMessageParams params}) : super('v1/reaction/$chatToken/$messageId', params);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
assemble(String raw) => null;
|
assemble(String raw) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Response>? request(Uri uri, ApiParams? body, Map<String, String>? headers) {
|
Future<Response>? request(Uri uri, ApiParams? body, Map<String, String>? headers) {
|
||||||
@ -21,4 +23,4 @@ class DeleteReactMessage extends TalkApi {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -12,4 +12,4 @@ class DeleteReactMessageParams extends ApiParams {
|
|||||||
|
|
||||||
factory DeleteReactMessageParams.fromJson(Map<String, dynamic> json) => _$DeleteReactMessageParamsFromJson(json);
|
factory DeleteReactMessageParams.fromJson(Map<String, dynamic> json) => _$DeleteReactMessageParamsFromJson(json);
|
||||||
Map<String, dynamic> toJson() => _$DeleteReactMessageParamsToJson(this);
|
Map<String, dynamic> toJson() => _$DeleteReactMessageParamsToJson(this);
|
||||||
}
|
}
|
@ -10,9 +10,13 @@ class GetParticipants extends TalkApi<GetParticipantsResponse> {
|
|||||||
GetParticipants(this.token) : super('v4/room/$token/participants', null);
|
GetParticipants(this.token) : super('v4/room/$token/participants', null);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
GetParticipantsResponse assemble(String raw) => GetParticipantsResponse.fromJson(jsonDecode(raw)['ocs']);
|
GetParticipantsResponse assemble(String raw) {
|
||||||
|
return GetParticipantsResponse.fromJson(jsonDecode(raw)['ocs']);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<http.Response> request(Uri uri, Object? body, Map<String, String>? headers) => http.get(uri, headers: headers);
|
Future<http.Response> request(Uri uri, Object? body, Map<String, String>? headers) {
|
||||||
|
return http.get(uri, headers: headers);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -8,15 +8,19 @@ class GetParticipantsCache extends RequestCache<GetParticipantsResponse> {
|
|||||||
String chatToken;
|
String chatToken;
|
||||||
|
|
||||||
GetParticipantsCache({required onUpdate, required this.chatToken}) : super(RequestCache.cacheNothing, onUpdate) {
|
GetParticipantsCache({required onUpdate, required this.chatToken}) : super(RequestCache.cacheNothing, onUpdate) {
|
||||||
start('nc-chat-participants-$chatToken');
|
start('MarianumMobile', 'nc-chat-participants-$chatToken');
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<GetParticipantsResponse> onLoad() => GetParticipants(
|
Future<GetParticipantsResponse> onLoad() {
|
||||||
|
return GetParticipants(
|
||||||
chatToken,
|
chatToken,
|
||||||
).run();
|
).run();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
GetParticipantsResponse onLocalData(String json) => GetParticipantsResponse.fromJson(jsonDecode(json));
|
GetParticipantsResponse onLocalData(String json) {
|
||||||
|
return GetParticipantsResponse.fromJson(jsonDecode(json));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -69,4 +69,4 @@ enum GetParticipantsResponseObjectParticipantsInCallFlags {
|
|||||||
@JsonValue(2) providesAudio,
|
@JsonValue(2) providesAudio,
|
||||||
@JsonValue(3) providesVideo,
|
@JsonValue(3) providesVideo,
|
||||||
@JsonValue(4) usesSipDialIn
|
@JsonValue(4) usesSipDialIn
|
||||||
}
|
}
|
@ -18,26 +18,34 @@ GetParticipantsResponse _$GetParticipantsResponseFromJson(
|
|||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$GetParticipantsResponseToJson(
|
Map<String, dynamic> _$GetParticipantsResponseToJson(
|
||||||
GetParticipantsResponse instance) =>
|
GetParticipantsResponse instance) {
|
||||||
<String, dynamic>{
|
final val = <String, dynamic>{};
|
||||||
if (instance.headers case final value?) 'headers': value,
|
|
||||||
'data': instance.data.map((e) => e.toJson()).toList(),
|
void writeNotNull(String key, dynamic value) {
|
||||||
};
|
if (value != null) {
|
||||||
|
val[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
writeNotNull('headers', instance.headers);
|
||||||
|
val['data'] = instance.data.map((e) => e.toJson()).toList();
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
GetParticipantsResponseObject _$GetParticipantsResponseObjectFromJson(
|
GetParticipantsResponseObject _$GetParticipantsResponseObjectFromJson(
|
||||||
Map<String, dynamic> json) =>
|
Map<String, dynamic> json) =>
|
||||||
GetParticipantsResponseObject(
|
GetParticipantsResponseObject(
|
||||||
(json['attendeeId'] as num).toInt(),
|
json['attendeeId'] as int,
|
||||||
json['actorType'] as String,
|
json['actorType'] as String,
|
||||||
json['actorId'] as String,
|
json['actorId'] as String,
|
||||||
json['displayName'] as String,
|
json['displayName'] as String,
|
||||||
$enumDecode(_$GetParticipantsResponseObjectParticipantTypeEnumMap,
|
$enumDecode(_$GetParticipantsResponseObjectParticipantTypeEnumMap,
|
||||||
json['participantType']),
|
json['participantType']),
|
||||||
(json['lastPing'] as num).toInt(),
|
json['lastPing'] as int,
|
||||||
$enumDecode(_$GetParticipantsResponseObjectParticipantsInCallFlagsEnumMap,
|
$enumDecode(_$GetParticipantsResponseObjectParticipantsInCallFlagsEnumMap,
|
||||||
json['inCall']),
|
json['inCall']),
|
||||||
(json['permissions'] as num).toInt(),
|
json['permissions'] as int,
|
||||||
(json['attendeePermissions'] as num).toInt(),
|
json['attendeePermissions'] as int,
|
||||||
json['sessionId'] as String?,
|
json['sessionId'] as String?,
|
||||||
(json['sessionIds'] as List<dynamic>).map((e) => e as String).toList(),
|
(json['sessionIds'] as List<dynamic>).map((e) => e as String).toList(),
|
||||||
json['status'] as String?,
|
json['status'] as String?,
|
||||||
|
@ -13,9 +13,13 @@ class GetReactions extends TalkApi<GetReactionsResponse> {
|
|||||||
GetReactions({required this.chatToken, required this.messageId}) : super('v1/reaction/$chatToken/$messageId', null);
|
GetReactions({required this.chatToken, required this.messageId}) : super('v1/reaction/$chatToken/$messageId', null);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
assemble(String raw) => GetReactionsResponse.fromJson(jsonDecode(raw)['ocs']);
|
assemble(String raw) {
|
||||||
|
return GetReactionsResponse.fromJson(jsonDecode(raw)['ocs']);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Response>? request(Uri uri, ApiParams? body, Map<String, String>? headers) => http.get(uri, headers: headers);
|
Future<Response>? request(Uri uri, ApiParams? body, Map<String, String>? headers) {
|
||||||
|
return http.get(uri, headers: headers);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -30,4 +30,4 @@ class GetReactionsResponseObject {
|
|||||||
enum GetReactionsResponseObjectActorType {
|
enum GetReactionsResponseObjectActorType {
|
||||||
@JsonValue('guests') guests,
|
@JsonValue('guests') guests,
|
||||||
@JsonValue('users') users,
|
@JsonValue('users') users,
|
||||||
}
|
}
|
@ -22,12 +22,20 @@ GetReactionsResponse _$GetReactionsResponseFromJson(
|
|||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$GetReactionsResponseToJson(
|
Map<String, dynamic> _$GetReactionsResponseToJson(
|
||||||
GetReactionsResponse instance) =>
|
GetReactionsResponse instance) {
|
||||||
<String, dynamic>{
|
final val = <String, dynamic>{};
|
||||||
if (instance.headers case final value?) 'headers': value,
|
|
||||||
'data': instance.data
|
void writeNotNull(String key, dynamic value) {
|
||||||
.map((k, e) => MapEntry(k, e.map((e) => e.toJson()).toList())),
|
if (value != null) {
|
||||||
};
|
val[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
writeNotNull('headers', instance.headers);
|
||||||
|
val['data'] = instance.data
|
||||||
|
.map((k, e) => MapEntry(k, e.map((e) => e.toJson()).toList()));
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
GetReactionsResponseObject _$GetReactionsResponseObjectFromJson(
|
GetReactionsResponseObject _$GetReactionsResponseObjectFromJson(
|
||||||
Map<String, dynamic> json) =>
|
Map<String, dynamic> json) =>
|
||||||
@ -36,7 +44,7 @@ GetReactionsResponseObject _$GetReactionsResponseObjectFromJson(
|
|||||||
_$GetReactionsResponseObjectActorTypeEnumMap, json['actorType']),
|
_$GetReactionsResponseObjectActorTypeEnumMap, json['actorType']),
|
||||||
json['actorId'] as String,
|
json['actorId'] as String,
|
||||||
json['actorDisplayName'] as String,
|
json['actorDisplayName'] as String,
|
||||||
(json['timestamp'] as num).toInt(),
|
json['timestamp'] as int,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$GetReactionsResponseObjectToJson(
|
Map<String, dynamic> _$GetReactionsResponseObjectToJson(
|
||||||
|
@ -9,8 +9,12 @@ class LeaveRoom extends TalkApi {
|
|||||||
LeaveRoom(this.chatToken) : super('v4/room/$chatToken/participants/self', null);
|
LeaveRoom(this.chatToken) : super('v4/room/$chatToken/participants/self', null);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
assemble(String raw) => null;
|
assemble(String raw) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Response> request(Uri uri, Object? body, Map<String, String>? headers) => http.delete(uri, headers: headers);
|
Future<Response> request(Uri uri, Object? body, Map<String, String>? headers) {
|
||||||
}
|
return http.delete(uri, headers: headers);
|
||||||
|
}
|
||||||
|
}
|
@ -11,7 +11,9 @@ class ReactMessage extends TalkApi {
|
|||||||
ReactMessage({required this.chatToken, required this.messageId, required ReactMessageParams params}) : super('v1/reaction/$chatToken/$messageId', params);
|
ReactMessage({required this.chatToken, required this.messageId, required ReactMessageParams params}) : super('v1/reaction/$chatToken/$messageId', params);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
assemble(String raw) => null;
|
assemble(String raw) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Response>? request(Uri uri, ApiParams? body, Map<String, String>? headers) {
|
Future<Response>? request(Uri uri, ApiParams? body, Map<String, String>? headers) {
|
||||||
@ -21,4 +23,4 @@ class ReactMessage extends TalkApi {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -12,4 +12,4 @@ class ReactMessageParams extends ApiParams {
|
|||||||
|
|
||||||
factory ReactMessageParams.fromJson(Map<String, dynamic> json) => _$ReactMessageParamsFromJson(json);
|
factory ReactMessageParams.fromJson(Map<String, dynamic> json) => _$ReactMessageParamsFromJson(json);
|
||||||
Map<String, dynamic> toJson() => _$ReactMessageParamsToJson(this);
|
Map<String, dynamic> toJson() => _$ReactMessageParamsToJson(this);
|
||||||
}
|
}
|
@ -14,9 +14,13 @@ class GetRoom extends TalkApi<GetRoomResponse> {
|
|||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
GetRoomResponse assemble(String raw) => GetRoomResponse.fromJson(jsonDecode(raw)['ocs']);
|
GetRoomResponse assemble(String raw) {
|
||||||
|
return GetRoomResponse.fromJson(jsonDecode(raw)['ocs']);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<http.Response> request(Uri uri, Object? body, Map<String, String>? headers) => http.get(uri, headers: headers);
|
Future<http.Response> request(Uri uri, Object? body, Map<String, String>? headers) {
|
||||||
|
return http.get(uri, headers: headers);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -8,16 +8,20 @@ import 'getRoomResponse.dart';
|
|||||||
|
|
||||||
class GetRoomCache extends RequestCache<GetRoomResponse> {
|
class GetRoomCache extends RequestCache<GetRoomResponse> {
|
||||||
GetRoomCache({onUpdate, renew}) : super(RequestCache.cacheMinute, onUpdate, renew: renew) {
|
GetRoomCache({onUpdate, renew}) : super(RequestCache.cacheMinute, onUpdate, renew: renew) {
|
||||||
start('nc-rooms');
|
start('MarianumMobile', 'nc-rooms');
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
GetRoomResponse onLocalData(String json) => GetRoomResponse.fromJson(jsonDecode(json));
|
GetRoomResponse onLocalData(String json) {
|
||||||
|
return GetRoomResponse.fromJson(jsonDecode(json));
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<GetRoomResponse> onLoad() => GetRoom(
|
Future<GetRoomResponse> onLoad() {
|
||||||
|
return GetRoom(
|
||||||
GetRoomParams(
|
GetRoomParams(
|
||||||
includeStatus: true,
|
includeStatus: true,
|
||||||
)
|
)
|
||||||
).run();
|
).run();
|
||||||
}
|
}
|
||||||
|
}
|
@ -22,4 +22,4 @@ class GetRoomParams extends ApiParams {
|
|||||||
enum GetRoomParamsStatusUpdate {
|
enum GetRoomParamsStatusUpdate {
|
||||||
@JsonValue(0) defaults,
|
@JsonValue(0) defaults,
|
||||||
@JsonValue(1) keepAlive,
|
@JsonValue(1) keepAlive,
|
||||||
}
|
}
|
@ -11,7 +11,7 @@ GetRoomParams _$GetRoomParamsFromJson(Map<String, dynamic> json) =>
|
|||||||
noStatusUpdate: $enumDecodeNullable(
|
noStatusUpdate: $enumDecodeNullable(
|
||||||
_$GetRoomParamsStatusUpdateEnumMap, json['noStatusUpdate']),
|
_$GetRoomParamsStatusUpdateEnumMap, json['noStatusUpdate']),
|
||||||
includeStatus: json['includeStatus'] as bool?,
|
includeStatus: json['includeStatus'] as bool?,
|
||||||
modifiedSince: (json['modifiedSince'] as num?)?.toInt(),
|
modifiedSince: json['modifiedSince'] as int?,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$GetRoomParamsToJson(GetRoomParams instance) =>
|
Map<String, dynamic> _$GetRoomParamsToJson(GetRoomParams instance) =>
|
||||||
|
@ -164,4 +164,4 @@ enum GetRoomResponseObjectMessageType {
|
|||||||
@JsonValue('comment_deleted') deletedComment,
|
@JsonValue('comment_deleted') deletedComment,
|
||||||
@JsonValue('system') system,
|
@JsonValue('system') system,
|
||||||
@JsonValue('command') command,
|
@JsonValue('command') command,
|
||||||
}
|
}
|
@ -15,42 +15,50 @@ GetRoomResponse _$GetRoomResponseFromJson(Map<String, dynamic> json) =>
|
|||||||
(k, e) => MapEntry(k, e as String),
|
(k, e) => MapEntry(k, e as String),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$GetRoomResponseToJson(GetRoomResponse instance) =>
|
Map<String, dynamic> _$GetRoomResponseToJson(GetRoomResponse instance) {
|
||||||
<String, dynamic>{
|
final val = <String, dynamic>{};
|
||||||
if (instance.headers case final value?) 'headers': value,
|
|
||||||
'data': instance.data.map((e) => e.toJson()).toList(),
|
void writeNotNull(String key, dynamic value) {
|
||||||
};
|
if (value != null) {
|
||||||
|
val[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
writeNotNull('headers', instance.headers);
|
||||||
|
val['data'] = instance.data.map((e) => e.toJson()).toList();
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
GetRoomResponseObject _$GetRoomResponseObjectFromJson(
|
GetRoomResponseObject _$GetRoomResponseObjectFromJson(
|
||||||
Map<String, dynamic> json) =>
|
Map<String, dynamic> json) =>
|
||||||
GetRoomResponseObject(
|
GetRoomResponseObject(
|
||||||
(json['id'] as num).toInt(),
|
json['id'] as int,
|
||||||
json['token'] as String,
|
json['token'] as String,
|
||||||
$enumDecode(_$GetRoomResponseObjectConversationTypeEnumMap, json['type']),
|
$enumDecode(_$GetRoomResponseObjectConversationTypeEnumMap, json['type']),
|
||||||
json['name'] as String,
|
json['name'] as String,
|
||||||
json['displayName'] as String,
|
json['displayName'] as String,
|
||||||
json['description'] as String,
|
json['description'] as String,
|
||||||
(json['participantType'] as num).toInt(),
|
json['participantType'] as int,
|
||||||
(json['participantFlags'] as num).toInt(),
|
json['participantFlags'] as int,
|
||||||
(json['readOnly'] as num).toInt(),
|
json['readOnly'] as int,
|
||||||
(json['listable'] as num).toInt(),
|
json['listable'] as int,
|
||||||
(json['lastPing'] as num).toInt(),
|
json['lastPing'] as int,
|
||||||
json['sessionId'] as String,
|
json['sessionId'] as String,
|
||||||
json['hasPassword'] as bool,
|
json['hasPassword'] as bool,
|
||||||
json['hasCall'] as bool,
|
json['hasCall'] as bool,
|
||||||
(json['callFlag'] as num).toInt(),
|
json['callFlag'] as int,
|
||||||
json['canStartCall'] as bool,
|
json['canStartCall'] as bool,
|
||||||
json['canDeleteConversation'] as bool,
|
json['canDeleteConversation'] as bool,
|
||||||
json['canLeaveConversation'] as bool,
|
json['canLeaveConversation'] as bool,
|
||||||
(json['lastActivity'] as num).toInt(),
|
json['lastActivity'] as int,
|
||||||
json['isFavorite'] as bool,
|
json['isFavorite'] as bool,
|
||||||
$enumDecode(_$GetRoomResponseObjectParticipantNotificationLevelEnumMap,
|
$enumDecode(_$GetRoomResponseObjectParticipantNotificationLevelEnumMap,
|
||||||
json['notificationLevel']),
|
json['notificationLevel']),
|
||||||
(json['unreadMessages'] as num).toInt(),
|
json['unreadMessages'] as int,
|
||||||
json['unreadMention'] as bool,
|
json['unreadMention'] as bool,
|
||||||
json['unreadMentionDirect'] as bool,
|
json['unreadMentionDirect'] as bool,
|
||||||
(json['lastReadMessage'] as num).toInt(),
|
json['lastReadMessage'] as int,
|
||||||
(json['lastCommonReadMessage'] as num).toInt(),
|
json['lastCommonReadMessage'] as int,
|
||||||
GetChatResponseObject.fromJson(
|
GetChatResponseObject.fromJson(
|
||||||
json['lastMessage'] as Map<String, dynamic>),
|
json['lastMessage'] as Map<String, dynamic>),
|
||||||
json['status'] as String?,
|
json['status'] as String?,
|
||||||
|
@ -10,7 +10,9 @@ class SendMessage extends TalkApi {
|
|||||||
SendMessage(this.chatToken, SendMessageParams params) : super('v1/chat/$chatToken', params);
|
SendMessage(this.chatToken, SendMessageParams params) : super('v1/chat/$chatToken', params);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
assemble(String raw) => null;
|
assemble(String raw) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Response>? request(Uri uri, ApiParams? body, Map<String, String>? headers) {
|
Future<Response>? request(Uri uri, ApiParams? body, Map<String, String>? headers) {
|
||||||
@ -20,4 +22,4 @@ class SendMessage extends TalkApi {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -7,10 +7,10 @@ part 'sendMessageParams.g.dart';
|
|||||||
@JsonSerializable(explicitToJson: true, includeIfNull: false)
|
@JsonSerializable(explicitToJson: true, includeIfNull: false)
|
||||||
class SendMessageParams extends ApiParams {
|
class SendMessageParams extends ApiParams {
|
||||||
String message;
|
String message;
|
||||||
String? replyTo;
|
int? replyTo;
|
||||||
|
|
||||||
SendMessageParams(this.message, {this.replyTo});
|
SendMessageParams(this.message, {this.replyTo});
|
||||||
|
|
||||||
factory SendMessageParams.fromJson(Map<String, dynamic> json) => _$SendMessageParamsFromJson(json);
|
factory SendMessageParams.fromJson(Map<String, dynamic> json) => _$SendMessageParamsFromJson(json);
|
||||||
Map<String, dynamic> toJson() => _$SendMessageParamsToJson(this);
|
Map<String, dynamic> toJson() => _$SendMessageParamsToJson(this);
|
||||||
}
|
}
|
@ -9,11 +9,20 @@ part of 'sendMessageParams.dart';
|
|||||||
SendMessageParams _$SendMessageParamsFromJson(Map<String, dynamic> json) =>
|
SendMessageParams _$SendMessageParamsFromJson(Map<String, dynamic> json) =>
|
||||||
SendMessageParams(
|
SendMessageParams(
|
||||||
json['message'] as String,
|
json['message'] as String,
|
||||||
replyTo: json['replyTo'] as String?,
|
replyTo: json['replyTo'] as int?,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$SendMessageParamsToJson(SendMessageParams instance) =>
|
Map<String, dynamic> _$SendMessageParamsToJson(SendMessageParams instance) {
|
||||||
<String, dynamic>{
|
final val = <String, dynamic>{
|
||||||
'message': instance.message,
|
'message': instance.message,
|
||||||
if (instance.replyTo case final value?) 'replyTo': value,
|
};
|
||||||
};
|
|
||||||
|
void writeNotNull(String key, dynamic value) {
|
||||||
|
if (value != null) {
|
||||||
|
val[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
writeNotNull('replyTo', instance.replyTo);
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
@ -2,4 +2,4 @@ import '../../../apiResponse.dart';
|
|||||||
|
|
||||||
class SendMessageResponse extends ApiResponse {
|
class SendMessageResponse extends ApiResponse {
|
||||||
|
|
||||||
}
|
}
|
@ -11,7 +11,9 @@ class SetFavorite extends TalkApi {
|
|||||||
SetFavorite(this.chatToken, this.favoriteState) : super('v4/room/$chatToken/favorite', null);
|
SetFavorite(this.chatToken, this.favoriteState) : super('v4/room/$chatToken/favorite', null);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
assemble(String raw) => null;
|
assemble(String raw) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Response> request(Uri uri, Object? body, Map<String, String>? headers) {
|
Future<Response> request(Uri uri, Object? body, Map<String, String>? headers) {
|
||||||
@ -22,4 +24,4 @@ class SetFavorite extends TalkApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -15,7 +15,9 @@ class SetReadMarker extends TalkApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
assemble(String raw) => null;
|
assemble(String raw) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Response> request(Uri uri, Object? body, Map<String, String>? headers) {
|
Future<Response> request(Uri uri, Object? body, Map<String, String>? headers) {
|
||||||
@ -27,4 +29,4 @@ class SetReadMarker extends TalkApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -14,4 +14,4 @@ class SetReadMarkerParams extends ApiParams {
|
|||||||
|
|
||||||
factory SetReadMarkerParams.fromJson(Map<String, dynamic> json) => _$SetReadMarkerParamsFromJson(json);
|
factory SetReadMarkerParams.fromJson(Map<String, dynamic> json) => _$SetReadMarkerParamsFromJson(json);
|
||||||
Map<String, dynamic> toJson() => _$SetReadMarkerParamsToJson(this);
|
Map<String, dynamic> toJson() => _$SetReadMarkerParamsToJson(this);
|
||||||
}
|
}
|
@ -8,7 +8,7 @@ part of 'setReadMarkerParams.dart';
|
|||||||
|
|
||||||
SetReadMarkerParams _$SetReadMarkerParamsFromJson(Map<String, dynamic> json) =>
|
SetReadMarkerParams _$SetReadMarkerParamsFromJson(Map<String, dynamic> json) =>
|
||||||
SetReadMarkerParams(
|
SetReadMarkerParams(
|
||||||
lastReadMessage: (json['lastReadMessage'] as num?)?.toInt(),
|
lastReadMessage: json['lastReadMessage'] as int?,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$SetReadMarkerParamsToJson(
|
Map<String, dynamic> _$SetReadMarkerParamsToJson(
|
||||||
|
@ -34,7 +34,7 @@ abstract class TalkApi<T extends ApiResponse?> extends ApiRequest {
|
|||||||
getParameters?.update(key, (value) => value.toString());
|
getParameters?.update(key, (value) => value.toString());
|
||||||
});
|
});
|
||||||
|
|
||||||
var endpoint = Uri.https('${AccountData().buildHttpAuthString()}@${EndpointData().nextcloud().domain}', '${EndpointData().nextcloud().path}/ocs/v2.php/apps/spreed/api/$path', getParameters);
|
Uri endpoint = Uri.https('${AccountData().buildHttpAuthString()}@${EndpointData().nextcloud().domain}', '${EndpointData().nextcloud().path}/ocs/v2.php/apps/spreed/api/$path', getParameters);
|
||||||
|
|
||||||
headers ??= {};
|
headers ??= {};
|
||||||
headers?.putIfAbsent('Accept', () => 'application/json');
|
headers?.putIfAbsent('Accept', () => 'application/json');
|
||||||
@ -65,4 +65,4 @@ abstract class TalkApi<T extends ApiResponse?> extends ApiRequest {
|
|||||||
throw Exception('Error assembling Talk API response');
|
throw Exception('Error assembling Talk API response');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -6,5 +6,7 @@ class TalkError {
|
|||||||
TalkError(this.status, this.code, this.message);
|
TalkError(this.status, this.code, this.message);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'Talk - $status - ($code): $message';
|
String toString() {
|
||||||
}
|
return 'Talk - $status - ($code): $message';
|
||||||
|
}
|
||||||
|
}
|
@ -19,4 +19,4 @@ class DownloadFile extends WebdavApi<DownloadFileParams> {
|
|||||||
// OpenFile.open(localPath);
|
// OpenFile.open(localPath);
|
||||||
throw UnimplementedError();
|
throw UnimplementedError();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,4 +14,4 @@ class DownloadFileParams extends ApiParams {
|
|||||||
|
|
||||||
factory DownloadFileParams.fromJson(Map<String, dynamic> json) => _$DownloadFileParamsFromJson(json);
|
factory DownloadFileParams.fromJson(Map<String, dynamic> json) => _$DownloadFileParamsFromJson(json);
|
||||||
Map<String, dynamic> toJson() => _$DownloadFileParamsToJson(this);
|
Map<String, dynamic> toJson() => _$DownloadFileParamsToJson(this);
|
||||||
}
|
}
|
@ -11,4 +11,4 @@ class DownloadFileResponse {
|
|||||||
|
|
||||||
factory DownloadFileResponse.fromJson(Map<String, dynamic> json) => _$DownloadFileResponseFromJson(json);
|
factory DownloadFileResponse.fromJson(Map<String, dynamic> json) => _$DownloadFileResponseFromJson(json);
|
||||||
Map<String, dynamic> toJson() => _$DownloadFileResponseToJson(this);
|
Map<String, dynamic> toJson() => _$DownloadFileResponseToJson(this);
|
||||||
}
|
}
|
@ -34,4 +34,4 @@ class CacheableFile {
|
|||||||
|
|
||||||
factory CacheableFile.fromJson(Map<String, dynamic> json) => _$CacheableFileFromJson(json);
|
factory CacheableFile.fromJson(Map<String, dynamic> json) => _$CacheableFileFromJson(json);
|
||||||
Map<String, dynamic> toJson() => _$CacheableFileToJson(this);
|
Map<String, dynamic> toJson() => _$CacheableFileToJson(this);
|
||||||
}
|
}
|
@ -12,7 +12,7 @@ CacheableFile _$CacheableFileFromJson(Map<String, dynamic> json) =>
|
|||||||
isDirectory: json['isDirectory'] as bool,
|
isDirectory: json['isDirectory'] as bool,
|
||||||
name: json['name'] as String,
|
name: json['name'] as String,
|
||||||
mimeType: json['mimeType'] as String?,
|
mimeType: json['mimeType'] as String?,
|
||||||
size: (json['size'] as num?)?.toInt(),
|
size: json['size'] as int?,
|
||||||
eTag: json['eTag'] as String?,
|
eTag: json['eTag'] as String?,
|
||||||
createdAt: json['createdAt'] == null
|
createdAt: json['createdAt'] == null
|
||||||
? null
|
? null
|
||||||
|
@ -13,8 +13,8 @@ class ListFiles extends WebdavApi<ListFilesParams> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<ListFilesResponse> run() async {
|
Future<ListFilesResponse> run() async {
|
||||||
var davFiles = (await (await WebdavApi.webdav).propfind(PathUri.parse(params.path))).toWebDavFiles();
|
List<WebDavFile> davFiles = (await (await WebdavApi.webdav).propfind(PathUri.parse(params.path))).toWebDavFiles();
|
||||||
var files = davFiles.map(CacheableFile.fromDavFile).toSet();
|
Set<CacheableFile> files = davFiles.map(CacheableFile.fromDavFile).toSet();
|
||||||
|
|
||||||
// webdav handles subdirectories wrong, this is a fix
|
// webdav handles subdirectories wrong, this is a fix
|
||||||
// currently this fix is not needed anymore
|
// currently this fix is not needed anymore
|
||||||
@ -30,4 +30,4 @@ class ListFiles extends WebdavApi<ListFilesParams> {
|
|||||||
|
|
||||||
return ListFilesResponse(files);
|
return ListFilesResponse(files);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,17 +11,19 @@ class ListFilesCache extends RequestCache<ListFilesResponse> {
|
|||||||
|
|
||||||
ListFilesCache({required onUpdate, required this.path}) : super(RequestCache.cacheNothing, onUpdate) {
|
ListFilesCache({required onUpdate, required this.path}) : super(RequestCache.cacheNothing, onUpdate) {
|
||||||
var bytes = utf8.encode('MarianumMobile-$path');
|
var bytes = utf8.encode('MarianumMobile-$path');
|
||||||
var cacheName = md5.convert(bytes).toString();
|
String cacheName = md5.convert(bytes).toString();
|
||||||
start('wd-folder-$cacheName');
|
start('MarianumMobile', 'wd-folder-$cacheName');
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<ListFilesResponse> onLoad() async {
|
Future<ListFilesResponse> onLoad() async {
|
||||||
var data = await ListFiles(ListFilesParams(path)).run();
|
ListFilesResponse data = await ListFiles(ListFilesParams(path)).run();
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ListFilesResponse onLocalData(String json) => ListFilesResponse.fromJson(jsonDecode(json));
|
ListFilesResponse onLocalData(String json) {
|
||||||
|
return ListFilesResponse.fromJson(jsonDecode(json));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -12,4 +12,4 @@ class ListFilesParams extends ApiParams {
|
|||||||
|
|
||||||
factory ListFilesParams.fromJson(Map<String, dynamic> json) => _$ListFilesParamsFromJson(json);
|
factory ListFilesParams.fromJson(Map<String, dynamic> json) => _$ListFilesParamsFromJson(json);
|
||||||
Map<String, dynamic> toJson() => _$ListFilesParamsToJson(this);
|
Map<String, dynamic> toJson() => _$ListFilesParamsToJson(this);
|
||||||
}
|
}
|
@ -54,4 +54,4 @@ class ListFilesResponse extends ApiResponse {
|
|||||||
var list = files.toList()..sort((a, b) => b.sort!.compareTo(a.sort!));
|
var list = files.toList()..sort((a, b) => b.sort!.compareTo(a.sort!));
|
||||||
return reversed ? list.reversed.toList() : list;
|
return reversed ? list.reversed.toList() : list;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -15,8 +15,16 @@ ListFilesResponse _$ListFilesResponseFromJson(Map<String, dynamic> json) =>
|
|||||||
(k, e) => MapEntry(k, e as String),
|
(k, e) => MapEntry(k, e as String),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$ListFilesResponseToJson(ListFilesResponse instance) =>
|
Map<String, dynamic> _$ListFilesResponseToJson(ListFilesResponse instance) {
|
||||||
<String, dynamic>{
|
final val = <String, dynamic>{};
|
||||||
if (instance.headers case final value?) 'headers': value,
|
|
||||||
'files': instance.files.map((e) => e.toJson()).toList(),
|
void writeNotNull(String key, dynamic value) {
|
||||||
};
|
if (value != null) {
|
||||||
|
val[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
writeNotNull('headers', instance.headers);
|
||||||
|
val['files'] = instance.files.map((e) => e.toJson()).toList();
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
@ -17,7 +17,11 @@ abstract class WebdavApi<T> extends ApiRequest {
|
|||||||
static Future<WebDavClient> webdav = establishWebdavConnection();
|
static Future<WebDavClient> webdav = establishWebdavConnection();
|
||||||
static Future<String> webdavConnectString = buildWebdavConnectString();
|
static Future<String> webdavConnectString = buildWebdavConnectString();
|
||||||
|
|
||||||
static Future<WebDavClient> establishWebdavConnection() async => NextcloudClient(Uri.parse('https://${EndpointData().nextcloud().full()}'), password: AccountData().getPassword(), loginName: AccountData().getUsername()).webdav;
|
static Future<WebDavClient> establishWebdavConnection() async {
|
||||||
|
return NextcloudClient(Uri.parse('https://${EndpointData().nextcloud().full()}'), password: AccountData().getPassword(), loginName: AccountData().getUsername()).webdav;
|
||||||
|
}
|
||||||
|
|
||||||
static Future<String> buildWebdavConnectString() async => 'https://${AccountData().buildHttpAuthString()}@${EndpointData().nextcloud().full()}/remote.php/dav/files/${AccountData().getUsername()}/';
|
static Future<String> buildWebdavConnectString() async {
|
||||||
}
|
return 'https://${AccountData().buildHttpAuthString()}@${EndpointData().nextcloud().full()}/remote.php/dav/files/${AccountData().getUsername()}/';
|
||||||
|
}
|
||||||
|
}
|
@ -9,9 +9,13 @@ class GetBreakers extends MhslApi<GetBreakersResponse> {
|
|||||||
GetBreakers() : super('breaker/');
|
GetBreakers() : super('breaker/');
|
||||||
|
|
||||||
@override
|
@override
|
||||||
GetBreakersResponse assemble(String raw) => GetBreakersResponse.fromJson(jsonDecode(raw));
|
GetBreakersResponse assemble(String raw) {
|
||||||
|
return GetBreakersResponse.fromJson(jsonDecode(raw));
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Response>? request(Uri uri) => http.get(uri);
|
Future<Response>? request(Uri uri) {
|
||||||
|
return http.get(uri);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -6,12 +6,16 @@ import 'getBreakersResponse.dart';
|
|||||||
|
|
||||||
class GetBreakersCache extends RequestCache<GetBreakersResponse> {
|
class GetBreakersCache extends RequestCache<GetBreakersResponse> {
|
||||||
GetBreakersCache({onUpdate, renew}) : super(RequestCache.cacheMinute, onUpdate, renew: renew) {
|
GetBreakersCache({onUpdate, renew}) : super(RequestCache.cacheMinute, onUpdate, renew: renew) {
|
||||||
start('breakers');
|
start('MarianumMobile', 'breakers');
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
GetBreakersResponse onLocalData(String json) => GetBreakersResponse.fromJson(jsonDecode(json));
|
GetBreakersResponse onLocalData(String json) {
|
||||||
|
return GetBreakersResponse.fromJson(jsonDecode(json));
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<GetBreakersResponse> onLoad() => GetBreakers().run();
|
Future<GetBreakersResponse> onLoad() {
|
||||||
}
|
return GetBreakers().run();
|
||||||
|
}
|
||||||
|
}
|
@ -33,4 +33,4 @@ enum BreakerArea {
|
|||||||
@JsonValue('TALK') talk,
|
@JsonValue('TALK') talk,
|
||||||
@JsonValue('FILES') files,
|
@JsonValue('FILES') files,
|
||||||
@JsonValue('MORE') more,
|
@JsonValue('MORE') more,
|
||||||
}
|
}
|
@ -17,13 +17,20 @@ GetBreakersResponse _$GetBreakersResponseFromJson(Map<String, dynamic> json) =>
|
|||||||
(k, e) => MapEntry(k, e as String),
|
(k, e) => MapEntry(k, e as String),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$GetBreakersResponseToJson(
|
Map<String, dynamic> _$GetBreakersResponseToJson(GetBreakersResponse instance) {
|
||||||
GetBreakersResponse instance) =>
|
final val = <String, dynamic>{};
|
||||||
<String, dynamic>{
|
|
||||||
if (instance.headers case final value?) 'headers': value,
|
void writeNotNull(String key, dynamic value) {
|
||||||
'global': instance.global.toJson(),
|
if (value != null) {
|
||||||
'regional': instance.regional.map((k, e) => MapEntry(k, e.toJson())),
|
val[key] = value;
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
writeNotNull('headers', instance.headers);
|
||||||
|
val['global'] = instance.global.toJson();
|
||||||
|
val['regional'] = instance.regional.map((k, e) => MapEntry(k, e.toJson()));
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
GetBreakersReponseObject _$GetBreakersReponseObjectFromJson(
|
GetBreakersReponseObject _$GetBreakersReponseObjectFromJson(
|
||||||
Map<String, dynamic> json) =>
|
Map<String, dynamic> json) =>
|
||||||
|