Skip to content

Commit

Permalink
Offline behaviour in Open In Action (#227)
Browse files Browse the repository at this point in the history
* -Add proper message when no connection and user tries to make the open in action

* - Localize the error message.

* - Made the name of the app to be the app's name in the bundle
  • Loading branch information
pablocarmu authored Jan 28, 2019
1 parent d712c82 commit fcc5e44
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ios-sdk
Submodule ios-sdk updated 31 files
+2 −2 .tx/config
+70 −0 ownCloudSDK.xcodeproj/project.pbxproj
+203 −0 ownCloudSDK/Resources/cs.lproj/Localizable.strings
+203 −0 ownCloudSDK/Resources/de-DE.lproj/Localizable.strings
+ ownCloudSDK/Resources/en-GB.lproj/Localizable.strings
+ ownCloudSDK/Resources/en_GB.lproj/Localizable.strings
+203 −0 ownCloudSDK/Resources/ko.lproj/Localizable.strings
+203 −0 ownCloudSDK/Resources/mk.lproj/Localizable.strings
+203 −0 ownCloudSDK/Resources/nb-NO.lproj/Localizable.strings
+203 −0 ownCloudSDK/Resources/nn-NO.lproj/Localizable.strings
+ ownCloudSDK/Resources/pt-BR.lproj/Localizable.strings
+ ownCloudSDK/Resources/pt-PT.lproj/Localizable.strings
+ ownCloudSDK/Resources/pt_BR.lproj/Localizable.strings
+ ownCloudSDK/Resources/ru.lproj/Localizable.strings
+ ownCloudSDK/Resources/sq.lproj/Localizable.strings
+ ownCloudSDK/Resources/th-TH.lproj/Localizable.strings
+ ownCloudSDK/Resources/th_TH.lproj/Localizable.strings
+ ownCloudSDK/Resources/zh-Hans.lproj/Localizable.strings
+46 −0 ownCloudUI/Resources/cs.lproj/Localizable.strings
+46 −0 ownCloudUI/Resources/de-DE.lproj/Localizable.strings
+46 −0 ownCloudUI/Resources/de.lproj/Localizable.strings
+ ownCloudUI/Resources/en-GB.lproj/Localizable.strings
+ ownCloudUI/Resources/gl.lproj/Localizable.strings
+46 −0 ownCloudUI/Resources/ko.lproj/Localizable.strings
+46 −0 ownCloudUI/Resources/mk.lproj/Localizable.strings
+46 −0 ownCloudUI/Resources/nb-NO.lproj/Localizable.strings
+46 −0 ownCloudUI/Resources/nn-NO.lproj/Localizable.strings
+ ownCloudUI/Resources/pt-BR.lproj/Localizable.strings
+ ownCloudUI/Resources/pt-PT.lproj/Localizable.strings
+ ownCloudUI/Resources/th-TH.lproj/Localizable.strings
+46 −0 ownCloudUI/Resources/zh-Hans.lproj/Localizable.strings
13 changes: 12 additions & 1 deletion ownCloud/Client/Actions/Actions+Extensions/OpenInAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,20 @@ class OpenInAction: Action {
let controller = DownloadFileProgressHUDViewController()

controller.present(on: viewController) {
if let progress = self.core?.downloadItem(item, options: nil, resultHandler: { (error, _, _, file) in
if let progress = self.core?.downloadItem(item, options: [ .returnImmediatelyIfOfflineOrUnavailable : true ], resultHandler: { (error, _, _, file) in
if error != nil {
Log.log("Error \(String(describing: error)) downloading \(String(describing: item.path)) in openIn function")

self.completionHandler = { error in
var name = "ownCloud"
if let appName = Bundle.main.infoDictionary?[kCFBundleNameKey as String] as? String {
name = appName
}

let alertController = UIAlertController(with: "Cannot connect to ".localized + name, message: name + " couldn't download this file".localized, okLabel: "OK".localized, action: nil)
viewController.present(alertController, animated: true)
}

controller.dismiss(animated: true, completion: {
self.completed(with: error)
})
Expand Down
2 changes: 2 additions & 0 deletions ownCloud/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@
"Open in" = "Open in";
"Copy" = "Copy";
"Copy here" = "Copy here";
"Cannot connect to " = "Cannot connect to ";
" couldn't download this file" = " couldn't download this file";

/* Directory Picker Messages */
"Move here" = "Move here";
Expand Down

0 comments on commit fcc5e44

Please sign in to comment.