Skip to content

Commit f96e647

Browse files
committed
Merge branch 'release/3.3.1'
2 parents 86729e6 + bee4c0b commit f96e647

21 files changed

+107
-58
lines changed

iMEGA/AppDelegate.m

+9-2
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
220220
}
221221
}
222222

223-
if ([[CameraUploads syncManager] isCameraUploadsEnabled] && [ALAssetsLibrary authorizationStatus] == ALAuthorizationStatusDenied) {
223+
if ([ALAssetsLibrary authorizationStatus] == ALAuthorizationStatusDenied && [[CameraUploads syncManager] isCameraUploadsEnabled]) {
224+
MEGALogInfo(@"Disable Camera Uploads");
224225
[[CameraUploads syncManager] setIsCameraUploadsEnabled:NO];
225226
}
226227

@@ -251,7 +252,8 @@ - (void)applicationDidEnterBackground:(UIApplication *)application {
251252
}
252253

253254
- (void)applicationWillEnterForeground:(UIApplication *)application {
254-
if ([[MEGASdkManager sharedMEGASdk] isLoggedIn] && [[CameraUploads syncManager] isCameraUploadsEnabled]) {
255+
if ([[MEGASdkManager sharedMEGASdk] isLoggedIn] && [[CameraUploads syncManager] isCameraUploadsEnabled]) {
256+
MEGALogInfo(@"Enable Camera Uploads");
255257
[[CameraUploads syncManager] setIsCameraUploadsEnabled:YES];
256258
}
257259

@@ -707,6 +709,7 @@ - (void)showOverquotaAlert {
707709

708710
- (void)disableCameraUploads {
709711
if ([[CameraUploads syncManager] isCameraUploadsEnabled]) {
712+
MEGALogInfo(@"Disable Camera Uploads");
710713
[[CameraUploads syncManager] setIsCameraUploadsEnabled:NO];
711714
}
712715
}
@@ -951,6 +954,7 @@ - (void)onNodesUpdate:(MEGASdk *)api nodeList:(MEGANodeList *)nodeList {
951954
MEGATransferList *transferList = [api uploadTransfers];
952955
if (transferList.size.integerValue == 0) {
953956
if ([CameraUploads syncManager].isCameraUploadsEnabled) {
957+
MEGALogInfo(@"Enable Camera Uploads");
954958
[[CameraUploads syncManager] setIsCameraUploadsEnabled:YES];
955959
}
956960
} else {
@@ -961,6 +965,8 @@ - (void)onNodesUpdate:(MEGASdk *)api nodeList:(MEGANodeList *)nodeList {
961965
if (![CameraUploads syncManager].isUseCellularConnectionEnabled && [MEGAReachabilityManager isReachableViaWWAN]) {
962966
[api cancelTransfer:transfer];
963967
} else {
968+
MEGALogInfo(@"Camera Upload should be delayed");
969+
MEGALogInfo(@"Set badge value to %@", transfer.appData);
964970
[CameraUploads syncManager].shouldCameraUploadsBeDelayed = YES;
965971
[[CameraUploads syncManager] setBadgeValue:transfer.appData];
966972
}
@@ -1407,6 +1413,7 @@ - (void)onTransferFinish:(MEGASdk *)api transfer:(MEGATransfer *)transfer error:
14071413
if ([transfer type] == MEGATransferTypeUpload && [CameraUploads syncManager].shouldCameraUploadsBeDelayed) {
14081414
[CameraUploads syncManager].shouldCameraUploadsBeDelayed = NO;
14091415
if ([[CameraUploads syncManager] isCameraUploadsEnabled]) {
1416+
MEGALogInfo(@"Enable Camera Uploads");
14101417
[[CameraUploads syncManager] setIsCameraUploadsEnabled:YES];
14111418
}
14121419
}

iMEGA/Camera uploads/CameraUploads.m

+13-8
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ - (void)prepare {
5858
self.isUseCellularConnectionEnabled = [[[NSUserDefaults standardUserDefaults] objectForKey:kIsUseCellularConnectionEnabled] boolValue];
5959
self.isOnlyWhenChargingEnabled = [[[NSUserDefaults standardUserDefaults] objectForKey:kIsOnlyWhenChargingEnabled] boolValue];
6060

61-
[self resetOperationQueue];
61+
self.assetsOperationQueue = [[NSOperationQueue alloc] init];
62+
if ([self.assetsOperationQueue respondsToSelector:@selector(qualityOfService)]) {
63+
self.assetsOperationQueue.qualityOfService = NSOperationQualityOfServiceUtility;
64+
}
65+
self.assetsOperationQueue.maxConcurrentOperationCount = 1;
6266
}
6367

6468
- (void)resetOperationQueue {
@@ -68,13 +72,13 @@ - (void)resetOperationQueue {
6872
if ([self.assetsOperationQueue respondsToSelector:@selector(qualityOfService)]) {
6973
self.assetsOperationQueue.qualityOfService = NSOperationQualityOfServiceUtility;
7074
}
71-
7275
self.assetsOperationQueue.maxConcurrentOperationCount = 1;
7376

7477
[self setBadgeValue:nil];
7578

7679
if (_isCameraUploadsEnabled) {
7780
if (_isUseCellularConnectionEnabled || [MEGAReachabilityManager isReachableViaWiFi]) {
81+
MEGALogInfo(@"Enable Camera Uploads");
7882
[self setIsCameraUploadsEnabled:YES];
7983
}
8084
}
@@ -88,7 +92,6 @@ - (void)setIsCameraUploadsEnabled:(BOOL)isCameraUploadsEnabled {
8892
return;
8993
}
9094

91-
MEGALogInfo(@"Camera Uploads enabled");
9295
self.lastUploadPhotoDate = [[NSUserDefaults standardUserDefaults] objectForKey:kLastUploadPhotoDate];
9396
self.lastUploadVideoDate = [[NSUserDefaults standardUserDefaults] objectForKey:kLastUploadVideoDate];
9497
if (![[NSUserDefaults standardUserDefaults] objectForKey:kCameraUploadsNodeHandle]){
@@ -133,7 +136,6 @@ - (void)setIsCameraUploadsEnabled:(BOOL)isCameraUploadsEnabled {
133136
[self getAssetsForUpload];
134137
}
135138
} else {
136-
MEGALogInfo(@"Camera Uploads disabled");
137139
[self resetOperationQueue];
138140

139141
_isCameraUploadsEnabled = NO;
@@ -177,15 +179,17 @@ - (void)getAssetsForUpload {
177179
MEGALogInfo(@"Retrieved assets %ld", assetsFetchResult.count);
178180

179181
[assetsFetchResult enumerateObjectsUsingBlock:^(PHAsset *asset, NSUInteger index, BOOL *stop) {
180-
if (asset.mediaType == PHAssetMediaTypeVideo && self.isUploadVideosEnabled && ([asset.creationDate timeIntervalSince1970] >= [self.lastUploadVideoDate timeIntervalSince1970])) {
182+
if (asset.mediaType == PHAssetMediaTypeVideo && self.isUploadVideosEnabled && ([asset.creationDate timeIntervalSince1970] > [self.lastUploadVideoDate timeIntervalSince1970])) {
181183
MEGAAssetOperation *uploadAssetsOperation = [[MEGAAssetOperation alloc] initWithPHAsset:asset parentNode:cameraUploadsNode automatically:YES];
182184
[_assetsOperationQueue addOperation:uploadAssetsOperation];
183-
} else if (asset.mediaType == PHAssetMediaTypeImage && ([asset.creationDate timeIntervalSince1970] >= [self.lastUploadPhotoDate timeIntervalSince1970])) {
185+
} else if (asset.mediaType == PHAssetMediaTypeImage && ([asset.creationDate timeIntervalSince1970] > [self.lastUploadPhotoDate timeIntervalSince1970])) {
184186
MEGAAssetOperation *uploadAssetsOperation = [[MEGAAssetOperation alloc] initWithPHAsset:asset parentNode:cameraUploadsNode automatically:YES];
185187
[_assetsOperationQueue addOperation:uploadAssetsOperation];
186188
}
187189
}];
188190

191+
MEGALogInfo(@"Assets in the operation queue %ld", _assetsOperationQueue.operationCount);
192+
189193
[self setBadgeValue:[NSString stringWithFormat:@"%ld", [self.assetsOperationQueue operationCount]]];
190194
} else {
191195
__block NSInteger totalAssets = 0;
@@ -197,10 +201,10 @@ - (void)getAssetsForUpload {
197201
resultBlock:^(ALAsset *asset) {
198202
NSDate *assetCreationTime = [asset valueForProperty:ALAssetPropertyDate];
199203

200-
if (asset != nil && [[asset valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypeVideo] && self.isUploadVideosEnabled && ([assetCreationTime timeIntervalSince1970] >= [self.lastUploadVideoDate timeIntervalSince1970])) {
204+
if (asset != nil && [[asset valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypeVideo] && self.isUploadVideosEnabled && ([assetCreationTime timeIntervalSince1970] > [self.lastUploadVideoDate timeIntervalSince1970])) {
201205
MEGAAssetOperation *uploadAssetsOperation = [[MEGAAssetOperation alloc] initWithALAsset:asset cameraUploadNode:cameraUploadsNode];
202206
[_assetsOperationQueue addOperation:uploadAssetsOperation];
203-
} else if (asset != nil && [[asset valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypePhoto] && ([assetCreationTime timeIntervalSince1970] >= [self.lastUploadPhotoDate timeIntervalSince1970])) {
207+
} else if (asset != nil && [[asset valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypePhoto] && ([assetCreationTime timeIntervalSince1970] > [self.lastUploadPhotoDate timeIntervalSince1970])) {
204208
MEGAAssetOperation *uploadAssetsOperation = [[MEGAAssetOperation alloc] initWithALAsset:asset cameraUploadNode:cameraUploadsNode];
205209
[_assetsOperationQueue addOperation:uploadAssetsOperation];
206210
}
@@ -227,6 +231,7 @@ - (void)getAssetsForUpload {
227231
[self.library enumerateGroupsWithTypes:ALAssetsGroupAll
228232
usingBlock:assetGroupEnumerator
229233
failureBlock:^(NSError *error) {
234+
MEGALogInfo(@"Disable Camera Uploads");
230235
[self setIsCameraUploadsEnabled:NO];
231236
[[NSNotificationCenter defaultCenter] postNotificationName:@"kUserDeniedPhotoAccess" object:nil];
232237
MEGALogError(@"Enumerate groups with types failed with error: %@", error);

iMEGA/Camera uploads/CameraUploadsPopUpViewController.m

+3-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ - (IBAction)enableTouchUpInside:(UIButton *)sender {
9090
switch (status) {
9191
case PHAuthorizationStatusNotDetermined:
9292
break;
93-
case PHAuthorizationStatusAuthorized: {
93+
case PHAuthorizationStatusAuthorized: {
94+
MEGALogInfo(@"Enable Camera Uploads");
9495
[[CameraUploads syncManager] setIsCameraUploadsEnabled:YES];
9596
[[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[CameraUploads syncManager].isCameraUploadsEnabled] forKey:kIsCameraUploadsEnabled];
9697

@@ -118,6 +119,7 @@ - (IBAction)enableTouchUpInside:(UIButton *)sender {
118119
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:AMLocalizedString(@"attention", @"Attention") message:AMLocalizedString(@"photoLibraryPermissions", @"Please give MEGA app permission to access your photo library in your settings app!") delegate:self cancelButtonTitle:(&UIApplicationOpenSettingsURLString ? AMLocalizedString(@"cancel", nil) : AMLocalizedString(@"ok", nil)) otherButtonTitles:(&UIApplicationOpenSettingsURLString ? AMLocalizedString(@"ok", nil) : nil), nil];
119120
[alert show];
120121
} else {
122+
MEGALogInfo(@"Enable Camera Uploads");
121123
[[CameraUploads syncManager] setIsCameraUploadsEnabled:YES];
122124
[[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[CameraUploads syncManager].isCameraUploadsEnabled] forKey:kIsCameraUploadsEnabled];
123125

iMEGA/Camera uploads/MEGAAssetOperation.m

+1
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ - (BOOL)hasFreeSpaceOnDiskForWriteFile:(long long)fileSize {
291291
otherButtonTitles:nil];
292292
[alertView show];
293293
if (_automatically) {
294+
MEGALogInfo(@"Disable Camera Uploads");
294295
[[CameraUploads syncManager] setIsCameraUploadsEnabled:NO];
295296
}
296297
});

iMEGA/Camera uploads/PhotosViewController.m

+5
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ - (void)didReceiveMemoryWarning {
126126
}
127127

128128
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
129+
if ([[UIDevice currentDevice] iPhone4X] || [[UIDevice currentDevice] iPhone5X]) {
130+
return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
131+
}
132+
129133
return UIInterfaceOrientationMaskAll;
130134
}
131135

@@ -248,6 +252,7 @@ - (void)enableCameraUploadsAndShowItsSettings {
248252
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:AMLocalizedString(@"attention", @"Attention") message:AMLocalizedString(@"photoLibraryPermissions", @"Please give MEGA app permission to access your photo library in your settings app!") delegate:self cancelButtonTitle:(&UIApplicationOpenSettingsURLString ? AMLocalizedString(@"cancel", nil) : AMLocalizedString(@"ok", nil)) otherButtonTitles:(&UIApplicationOpenSettingsURLString ? AMLocalizedString(@"ok", nil) : nil), nil];
249253
[alert show];
250254
} else {
255+
MEGALogInfo(@"Enable Camera Uploads");
251256
[[CameraUploads syncManager] setIsCameraUploadsEnabled:YES];
252257
[[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[CameraUploads syncManager].isCameraUploadsEnabled] forKey:kIsCameraUploadsEnabled];
253258
[self reloadUI];

iMEGA/Categories/UIDevice+MNZCategory.h

+3
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,7 @@
4141
*/
4242
@property (nonatomic, readonly) BOOL iPadPro;
4343

44+
45+
- (NSString *)deviceName;
46+
4447
@end

iMEGA/Cloud drive/Activities/GetLinkActivity.h

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
@interface GetLinkActivity : UIActivity
66

7-
- (instancetype)initWithNode:(MEGANode *)nodeCopy;
87
- (instancetype)initWithNodes:(NSArray *)nodesArray;
98

109
@end

iMEGA/Cloud drive/Activities/GetLinkActivity.m

-9
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,12 @@
77

88
@interface GetLinkActivity ()
99

10-
@property (strong, nonatomic) MEGANode *node;
1110
@property (strong, nonatomic) NSArray *nodes;
1211

1312
@end
1413

1514
@implementation GetLinkActivity
1615

17-
- (instancetype)initWithNode:(MEGANode *)nodeCopy {
18-
_node = nodeCopy;
19-
20-
return self;
21-
}
22-
2316
- (instancetype)initWithNodes:(NSArray *)nodesArray {
2417
_nodes = nodesArray;
2518

@@ -54,8 +47,6 @@ - (void)performActivity {
5447
for (MEGANode *n in self.nodes) {
5548
[[MEGASdkManager sharedMEGASdk] exportNode:n];
5649
}
57-
} else {
58-
[[MEGASdkManager sharedMEGASdk] exportNode:self.node];
5950
}
6051

6152
if (([[[UIDevice currentDevice] systemVersion] compare:@"8.0" options:NSNumericSearch] != NSOrderedDescending)) {

iMEGA/Cloud drive/Activities/RemoveLinkActivity.h

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
@interface RemoveLinkActivity : UIActivity
66

7-
- (instancetype)initWithNode:(MEGANode *)nodeCopy;
87
- (instancetype)initWithNodes:(NSArray *)nodesArray;
98

109
@end

iMEGA/Cloud drive/Activities/RemoveLinkActivity.m

-9
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,12 @@
66

77
@interface RemoveLinkActivity ()
88

9-
@property (strong, nonatomic) MEGANode *node;
109
@property (strong, nonatomic) NSArray *nodes;
1110

1211
@end
1312

1413
@implementation RemoveLinkActivity
1514

16-
- (instancetype)initWithNode:(MEGANode *)nodeCopy {
17-
_node = nodeCopy;
18-
19-
return self;
20-
}
21-
2215
- (instancetype)initWithNodes:(NSArray *)nodesArray {
2316
_nodes = nodesArray;
2417

@@ -51,8 +44,6 @@ - (void)performActivity {
5144
for (MEGANode *n in self.nodes) {
5245
[[MEGASdkManager sharedMEGASdk] disableExportNode:n];
5346
}
54-
} else {
55-
[[MEGASdkManager sharedMEGASdk] disableExportNode:self.node];
5647
}
5748

5849
if (([[[UIDevice currentDevice] systemVersion] compare:@"8.0" options:NSNumericSearch] != NSOrderedDescending)) {

iMEGA/Cloud drive/Activities/ShareFolderActivity.h

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
@interface ShareFolderActivity : UIActivity
44

5-
- (instancetype)initWithNode:(MEGANode *)nodeCopy;
65
- (instancetype)initWithNodes:(NSArray *)nodesArray;
76

87
@end

iMEGA/Cloud drive/Activities/ShareFolderActivity.m

+2-17
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,14 @@
55

66
@interface ShareFolderActivity ()
77

8-
@property (strong, nonatomic) MEGANode *node;
98
@property (strong, nonatomic) NSArray *nodes;
109

11-
@property (nonatomic) ContactsMode contactsMode;
12-
1310
@end
1411

1512
@implementation ShareFolderActivity
1613

17-
- (instancetype)initWithNode:(MEGANode *)nodeCopy {
18-
_node = nodeCopy;
19-
_contactsMode = ContactsShareFolderWith;
20-
21-
return self;
22-
}
23-
2414
- (instancetype)initWithNodes:(NSArray *)nodesArray {
2515
_nodes = nodesArray;
26-
_contactsMode = ContactsShareFoldersWith;
2716

2817
return self;
2918
}
@@ -52,12 +41,8 @@ - (UIViewController *)activityViewController {
5241

5342
MEGANavigationController *navigationController = [[UIStoryboard storyboardWithName:@"Contacts" bundle:nil] instantiateViewControllerWithIdentifier:@"ContactsNavigationControllerID"];
5443
ContactsViewController *contactsVC = navigationController.viewControllers.firstObject;
55-
if (self.contactsMode == ContactsShareFolderWith) {
56-
[contactsVC setNode:self.node];
57-
} else if (self.contactsMode == ContactsShareFoldersWith) {
58-
[contactsVC setNodesArray:self.nodes];
59-
}
60-
[contactsVC setContactsMode:self.contactsMode];
44+
contactsVC.nodesArray = self.nodes;
45+
contactsVC.contactsMode = ContactsShareFoldersWith;
6146
[contactsVC setShareFolderActivity:self];
6247

6348
return navigationController;

iMEGA/Cloud drive/CloudDriveTableViewController.m

+4
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ - (void)viewDidDisappear:(BOOL)animated {
183183
}
184184

185185
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
186+
if ([[UIDevice currentDevice] iPhone4X] || [[UIDevice currentDevice] iPhone5X]) {
187+
return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
188+
}
189+
186190
return UIInterfaceOrientationMaskAll;
187191
}
188192

iMEGA/Info.plist

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<key>CFBundlePackageType</key>
3737
<string>APPL</string>
3838
<key>CFBundleShortVersionString</key>
39-
<string>3.3</string>
39+
<string>3.3.1</string>
4040
<key>CFBundleSignature</key>
4141
<string>????</string>
4242
<key>CFBundleURLTypes</key>
@@ -51,7 +51,7 @@
5151
</dict>
5252
</array>
5353
<key>CFBundleVersion</key>
54-
<string>38</string>
54+
<string>39</string>
5555
<key>ITSAppUsesNonExemptEncryption</key>
5656
<false/>
5757
<key>LSRequiresIPhoneOS</key>

iMEGA/Login/MainTabBarController.m

+5-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,11 @@ - (BOOL)shouldAutorotate {
103103
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
104104
if ([self.selectedViewController respondsToSelector:@selector(supportedInterfaceOrientations)]) {
105105
if ([[UIDevice currentDevice] iPhone4X] || [[UIDevice currentDevice] iPhone5X]) {
106-
return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
106+
if ([self.selectedViewController isEqual:self.moreNavigationController]) {
107+
return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
108+
}
109+
110+
return [self.selectedViewController supportedInterfaceOrientations];
107111
}
108112

109113
if ([self.selectedViewController isEqual:self.moreNavigationController]) {

0 commit comments

Comments
 (0)