Skip to content

Commit 4961e40

Browse files
authored
Merge pull request #51 from opendocument-app/development
1.14
2 parents 7c30841 + b411f53 commit 4961e40

27 files changed

+1577
-1079
lines changed

.github/workflows/ios_main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Install pods
1717
run: pod install
1818
- name: Run build.sh
19-
run: bash build.sh
19+
run: bash build-simulator.sh
2020
- name: Build
2121
run: |
2222
xcodebuild clean build -workspace OpenDocumentReader.xcworkspace -scheme "${scheme}" -destination "${destination}" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
cmake_minimum_required(VERSION 3.12.4)
2+
3+
option (ODR_TEST "" OFF)
4+
set(ODR_TEST OFF)
5+
6+
add_subdirectory(OpenDocument.core)

OpenDocument.core

OpenDocumentReader.xcodeproj/project.pbxproj

Lines changed: 341 additions & 1042 deletions
Large diffs are not rendered by default.

OpenDocumentReader/CoreWrapper.mm

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010

1111
#import "CoreWrapper.h"
1212

13-
#include "TranslationHelper.h"
14-
#include "TranslationConfig.h"
15-
#include "FileMeta.h"
13+
#include "odr/OpenDocumentReader.h"
14+
#include "odr/Config.h"
15+
#include "odr/Meta.h"
1616

1717
@implementation CoreWrapper {
18-
odr::TranslationHelper translator;
18+
odr::OpenDocumentReader translator;
1919
bool initialized;
2020
}
2121

@@ -25,15 +25,15 @@ - (bool)translate:(NSString *)inputPath into:(NSString *)outputPath at:(NSNumber
2525
_errorCode = 0;
2626

2727
if (!initialized) {
28-
bool opened = translator.openOpenDocument([inputPath cStringUsingEncoding:NSUTF8StringEncoding]);
28+
bool opened = translator.open([inputPath cStringUsingEncoding:NSUTF8StringEncoding]);
2929
if (!opened) {
3030
_errorCode = @(-1);
3131
return false;
3232
}
3333

3434
const auto meta = translator.getMeta();
3535

36-
bool decrypted = !meta->encrypted;
36+
bool decrypted = !meta.encrypted;
3737
if (password != nil) {
3838
decrypted = translator.decrypt([password cStringUsingEncoding:NSUTF8StringEncoding]);
3939
}
@@ -44,10 +44,10 @@ - (bool)translate:(NSString *)inputPath into:(NSString *)outputPath at:(NSNumber
4444
}
4545

4646
NSMutableArray *pageNames = [[NSMutableArray alloc] init];
47-
if (meta->type == odr::FileType::OPENDOCUMENT_TEXT) {
47+
if (meta.type == odr::FileType::OPENDOCUMENT_TEXT) {
4848
[pageNames addObject:@"Text document"];
4949
} else {
50-
for (auto page = meta->entries.begin(); page != meta->entries.end(); page++) {
50+
for (auto page = meta.entries.begin(); page != meta.entries.end(); page++) {
5151
auto pageName = page->name;
5252

5353
[pageNames addObject:[NSString stringWithCString:pageName.c_str() encoding:[NSString defaultCStringEncoding]]];
@@ -58,7 +58,7 @@ - (bool)translate:(NSString *)inputPath into:(NSString *)outputPath at:(NSNumber
5858
initialized = true;
5959
}
6060

61-
odr::TranslationConfig config = {};
61+
odr::Config config = {};
6262
config.editable = editable;
6363
config.entryOffset = page.intValue;
6464
config.entryCount = 1;

OpenDocumentReader/DocumentBrowserViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ class DocumentBrowserViewController: UIDocumentBrowserViewController, UIDocument
4646

4747
func documentBrowser(_ controller: UIDocumentBrowserViewController, failedToImportDocumentAt documentURL: URL, error: Error?) {
4848
let alert = UIAlertController(
49-
title: "Unable to Import Document",
50-
message: "An error occurred while trying to import a document: \(error?.localizedDescription ?? "No Description")",
49+
title: "",
50+
message: NSLocalizedString("alert_error_generic", comment: ""),
5151
preferredStyle: .alert)
5252

5353
let action = UIAlertAction(
54-
title: "OK",
54+
title: NSLocalizedString("ok", comment: ""),
5555
style: .cancel,
5656
handler: nil)
5757

OpenDocumentReader/DocumentViewController.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ class DocumentViewController: UIViewController, DocumentDelegate {
115115
}
116116

117117
if doc.edit {
118-
let alert = UIAlertController(title: "You have unsaved changes", message: "Save them now?", preferredStyle: .alert)
119-
alert.addAction(UIAlertAction(title: "No", style: .destructive, handler: { (_) in
118+
let alert = UIAlertController(title: NSLocalizedString("alert_unsaved_changes", comment: ""), message: NSLocalizedString("alert_save_now", comment: ""), preferredStyle: .alert)
119+
alert.addAction(UIAlertAction(title: NSLocalizedString("no", comment: ""), style: .destructive, handler: { (_) in
120120
Analytics.logEvent("alert_unsaved_changes_no", parameters: nil)
121121

122122
self.discardChanges()
123123
self.closeCurrentDocument()
124124
}))
125-
alert.addAction(UIAlertAction(title: "Yes", style: .default, handler: { (_) in
125+
alert.addAction(UIAlertAction(title: NSLocalizedString("yes", comment: ""), style: .default, handler: { (_) in
126126
Analytics.logEvent("alert_unsaved_changes_yes", parameters: nil)
127127

128128
self.saveContent()
@@ -152,31 +152,31 @@ class DocumentViewController: UIViewController, DocumentDelegate {
152152
let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
153153

154154
if (document?.isOdf ?? false && !(document?.edit ?? false)) {
155-
alert.addAction(UIAlertAction(title: "Edit (EXPERIMENTAL)", style: .default, handler: { (_) in
155+
alert.addAction(UIAlertAction(title: NSLocalizedString("menu_edit", comment: ""), style: .default, handler: { (_) in
156156
self.editDocument()
157157
}))
158158
}
159159

160160
if document?.edit ?? false {
161-
alert.addAction(UIAlertAction(title: "Save", style: .default, handler: { (_) in
161+
alert.addAction(UIAlertAction(title: NSLocalizedString("menu_save", comment: ""), style: .default, handler: { (_) in
162162
self.saveContent()
163163
}))
164164

165-
alert.addAction(UIAlertAction(title: "Discard changes", style: .default, handler: { (_) in
165+
alert.addAction(UIAlertAction(title: NSLocalizedString("menu_discard_changes", comment: ""), style: .default, handler: { (_) in
166166
self.discardChanges()
167167
}))
168168
}
169169

170-
alert.addAction(UIAlertAction(title: "Fullscreen", style: .default, handler: { (_) in
170+
alert.addAction(UIAlertAction(title: NSLocalizedString("menu_fullscreen", comment: ""), style: .default, handler: { (_) in
171171
self.toggleFullscreen()
172172
}))
173-
alert.addAction(UIAlertAction(title: "Print", style: .default, handler: { (_) in
173+
alert.addAction(UIAlertAction(title: NSLocalizedString("menu_cloud_print", comment: ""), style: .default, handler: { (_) in
174174
self.printDocument()
175175
}))
176-
alert.addAction(UIAlertAction(title: "Help!?", style: .default, handler: { (_) in
176+
alert.addAction(UIAlertAction(title: NSLocalizedString("menu_help", comment: ""), style: .default, handler: { (_) in
177177
self.showWebsite()
178178
}))
179-
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
179+
alert.addAction(UIAlertAction(title: NSLocalizedString("cancel", comment: ""), style: .cancel, handler: nil))
180180

181181
alert.popoverPresentationController?.sourceView = menuButton.value(forKey: "view") as? UIView
182182
self.present(alert, animated: true, completion: nil)
@@ -207,10 +207,10 @@ class DocumentViewController: UIViewController, DocumentDelegate {
207207
let message: String
208208
let color: UIColor
209209
if success {
210-
message = "Successfully saved"
210+
message = NSLocalizedString("alert_document_saved", comment: "")
211211
color = .green
212212
} else {
213-
message = "Error while saving"
213+
message = NSLocalizedString("alert_error_save_failed", comment: "")
214214
color = .red
215215
}
216216

@@ -280,14 +280,14 @@ class DocumentViewController: UIViewController, DocumentDelegate {
280280
})
281281
}
282282

283-
let alert = UIAlertController(title: "Document encrypted", message: "Please enter the password to decrypt this document", preferredStyle: .alert)
283+
let alert = UIAlertController(title: NSLocalizedString("alert_error_password_protected", comment: ""), message: NSLocalizedString("alert_enter_password", comment: ""), preferredStyle: .alert)
284284
alert.addTextField { (textField) in
285285
textField.text = ""
286286
}
287-
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { [] (_) in
287+
alert.addAction(UIAlertAction(title: NSLocalizedString("cancel", comment: ""), style: .cancel, handler: { [] (_) in
288288
self.returnToDocuments("nil" as Any)
289289
}))
290-
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { [weak alert] (_) in
290+
alert.addAction(UIAlertAction(title: NSLocalizedString("ok", comment: ""), style: .default, handler: { [weak alert] (_) in
291291
let textField = alert?.textFields![0]
292292

293293
self.document?.password = textField!.text!

OpenDocumentReader/PageViewController.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ class PageViewController: UIPageViewController {
1212

1313
let contentViewController = "contentViewController"
1414

15-
var headersArray = [Constants.onboarding_header_1,
16-
Constants.onboarding_header_2,
17-
Constants.onboarding_header_3]
18-
var subHeadersArray = [Constants.onboarding_subheader_1,
19-
Constants.onboarding_subheader_2,
20-
Constants.onboarding_subheader_3]
15+
var headersArray = [NSLocalizedString("intro_title_1", comment: ""),
16+
NSLocalizedString("intro_title_2", comment: ""),
17+
NSLocalizedString("intro_title_3", comment: ""),]
18+
var subHeadersArray = [NSLocalizedString("intro_description_1", comment: ""),
19+
NSLocalizedString("intro_description_2", comment: ""),
20+
NSLocalizedString("intro_description_3", comment: ""),]
2121
var imagesArray = [Constants.onboarding_image_1,
2222
Constants.onboarding_image_2,
2323
Constants.onboarding_image_3]
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/* */
2+
"alert_error_generic" = "Hi ha hagut un problema. No s'ha pogut obrir el fitxer.";
3+
4+
/* */
5+
"ok" = "OK";
6+
7+
/* */
8+
"no_description" = "No Description";
9+
10+
/* */
11+
"alert_unsaved_changes" = "You have unsaved changes";
12+
13+
/* */
14+
"alert_save_now" = "Save them now?";
15+
16+
/* */
17+
"yes" = "Yes";
18+
19+
/* */
20+
"no" = "No";
21+
22+
/* */
23+
"menu_edit" = "Edit document";
24+
25+
/* */
26+
"menu_save" = "Save";
27+
28+
/* */
29+
"menu_discard_changes" = "Discard changes";
30+
31+
/* */
32+
"menu_fullscreen" = "Mode de pantalla completa";
33+
34+
/* */
35+
"menu_cloud_print" = "Google Cloud Print";
36+
37+
/* */
38+
"menu_help" = "Help!?";
39+
40+
/* */
41+
"cancel" = "Cancel";
42+
43+
/* */
44+
"alert_document_saved" = "Document saved";
45+
46+
/* */
47+
"alert_error_save_failed" = "File could not be saved. Please contact support@opendocument.app";
48+
49+
/* */
50+
"alert_error_password_protected" = "El document està protegit per contrasenya";
51+
52+
/* */
53+
"alert_enter_password" = "Please enter the password to decrypt this document";
54+
55+
/* */
56+
"intro_title_1" = "Open and read your ODF file on the go!";
57+
58+
/* */
59+
"intro_title_2" = "Found a typo in your document? Now supports modification!";
60+
61+
/* */
62+
"intro_title_3" = "Read your documents from within other apps";
63+
64+
/* */
65+
"intro_description_1" = "OpenDocument Reader allows you to view documents that are stored in OpenDocument format (.odt, .ods, .odp and .odg). These files are usually created using LibreOffice or OpenOffice. This app allows to open such files on your mobile device too, so you can read them on the go.";
66+
67+
/* */
68+
"intro_description_2" = "OpenDocument Reader not only allows to read documents on your mobile device, but also supports modifying them too. Typos are fixed in a breeze, even on the train!";
69+
70+
/* */
71+
"intro_description_3" = "OpenDocument Reader supports a huge range of other apps to open documents from. A colleague sent a presentation via Gmail? Click the attachment and this app is going to open right away!";
72+
73+
74+
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/* */
2+
"alert_error_generic" = "Něco se pokazilo. Nelze otevřít soubor.";
3+
4+
/* */
5+
"ok" = "OK";
6+
7+
/* */
8+
"no_description" = "No Description";
9+
10+
/* */
11+
"alert_unsaved_changes" = "You have unsaved changes";
12+
13+
/* */
14+
"alert_save_now" = "Save them now?";
15+
16+
/* */
17+
"yes" = "Yes";
18+
19+
/* */
20+
"no" = "No";
21+
22+
/* */
23+
"menu_edit" = "Upravit dokument";
24+
25+
/* */
26+
"menu_save" = "Uložit";
27+
28+
/* */
29+
"menu_discard_changes" = "Discard changes";
30+
31+
/* */
32+
"menu_fullscreen" = "Celá obrazovka";
33+
34+
/* */
35+
"menu_cloud_print" = "Google Cloud Print";
36+
37+
/* */
38+
"menu_help" = "Help!?";
39+
40+
/* */
41+
"cancel" = "Cancel";
42+
43+
/* */
44+
"alert_document_saved" = "Document saved";
45+
46+
/* */
47+
"alert_error_save_failed" = "File could not be saved. Please contact support@opendocument.app";
48+
49+
/* */
50+
"alert_error_password_protected" = "Dokument je chráněn heslem";
51+
52+
/* */
53+
"alert_enter_password" = "Please enter the password to decrypt this document";
54+
55+
/* */
56+
"intro_title_1" = "Open and read your ODF file on the go!";
57+
58+
/* */
59+
"intro_title_2" = "Found a typo in your document? Now supports modification!";
60+
61+
/* */
62+
"intro_title_3" = "Read your documents from within other apps";
63+
64+
/* */
65+
"intro_description_1" = "OpenDocument Reader allows you to view documents that are stored in OpenDocument format (.odt, .ods, .odp and .odg). These files are usually created using LibreOffice or OpenOffice. This app allows to open such files on your mobile device too, so you can read them on the go.";
66+
67+
/* */
68+
"intro_description_2" = "OpenDocument Reader not only allows to read documents on your mobile device, but also supports modifying them too. Typos are fixed in a breeze, even on the train!";
69+
70+
/* */
71+
"intro_description_3" = "OpenDocument Reader supports a huge range of other apps to open documents from. A colleague sent a presentation via Gmail? Click the attachment and this app is going to open right away!";
72+
73+
74+

0 commit comments

Comments
 (0)