Skip to content

Commit

Permalink
Merge pull request #1439 from Catrobat/hotfix-0.6.15
Browse files Browse the repository at this point in the history
Hotfix 0.6.15
  • Loading branch information
m-herold authored Jul 24, 2020
2 parents f353304 + bdde576 commit fc40989
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 78 deletions.
8 changes: 4 additions & 4 deletions src/Catty.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11336,7 +11336,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COMPRESS_PNG_FILES = NO;
CURRENT_PROJECT_VERSION = 40;
CURRENT_PROJECT_VERSION = 41;
DEFINES_MODULE = NO;
DEVELOPMENT_TEAM = 8FL5R8726S;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -11354,7 +11354,7 @@
INFOPLIST_FILE = "Catty/Supporting Files/App-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 0.6.14;
MARKETING_VERSION = 0.6.15;
OTHER_LDFLAGS = (
"-lxml2",
"$(inherited)",
Expand Down Expand Up @@ -11384,7 +11384,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COMPRESS_PNG_FILES = NO;
CURRENT_PROJECT_VERSION = 40;
CURRENT_PROJECT_VERSION = 41;
DEFINES_MODULE = NO;
DEVELOPMENT_TEAM = 8FL5R8726S;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -11402,7 +11402,7 @@
INFOPLIST_FILE = "Catty/Supporting Files/App-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 0.6.14;
MARKETING_VERSION = 0.6.15;
OTHER_LDFLAGS = (
"-lxml2",
"$(inherited)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

@objc extension NSData {
func md5() -> String {
let data = Data(self)
let data = Data(referencing: self)
return data.md5()
}
}
27 changes: 14 additions & 13 deletions src/Catty/PocketPaint/ViewController/PaintViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -877,22 +877,23 @@ - (void)saveAction
UIImageWriteToSavedPhotosAlbum(self.saveView.image, nil, nil, nil);
dispatch_async(dispatch_get_main_queue(), ^{
[self showSavedView];
NSDebug(@"saved to Camera Roll");
});
} else {
[[[[[AlertControllerBuilder alertWithTitle:nil message:kLocalizedNoAccesToImagesCheckSettingsDescription]
addCancelActionWithTitle:kLocalizedCancel handler:nil]
addDefaultActionWithTitle:kLocalizedSettings handler:^{
if ([self.delegate respondsToSelector:@selector(addPaintedImage:andPath:)]) {
if (self.editingPath) {
[self.delegate addPaintedImage:self.saveView.image andPath:self.editingPath];
} else {
[self.delegate addPaintedImage:self.saveView.image andPath:@"settings"];
dispatch_async(dispatch_get_main_queue(), ^{
[[[[[AlertControllerBuilder alertWithTitle:nil message:kLocalizedNoAccesToImagesCheckSettingsDescription]
addCancelActionWithTitle:kLocalizedCancel handler:nil]
addDefaultActionWithTitle:kLocalizedSettings handler:^{
if ([self.delegate respondsToSelector:@selector(addPaintedImage:andPath:)]) {
if (self.editingPath) {
[self.delegate addPaintedImage:self.saveView.image andPath:self.editingPath];
} else {
[self.delegate addPaintedImage:self.saveView.image andPath:@"settings"];
}
}
}
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}] build]
showWithController:self];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}] build]
showWithController:self];
});
}
}];
});
Expand Down
2 changes: 1 addition & 1 deletion src/Catty/Settings.bundle/Root.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</dict>
<dict>
<key>DefaultValue</key>
<string>0.6.14</string>
<string>0.6.15</string>
<key>Key</key>
<string>versionNumberSettings</string>
<key>Title</key>
Expand Down
92 changes: 33 additions & 59 deletions src/CattyTests/Extensions/NSDataExtensionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,64 +25,38 @@ import XCTest
@testable import Pocket_Code

final class NSDataExtensionTests: XCTestCase {
func testMD5() {

guard let data1 = "".data(using: .ascii) else {
XCTFail("Failed to get string into data using ASCII encoding")
return
}
let testData1 = NSData(data: data1)
let correctOutput1 = "d41d8cd98f00b204e9800998ecf8427e"

guard let data2 = "a".data(using: .ascii) else {
XCTFail("Failed to get string into data using ASCII encoding")
return
}
let testData2 = NSData(data: data2)
let correctOutput2 = "0cc175b9c0f1b6a831c399e269772661"

guard let data3 = "abc".data(using: .ascii) else {
XCTFail("Failed to get string into data using ASCII encoding")
return
}
let testData3 = NSData(data: data3)
let correctOutput3 = "900150983cd24fb0d6963f7d28e17f72"

guard let data4 = "message digest".data(using: .ascii) else {
XCTFail("Failed to get string into data using ASCII encoding")
return
}
let testData4 = NSData(data: data4)
let correctOutput4 = "f96b697d7cb7938d525a2f31aaf161d0"

guard let data5 = "abcdefghijklmnopqrstuvwxyz".data(using: .ascii) else {
XCTFail("Failed to get string into data using ASCII encoding")
return
}
let testData5 = NSData(data: data5)
let correctOutput5 = "c3fcd3d76192e4007dfb496cca67e13b"

guard let data6 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".data(using: .ascii) else {
XCTFail("Failed to get string into data using ASCII encoding")
return
}
let testData6 = NSData(data: data6)
let correctOutput6 = "d174ab98d277d9f5a5611c2c9f419d9f"

guard let data7 = "12345678901234567890123456789012345678901234567890123456789012345678901234567890".data(using: .ascii) else {
XCTFail("Failed to get string into data using ASCII encoding")
return
}
let testData7 = NSData(data: data7)
let correctOutput7 = "57edf4a22be3c955ac49da2e2107b67a"

XCTAssertEqual(testData1.md5(), correctOutput1)
XCTAssertEqual(testData2.md5(), correctOutput2)
XCTAssertEqual(testData3.md5(), correctOutput3)
XCTAssertEqual(testData4.md5(), correctOutput4)
XCTAssertEqual(testData5.md5(), correctOutput5)
XCTAssertEqual(testData6.md5(), correctOutput6)
XCTAssertEqual(testData7.md5(), correctOutput7)

}
func testMD5() {
guard let data1 = "".data(using: .ascii) else {
XCTFail("Failed to get string into data using ASCII encoding")
return
}
let testData1 = NSData(data: data1)
let correctOutput1 = "d41d8cd98f00b204e9800998ecf8427e"

guard let data2 = "a".data(using: .ascii) else {
XCTFail("Failed to get string into data using ASCII encoding")
return
}
let testData2 = NSData(data: data2)
let correctOutput2 = "0cc175b9c0f1b6a831c399e269772661"

XCTAssertEqual(testData1.md5(), correctOutput1)
XCTAssertEqual(testData2.md5(), correctOutput2)
}

func testMD5WithLargeData() {
let fiveHundredMegabyteData = NSData(data: Data(count: 524288000))
let expectation = self.expectation(description: "md5 calculated")

DispatchQueue.global(qos: .userInitiated).async {
let md5 = fiveHundredMegabyteData.md5()
XCTAssertNotNil(md5)
expectation.fulfill()
}

waitForExpectations(timeout: 10) { error in
XCTAssertNil(error)
}
}
}

0 comments on commit fc40989

Please sign in to comment.