Skip to content

Commit

Permalink
Enable Catalyst support for the catalogs.
Browse files Browse the repository at this point in the history
Turning this support on revealed a new class of error:

```
Implicit conversion from integral type 'int' to 'BOOL'
```

These errors have been fixed where applicable.

Note that due to https://stackoverflow.com/questions/58547010/ios-catalyst-cocoapod-framework-error-signing-requires-a-development-team, each of the icons pod targets needs to have its Signing Certificate value manually set to "Sign to Run Locally".

Separately, due to onmyway133/blog#572 we also need to disable Library Validation on the projects.

Closes #10059

COPYBARA_INTEGRATE_REVIEW=#10059 from jverkoey:catalyst 6612744
PiperOrigin-RevId: 326058707
  • Loading branch information
jverkoey authored and material-automation committed Aug 11, 2020
1 parent 7532dfd commit 8cea56b
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 14 deletions.
12 changes: 12 additions & 0 deletions catalog/MDCActionExtension/MDCActionExtension.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>
34 changes: 30 additions & 4 deletions catalog/MDCCatalog.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@
664524C21C6BA62A001ADBF8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
665A34D91C6BD01900962055 /* MDCCatalog-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MDCCatalog-Bridging-Header.h"; sourceTree = "<group>"; };
6681FDFC1CC586660013A0C7 /* MDCCatalogTileView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MDCCatalogTileView.swift; sourceTree = "<group>"; };
66A69D4024E2FDC900D0698E /* MDCCatalog.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = MDCCatalog.entitlements; sourceTree = "<group>"; };
66A69D4124E2FDC900D0698E /* MDCActionExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = MDCActionExtension.entitlements; sourceTree = "<group>"; };
66CD19282072A54000DE6340 /* AppTheme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppTheme.swift; sourceTree = "<group>"; };
66D3389420730A3E00FFA1AB /* MDCThemePickerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MDCThemePickerViewController.swift; sourceTree = "<group>"; };
88AB955E76304B684707293E /* Pods_MDCActionExtension.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MDCActionExtension.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -161,6 +163,7 @@
64307B391DF74FEF004AE4AC /* MDCActionExtension */ = {
isa = PBXGroup;
children = (
66A69D4124E2FDC900D0698E /* MDCActionExtension.entitlements */,
64307B3A1DF74FEF004AE4AC /* MDCActionViewController.h */,
64307B3B1DF74FEF004AE4AC /* MDCActionViewController.m */,
64307B481DF76170004AE4AC /* Resources */,
Expand Down Expand Up @@ -202,6 +205,7 @@
664524B51C6BA62A001ADBF8 /* MDCCatalog */ = {
isa = PBXGroup;
children = (
66A69D4024E2FDC900D0698E /* MDCCatalog.entitlements */,
664524B61C6BA62A001ADBF8 /* AppDelegate.swift */,
66CD19282072A54000DE6340 /* AppTheme.swift */,
665A34D91C6BD01900962055 /* MDCCatalog-Bridging-Header.h */,
Expand Down Expand Up @@ -585,15 +589,20 @@
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CODE_SIGN_ENTITLEMENTS = MDCActionExtension/MDCActionExtension.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = EQHXZ8M8AV;
DEVELOPMENT_TEAM = "";
"ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES;
INFOPLIST_FILE = MDCActionExtension/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.google.mdc-catalog.MDCActionExtension";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "Google Development";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SKIP_INSTALL = YES;
SUPPORTS_MACCATALYST = YES;
SWIFT_VERSION = 4.2;
};
name = Debug;
Expand All @@ -607,15 +616,20 @@
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CODE_SIGN_ENTITLEMENTS = MDCActionExtension/MDCActionExtension.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = EQHXZ8M8AV;
DEVELOPMENT_TEAM = "";
"ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES;
INFOPLIST_FILE = MDCActionExtension/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.google.mdc-catalog.MDCActionExtension";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "Google Development";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SKIP_INSTALL = YES;
SUPPORTS_MACCATALYST = YES;
SWIFT_VERSION = 4.2;
};
name = Release;
Expand Down Expand Up @@ -733,17 +747,23 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = MDCCatalog/MDCCatalog.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = EQHXZ8M8AV;
DEVELOPMENT_TEAM = "";
"ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES;
INFOPLIST_FILE = MDCCatalog/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.google.MDCCatalog;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "Google Development";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SUPPORTS_MACCATALYST = YES;
SWIFT_OBJC_BRIDGING_HEADER = "MDCCatalog/MDCCatalog-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2,6";
};
name = Debug;
};
Expand All @@ -754,16 +774,22 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = MDCCatalog/MDCCatalog.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = EQHXZ8M8AV;
DEVELOPMENT_TEAM = "";
"ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES;
INFOPLIST_FILE = MDCCatalog/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.google.MDCCatalog;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "Google Development";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SUPPORTS_MACCATALYST = YES;
SWIFT_OBJC_BRIDGING_HEADER = "MDCCatalog/MDCCatalog-Bridging-Header.h";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2,6";
};
name = Release;
};
Expand Down
12 changes: 12 additions & 0 deletions catalog/MDCCatalog/MDCCatalog.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>
20 changes: 16 additions & 4 deletions catalog/MDCDragons.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
5CE8092C1FD729880068A050 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
5CE809381FD729880068A050 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
63301F6E1E07E3E0BAAFE1AF /* Pods-MDCDragons.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MDCDragons.release.xcconfig"; path = "Pods/Target Support Files/Pods-MDCDragons/Pods-MDCDragons.release.xcconfig"; sourceTree = "<group>"; };
66A69D4224E310E100D0698E /* MDCDragons.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = MDCDragons.entitlements; sourceTree = "<group>"; };
D1727545609D5A05DD1A8DD8 /* Pods_MDCDragons.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MDCDragons.framework; sourceTree = BUILT_PRODUCTS_DIR; };
DF373EC1248FF0C900F47798 /* MDCCatalogWindow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MDCCatalogWindow.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -72,6 +73,7 @@
5CE8092B1FD729880068A050 /* MDCDragons */ = {
isa = PBXGroup;
children = (
66A69D4224E310E100D0698E /* MDCDragons.entitlements */,
DF373EC1248FF0C900F47798 /* MDCCatalogWindow.swift */,
5CE8092C1FD729880068A050 /* AppDelegate.swift */,
5C3964411FD72D0E003CB44B /* MDCDragonsController.swift */,
Expand Down Expand Up @@ -372,16 +374,21 @@
baseConfigurationReference = 096F30AD42FD7675B81193D1 /* Pods-MDCDragons.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIconInverse;
CODE_SIGN_ENTITLEMENTS = MDCDragons/MDCDragons.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = EQHXZ8M8AV;
DEVELOPMENT_TEAM = "";
"ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES;
INFOPLIST_FILE = MDCDragons/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.google.MDCDragons;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "Google Development";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SUPPORTS_MACCATALYST = YES;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,6";
};
name = Debug;
};
Expand All @@ -390,16 +397,21 @@
baseConfigurationReference = 63301F6E1E07E3E0BAAFE1AF /* Pods-MDCDragons.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIconInverse;
CODE_SIGN_ENTITLEMENTS = MDCDragons/MDCDragons.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = EQHXZ8M8AV;
DEVELOPMENT_TEAM = "";
"ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES;
INFOPLIST_FILE = MDCDragons/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.google.MDCDragons;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "Google Development";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SUPPORTS_MACCATALYST = YES;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,6";
};
name = Release;
};
Expand Down
12 changes: 12 additions & 0 deletions catalog/MDCDragons/MDCDragons.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>
3 changes: 2 additions & 1 deletion components/CollectionCells/src/MDCCollectionViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,8 @@ - (void)drawSeparatorIfNeeded {
_usesCellSeparatorHiddenOverride ? _shouldHideSeparator : _attr.shouldHideSeparators;
UIEdgeInsets separatorInset =
_usesCellSeparatorInsetOverride ? _separatorInset : _attr.separatorInset;
BOOL isBottom = _attr.sectionOrdinalPosition & MDCCollectionViewOrdinalPositionVerticalBottom;
BOOL isBottom =
(_attr.sectionOrdinalPosition & MDCCollectionViewOrdinalPositionVerticalBottom) ? YES : NO;
BOOL isGrid = _attr.isGridLayout;

BOOL hideSeparator = isBottom || isHidden || isGrid;
Expand Down
6 changes: 4 additions & 2 deletions components/Collections/src/private/MDCCollectionViewStyler.m
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,10 @@ - (UIImage *)backgroundImageForCellLayoutAttributes:(MDCCollectionViewLayoutAttr
[attr.representedElementKind isEqualToString:UICollectionElementKindSectionFooter];
BOOL isDecorationView =
attr.representedElementCategory == UICollectionElementCategoryDecorationView;
BOOL isTop = attr.sectionOrdinalPosition & MDCCollectionViewOrdinalPositionVerticalTop;
BOOL isBottom = attr.sectionOrdinalPosition & MDCCollectionViewOrdinalPositionVerticalBottom;
BOOL isTop =
(attr.sectionOrdinalPosition & MDCCollectionViewOrdinalPositionVerticalTop) ? YES : NO;
BOOL isBottom =
(attr.sectionOrdinalPosition & MDCCollectionViewOrdinalPositionVerticalBottom) ? YES : NO;

MDCCollectionViewCellStyle cellStyle = [self cellStyleAtSectionIndex:attr.indexPath.section];
BOOL isCardStyle = cellStyle == MDCCollectionViewCellStyleCard;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,11 @@ - (void)observeValueForKeyPath:(NSString *)keyPath
CGPoint contentOffset = [(NSValue *)[change objectForKey:NSKeyValueChangeNewKey] CGPointValue];
CGPoint oldContentOffset =
[(NSValue *)[change objectForKey:NSKeyValueChangeOldKey] CGPointValue];
self.scrollViewIsDraggedToBottom = contentOffset.y == oldContentOffset.y
? self.scrollViewIsDraggedToBottom
: contentOffset.y < oldContentOffset.y;
self.scrollViewIsDraggedToBottom =
(contentOffset.y == oldContentOffset.y ? self.scrollViewIsDraggedToBottom
: contentOffset.y < oldContentOffset.y)
? YES
: NO;

// The normalized content offset takes the content offset and updates it if using the
// performance logic that comes with setting the tracking scroll view. The reason we update
Expand Down

0 comments on commit 8cea56b

Please sign in to comment.