Explorar el Código

Add copy action for database browser row selection alert

matrush hace 6 años
padre
commit
4dc206eaa6

+ 2 - 2
Classes/Core/Controllers/FLEXFilteringTableViewController.h

@@ -25,7 +25,7 @@
 @property (nonatomic, copy) NSArray<FLEXTableViewSection *> *allSections;
 @property (nonatomic, copy) NSArray<FLEXTableViewSection *> *allSections;
 
 
 /// This computed property should filter \c allSections for assignment to \c sections
 /// This computed property should filter \c allSections for assignment to \c sections
-@property (nonatomic, readonly) NSArray<FLEXTableViewSection *> *nonemptySections;
+@property (nonatomic, readonly, copy) NSArray<FLEXTableViewSection *> *nonemptySections;
 
 
 /// This should be able to re-initialize \c allSections
 /// This should be able to re-initialize \c allSections
 - (NSArray<FLEXTableViewSection *> *)makeSections;
 - (NSArray<FLEXTableViewSection *> *)makeSections;
@@ -80,7 +80,7 @@
 /// if using \c self as the \c filterDelegate, as is the default.
 /// if using \c self as the \c filterDelegate, as is the default.
 ///
 ///
 /// For example, the object explorer hides the description section when searching.
 /// For example, the object explorer hides the description section when searching.
-@property (nonatomic, readonly) NSArray<FLEXTableViewSection *> *nonemptySections;
+@property (nonatomic, readonly, copy) NSArray<FLEXTableViewSection *> *nonemptySections;
 
 
 /// If using \c self as the \c filterDelegate, as is the default,
 /// If using \c self as the \c filterDelegate, as is the default,
 /// subclasses should override to provide the sections for the table view.
 /// subclasses should override to provide the sections for the table view.

+ 4 - 4
Classes/Core/Controllers/FLEXTableViewController.h

@@ -89,7 +89,7 @@ extern CGFloat const kFLEXDebounceForExpensiveIO;
 /// or it will not be respsected. Use this instead.
 /// or it will not be respsected. Use this instead.
 /// Defaults to NO.
 /// Defaults to NO.
 @property (nonatomic) BOOL pinSearchBar;
 @property (nonatomic) BOOL pinSearchBar;
-/// By default, we will show the search bar's cancel button when 
+/// By default, we will show the search bar's cancel button when
 /// search becomes active and hide it when search is dismissed.
 /// search becomes active and hide it when search is dismissed.
 ///
 ///
 /// Do not set the showsCancelButton property on the searchController's
 /// Do not set the showsCancelButton property on the searchController's
@@ -102,11 +102,11 @@ extern CGFloat const kFLEXDebounceForExpensiveIO;
 /// Otherwise, this is the selected index of the carousel, or NSNotFound if using neither.
 /// Otherwise, this is the selected index of the carousel, or NSNotFound if using neither.
 @property (nonatomic) NSInteger selectedScope;
 @property (nonatomic) NSInteger selectedScope;
 /// self.searchController.searchBar.text
 /// self.searchController.searchBar.text
-@property (nonatomic, readonly) NSString *searchText;
+@property (nonatomic, readonly, copy) NSString *searchText;
 
 
 /// A totally optional delegate to forward search results updater calls to.
 /// A totally optional delegate to forward search results updater calls to.
-/// If a delegate is set, updateSearchResults: is not called on this view controller. 
-@property (nonatomic, weak    ) id<FLEXSearchResultsUpdating> searchResultsUpdater;
+/// If a delegate is set, updateSearchResults: is not called on this view controller.
+@property (nonatomic, weak) id<FLEXSearchResultsUpdating> searchResultsUpdater;
 
 
 /// self.view.window as a \c FLEXWindow
 /// self.view.window as a \c FLEXWindow
 @property (nonatomic, readonly) FLEXWindow *window;
 @property (nonatomic, readonly) FLEXWindow *window;

+ 1 - 1
Classes/Core/FLEXTableViewSection.h

@@ -30,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 
 /// A title to be displayed for the custom section.
 /// A title to be displayed for the custom section.
 /// Subclasses may override or use the \c _title ivar.
 /// Subclasses may override or use the \c _title ivar.
-@property (nonatomic, readonly, nullable) NSString *title;
+@property (nonatomic, readonly, nullable, copy) NSString *title;
 /// The number of rows in this section. Subclasses must override.
 /// The number of rows in this section. Subclasses must override.
 /// This should not change until \c filterText is changed or \c reloadData is called.
 /// This should not change until \c filterText is changed or \c reloadData is called.
 @property (nonatomic, readonly) NSInteger numberOfRows;
 @property (nonatomic, readonly) NSInteger numberOfRows;

+ 5 - 1
Classes/GlobalStateExplorers/DatabaseBrowser/FLEXTableContentViewController.m

@@ -113,7 +113,11 @@
     
     
     [FLEXAlert makeAlert:^(FLEXAlert *make) {
     [FLEXAlert makeAlert:^(FLEXAlert *make) {
         make.title([@"Row " stringByAppendingString:@(row).stringValue]);
         make.title([@"Row " stringByAppendingString:@(row).stringValue]);
-        make.message([fields componentsJoinedByString:@"\n\n"]);
+        NSString *message = [fields componentsJoinedByString:@"\n\n"];
+        make.message(message);
+        make.button(@"Copy").handler(^(NSArray<NSString *> *strings) {
+            UIPasteboard.generalPasteboard.string = message;
+        });
         make.button(@"Dismiss").cancelStyle();
         make.button(@"Dismiss").cancelStyle();
     } showFrom:self];
     } showFrom:self];
 }
 }

+ 1 - 1
Classes/ObjectExplorers/Sections/FLEXCollectionContentSection.h

@@ -77,7 +77,7 @@ typedef id<FLEXCollection>(^FLEXCollectionContentFuture)(__kindof FLEXCollection
 /// Defaults to \c NO
 /// Defaults to \c NO
 @property (nonatomic) BOOL hideSectionTitle;
 @property (nonatomic) BOOL hideSectionTitle;
 /// Defaults to \c nil
 /// Defaults to \c nil
-@property (nonatomic) NSString *customTitle;
+@property (nonatomic, copy) NSString *customTitle;
 /// Defaults to \c NO
 /// Defaults to \c NO
 ///
 ///
 /// Settings this to \c NO will not display the element index for ordered collections.
 /// Settings this to \c NO will not display the element index for ordered collections.

+ 1 - 1
Classes/ObjectExplorers/Sections/FLEXMutableListSection.h

@@ -36,7 +36,7 @@ typedef void (^FLEXMutableListCellForElement)(__kindof UITableViewCell *cell, id
 
 
 /// By default, rows are not selectable. If you want rows
 /// By default, rows are not selectable. If you want rows
 /// to be selectable, provide a selection handler here.
 /// to be selectable, provide a selection handler here.
-@property (nonatomic) void (^selectionHandler)(__kindof UIViewController * host, id element);
+@property (nonatomic, copy) void (^selectionHandler)(__kindof UIViewController *host, id element);
 
 
 /// The objects representing all possible rows in the section.
 /// The objects representing all possible rows in the section.
 @property (nonatomic) NSArray<ObjectType> *list;
 @property (nonatomic) NSArray<ObjectType> *list;