Skip to content

Commit

Permalink
fix: macos
Browse files Browse the repository at this point in the history
  • Loading branch information
borgoat committed Jan 29, 2024
1 parent 1f73d24 commit 30e716e
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 51 deletions.
21 changes: 6 additions & 15 deletions lib/presentation/widgets/group_members.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,17 @@ class GroupMembers extends StatelessWidget {
});

Future<List<ContactInvite>?> _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<List<Contact>>(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();
}

Expand Down
49 changes: 27 additions & 22 deletions lib/repositories/groups.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,26 @@ import 'package:parousia/models/models.dart';
import 'const.dart';
import 'supabase.dart';

typedef GroupsAndMembers = ({
Iterable<Group> groups,
Iterable<Member> members,
Iterable<Profile> profiles,
});

class GroupsRepository extends SupabaseRepository with Postgrest {
GroupsRepository({required super.supabase}) : super(tableName: Tables.groups);

Future<
({
Iterable<Group> groups,
Iterable<Member> members,
Iterable<Profile> profiles,
})> getUserGroups() async {
Future<GroupsAndMembers> 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 = <Group>{};
final members = <Member>{};
final profiles = <Profile>{};
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<Group> getGroupById(int id) async {
return table()
.select('*, members!inner(*,profiles!inner(*))')
.select('*,members!inner(*,profiles!inner(*))')
.eq('id', id)
.single()
.withConverter(Group.fromJson);
Expand All @@ -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);
}
Expand All @@ -71,4 +60,20 @@ class GroupsRepository extends SupabaseRepository with Postgrest {
.single()
.withConverter(Group.fromJson);
}

GroupsAndMembers _convertGroupsAndMembers(List<Map<String, dynamic>> data) {
final groups = <Group>{};
final members = <Member>{};
final profiles = <Profile>{};
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);
}


}
2 changes: 1 addition & 1 deletion macos/Podfile
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
41 changes: 37 additions & 4 deletions macos/Podfile.lock
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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
33 changes: 28 additions & 5 deletions macos/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@
D9225C9CDD2C17AB09019BE4 /* Pods-RunnerTests.release.xcconfig */,
22B187F46EA2A6711E35839B /* Pods-RunnerTests.profile.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
Expand Down Expand Up @@ -241,6 +240,7 @@
33CC110E2044A8840003C045 /* Bundle Framework */,
3399D490228B24CF009A79C7 /* ShellScript */,
B2E715301588E344DDD636BD /* [CP] Embed Pods Frameworks */,
D0BCDE748F545724A34DC3CC /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -259,7 +259,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
331C80D4294CF70F00263BE5 = {
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
Expand All @@ -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;
};
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
6 changes: 4 additions & 2 deletions macos/Runner/DebugProfile.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.network.server</key>
<key>com.apple.security.device.camera</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<key>com.apple.security.network.server</key>
<true/>
</dict>
</plist>
4 changes: 3 additions & 1 deletion macos/Runner/Release.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.network.client</key>
<key>com.apple.security.device.camera</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>

0 comments on commit 30e716e

Please sign in to comment.