Skip to content

Commit

Permalink
Merge pull request #180 from humhub/179-dont-show-the-instance-url-co…
Browse files Browse the repository at this point in the history
…nnection-form-for-single-instance-usage

Fix redirect to opener and upgrade compileSdkVersion to 34
  • Loading branch information
luke- authored May 13, 2024
2 parents 5c0c02d + 8efde8c commit 2b9409a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ apply plugin: 'com.google.gms.google-services'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 33
compileSdkVersion 34
ndkVersion flutter.ndkVersion

compileOptions {
Expand Down
11 changes: 4 additions & 7 deletions lib/models/hum_hub.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import 'dart:math';

import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:humhub/models/manifest.dart';
import 'package:humhub/util/api_provider.dart';
import 'package:humhub/util/universal_opener_controller.dart';

enum RedirectAction { opener, webView }

Expand Down Expand Up @@ -42,10 +40,9 @@ class HumHub {
return RedirectAction.opener;
} else {
if (manifest != null) {
AsyncValue<Manifest> asyncData = await APIProvider.of(ref).request(
Manifest.get(manifest!.baseUrl),
);
if (asyncData.hasError) {
UniversalOpenerController openerController = UniversalOpenerController(url: manifest!.baseUrl);
String? manifestUrl = await openerController.findManifest(manifest!.baseUrl);
if (manifestUrl == null) {
return RedirectAction.opener;
} else {
return RedirectAction.webView;
Expand Down
9 changes: 5 additions & 4 deletions lib/util/loading_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

final _provider = StateProvider<GlobalKey<_ManagerState>>(
(ref) => GlobalKey<_ManagerState>(),
(ref) => GlobalKey<_ManagerState>(),
);

class LoadingProvider extends StatelessWidget {
Expand All @@ -24,12 +24,13 @@ class LoadingProvider extends StatelessWidget {
);
}

//ignore: library_private_types_in_public_api
static _ManagerState of(WidgetRef ref) {
final state = ref.read(_provider).currentState;
assert(
state != null,
'Loading overlay is uninitialized. '
'Place LoadingProvider widget as high in widget tree as possible.',
state != null,
'Loading overlay is uninitialized. '
'Place LoadingProvider widget as high in widget tree as possible.',
);
return state!;
}
Expand Down

0 comments on commit 2b9409a

Please sign in to comment.