Skip to content

Commit 2b6a83d

Browse files
[feature/appstore-buildflag] Remove App Store / IAP code via build flag (#1052)
* - add support and documentation for DISABLE_APPSTORE_LICENSING build flag * - ReleaseNotesHostViewController: remove unused reference to StoreKit - OCLicenseDuration: make sure SKProductSubscriptionPeriod conversion code is excluded when using the DISABLE_APPSTORE_LICENSING build flag
1 parent 4e29fd5 commit 2b6a83d

25 files changed

+91
-2
lines changed

doc/APP_BUILD_FLAGS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,9 @@ Removes the following from the app:
2424
- the location description keys from the app's `Info.plist`
2525

2626
Not used by default.
27+
28+
### `DISABLE_APPSTORE_LICENSING`
29+
30+
Removes the following from the app:
31+
- App Store integration for OCLicense
32+
- App Store related view controllers and settings section

ownCloud/Client/Actions/Action+UserInterface.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ extension Action {
9494
if !isLicensed {
9595
if let core = core, let requirements = type(of:self).licenseRequirements {
9696
OnMainThread {
97+
#if !DISABLE_APPSTORE_LICENSING
9798
OCLicenseManager.appStoreProvider?.refreshProductsIfNeeded(completionHandler: { (error) in
9899
OnMainThread {
99100
if error != nil {
@@ -107,6 +108,7 @@ extension Action {
107108
}
108109
}
109110
})
111+
#endif
110112
}
111113
}
112114

ownCloud/Licensing/Offers/LicenseOfferButton.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*
1717
*/
1818

19+
#if !DISABLE_APPSTORE_LICENSING
20+
1921
import UIKit
2022
import ownCloudAppShared
2123

@@ -61,3 +63,5 @@ class LicenseOfferButton: ThemeButton {
6163
fatalError("init(coder:) has not been implemented")
6264
}
6365
}
66+
67+
#endif

ownCloud/Licensing/Offers/LicenseOfferView.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*
1717
*/
1818

19+
#if !DISABLE_APPSTORE_LICENSING
20+
1921
import UIKit
2022
import ownCloudApp
2123
import ownCloudAppShared
@@ -288,3 +290,5 @@ class LicenseOfferView: UIView, Themeable {
288290
}
289291
}
290292
}
293+
294+
#endif

ownCloud/Licensing/Offers/LicenseOffersViewController.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*
1717
*/
1818

19+
#if !DISABLE_APPSTORE_LICENSING
20+
1921
import UIKit
2022
import ownCloudApp
2123
import ownCloudAppShared
@@ -116,6 +118,7 @@ class LicenseOffersViewController: StaticTableViewController {
116118
sections.append(subSection)
117119
}
118120

121+
#if !DISABLE_APPSTORE_LICENSING
119122
let restoreSection = StaticTableViewSection()
120123

121124
restoreSection.add(row: StaticTableViewRow(rowWithAction: { (_, _) in
@@ -125,6 +128,7 @@ class LicenseOffersViewController: StaticTableViewController {
125128
}, title: "Restore purchases".localized, alignment: .center))
126129

127130
sections.append(restoreSection)
131+
#endif
128132

129133
// Set sections
130134
self.sections = sections
@@ -153,3 +157,5 @@ class LicenseOffersViewController: StaticTableViewController {
153157
self.tableView.contentInsetAdjustmentBehavior = .never
154158
}
155159
}
160+
161+
#endif

ownCloud/Licensing/Product List/LicenseInAppProductListViewController.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*
1717
*/
1818

19+
#if !DISABLE_APPSTORE_LICENSING
20+
1921
import UIKit
2022
import ownCloudApp
2123
import ownCloudAppShared
@@ -132,3 +134,5 @@ class LicenseInAppProductListViewController: StaticTableViewController {
132134
}
133135

134136
}
137+
138+
#endif

ownCloud/Licensing/Product List/LicenseInAppPurchaseFeatureView.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*
1717
*/
1818

19+
#if !DISABLE_APPSTORE_LICENSING
20+
1921
import UIKit
2022
import ownCloudApp
2123
import ownCloudAppShared
@@ -134,3 +136,5 @@ class LicenseInAppPurchaseFeatureView: UIView, Themeable {
134136
baseViewController?.present(asCard: FrameViewController(header: offersViewController.cardHeaderView!, viewController: offersViewController), animated: true)
135137
}
136138
}
139+
140+
#endif

ownCloud/Licensing/Tools/OCLicenseManager+AppStore.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*
1717
*/
1818

19+
#if !DISABLE_APPSTORE_LICENSING
20+
1921
import UIKit
2022
import ownCloudApp
2123
import ownCloudAppShared
@@ -52,5 +54,6 @@ extension OCLicenseManager {
5254
})
5355
}
5456
}
55-
5657
}
58+
59+
#endif

ownCloud/Licensing/Transactions/LicenseTransactionsViewController.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*
1717
*/
1818

19+
#if !DISABLE_APPSTORE_LICENSING
20+
1921
import UIKit
2022
import ownCloudApp
2123
import ownCloudAppShared
@@ -111,3 +113,5 @@ class LicenseTransactionsViewController: StaticTableViewController {
111113
}
112114
}
113115
}
116+
117+
#endif

ownCloud/Release Notes/ReleaseNotesHostViewController.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import UIKit
2020
import ownCloudSDK
2121
import ownCloudAppShared
22-
import StoreKit
2322

2423
class ReleaseNotesHostViewController: UIViewController {
2524

0 commit comments

Comments
 (0)