diff --git a/lib/presentation/widgets/group_members.dart b/lib/presentation/widgets/group_members.dart index 3dd2ad0..ed900df 100644 --- a/lib/presentation/widgets/group_members.dart +++ b/lib/presentation/widgets/group_members.dart @@ -23,26 +23,17 @@ class GroupMembers extends StatelessWidget { }); Future?> _inviteFromContacts(BuildContext context) async { - if (!(await FlutterContacts.requestPermission(readonly: true))) { - throw Exception('Contacts permission not granted'); - } - - final contacts = await FlutterContacts.getContacts( - withAccounts: true, - withPhoto: true, - withProperties: true, - ); - if (!context.mounted) return null; final invited = await SelectContactsRoute().push>(context); return invited - ?.map((c) => ContactInvite(c.displayName, [ - ...(c.emails ?? []).map((e) => (InviteMethods.email, e.address)), - ...(c.phones ?? []) - .map((p) => (InviteMethods.phone, p.normalizedNumber)), - ])) + ?.map( + (c) => ContactInvite(c.displayName, [ + ...(c.emails).map((e) => (InviteMethods.email, e.address)), + ...(c.phones).map((p) => (InviteMethods.phone, p.normalizedNumber)), + ]), + ) .toList(); } diff --git a/lib/repositories/groups.dart b/lib/repositories/groups.dart index f727381..fd4fd7d 100644 --- a/lib/repositories/groups.dart +++ b/lib/repositories/groups.dart @@ -3,37 +3,26 @@ import 'package:parousia/models/models.dart'; import 'const.dart'; import 'supabase.dart'; +typedef GroupsAndMembers = ({ + Iterable groups, + Iterable members, + Iterable profiles, +}); + class GroupsRepository extends SupabaseRepository with Postgrest { GroupsRepository({required super.supabase}) : super(tableName: Tables.groups); - Future< - ({ - Iterable groups, - Iterable members, - Iterable profiles, - })> getUserGroups() async { + Future getUserGroups() async { return table() - .select('*, members!inner(*,profiles!inner(*))') + .select('*,members!inner(*,profiles!inner(*))') // TODO(borgoat): should filter by profile_id but return all members // .eq('members.profile_id', supabase.auth.currentUser!.id) - .withConverter((data) { - final groups = {}; - final members = {}; - final profiles = {}; - for (var value in data) { - groups.add(Group.fromJson(value)); - for (var member in value['members']) { - members.add(Member.fromJson(member)); - profiles.add(Profile.fromJson(member['profiles'])); - } - } - return (groups: groups, members: members, profiles: profiles); - }); + .withConverter(_convertGroupsAndMembers); } Future getGroupById(int id) async { return table() - .select('*, members!inner(*,profiles!inner(*))') + .select('*,members!inner(*,profiles!inner(*))') .eq('id', id) .single() .withConverter(Group.fromJson); @@ -58,7 +47,7 @@ class GroupsRepository extends SupabaseRepository with Postgrest { 'picture': group.picture, }) .eq('id', group.id) - .select('*, members!inner(*)') + .select('*') .single() .withConverter(Group.fromJson); } @@ -71,4 +60,20 @@ class GroupsRepository extends SupabaseRepository with Postgrest { .single() .withConverter(Group.fromJson); } + + GroupsAndMembers _convertGroupsAndMembers(List> data) { + final groups = {}; + final members = {}; + final profiles = {}; + for (var value in data) { + groups.add(Group.fromJson(value)); + for (var member in value['members']) { + members.add(Member.fromJson(member)); + profiles.add(Profile.fromJson(member['profiles'])); + } + } + return (groups: groups, members: members, profiles: profiles); + } + + } diff --git a/macos/Podfile b/macos/Podfile index c795730..b52666a 100644 --- a/macos/Podfile +++ b/macos/Podfile @@ -1,4 +1,4 @@ -platform :osx, '10.14' +platform :osx, '10.15' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/macos/Podfile.lock b/macos/Podfile.lock index 2b65167..6363aa9 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -1,11 +1,29 @@ PODS: - app_links (1.0.0): - FlutterMacOS + - AppAuth (1.6.2): + - AppAuth/Core (= 1.6.2) + - AppAuth/ExternalUserAgent (= 1.6.2) + - AppAuth/Core (1.6.2) + - AppAuth/ExternalUserAgent (1.6.2): + - AppAuth/Core - dynamic_color (0.0.2): - FlutterMacOS - file_selector_macos (0.0.1): - FlutterMacOS - FlutterMacOS (1.0.0) + - google_sign_in_ios (0.0.1): + - Flutter + - FlutterMacOS + - GoogleSignIn (~> 7.0) + - GoogleSignIn (7.0.0): + - AppAuth (~> 1.5) + - GTMAppAuth (< 3.0, >= 1.3) + - GTMSessionFetcher/Core (< 4.0, >= 1.1) + - GTMAppAuth (2.0.0): + - AppAuth/Core (~> 1.6) + - GTMSessionFetcher/Core (< 4.0, >= 1.5) + - GTMSessionFetcher/Core (3.2.0) - path_provider_foundation (0.0.1): - Flutter - FlutterMacOS @@ -22,11 +40,19 @@ DEPENDENCIES: - dynamic_color (from `Flutter/ephemeral/.symlinks/plugins/dynamic_color/macos`) - file_selector_macos (from `Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos`) - FlutterMacOS (from `Flutter/ephemeral`) + - google_sign_in_ios (from `Flutter/ephemeral/.symlinks/plugins/google_sign_in_ios/darwin`) - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`) - sign_in_with_apple (from `Flutter/ephemeral/.symlinks/plugins/sign_in_with_apple/macos`) - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) +SPEC REPOS: + trunk: + - AppAuth + - GoogleSignIn + - GTMAppAuth + - GTMSessionFetcher + EXTERNAL SOURCES: app_links: :path: Flutter/ephemeral/.symlinks/plugins/app_links/macos @@ -36,6 +62,8 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos FlutterMacOS: :path: Flutter/ephemeral + google_sign_in_ios: + :path: Flutter/ephemeral/.symlinks/plugins/google_sign_in_ios/darwin path_provider_foundation: :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin shared_preferences_foundation: @@ -47,14 +75,19 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: app_links: 4481ed4d71f384b0c3ae5016f4633aa73d32ff67 + AppAuth: 3bb1d1cd9340bd09f5ed189fb00b1cc28e1e8570 dynamic_color: 2eaa27267de1ca20d879fbd6e01259773fb1670f file_selector_macos: 468fb6b81fac7c0e88d71317f3eec34c3b008ff9 FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 - path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 - shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126 + google_sign_in_ios: 1bfaf6607b44cd1b24c4d4bc39719870440f9ce1 + GoogleSignIn: b232380cf495a429b8095d3178a8d5855b42e842 + GTMAppAuth: 99fb010047ba3973b7026e45393f51f27ab965ae + GTMSessionFetcher: 41b9ef0b4c08a6db4b7eb51a21ae5183ec99a2c8 + path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c + shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695 sign_in_with_apple: a9e97e744e8edc36aefc2723111f652102a7a727 url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95 -PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367 +PODFILE CHECKSUM: 9ebaf0ce3d369aaa26a9ea0e159195ed94724cf3 -COCOAPODS: 1.12.1 +COCOAPODS: 1.14.3 diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index 5ca9cf1..5a210ab 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -195,7 +195,6 @@ D9225C9CDD2C17AB09019BE4 /* Pods-RunnerTests.release.xcconfig */, 22B187F46EA2A6711E35839B /* Pods-RunnerTests.profile.xcconfig */, ); - name = Pods; path = Pods; sourceTree = ""; }; @@ -241,6 +240,7 @@ 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, B2E715301588E344DDD636BD /* [CP] Embed Pods Frameworks */, + D0BCDE748F545724A34DC3CC /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -259,7 +259,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 1430; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 331C80D4294CF70F00263BE5 = { @@ -421,6 +421,23 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; + D0BCDE748F545724A34DC3CC /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -553,7 +570,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.14; + MACOSX_DEPLOYMENT_TARGET = 10.15; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; @@ -570,11 +587,13 @@ CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = D5Q258YWK7; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 10.15; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; }; @@ -632,7 +651,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.14; + MACOSX_DEPLOYMENT_TARGET = 10.15; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; @@ -679,7 +698,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.14; + MACOSX_DEPLOYMENT_TARGET = 10.15; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; @@ -696,11 +715,13 @@ CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = D5Q258YWK7; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 10.15; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; @@ -716,11 +737,13 @@ CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = D5Q258YWK7; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 10.15; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; }; diff --git a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 97e78f9..ff1fb75 100644 --- a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ com.apple.security.cs.allow-jit - com.apple.security.network.server + com.apple.security.device.camera + + com.apple.security.files.user-selected.read-only com.apple.security.network.client - com.apple.security.files.user-selected.read-only + com.apple.security.network.server diff --git a/macos/Runner/Release.entitlements b/macos/Runner/Release.entitlements index 741903e..0001fa3 100644 --- a/macos/Runner/Release.entitlements +++ b/macos/Runner/Release.entitlements @@ -4,9 +4,11 @@ com.apple.security.app-sandbox - com.apple.security.network.client + com.apple.security.device.camera com.apple.security.files.user-selected.read-only + com.apple.security.network.client +