summaryrefslogtreecommitdiff
path: root/ios
diff options
context:
space:
mode:
authorjan Iversen <jani@libreoffice.org>2017-10-29 10:15:44 +0100
committerjan Iversen <jani@libreoffice.org>2017-10-29 10:46:57 +0100
commit351d83c357093ac0ec6d3768355df9ee1b224d02 (patch)
tree8ca27e58f816e06b2bbd1b9d3113c2117fae3d25 /ios
parent3d872ecc51e47e02e70732c848964274b2aad29e (diff)
iOS background handling
When the app moves to background (hipernate) LOkit needs to be stopped, and when it reenters foreground started again. In order to keep AppDelegate slim as recommended, calls to DocumentController are added. Change-Id: I7e4c8c5ae7fe29235381e3e7217abfd1911e39ad
Diffstat (limited to 'ios')
-rw-r--r--ios/LibreOfficeLight/LibreOfficeLight/AppDelegate.swift10
-rwxr-xr-xios/LibreOfficeLight/LibreOfficeLight/DocumentController.swift25
-rwxr-xr-xios/LibreOfficeLight/LibreOfficeLight/en.lproj/Main.storyboard44
3 files changed, 60 insertions, 19 deletions
diff --git a/ios/LibreOfficeLight/LibreOfficeLight/AppDelegate.swift b/ios/LibreOfficeLight/LibreOfficeLight/AppDelegate.swift
index 12e596bc030d..9bdc1fefa48e 100644
--- a/ios/LibreOfficeLight/LibreOfficeLight/AppDelegate.swift
+++ b/ios/LibreOfficeLight/LibreOfficeLight/AppDelegate.swift
@@ -39,14 +39,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate
let appInfo = Bundle.main.infoDictionary! as Dictionary<String,AnyObject>
let applicationVersion = (appInfo["CFBundleShortVersionString"] as! String) + "." +
(appInfo["CFBundleVersion"] as! String)
+
+ // Add version string to setting
let defaults = UserDefaults.standard
defaults.set(applicationVersion, forKey: "application_version")
defaults.synchronize()
// start LibreOfficeKit
//FIX BridgeLOkit_Init(Bundle.main.bundlePath)
- //FIX BridgeLOkit_open("jan");
- //FIX BridgeLOkit_ClientCommand("jan");
return true
}
@@ -72,7 +72,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate
// this method is called instead of applicationWillTerminate: when the user quits.
func applicationDidEnterBackground(_ application: UIApplication)
{
- // Jan to do done (scale down LO)
+ let document = window?.rootViewController?.childViewControllers[0] as! DocumentController
+ document.Hipernate()
}
@@ -81,7 +82,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate
// Restart timers, tasks as well as graphic rendering
func applicationWillEnterForeground(_ application: UIApplication)
{
- // Jan to be done (reactivate LO)
+ let document = window?.rootViewController?.childViewControllers[0] as! DocumentController
+ document.LeaveHipernate()
}
diff --git a/ios/LibreOfficeLight/LibreOfficeLight/DocumentController.swift b/ios/LibreOfficeLight/LibreOfficeLight/DocumentController.swift
index 1ef7d80c792f..0190ad946666 100755
--- a/ios/LibreOfficeLight/LibreOfficeLight/DocumentController.swift
+++ b/ios/LibreOfficeLight/LibreOfficeLight/DocumentController.swift
@@ -53,6 +53,14 @@ class DocumentController: UIViewController, MenuDelegate, UIDocumentBrowserViewC
+ public func Hipernate() -> Void
+ {
+ }
+
+ public func LeaveHipernate() -> Void
+ {
+ }
+
// var currentDocumentName : String?
@@ -67,6 +75,9 @@ class DocumentController: UIViewController, MenuDelegate, UIDocumentBrowserViewC
toDestinationURL destinationURL: URL)
{
// Tells the delegate that a document has been successfully imported.
+ //FIX BridgeLOkit_open("jan");
+ //FIX BridgeLOkit_ClientCommand("jan");
+
}
internal func documentBrowser(_ controller: UIDocumentBrowserViewController,
@@ -80,6 +91,8 @@ class DocumentController: UIViewController, MenuDelegate, UIDocumentBrowserViewC
didPickDocumentURLs documentURLs: [URL])
{
// Tells the delegate that the user has selected one or more documents.
+ //FIX BridgeLOkit_open("jan");
+ //FIX BridgeLOkit_ClientCommand("jan");
}
@IBOutlet weak var janTest: UILabel!
@@ -112,16 +125,19 @@ class DocumentController: UIViewController, MenuDelegate, UIDocumentBrowserViewC
self.present(openMenu, animated: true, completion: nil)
print("menu Open... to be done")
- case 2: // Save
+ case 2: // Properties
+ print("menu Properties to be done")
+
+ case 3: // Save
print("menu Save to be done")
- case 3: // Save as...
+ case 4: // Save as...
print("menu Save as... to be done")
- case 4: // Save as PDF...
+ case 5: // Save as PDF...
print("menu Save as PDF... to be done")
- case 5: // Print...
+ case 6: // Print...
print("menu Print... to be done")
default: // should not happen
@@ -172,6 +188,7 @@ class DocumentActions: UITableViewController
delegate?.actionMenuSelected(sender.tag)
}
+ @IBOutlet weak var buttonProperties: UIButton!
@IBOutlet weak var buttonNew: UIButton!
@IBOutlet weak var buttonOpen: UIButton!
@IBOutlet weak var buttonSave: UIButton!
diff --git a/ios/LibreOfficeLight/LibreOfficeLight/en.lproj/Main.storyboard b/ios/LibreOfficeLight/LibreOfficeLight/en.lproj/Main.storyboard
index 25d77018d279..81a2b4b5376c 100755
--- a/ios/LibreOfficeLight/LibreOfficeLight/en.lproj/Main.storyboard
+++ b/ios/LibreOfficeLight/LibreOfficeLight/en.lproj/Main.storyboard
@@ -286,7 +286,7 @@
<objects>
<tableViewController autoresizesArchivedViewToFullSize="NO" title="Document Actions" automaticallyAdjustsScrollViewInsets="NO" modalTransitionStyle="crossDissolve" modalPresentationStyle="overCurrentContext" clearsSelectionOnViewWillAppear="NO" id="IER-X5-Ax8" customClass="DocumentActions" customModule="LibreOfficeLight" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="plain" separatorStyle="default" rowHeight="30" sectionHeaderHeight="28" sectionFooterHeight="28" id="RqF-IL-YJc">
- <rect key="frame" x="0.0" y="0.0" width="134" height="150"/>
+ <rect key="frame" x="0.0" y="0.0" width="134" height="180"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<sections>
@@ -320,7 +320,28 @@
<rect key="frame" x="0.0" y="0.0" width="134" height="29.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
- <button opaque="NO" tag="2" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="b90-ja-Wm0">
+ <button opaque="NO" tag="2" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="b90-ja-Wm0" userLabel="Button Properties">
+ <rect key="frame" x="8" y="0.0" width="118" height="30"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <accessibility key="accessibilityConfiguration" identifier="actionSave">
+ <bool key="isElement" value="NO"/>
+ </accessibility>
+ <state key="normal" title="Properties"/>
+ <connections>
+ <action selector="actionMenuSelect:" destination="IER-X5-Ax8" eventType="touchUpInside" id="ErC-4Q-0we"/>
+ </connections>
+ </button>
+ </subviews>
+ </tableViewCellContentView>
+ </tableViewCell>
+ <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="Osp-RA-lhK">
+ <rect key="frame" x="0.0" y="60" width="134" height="30"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Osp-RA-lhK" id="mU4-Wv-5dR">
+ <rect key="frame" x="0.0" y="0.0" width="134" height="29.5"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <button opaque="NO" tag="3" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="m45-MR-Gca">
<rect key="frame" x="8" y="0.0" width="118" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" identifier="actionSave">
@@ -328,20 +349,20 @@
</accessibility>
<state key="normal" title="Save"/>
<connections>
- <action selector="actionMenuSelect:" destination="IER-X5-Ax8" eventType="touchUpInside" id="0gI-or-ji3"/>
+ <action selector="actionMenuSelect:" destination="IER-X5-Ax8" eventType="touchUpInside" id="pXt-Kb-Vjw"/>
</connections>
</button>
</subviews>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="AN7-6j-wO7">
- <rect key="frame" x="0.0" y="60" width="134" height="30"/>
+ <rect key="frame" x="0.0" y="90" width="134" height="30"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="AN7-6j-wO7" id="kl1-nQ-aIu">
<rect key="frame" x="0.0" y="0.0" width="134" height="29.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
- <button opaque="NO" tag="3" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6vH-aM-aYe">
+ <button opaque="NO" tag="4" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6vH-aM-aYe">
<rect key="frame" x="8" y="0.0" width="118" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration">
@@ -356,13 +377,13 @@
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="GmK-gj-GYu">
- <rect key="frame" x="0.0" y="90" width="134" height="30"/>
+ <rect key="frame" x="0.0" y="120" width="134" height="30"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="GmK-gj-GYu" id="3OK-Zz-mqN">
<rect key="frame" x="0.0" y="0.0" width="134" height="29.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
- <button opaque="NO" tag="4" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="apE-3B-lUt" userLabel="Button Save As PDF">
+ <button opaque="NO" tag="5" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="apE-3B-lUt" userLabel="Button Save As PDF">
<rect key="frame" x="8" y="0.0" width="118" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" identifier="actionSaveAsPDF">
@@ -377,13 +398,13 @@
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="diN-3v-tgm">
- <rect key="frame" x="0.0" y="120" width="134" height="30"/>
+ <rect key="frame" x="0.0" y="150" width="134" height="30"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="diN-3v-tgm" id="24s-fs-4cw">
<rect key="frame" x="0.0" y="0.0" width="134" height="29.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
- <button opaque="NO" tag="5" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tvH-WR-c61" userLabel="Button Print">
+ <button opaque="NO" tag="6" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tvH-WR-c61" userLabel="Button Print">
<rect key="frame" x="8" y="0.0" width="118" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration">
@@ -406,15 +427,16 @@
</connections>
</tableView>
<extendedEdge key="edgesForExtendedLayout"/>
- <value key="contentSizeForViewInPopover" type="size" width="134" height="150"/>
+ <value key="contentSizeForViewInPopover" type="size" width="134" height="180"/>
<nil key="simulatedStatusBarMetrics"/>
<nil key="simulatedTopBarMetrics"/>
<nil key="simulatedBottomBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
- <size key="freeformSize" width="134" height="150"/>
+ <size key="freeformSize" width="134" height="180"/>
<connections>
<outlet property="buttonOpen" destination="myk-zs-md7" id="xQK-I1-pDl"/>
<outlet property="buttonPrint" destination="tvH-WR-c61" id="4YU-p2-Fim"/>
+ <outlet property="buttonProperties" destination="b90-ja-Wm0" id="scY-Fn-fss"/>
<outlet property="buttonSave" destination="b90-ja-Wm0" id="Sdz-lq-s3S"/>
<outlet property="buttonSaveAs" destination="6vH-aM-aYe" id="4KY-Zi-iH4"/>
<outlet property="buttonSaveAsPDF" destination="apE-3B-lUt" id="AZL-ON-v2Y"/>