Pasteboard improvements, UI fixes and site name from pasteboard URL.
[UPDATED] Timeout after 3 min for other pasteboard copies too. [FIXED] Sometimes cell content loading can fail, schedule a retry. [UPDATED] Dismiss keyboard when copying content. [IMPROVED] Handling of deactivation and reactivation observation. [ADDED] When a URL is in the pasteboard, search for the hostname.
This commit is contained in:
@@ -84,18 +84,28 @@
|
||||
- (IBAction)copyPassword:(id)sender {
|
||||
|
||||
NSString *sitePassword = [self.passwordButton titleForState:UIControlStateNormal];
|
||||
if ([sitePassword length]) {
|
||||
[UIPasteboard generalPasteboard].string = sitePassword;
|
||||
[UIView animateWithDuration:0.3f animations:^{
|
||||
self.tipContainer.visible = YES;
|
||||
} completion:^(BOOL finished) {
|
||||
PearlMainQueueAfter( 3, ^{
|
||||
[UIView animateWithDuration:0.3f animations:^{
|
||||
self.tipContainer.visible = NO;
|
||||
}];
|
||||
} );
|
||||
}];
|
||||
}
|
||||
if (![sitePassword length])
|
||||
return;
|
||||
|
||||
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
|
||||
if ([pasteboard respondsToSelector:@selector( setItems:options: )])
|
||||
[pasteboard setItems:@[ @{ UIPasteboardTypeAutomatic: sitePassword } ]
|
||||
options:@{
|
||||
UIPasteboardOptionLocalOnly : @NO,
|
||||
UIPasteboardOptionExpirationDate: [NSDate dateWithTimeIntervalSinceNow:3 * 60]
|
||||
}];
|
||||
else
|
||||
pasteboard.string = sitePassword;
|
||||
|
||||
[UIView animateWithDuration:0.3f animations:^{
|
||||
self.tipContainer.visible = YES;
|
||||
} completion:^(BOOL finished) {
|
||||
PearlMainQueueAfter( 3, ^{
|
||||
[UIView animateWithDuration:0.3f animations:^{
|
||||
self.tipContainer.visible = NO;
|
||||
}];
|
||||
} );
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Private
|
||||
|
Reference in New Issue
Block a user