This repository has been archived by the owner. It is now read-only.
Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Show sharing menus when clicking the menu button on the toolbar
- Loading branch information
Showing
with
81 additions
and 0 deletions.
| @@ -0,0 +1,36 @@ | ||
| // | ||
| // SettingsActivity.swift | ||
| // Client | ||
| // | ||
| // Created by Mahmoud Adam on 4/18/18. | ||
| // Copyright © 2018 Cliqz. All rights reserved. | ||
| // | ||
| import Foundation | ||
|
|
||
| let ShowSettingsNotification = NSNotification.Name(rawValue: "ShareMenu.ShowSettings") | ||
|
|
||
| class SettingsActivity : UIActivity { | ||
|
|
||
| override var activityTitle : String? { | ||
| return NSLocalizedString("Settings", tableName: "Cliqz", comment: "Sharing activity for opening Settings") | ||
| } | ||
|
|
||
| override var activityImage : UIImage? { | ||
| return UIImage(named: "settings") | ||
| } | ||
|
|
||
| override var activityType: UIActivityType? { | ||
| return UIActivityType("com.cliqz.settings") | ||
| } | ||
|
|
||
| override func perform() { | ||
| NotificationCenter.default.post(name: ShowSettingsNotification, object: nil) | ||
| activityDidFinish(true) | ||
| } | ||
|
|
||
| override func canPerform(withActivityItems activityItems: [Any]) -> Bool { | ||
| return true | ||
| } | ||
| } | ||
|
|
| @@ -0,0 +1,17 @@ | ||
| // | ||
| // ShareExtensionActivities.swift | ||
| // Client | ||
| // | ||
| // Created by Mahmoud Adam on 4/18/18. | ||
| // Copyright © 2018 Cliqz. All rights reserved. | ||
| // | ||
| import UIKit | ||
|
|
||
| extension ShareExtensionHelper { | ||
| func getApplicationActivities() -> [UIActivity] { | ||
| let applicationActivities = [SettingsActivity()] | ||
| return applicationActivities | ||
| } | ||
|
|
||
| } |