diff --git a/.github/workflows/flatpak.yml b/.github/workflows/flatpak.yml index 5e693f0..d280bc6 100644 --- a/.github/workflows/flatpak.yml +++ b/.github/workflows/flatpak.yml @@ -34,4 +34,4 @@ jobs: uses: actions/upload-artifact@v6 with: name: flatpak-${{ matrix.arch }} - path: result/nexus.federated.Nexus.flatpak \ No newline at end of file + path: result/nexus.federated.nexus.flatpak \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle index fd51ea0..4453d8d 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -30,7 +30,7 @@ if (keystorePropertiesFile.exists()) { } android { - namespace = "nexus.federated.Nexus" + namespace = "nexus.federated.nexus" ndkVersion = flutter.ndkVersion compileSdk = 34 @@ -45,7 +45,7 @@ android { } defaultConfig { - applicationId = "nexus.federated.Nexus" + applicationId = "nexus.federated.nexus" minSdk = 29 targetSdkVersion flutter.targetSdkVersion versionCode = flutterVersionCode.toInteger() diff --git a/android/app/src/main/kotlin/com/example/mobile_requester_app/MainActivity.kt b/android/app/src/main/kotlin/com/example/mobile_requester_app/MainActivity.kt index a942679..25aab2f 100644 --- a/android/app/src/main/kotlin/com/example/mobile_requester_app/MainActivity.kt +++ b/android/app/src/main/kotlin/com/example/mobile_requester_app/MainActivity.kt @@ -1,4 +1,4 @@ -package nexus.federated.Nexus +package nexus.federated.nexus import io.flutter.embedding.android.FlutterActivity diff --git a/flake.nix b/flake.nix index 7503c87..2b13a08 100644 --- a/flake.nix +++ b/flake.nix @@ -52,7 +52,7 @@ flatpak = inputs.nix2flatpak.lib.${system}.mkFlatpak { appName = "Nexus"; developer = "QuadRadical"; - appId = "nexus.federated.Nexus"; + appId = "nexus.federated.nexus"; package = default; runtime = "org.gnome.Platform/49"; permissions = { diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist index 6f637da..49cc1c7 100644 --- a/ios/Flutter/AppFrameworkInfo.plist +++ b/ios/Flutter/AppFrameworkInfo.plist @@ -7,7 +7,7 @@ CFBundleExecutable App CFBundleIdentifier - nexus.federated.Nexus + nexus.federated.nexus CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 44f96da..d4af5a1 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -387,7 +387,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = nexus.federated.Nexus; + PRODUCT_BUNDLE_IDENTIFIER = nexus.federated.nexus; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; @@ -519,7 +519,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = nexus.federated.Nexus; + PRODUCT_BUNDLE_IDENTIFIER = nexus.federated.nexus; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -545,7 +545,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = nexus.federated.Nexus; + PRODUCT_BUNDLE_IDENTIFIER = nexus.federated.nexus; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; diff --git a/lib/controllers/auth_url.dart b/lib/controllers/auth_url.dart index d628461..41c99a7 100644 --- a/lib/controllers/auth_url.dart +++ b/lib/controllers/auth_url.dart @@ -1,32 +1,31 @@ import "package:flutter_riverpod/flutter_riverpod.dart"; import "package:nexus/controllers/client.dart"; import "package:nexus/controllers/client_id.dart"; +import "package:nexus/models/oauth_auth_code_response.dart"; -class AuthUrlController extends AsyncNotifier { - static const prefString = "auth_url"; - +class AuthUrlController extends AsyncNotifier { final Uri homeserver; AuthUrlController(this.homeserver); @override - Future build() async { - final fetched = await ref - .watch(ClientController.provider.notifier) - .getAuthUrl( - .new( - homeserverUrl: homeserver, - redirectUri: Uri.https("nexus.federated.nexus"), - responseMode: .query, - scopes: .new([.clientApi]), - clientId: await ref.watch( - ClientIdController.provider(homeserver).future, - ), + Future build() async => ref + .watch(ClientController.provider.notifier) + .getAuthUrl( + .new( + homeserverUrl: homeserver, + redirectUri: .new(scheme: "nexus.federated.nexus"), + responseMode: .query, + scopes: .new([.clientApi]), + clientId: await ref.watch( + ClientIdController.provider(homeserver).future, ), - ); + ), + ); - return fetched.url; - } - - static final provider = AsyncNotifierProvider.autoDispose - .family(AuthUrlController.new); + static final provider = + AsyncNotifierProvider.family< + AuthUrlController, + OAuthAuthCodeResponse, + Uri + >(AuthUrlController.new); } diff --git a/lib/controllers/client_id.dart b/lib/controllers/client_id.dart index 14bfe35..8be30f2 100644 --- a/lib/controllers/client_id.dart +++ b/lib/controllers/client_id.dart @@ -1,43 +1,31 @@ import "package:flutter_riverpod/flutter_riverpod.dart"; import "package:nexus/controllers/client.dart"; -import "package:nexus/controllers/shared_prefs.dart"; class ClientIdController extends AsyncNotifier { - static const prefString = "client_id"; - final Uri homeserver; ClientIdController(this.homeserver); @override - Future build() async { - final prefs = await ref.watch(SharedPrefsController.provider.future); - final fromPref = prefs.getString(prefString); - - if (fromPref != null) return fromPref; - - final fetched = await ref - .watch(ClientController.provider.notifier) - .registerClient( - .new( - clientName: "Nexus", - applicationType: .native, - grantTypes: .new([.authorizationCode, .refreshToken]), - responseTypes: .new([.code]), - logoUri: Uri.https( - "nexus.federated.nexus", - "raw/branch/main/assets/mobile.svg", - ), - homeserverUrl: homeserver, - clientUri: Uri.https("nexus.federated.nexus"), - redirectUris: .new([.https("nexus.federated.nexus")]), + Future build() => ref + .watch(ClientController.provider.notifier) + .registerClient( + .new( + clientName: "Nexus", + applicationType: .native, + grantTypes: .new([.authorizationCode, .refreshToken]), + responseTypes: .new([.code]), + logoUri: Uri.https( + "nexus.federated.nexus", + "raw/branch/main/assets/mobile.svg", ), - ); + homeserverUrl: homeserver, + clientUri: Uri.https("nexus.federated.nexus"), + redirectUris: .new([.new(scheme: "nexus.federated.nexus")]), + ), + ); - await prefs.setString(prefString, fetched); - - return fetched; - } - - static final provider = AsyncNotifierProvider.autoDispose - .family(ClientIdController.new); + static final provider = + AsyncNotifierProvider.family( + ClientIdController.new, + ); } diff --git a/lib/pages/select_server.dart b/lib/pages/select_server.dart index d602c16..2d02e28 100644 --- a/lib/pages/select_server.dart +++ b/lib/pages/select_server.dart @@ -52,7 +52,7 @@ class SelectServerPage extends HookConsumerWidget { AuthUrlController.provider(newUrl).future, ); - print(authUrl); + await ref.watch(LaunchHelper.provider).launchUrl(authUrl.url); // await Navigator.of(context).push( // MaterialPageRoute(builder: (_) => LoginPage(homeserver: newUrl)), // ); diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index fee47c5..2e0c766 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -7,7 +7,7 @@ project(runner LANGUAGES CXX) set(BINARY_NAME "nexus") # The unique GTK application identifier for this application. See: # https://wiki.gnome.org/HowDoI/ChooseApplicationID -set(APPLICATION_ID "nexus.federated.Nexus") +set(APPLICATION_ID "nexus.federated.nexus") # Explicitly opt in to modern CMake behaviors to avoid warnings with recent # versions of CMake. diff --git a/linux/nix/pkg/default.nix b/linux/nix/pkg/default.nix index c879f24..37ca84c 100644 --- a/linux/nix/pkg/default.nix +++ b/linux/nix/pkg/default.nix @@ -37,7 +37,7 @@ flutter.buildFlutterApplication { postInstall = '' install -D assets/icon.svg $out/share/icons/hicolor/scalable/apps/nexus.svg - install -Dm755 linux/nexus.federated.Nexus.desktop -t $out/share/applications + install -Dm755 linux/nexus.federated.nexus.desktop -t $out/share/applications wrapProgram $out/bin/nexus \ --suffix LD_LIBRARY_PATH : $out/app/nexus/lib ''; diff --git a/windows/runner/Runner.rc b/windows/runner/Runner.rc index 3583d23..24405eb 100644 --- a/windows/runner/Runner.rc +++ b/windows/runner/Runner.rc @@ -89,11 +89,11 @@ BEGIN BEGIN BLOCK "040904e4" BEGIN - VALUE "CompanyName", "nexus.federated.Nexus" "\0" + VALUE "CompanyName", "nexus.federated.nexus" "\0" VALUE "FileDescription", "nexus" "\0" VALUE "FileVersion", VERSION_AS_STRING "\0" VALUE "InternalName", "nexus" "\0" - VALUE "LegalCopyright", "Copyright (C) 2025 nexus.federated.Nexus. All rights reserved." "\0" + VALUE "LegalCopyright", "Copyright (C) 2025 nexus.federated.nexus. All rights reserved." "\0" VALUE "OriginalFilename", "nexus.exe" "\0" VALUE "ProductName", "nexus" "\0" VALUE "ProductVersion", VERSION_AS_STRING "\0"