|
@@ -133,6 +133,12 @@
|
|
|
UILongPressGestureRecognizer* longPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(onLongPressTableView:)];
|
|
|
[self.tableView addGestureRecognizer:longPressRecognizer];
|
|
|
|
|
|
+ // vewView Tap Action
|
|
|
+ UITapGestureRecognizer *webViewTapped = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(webViewTapAction:)];
|
|
|
+ webViewTapped.numberOfTapsRequired = 1;
|
|
|
+ webViewTapped.delegate = self;
|
|
|
+ [self.webView addGestureRecognizer:webViewTapped];
|
|
|
+
|
|
|
// Pull-to-Refresh
|
|
|
[self createRefreshControl];
|
|
|
|
|
@@ -318,7 +324,16 @@
|
|
|
// Nextcloud 18
|
|
|
tableCapabilities *capabilities = [[NCManageDatabase sharedInstance] getCapabilitesWithAccount:appDelegate.activeAccount];
|
|
|
if (capabilities.versionMajor >= k_nextcloud_version_18_0) {
|
|
|
- self.viewSectionWebViewHeight.constant = CCUtility.getViewSectionWebViewHeight;
|
|
|
+ tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@ AND fileNameView LIKE[c] %@", appDelegate.activeAccount, self.serverUrl, @"readme.md"]];
|
|
|
+ if (metadata && [[NCUtility sharedInstance] isDirectEditing:metadata]) {
|
|
|
+ NSString *htmlString = metadata.richWorkspace;
|
|
|
+ [self.webView loadHTMLString:htmlString baseURL:NSBundle.mainBundle.bundleURL];
|
|
|
+ self.viewSectionWebViewHeight.constant = CCUtility.getViewSectionWebViewHeight;
|
|
|
+ } else {
|
|
|
+ NSString *htmlString = [NSString stringWithFormat:@"<h2><span style=\"color: #999999;\">%@</span></h2>", NSLocalizedString(@"_add_notes_readme_md_", nil)];
|
|
|
+ [self.webView loadHTMLString:htmlString baseURL:NSBundle.mainBundle.bundleURL];
|
|
|
+ self.viewSectionWebViewHeight.constant = CCUtility.getViewSectionWebViewHeight;
|
|
|
+ }
|
|
|
[self.mainChangeHeightWebView setHidden:false];
|
|
|
} else {
|
|
|
self.viewSectionWebViewHeight.constant = 0;
|
|
@@ -1934,6 +1949,39 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+#pragma --------------------------------------------------------------------------------------------
|
|
|
+#pragma mark ===== Web view (NC 18) =====
|
|
|
+#pragma --------------------------------------------------------------------------------------------
|
|
|
+
|
|
|
+- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
|
|
|
+{
|
|
|
+ return YES;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)webViewTapAction:(UITapGestureRecognizer *)tapGesture
|
|
|
+{
|
|
|
+ tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@ AND fileNameView LIKE[c] %@", appDelegate.activeAccount, self.serverUrl, @"readme.md"]];
|
|
|
+ if (metadata && [[NCUtility sharedInstance] isDirectEditing:metadata]) {
|
|
|
+ if (appDelegate.reachability.isReachable) {
|
|
|
+ [self shouldPerformSegue:metadata selector:@""];
|
|
|
+ } else {
|
|
|
+ [[NCContentPresenter shared] messageNotification:@"_info_" description:@"_go_online_" delay:k_dismissAfterSecond type:messageTypeInfo errorCode:0];
|
|
|
+ }
|
|
|
+ } else if (metadata == nil) {
|
|
|
+ NSString *fileNamePath = [CCUtility returnFileNamePathFromFileName:@"Readme.md" serverUrl:self.serverUrl activeUrl:appDelegate.activeUrl];
|
|
|
+ [[NCCommunication sharedInstance] NCTextCreateFileWithUrlString:appDelegate.activeUrl fileNamePath:fileNamePath editor:@"text" templateId:@"" account:appDelegate.activeAccount completionHandler:^(NSString *account, NSString *url, NSInteger errorCode, NSString *errorMessage) {
|
|
|
+ if (errorCode == 0 && [account isEqualToString:appDelegate.activeAccount]) {
|
|
|
+ tableMetadata *metadata = [CCUtility createMetadataWithAccount:appDelegate.activeAccount date:[NSDate date] directory:false ocId:[CCUtility createRandomString:12] serverUrl:self.serverUrl fileName:@"Readme.md" etag:@"" size:0 status:k_metadataStatusNormal url:url contentType:@"text/markdown"];
|
|
|
+ [self shouldPerformSegue:metadata selector:@""];
|
|
|
+ } else if (errorCode != 0) {
|
|
|
+ [NCContentPresenter.shared messageNotification:@"_error_" description:errorMessage delay:k_dismissAfterSecond type:messageTypeError errorCode:errorCode];
|
|
|
+ } else {
|
|
|
+ NSLog(@"[LOG] It has been changed user during networking process, error.");
|
|
|
+ }
|
|
|
+ }];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
#pragma --------------------------------------------------------------------------------------------
|
|
|
#pragma mark ===== Favorite =====
|
|
|
#pragma --------------------------------------------------------------------------------------------
|