...
This commit is contained in:
27
.metadata
27
.metadata
@ -4,8 +4,8 @@
|
|||||||
# This file should be version controlled and should not be manually edited.
|
# This file should be version controlled and should not be manually edited.
|
||||||
|
|
||||||
version:
|
version:
|
||||||
revision: "8b18dde77fa59ba7f87540c05d1aba787198e77a"
|
revision: "01fde956f0d13551843a44ae16eda7ca87478603"
|
||||||
channel: "master"
|
channel: "beta"
|
||||||
|
|
||||||
project_type: app
|
project_type: app
|
||||||
|
|
||||||
@ -13,27 +13,8 @@ project_type: app
|
|||||||
migration:
|
migration:
|
||||||
platforms:
|
platforms:
|
||||||
- platform: root
|
- platform: root
|
||||||
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
create_revision: 01fde956f0d13551843a44ae16eda7ca87478603
|
||||||
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
base_revision: 01fde956f0d13551843a44ae16eda7ca87478603
|
||||||
- platform: android
|
|
||||||
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
|
||||||
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
|
||||||
- platform: ios
|
|
||||||
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
|
||||||
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
|
||||||
- platform: linux
|
|
||||||
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
|
||||||
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
|
||||||
- platform: macos
|
|
||||||
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
|
||||||
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
|
||||||
- platform: web
|
|
||||||
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
|
||||||
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
|
||||||
- platform: windows
|
|
||||||
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
|
||||||
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
|
||||||
|
|
||||||
# User provided section
|
# User provided section
|
||||||
|
|
||||||
# List of Local paths (relative to this file) that should be
|
# List of Local paths (relative to this file) that should be
|
||||||
|
@ -2,7 +2,6 @@ import 'dart:convert';
|
|||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:encrypt_shared_preferences/provider.dart';
|
import 'package:encrypt_shared_preferences/provider.dart';
|
||||||
import 'package:http/http.dart' as http;
|
|
||||||
|
|
||||||
import 'package:f0ckapp/models/user.dart';
|
import 'package:f0ckapp/models/user.dart';
|
||||||
|
|
||||||
@ -10,6 +9,8 @@ class AuthController extends GetxController {
|
|||||||
final EncryptedSharedPreferencesAsync storage =
|
final EncryptedSharedPreferencesAsync storage =
|
||||||
EncryptedSharedPreferencesAsync.getInstance();
|
EncryptedSharedPreferencesAsync.getInstance();
|
||||||
|
|
||||||
|
final GetConnect http = GetConnect();
|
||||||
|
|
||||||
RxnString token = RxnString();
|
RxnString token = RxnString();
|
||||||
Rxn<User> user = Rxn<User>();
|
Rxn<User> user = Rxn<User>();
|
||||||
RxBool isLoading = false.obs;
|
RxBool isLoading = false.obs;
|
||||||
@ -38,7 +39,8 @@ class AuthController extends GetxController {
|
|||||||
if (token.value != null) {
|
if (token.value != null) {
|
||||||
try {
|
try {
|
||||||
await http.post(
|
await http.post(
|
||||||
Uri.parse('https://api.f0ck.me/logout'),
|
'https://api.f0ck.me/logout',
|
||||||
|
{},
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': 'Bearer ${token.value}',
|
'Authorization': 'Bearer ${token.value}',
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
@ -55,13 +57,15 @@ class AuthController extends GetxController {
|
|||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
error.value = null;
|
error.value = null;
|
||||||
try {
|
try {
|
||||||
final http.Response response = await http.post(
|
final Response<dynamic> response = await http.post(
|
||||||
Uri.parse('https://api.f0ck.me/login'),
|
'https://api.f0ck.me/login',
|
||||||
|
json.encode({'username': username, 'password': password}),
|
||||||
headers: {'Content-Type': 'application/json'},
|
headers: {'Content-Type': 'application/json'},
|
||||||
body: json.encode({'username': username, 'password': password}),
|
|
||||||
);
|
);
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
final dynamic data = json.decode(response.body);
|
final dynamic data = response.body is String
|
||||||
|
? json.decode(response.body)
|
||||||
|
: response.body;
|
||||||
if (data['token'] != null) {
|
if (data['token'] != null) {
|
||||||
await saveToken(data['token']);
|
await saveToken(data['token']);
|
||||||
user.value = User.fromJson(data);
|
user.value = User.fromJson(data);
|
||||||
@ -83,12 +87,14 @@ class AuthController extends GetxController {
|
|||||||
Future<void> fetchUserInfo() async {
|
Future<void> fetchUserInfo() async {
|
||||||
if (token.value == null) return;
|
if (token.value == null) return;
|
||||||
try {
|
try {
|
||||||
final http.Response response = await http.get(
|
final Response<dynamic> response = await http.get(
|
||||||
Uri.parse('https://api.f0ck.me/login/check'),
|
'https://api.f0ck.me/login/check',
|
||||||
headers: {'Authorization': 'Bearer ${token.value}'},
|
headers: {'Authorization': 'Bearer ${token.value}'},
|
||||||
);
|
);
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
final dynamic data = json.decode(response.body);
|
final dynamic data = response.body is String
|
||||||
|
? json.decode(response.body)
|
||||||
|
: response.body;
|
||||||
user.value = User.fromJson(data);
|
user.value = User.fromJson(data);
|
||||||
} else {
|
} else {
|
||||||
await logout();
|
await logout();
|
||||||
|
@ -329,7 +329,9 @@ class _MediaDetailScreenState extends State<MediaDetailScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (isReady)
|
if (isReady)
|
||||||
SliverToBoxAdapter(
|
SliverFillRemaining(
|
||||||
|
hasScrollBody: false,
|
||||||
|
fillOverscroll: true,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () => settingsController.hideVideoControls(),
|
onTap: () => settingsController.hideVideoControls(),
|
||||||
behavior: HitTestBehavior.translucent,
|
behavior: HitTestBehavior.translucent,
|
||||||
|
@ -133,6 +133,7 @@ class _MediaGridBody extends StatelessWidget {
|
|||||||
final SettingsController settingsController;
|
final SettingsController settingsController;
|
||||||
final ScrollController scrollController;
|
final ScrollController scrollController;
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return PullexRefresh(
|
return PullexRefresh(
|
||||||
|
@ -4,13 +4,13 @@ import 'dart:convert';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:http/http.dart' as http;
|
|
||||||
|
|
||||||
import 'package:f0ckapp/controller/mediacontroller.dart';
|
import 'package:f0ckapp/controller/mediacontroller.dart';
|
||||||
import 'package:f0ckapp/models/suggestion.dart';
|
import 'package:f0ckapp/models/suggestion.dart';
|
||||||
|
|
||||||
class CustomSearchDelegate extends SearchDelegate<String> {
|
class CustomSearchDelegate extends SearchDelegate<String> {
|
||||||
final MediaController controller = Get.find<MediaController>();
|
final MediaController controller = Get.find<MediaController>();
|
||||||
|
final GetConnect http = GetConnect();
|
||||||
Timer? _debounceTimer;
|
Timer? _debounceTimer;
|
||||||
List<Suggestion>? _suggestions;
|
List<Suggestion>? _suggestions;
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
@ -48,14 +48,16 @@ class CustomSearchDelegate extends SearchDelegate<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Suggestion>> fetchSuggestions(String query) async {
|
Future<List<Suggestion>> fetchSuggestions(String query) async {
|
||||||
final Uri uri = Uri.parse('https://api.f0ck.me/search/?q=$query');
|
final String url = 'https://api.f0ck.me/search/?q=$query';
|
||||||
try {
|
try {
|
||||||
final http.Response response = await http
|
final Response<dynamic> response = await http
|
||||||
.get(uri)
|
.get(url)
|
||||||
.timeout(const Duration(seconds: 5));
|
.timeout(const Duration(seconds: 5));
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
final dynamic decoded = jsonDecode(response.body);
|
final dynamic decoded = response.body is String
|
||||||
|
? jsonDecode(response.body)
|
||||||
|
: response.body;
|
||||||
if (decoded is List) {
|
if (decoded is List) {
|
||||||
final suggestions = decoded
|
final suggestions = decoded
|
||||||
.map((item) => Suggestion.fromJson(item as Map<String, dynamic>))
|
.map((item) => Suggestion.fromJson(item as Map<String, dynamic>))
|
||||||
@ -66,7 +68,9 @@ class CustomSearchDelegate extends SearchDelegate<String> {
|
|||||||
throw Exception('Unerwartetes Format: Es wurde eine Liste erwartet.');
|
throw Exception('Unerwartetes Format: Es wurde eine Liste erwartet.');
|
||||||
}
|
}
|
||||||
} else if (response.statusCode == 400) {
|
} else if (response.statusCode == 400) {
|
||||||
final dynamic error = jsonDecode(response.body);
|
final dynamic error = response.body is String
|
||||||
|
? jsonDecode(response.body)
|
||||||
|
: response.body;
|
||||||
final String message = error is Map<String, dynamic>
|
final String message = error is Map<String, dynamic>
|
||||||
? error['detail']?.toString() ?? 'Unbekannter Fehler.'
|
? error['detail']?.toString() ?? 'Unbekannter Fehler.'
|
||||||
: 'Unbekannter Fehler.';
|
: 'Unbekannter Fehler.';
|
||||||
|
14
pubspec.lock
14
pubspec.lock
@ -249,7 +249,7 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "0.15.6"
|
version: "0.15.6"
|
||||||
http:
|
http:
|
||||||
dependency: "direct main"
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: http
|
name: http
|
||||||
sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b"
|
sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b"
|
||||||
@ -268,10 +268,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: js
|
name: js
|
||||||
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
|
sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.6.7"
|
version: "0.7.2"
|
||||||
json_rpc_2:
|
json_rpc_2:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -761,10 +761,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: vm_service
|
name: vm_service
|
||||||
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02
|
sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "15.0.0"
|
version: "15.0.2"
|
||||||
web:
|
web:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -801,10 +801,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: win32
|
name: win32
|
||||||
sha256: "329edf97fdd893e0f1e3b9e88d6a0e627128cc17cc316a8d67fda8f1451178ba"
|
sha256: "66814138c3562338d05613a6e368ed8cfb237ad6d64a9e9334be3f309acfca03"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.13.0"
|
version: "5.14.0"
|
||||||
xdg_directories:
|
xdg_directories:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -30,7 +30,6 @@ environment:
|
|||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
http: ^1.4.0
|
|
||||||
get: ^4.7.2
|
get: ^4.7.2
|
||||||
encrypt_shared_preferences: ^0.9.9
|
encrypt_shared_preferences: ^0.9.9
|
||||||
cached_network_image: ^3.4.1
|
cached_network_image: ^3.4.1
|
||||||
|
Reference in New Issue
Block a user