Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deep linking setup #2360

Open
wants to merge 64 commits into
base: main
Choose a base branch
from
Open

Deep linking setup #2360

wants to merge 64 commits into from

Conversation

gnunicorn
Copy link
Contributor

@gnunicorn gnunicorn commented Nov 10, 2024

This PR brings the infrastructure for deep-linking -- aka opening the App with custom provided links -- to Acter. Additionally, these links can also be shared via QR-Code and a corresponding QR-parsing facility is included.

Here as if a link was clicked:

PXL_20241122_164942060.TS.mp4

With QR code reader:

PXL_20241122_165422382.TS.mp4

Opening super invite via QR code:

PXL_20241122_165549728.TS.mp4

refs #2223 :

In particular this PR does:

  • Recognise links (tests provided)
    • matrix:
    • https://matrix.to/
    • acter: => devise a scheme
      • events
      • pins
      • boosts
      • tasklists
      • tasks
      • comments
      • super invites
  • Accept Links & deal with them from QR reader
    • parsing links
    • super invites
    • user id
  • QR generator for sharable

Copy link

codecov bot commented Nov 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 27.37%. Comparing base (d8d6bdf) to head (0f0827a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2360      +/-   ##
==========================================
+ Coverage   27.34%   27.37%   +0.02%     
==========================================
  Files         604      613       +9     
  Lines       41888    42167     +279     
==========================================
+ Hits        11455    11543      +88     
- Misses      30433    30624     +191     
Flag Coverage Δ
integration-test 36.88% <ø> (ø)
unittest 19.32% <ø> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:


class ParsingFailed extends UriParseError {}

UriParseResult parseUri(Uri uri) => switch (uri.scheme) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Highly wrapped code, but just check the unit tests to understand the formats and what it does ...

import 'package:flutter_riverpod/flutter_riverpod.dart';

final quickActionVisibilityProvider =
StateProvider.autoDispose<bool>((ref) => false);

final appLinks = AppLinks(); // AppLinks is singleton
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

global setup according to applinks plugin

@@ -41,7 +41,7 @@ class BottomNavigationWidget extends ConsumerWidget {
bottomNavNar(ref),
AnimatedContainer(
duration: const Duration(milliseconds: 300),
height: showQuickActions ? 150 : 0,
height: showQuickActions ? 180 : 0,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

slightly more space for our new bottom bar.

Comment on lines +54 to +67
return InkWell(
onTap: () => shouldGoReplacement
? context.pushReplacementNamed(Routes.myProfile.name)
: context.pushNamed(Routes.myProfile.name),
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
child: Column(
children: [
ListTile(
leading: ActerAvatar(
options: AvatarOptions.DM(accountInfo),
),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactorted the UserHeader card a bit for usability:

  1. trailing now has the QR-code button
  2. the entire area is now clickable to get into the profile edit

import 'package:acter/features/users/widgets/user_info_drawer.dart';
import 'package:flutter/material.dart';

const Key userInfoDrawer = Key('users-widgets-user-info-drawer');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly copy of the member-info-drawer section but adapted to our profile (which might even be missing) and doesn't have any room.

final globalUserProfileProvider =
FutureProvider.family<UserProfile?, String>((ref, userId) async {
final client = ref.watch(alwaysClientProvider);
return (await client.searchUsers(userId)).toList().firstOrNull;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trying to find a user-id without any additional info goes over the search.

@@ -10,18 +10,20 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';

class MessageUserButton extends ConsumerWidget {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved and simplified to work in both room-member and global-user-scenarios ...


final _log = Logger('a3::user::user_info_drawer');

class _UserInfoDrawerInner extends ConsumerWidget {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly a copy of the member_info_drawer. Just simplified and removed a few things we never have here.

import 'package:acter/features/deep_linking/utils.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are all the parsing tests

@gnunicorn gnunicorn marked this pull request as ready for review November 22, 2024 17:25
@gnunicorn gnunicorn requested review from kumarpalsinh25, bitfriend and gtalha07 and removed request for bitfriend and kumarpalsinh25 November 22, 2024 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

3 participants