Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Sync of photos wifiOnly #1313

Open
wants to merge 4 commits into
base: Update-feature-wifi-only
Choose a base branch
from

Conversation

BaptGrv
Copy link
Contributor

@BaptGrv BaptGrv commented Oct 1, 2024

Feature PR here #1310

Copy link

sonarcloud bot commented Oct 1, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
16.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

@BaptGrv BaptGrv changed the title Sync of photos wifiOnly feat: Sync of photos wifiOnly Oct 1, 2024
@adrien-coye adrien-coye added this to the 5.0.2 milestone Nov 14, 2024
@adrien-coye adrien-coye self-requested a review November 14, 2024 08:46
Copy link

sonarcloud bot commented Nov 14, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
16.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Copy link
Contributor

@adrien-coye adrien-coye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to discuss the behaviour when the queue is suspended.
Right now your PR puts all the uploads in an error state, also this could be costly when dealing with a large upload queue.


class OfflineSyncSettingsViewController: BaseGroupedTableViewController {
private var tableContent: [SyncMode] = SyncMode.allCases
private var selectedOfflineMod: SyncMode!
Copy link
Contributor

@adrien-coye adrien-coye Nov 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We really should not use force unwrap. You could provide a default value for instance or make it lazy / computed property to make it work.

}

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let mod = tableContent[indexPath.row]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mode

@@ -66,19 +64,18 @@ class WifiSyncSettingsViewController: BaseGroupedTableViewController {
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(type: ParameterSyncTableViewCell.self, for: indexPath)
cell.initWithPositionAndShadow(isFirst: true, isLast: true)
let currentMode = tableContent[indexPath.row]
if currentMode == selectedMode {
let currentMod = tableContent[indexPath.row]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mode

let mode = tableContent[indexPath.row]
MatomoUtils.track(eventWithCategory: .settings, name: "mode\(mode.rawValue.capitalized)")
UserDefaults.shared.syncMode = mode
let mod = tableContent[indexPath.row]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mode

@@ -338,16 +338,16 @@ public extension UserDefaults {
}
}

var syncMode: SyncMode {
var syncOfflineMod: SyncMode {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mode

@@ -56,4 +57,22 @@ extension UploadOperation {
file.pathURL = url
}
}

func checkForRestrictedUploadOverDataMode() throws {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not found of this, can we keep it in UploadQueue ? We do not want to put each upload in error, do we ?

The behaviour until now was the upload queue would not start. We need to discuss this together at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants