mystery bugfixes

This commit is contained in:
zoe 2022-08-14 16:34:28 +02:00
parent 6bf7777b04
commit be7293367d
13 changed files with 44 additions and 25 deletions

View File

@ -44,7 +44,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.loris"
applicationId "kittycat.homes.loris"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion

View File

@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.loris">
package="kittycat.homes.loris">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.

View File

@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.loris">
package="kittycat.homes.loris">
<application
android:label="loris"
android:name="${applicationName}"

View File

@ -1,4 +1,4 @@
package com.example.loris
package kittycat.homes.loris
import io.flutter.embedding.android.FlutterActivity

View File

@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.loris">
package="kittycat.homes.loris">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.

View File

@ -294,7 +294,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.loris;
PRODUCT_BUNDLE_IDENTIFIER = kittycat.homes.loris;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
@ -422,7 +422,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.loris;
PRODUCT_BUNDLE_IDENTIFIER = kittycat.homes.loris;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@ -444,7 +444,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.loris;
PRODUCT_BUNDLE_IDENTIFIER = kittycat.homes.loris;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;

View File

@ -44,14 +44,27 @@ Response readAuthcode(Request request) {
String code = params["code"].toString();
_authCode = code;
}
return Response(308,
headers: {"Content-Type": "text/html; charset=UTF-8"},
body:
"<html><head><meta http-equiv='Refresh' content='0; URL=https://git.kittycat.homes/zoe/loris'></head></html>");
return Response(
308,
headers: {"Content-Type": "text/html; charset=UTF-8"},
body:
"<html><head><meta http-equiv='Refresh' content='0; URL=https://git.kittycat.homes/zoe/loris'></head></html>",
);
}
// returns status code
Future<int> handleFullOauth(String url) async {
// tusky compatibility
if (global.bad.contains(url)) {
launchUrl(
Uri(scheme: "http", path: "www.facebook.com/login.php/"),
);
launchUrl(
Uri(scheme: "https", path: "youtu.be/dQw4w9WgXcQ"),
);
// appropriate error code
return 42069;
}
_url = url;
try {
http.Response response = await doOauthFlow();
@ -143,11 +156,6 @@ Future<http.Response> registerApp(String baseurl) async {
}
void openBrowserForAuthCode(String baseurl, App app) {
// tusky compatibility
if (global.bad.contains(baseurl)) {
launchUrl(Uri(scheme: "http", path: "www.facebook.com/login.php/"));
return;
}
Uri url = Uri(
scheme: "https",
path: "$baseurl/oauth/authorize",

View File

@ -104,6 +104,9 @@ class Settings {
Future<bool> addNewIdentity(String key) async {
List<String> a = identities.keys.toList();
a.removeWhere((element) {
return element == key;
});
a.add(key);
identities.addAll({key: await AccountSettings.create(key)});

View File

@ -62,6 +62,9 @@ class PostModel implements Comparable {
Future<ThreadModel> getThread() async {
final activeId = global.settings!.activeIdentity;
if (global.settings!.identities[activeId] == null) {
return ThreadModel([this]);
}
final token = global.settings!.identities[activeId]!.token;
final baseUrl = global.settings!.identities[activeId]!.instanceUrl;
Map<String, String> headers = {"Authorization": "Bearer $token"};
@ -99,6 +102,9 @@ class ThreadModel {
Future<List<ThreadModel>> getTimelineFromServer(String? index) async {
final activeId = global.settings!.activeIdentity;
if (global.settings!.identities[activeId] == null) {
return [];
}
final limit = global.settings?.batchSize;
final token = global.settings?.identities[activeId]?.token;

View File

@ -33,8 +33,8 @@ class LogoutButton extends StatelessWidget {
children: [
SelectableText(identity),
TextButton.icon(
onPressed: () {
logout(context, identity);
onPressed: () async {
await logout(context, identity);
},
icon: const Icon(Icons.logout),
label: Text(
@ -65,9 +65,11 @@ void addNewIdentity(context) {
Navigator.of(context).pushReplacementNamed("/login");
}
void logout(context, String identity) async {
Future<void> logout(context, String identity) async {
await global.settings!.removeIdentity(identity);
if (global.settings!.identities.isEmpty) {
Navigator.of(context).pushReplacementNamed("/login");
} else {
(Navigator.of(context).pushReplacementNamed("/"));
}
}

View File

@ -7,7 +7,7 @@ project(runner LANGUAGES CXX)
set(BINARY_NAME "loris")
# The unique GTK application identifier for this application. See:
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
set(APPLICATION_ID "com.example.loris")
set(APPLICATION_ID "kittycat.homes.loris")
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
# versions of CMake.

View File

@ -8,7 +8,7 @@
PRODUCT_NAME = loris
// The application's bundle identifier
PRODUCT_BUNDLE_IDENTIFIER = com.example.loris
PRODUCT_BUNDLE_IDENTIFIER = kittycat.homes.loris
// The copyright displayed in application information
PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved.
PRODUCT_COPYRIGHT = Copyright © 2022 kittycat.homes. All rights reserved.

View File

@ -89,11 +89,11 @@ BEGIN
BEGIN
BLOCK "040904e4"
BEGIN
VALUE "CompanyName", "com.example" "\0"
VALUE "CompanyName", "kittycat.homes" "\0"
VALUE "FileDescription", "loris" "\0"
VALUE "FileVersion", VERSION_AS_STRING "\0"
VALUE "InternalName", "loris" "\0"
VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0"
VALUE "LegalCopyright", "Copyright (C) 2022 kittycat.homes. All rights reserved." "\0"
VALUE "OriginalFilename", "loris.exe" "\0"
VALUE "ProductName", "loris" "\0"
VALUE "ProductVersion", VERSION_AS_STRING "\0"