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

Merged
merged 66 commits into from
Nov 26, 2024
Merged

Deep linking setup #2360

merged 66 commits into from
Nov 26, 2024

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_165527734.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

@gnunicorn gnunicorn force-pushed the ben-deep-linking-setup branch from 1c9a95c to 34e9130 Compare November 10, 2024 15:42
Copy link

codecov bot commented Nov 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 27.86%. Comparing base (4e0dacf) to head (b1eb5c5).
Report is 67 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2360      +/-   ##
==========================================
+ Coverage   27.84%   27.86%   +0.02%     
==========================================
  Files         608      617       +9     
  Lines       41982    42261     +279     
==========================================
+ Hits        11688    11778      +90     
- Misses      30294    30483     +189     
Flag Coverage Δ
integration-test 36.89% <ø> (+0.01%) ⬆️
unittest 20.06% <ø> (+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.


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
Copy link
Contributor

@kumarpalsinh25 kumarpalsinh25 left a comment

Choose a reason for hiding this comment

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

Very Nicee! Most awaited feature which boost-up user engagement. 🚀 🥳

Code is well structured with very good base setup for deep-linking. 👏

Can I have screen-recording for iOS devices deep-link example? I hope apple-app-site-association-json-file related stuff is configured and deep linking on iOS working fine which all the use-cases.

.changes/2360-deep-linking.md Outdated Show resolved Hide resolved
app/linux/packaging/global.acter.a3.desktop Outdated Show resolved Hide resolved
app/linux/my_application.cc Show resolved Hide resolved
Comment on lines 117 to 120
// disabled until we have the proper reading facilities ready, See #2373
// QrCodeButton(
// qrCodeData: 'matrix:roomid/${spaceId.substring(1)}',
// ),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we put this when it is ready?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as 2373 is running around at the same time, there is still a chance this can land here. but if not, sure, I can remove this before merging.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed.

@gnunicorn
Copy link
Contributor Author

gnunicorn commented Nov 25, 2024

Can I have screen-recording for iOS devices deep-link example? I hope apple-app-site-association-json-file related stuff is configured and deep linking on iOS working fine which all the use-cases.

yes, an iOS setup did exist -- though not yet the associated domains, as a) I can't do that on matrix.to and b) we didn't yet take over app.acter.global - this comes in the next step(s). but as I had to redo the certificate signing part, I am not sure this is still the case ... let me confirm this again.

@gnunicorn gnunicorn merged commit 0a863be into main Nov 26, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants