Skip to content

Commit

Permalink
Merge develop into master for 1.0.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
emanuellupu authored Mar 12, 2021
2 parents 88af7a8 + 3e4433e commit 2a2bd13
Show file tree
Hide file tree
Showing 309 changed files with 9,268 additions and 5,116 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# https://github.com/github/linguist#using-gitattributes
ContentApp/PresentationLayer/Components/PDFRenderer/pdfjs-library/pdf.js linguist-vendored
ContentApp/PresentationLayer/Components/PDFRenderer/pdfjs-library/pdf.worker.js linguist-vendored
ContentApp/PresentationLayer/Components/PDFRenderer/pdfjs-library/pdf_viewer.js linguist-vendored
ContentApp/PresentationLayer/Components/PDFRenderer/pdfjs-library/viewer-inlined.html linguist-generated
47 changes: 47 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# How to Contribute

Thanks for taking the time to bring your contributions back to the community. We are excited to collaborate with you!

First of all take some time to go through our contributor code of conduct. We expect all members to uphold it.

## Code of conduct

As a contributor to this project and with the interest of fostering an open and welcoming community, we pledge respect to all people who contribute, submit pull requests, report issues, post feature requests, update the documentation and engage in other community activities.

As a commitment to participants in this project we want to offer a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.

Any deviation from this conduct entitles project maintainers to remove, edit or reject comments, commits, issues etc or temporarily / permanently ban any contributor that is deemed inappropriate, threatening, offensive or harmful.

This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org/), version 1.3.0, available at [http://contributor-covenant.org/version/1/3/0/](http://contributor-covenant.org/version/1/3/0/)

## Reporting issues, asking Questions, or making feature requests

If you have some feedback that you want to share, please go to [Issues](https://github.com/Alfresco/alfresco-mobile-workspace-ios/issues) and open a new issue. It's important to pay attention and follow the issue templates that are provided to make sure you offer an in-depth level of detail to avoid any un-necessary follow-ups.
Additionally, make use of the available labels to enhance your issue with information such as: `bug`, `feature request`, `question`.

Screenshots help us resolve issues and answer questions faster, so thanks for including some if you can.

## Beta Testing

Are you interested in new upcoming features and would like to provide and steer the development with feedback? Join us in the beta program by going to the [Alfresco Mobile Workspace beta program](https://testflight.apple.com/join/5Hz2IgRJ) page and use your iOS device to follow the instructions.

# Making a Pull Request

## Before you Start

If you are just starting out and want to familiarize youself with the application code we suggest looking at [these issues](https://github.com/Alfresco/alfresco-mobile-workspace-ios/labels/good%20first%20issue) that have the `good first issue` label attached with are suitable for newcomers, otherwise you are welcome to tackle any of the open issues.

We are aiming to avoid duplicate work effort so if you decide to work on an open issue leave a comment to state your intent. Sometimes the necessary work to address an issue is great and for that reason we recommend you wait for one of the maintainer's response before committing to make a certain contribution.

It could be the case that the reported issue does not align with the project goals.
For that reason it's best to address and discuss the issue beforehand.

## Coding Standards

Descriptive and consistent naming makes software easier to read and understand. Use the Swift naming conventions described in the [API Design Guidelines](https://swift.org/documentation/api-design-guidelines/)

We use Swiftlint to reinforce some of guidelines and that may be subject to change so keep [an eye on it](https://github.com/Alfresco/alfresco-mobile-workspace-ios/blob/master/.swiftlint.yml). For convenience it's already integrated in the project so make sure you're on the latest version before making your PR.

## Code reviews

All external submissions require formal review. We use GitHub pull requests for this purpose. Consult [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more information on using pull requests.
529 changes: 373 additions & 156 deletions ContentApp.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

47 changes: 40 additions & 7 deletions ContentApp/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,64 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
private var applicationCoordinator: ApplicationCoordinator?
var orientationLock = UIInterfaceOrientationMask.all
var enterInBackgroundTimestamp: TimeInterval?
var enterInForegroundTimestamp: TimeInterval?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let window = UIWindow(frame: UIScreen.main.bounds)
let applicationCoordinator = ApplicationCoordinator(window: window)

self.window = window
self.applicationCoordinator = applicationCoordinator
if let themingService = applicationCoordinator.repository.service(of: MaterialDesignThemingService.identifier) as? MaterialDesignThemingService {
let repository = applicationCoordinator.repository

if let themingService = repository.service(of: MaterialDesignThemingService.identifier) as? MaterialDesignThemingService {
window.backgroundColor = themingService.activeTheme?.surfaceColor
}

applicationCoordinator.start()

FirebaseApp.configure()

let connectivityService = repository.service(of: ConnectivityService.identifier) as? ConnectivityService
connectivityService?.startNetworkReachabilityObserver()

return true
}

func applicationDidBecomeActive(_ application: UIApplication) {
let themingService = applicationCoordinator?.repository.service(of: MaterialDesignThemingService.identifier) as? MaterialDesignThemingService
let repository = applicationCoordinator?.repository

let themingService = repository?.service(of: MaterialDesignThemingService.identifier) as? MaterialDesignThemingService
themingService?.activateAutoTheme(for: UIScreen.main.traitCollection.userInterfaceStyle)
let accountService = applicationCoordinator?.repository.service(of: AccountService.identifier) as? AccountService
accountService?.activeAccount?.createTicket()

let accountService = repository?.service(of: AccountService.identifier) as? AccountService
accountService?.createTicketForCurrentAccount()

let syncTriggerService = repository?.service(of: SyncTriggersService.identifier) as? SyncTriggersService

enterInForegroundTimestamp = Date().timeIntervalSince1970

if let enterInForegroundTimestamp = self.enterInForegroundTimestamp,
let enterInBackgroundTimestamp = self.enterInBackgroundTimestamp {

let interval = enterInForegroundTimestamp - enterInBackgroundTimestamp
syncTriggerService?.triggerSync(for: .applicationDidFinishedLaunching,
in: interval)

self.enterInForegroundTimestamp = nil
self.enterInForegroundTimestamp = nil
}
}

func applicationDidEnterBackground(_ application: UIApplication) {
enterInBackgroundTimestamp = Date().timeIntervalSince1970
}

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
func application(_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
let accountService = applicationCoordinator?.repository.service(of: AccountService.identifier) as? AccountService
if let aimsAccount = accountService?.activeAccount as? AIMSAccount {
if let session = aimsAccount.session.session {
Expand All @@ -60,7 +92,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
return false
}

func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
func application(_ application: UIApplication,
supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
return self.orientationLock
}
}
32 changes: 31 additions & 1 deletion ContentApp/BusinessLayer/Action Menu/Models/ActionMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,32 @@ class ActionMenu {
}

enum ActionMenuType: String {

var isGenericActions: Bool {
return [.more].contains(self)
}

var isFavoriteActions: Bool {
return [.addFavorite, .removeFavorite].contains(self)
}

var isMoveActions: Bool {
return [.moveTrash, .restore, .permanentlyDelete].contains(self)
}

var isDownloadActions: Bool {
return [.download, .markOffline, .removeOffline].contains(self)
}

var isCreateActions: Bool {
return [.createMSWord, .createMSExcel, .createMSPowerPoint,
.createFolder].contains(self)
}

var isMoreAction: Bool {
return [.more].contains(self)
}

// MARK: - Generic
case placeholder = "ic-placeholder"
case node = "ic-node"
Expand All @@ -47,11 +73,15 @@ enum ActionMenuType: String {
// MARK: - Nodes
case addFavorite = "ic-action-outline-favorite"
case removeFavorite = "ic-action-fill-favorite"

case moveTrash = "ic-action-delete"
case download = "ic-action-download"
case restore = "ic-restore"
case permanentlyDelete = "ic-action-delete-forever"

case download = "ic-action-download"
case markOffline = "ic-action-outline-offline"
case removeOffline = "ic-action-fill-offline"

// MARK: - Create
case createFolder = "ic-action-create-folder"
case createMSExcel = "ic-ms_spreadsheet"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,40 +25,70 @@ struct ActionsMenuGeneric {
let infoAction = ActionMenu(title: node.title,
type: .node,
icon: FileIcon.icon(for: node))

var actions2: [ActionMenu] = []

if let action = offlineAction(for: node) {
actions2.append(action)
}
actions2.append(favoriteAction(for: node))

if let action = downloadAction(for: node) {
actions2.append(action)
}

if let action = deleteAction(for: node) {
actions2.append(action)
}

actions.append([infoAction])
actions.append(actions2)

return actions
}

// MARK: Private Helpers

static private func favoriteAction(for node: ListNode) -> ActionMenu {
let addFavAction = ActionMenu(title: LocalizationConstants.ActionMenu.addFavorite,
type: .addFavorite)
let removeFavAction = ActionMenu(title: LocalizationConstants.ActionMenu.removeFavorite,
type: .removeFavorite)
let deleteAction = ActionMenu(title: LocalizationConstants.ActionMenu.moveTrash,
type: .moveTrash)
let downloadAction = ActionMenu(title: LocalizationConstants.ActionMenu.download,
type: .download)
return (node.favorite == true) ? removeFavAction : addFavAction
}

var actions2: [ActionMenu] = []
static private func offlineAction(for node: ListNode) -> ActionMenu? {
let markOffAction = ActionMenu(title: LocalizationConstants.ActionMenu.markOffline,
type: .markOffline)
let removeOffAction = ActionMenu(title: LocalizationConstants.ActionMenu.removeOffline,
type: .removeOffline)
let enableAction = node.isAFileType() || node.isAFolderType()

if node.favorite == true {
actions2.append(removeFavAction)
} else {
actions2.append(addFavAction)
if enableAction {
return node.isMarkedOffline() ? removeOffAction : markOffAction
}

if node.kind == .site {
if node.hasRole(to: .manager) {
actions2.append(deleteAction)
}
} else {
if node.kind == .file {
actions2.append(downloadAction)
}
if node.hasPersmission(to: .delete) {
actions2.append(deleteAction)
}
return nil
}

static private func downloadAction(for node: ListNode) -> ActionMenu? {
let downloadAction = ActionMenu(title: LocalizationConstants.ActionMenu.download,
type: .download)
if node.isAFileType() {
return downloadAction
}
let actions1 = [infoAction]

actions.append(actions1)
actions.append(actions2)
return nil
}

return actions
static private func deleteAction(for node: ListNode) -> ActionMenu? {
let deleteAction = ActionMenu(title: LocalizationConstants.ActionMenu.moveTrash,
type: .moveTrash)
switch node.nodeType {
case .site:
return node.hasRole(to: .manager) ? deleteAction : nil
default:
return node.hasPersmission(to: .delete) ? deleteAction : nil
}
}
}
Loading

0 comments on commit 2a2bd13

Please sign in to comment.