Skip to content

Commit

Permalink
🛁 Cleanup: Remove Debug Logs
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicstop committed Sep 25, 2022
1 parent 588e6dd commit 78c7479
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 73 deletions.
6 changes: 1 addition & 5 deletions ios/src/ReactNative/RNIContextMenu/RNIMenuActionItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,7 @@ extension RNIMenuActionItem {

typealias ActionItemHandler = ([String: Any], UIAction) -> Void;

func createAction(handler: @escaping ActionItemHandler) -> UIAction {
#if DEBUG
print("RNIMenuActionItem, makeUIAction...");
#endif

func createAction(handler: @escaping ActionItemHandler) -> UIAction {
let action = UIAction(
title : self.actionTitle,
image : self.icon?.image,
Expand Down
9 changes: 0 additions & 9 deletions ios/src/ReactNative/RNIContextMenu/RNIMenuItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,24 +79,15 @@ class RNIMenuItem: RNIMenuElement {
guard let dictItem = $0 as? NSDictionary else { return nil };

if let menuItem = RNIMenuItem(dictionary: dictItem) {
#if DEBUG
print("RNIMenuItem, init - compactMap: Creating RNIMenuItem...");
#endif
return menuItem;

} else if let menuAction = RNIMenuActionItem(dictionary: dictItem) {
#if DEBUG
print("RNIMenuItem, init - compactMap: Creating RNIMenuActionItem...");
#endif
return menuAction;

} else if let deferredElement = RNIDeferredMenuElement(dictionary: dictItem) {
return deferredElement;

} else {
#if DEBUG
print("RNIMenuItem, init - compactMap: nil");
#endif
return nil;
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,6 @@ class RNIContextMenuButton: UIButton {

let rootMenuConfig = RNIMenuItem(dictionary: rawMenuConfig)
else { return };

#if DEBUG
print("RNIContextMenuButton"
+ " - menuConfig didSet"
+ " - RNIMenuItem init"
);
#endif

// cleanup `deferredElementCompletionMap`
self.cleanupOrphanedDeferredElements(currentMenuConfig: rootMenuConfig);
Expand Down Expand Up @@ -321,12 +314,6 @@ extension RNIContextMenuButton {
// context menu display begins
override func contextMenuInteraction(_ interaction: UIContextMenuInteraction, willDisplayMenuFor configuration: UIContextMenuConfiguration, animator: UIContextMenuInteractionAnimating?) {
super.contextMenuInteraction(interaction, willDisplayMenuFor: configuration, animator: animator);

#if DEBUG
print("RNIContextMenuButton, UIContextMenuInteractionDelegate"
+ " - contextMenuInteraction: will show"
);
#endif

self.isContextMenuVisible = true;

Expand All @@ -340,12 +327,6 @@ extension RNIContextMenuButton {
override func contextMenuInteraction(_ interaction: UIContextMenuInteraction, willEndFor configuration: UIContextMenuConfiguration, animator: UIContextMenuInteractionAnimating?) {
super.contextMenuInteraction(interaction, willEndFor: configuration, animator: animator);

#if DEBUG
print("RNIContextMenuButton, UIContextMenuInteractionDelegate"
+ " - contextMenuInteraction: will hide"
);
#endif

guard self.isContextMenuVisible else { return };

self.onMenuWillHide?([:]);
Expand Down
43 changes: 3 additions & 40 deletions ios/src/ReactNative/RNIContextMenuView/RNIContextMenuView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,6 @@ class RNIContextMenuView: UIView {

menuConfig.shouldUseDiscoverabilityTitleAsFallbackValueForSubtitle =
self.shouldUseDiscoverabilityTitleAsFallbackValueForSubtitle;

#if DEBUG
print("menuConfig didSet"
+ " - RNIMenuItem init"
+ " - menuConfig count: \(menuConfigDict.count)"
);
#endif

self.updateContextMenuIfVisible(with: menuConfig);

Expand Down Expand Up @@ -457,14 +450,8 @@ fileprivate extension RNIContextMenuView {

/// create `UIMenu` based on `menuConfig` prop
func createMenu(_ suggestedAction: [UIMenuElement]) -> UIMenu? {
guard let menuConfig = self._menuConfig else {
#if DEBUG
print("RNIContextMenuView, createMenu"
+ " - guard check failed, menuConfig: nil"
);
#endif
return nil;
};
guard let menuConfig = self._menuConfig
else { return nil };

return menuConfig.createMenu(actionItemHandler: {
// A. menu item has been pressed...
Expand Down Expand Up @@ -554,13 +541,7 @@ fileprivate extension RNIContextMenuView {
self.isContextMenuVisible,
let interaction: UIContextMenuInteraction = self.contextMenuInteraction
else { return };

#if DEBUG
print("menuConfig didSet"
+ " - Updating visible menu"
);
#endif


// context menu is open, update the menu items
interaction.updateVisibleMenu { _ in
return menuConfig.createMenu(
Expand Down Expand Up @@ -1149,12 +1130,6 @@ extension RNIContextMenuView: UIContextMenuInteractionDelegate {
willDisplayMenuFor configuration: UIContextMenuConfiguration,
animator: UIContextMenuInteractionAnimating?
) {

#if DEBUG
print("RNIContextMenuView, UIContextMenuInteractionDelegate"
+ " - contextMenuInteraction: will show"
);
#endif

self.isContextMenuVisible = true;
self.onMenuWillShow?([:]);
Expand Down Expand Up @@ -1201,12 +1176,6 @@ extension RNIContextMenuView: UIContextMenuInteractionDelegate {
willEndFor configuration: UIContextMenuConfiguration,
animator: UIContextMenuInteractionAnimating?
) {

#if DEBUG
print("RNIContextMenuView, UIContextMenuInteractionDelegate"
+ " - contextMenuInteraction: will hide"
);
#endif

guard self.isContextMenuVisible else { return };

Expand Down Expand Up @@ -1243,12 +1212,6 @@ extension RNIContextMenuView: UIContextMenuInteractionDelegate {
willPerformPreviewActionForMenuWith configuration: UIContextMenuConfiguration,
animator: UIContextMenuInteractionCommitAnimating
) {

#if DEBUG
print("RNIContextMenuView, UIContextMenuInteractionDelegate"
+ " - contextMenuInteraction: preview tapped"
);
#endif

// MARK: Experimental - "Auxiliary Context Menu Preview"-Related
// hide preview auxiliary view
Expand Down

0 comments on commit 78c7479

Please sign in to comment.