Skip to content

Commit

Permalink
Release 0.1.1 - Swift 4.1 update
Browse files Browse the repository at this point in the history
  • Loading branch information
alexruperez committed Apr 3, 2018
1 parent e430b25 commit 66d799b
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 77 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0
4.1
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: swift
osx_image: xcode9
osx_image: xcode9.3beta
script:
- xcodebuild -workspace SafeBrowsing.xcworkspace -scheme SafeBrowsing -destination "platform=iOS
Simulator,name=iPhone 7,OS=11.0" -configuration Debug -enableCodeCoverage YES clean
Simulator,name=iPhone X,OS=11.3" -configuration Debug -enableCodeCoverage YES clean
build test
after_success:
- bash <(curl -s https://codecov.io/bash)
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Release 0.1.1

- [x] Swift 4.1

# Release 0.1.0

- [x] First release.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Version](https://img.shields.io/cocoapods/v/SafeBrowsing.svg?style=flat)](http://cocoapods.org/pods/SafeBrowsing)
[![License](https://img.shields.io/cocoapods/l/SafeBrowsing.svg?style=flat)](http://cocoapods.org/pods/SafeBrowsing)
[![Platform](https://img.shields.io/cocoapods/p/SafeBrowsing.svg?style=flat)](http://cocoapods.org/pods/SafeBrowsing)
[![Swift](https://img.shields.io/badge/Swift-4-orange.svg?style=flat)](https://swift.org)
[![Swift](https://img.shields.io/badge/Swift-4.1-orange.svg?style=flat)](https://swift.org)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Swift Package Manager Compatible](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-4BC51D.svg?style=flat)](https://github.com/apple/swift-package-manager)
[![Build Status](https://travis-ci.org/alexruperez/SafeBrowsing.svg?branch=master)](https://travis-ci.org/alexruperez/SafeBrowsing)
Expand Down
2 changes: 1 addition & 1 deletion SafeBrowsing.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'SafeBrowsing'
s.version = '0.1.0'
s.version = '0.1.1'
s.summary = 'Protect your users against malware and phishing threats using Google Safe Browsing'

s.homepage = 'https://github.com/alexruperez/SafeBrowsing'
Expand Down
10 changes: 7 additions & 3 deletions SafeBrowsing.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 0920;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = alexruperez;
TargetAttributes = {
D577D1C320693C7E00D4A8D0 = {
Expand Down Expand Up @@ -247,13 +247,15 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand All @@ -266,7 +268,7 @@
CURRENT_PROJECT_VERSION = "$(DYLIB_CURRENT_VERSION)";
DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 0.1.0;
DYLIB_CURRENT_VERSION = 0.1.0;
DYLIB_CURRENT_VERSION = 0.1.1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand Down Expand Up @@ -315,13 +317,15 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand All @@ -334,7 +338,7 @@
CURRENT_PROJECT_VERSION = "$(DYLIB_CURRENT_VERSION)";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 0.1.0;
DYLIB_CURRENT_VERSION = 0.1.0;
DYLIB_CURRENT_VERSION = 0.1.1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0920"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,9 +26,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
Expand Down Expand Up @@ -57,7 +56,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
2 changes: 1 addition & 1 deletion SafeBrowsing/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<string>0.1.1</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down
2 changes: 1 addition & 1 deletion SafeBrowsing/SafeBrowsing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public struct SafeBrowsing {

public static var apiKey: String?
public static var clientId = Bundle.main.bundleIdentifier ?? "com.alexruperez.SafeBrowsing"
public static var clientVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "0.1.0"
public static var clientVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "0.1.1"
public static var threatTypes: [ThreatType] = [.malware, .socialEngineering, .unwantedSoftware, .potenciallyHarmfulApplication]
public static var platformTypes: [PlatformType] = [.any]
public static var threatEntryTypes: [ThreatEntryType] = [.url, .executable]
Expand Down
69 changes: 7 additions & 62 deletions SafeBrowsing/SafeBrowsingModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ public enum SafeBrowsingError: Error, CustomDebugStringConvertible {
}
}

public enum ThreatType: String, Codable {
public enum ThreatType: String, Codable, Hashable {
case unspecified = "THREAT_TYPE_UNSPECIFIED"
case malware = "MALWARE"
case socialEngineering = "SOCIAL_ENGINEERING"
case unwantedSoftware = "UNWANTED_SOFTWARE"
case potenciallyHarmfulApplication = "POTENTIALLY_HARMFUL_APPLICATION"
}

public enum PlatformType: String, Codable {
public enum PlatformType: String, Codable, Hashable {
case unspecified = "PLATFORM_TYPE_UNSPECIFIED"
case windows = "WINDOWS"
case linux = "LINUX"
Expand All @@ -50,22 +50,16 @@ public enum PlatformType: String, Codable {
case chrome = "CHROME"
}

public enum ThreatEntryType: String, Codable {
public enum ThreatEntryType: String, Codable, Hashable {
case unspecified = "THREAT_ENTRY_TYPE_UNSPECIFIED"
case url = "URL"
case executable = "EXECUTABLE"
}

public struct ErrorDetail: Codable, Equatable {
public struct ErrorDetail: Codable, Hashable {
public let status: String
public let message: String
public let code: Int

public static func ==(lhs: ErrorDetail, rhs: ErrorDetail) -> Bool {
return lhs.status == rhs.status &&
lhs.message == rhs.message &&
lhs.code == rhs.code
}
}

public struct ThreatMatch: Codable, Equatable {
Expand All @@ -75,93 +69,44 @@ public struct ThreatMatch: Codable, Equatable {
public let threat: ThreatEntry
public let threatEntryMetadata: ThreatEntryMetadata?
public let cacheDuration: String

public static func ==(lhs: ThreatMatch, rhs: ThreatMatch) -> Bool {
return lhs.threatType == rhs.threatType &&
lhs.platformType == rhs.platformType &&
lhs.threatEntryType == rhs.threatEntryType &&
lhs.threat == rhs.threat &&
lhs.threatEntryMetadata == rhs.threatEntryMetadata &&
lhs.cacheDuration == rhs.cacheDuration
}
}

public struct ThreatEntry: Codable, Equatable {
public let hash: String?
public let url: String?
public let digest: String?

public static func ==(lhs: ThreatEntry, rhs: ThreatEntry) -> Bool {
return lhs.hash == rhs.hash &&
lhs.url == rhs.url &&
lhs.digest == rhs.digest
}
}

public struct ThreatEntryMetadata: Codable, Equatable {
public let entries: [MetadataEntry]

public static func ==(lhs: ThreatEntryMetadata, rhs: ThreatEntryMetadata) -> Bool {
return lhs.entries == rhs.entries
}
}

public struct MetadataEntry: Codable, Equatable {
public struct MetadataEntry: Codable, Hashable {
public let key: String
public let value: String

public static func ==(lhs: MetadataEntry, rhs: MetadataEntry) -> Bool {
return lhs.key == rhs.key &&
lhs.key == rhs.key
}
}

struct ThreatMatchesRequest: Codable, Equatable {
let client: ClientInfo
let threatInfo: ThreatInfo

static func ==(lhs: ThreatMatchesRequest, rhs: ThreatMatchesRequest) -> Bool {
return lhs.client == rhs.client &&
lhs.threatInfo == rhs.threatInfo
}
}

struct ClientInfo: Codable, Equatable {
struct ClientInfo: Codable, Hashable {
let clientId: String
let clientVersion: String

static func ==(lhs: ClientInfo, rhs: ClientInfo) -> Bool {
return lhs.clientId == rhs.clientId &&
lhs.clientVersion == rhs.clientVersion
}
}

struct ThreatInfo: Codable, Equatable {
let threatTypes: [ThreatType]
let platformTypes: [PlatformType]
let threatEntryTypes: [ThreatEntryType]
let threatEntries: [ThreatEntry]

static func ==(lhs: ThreatInfo, rhs: ThreatInfo) -> Bool {
return lhs.threatTypes == rhs.threatTypes &&
lhs.platformTypes == rhs.platformTypes &&
lhs.threatEntryTypes == rhs.threatEntryTypes &&
lhs.threatEntries == rhs.threatEntries
}
}

struct ErrorResponse: Codable, Equatable {
struct ErrorResponse: Codable, Hashable {
let error: ErrorDetail

static func ==(lhs: ErrorResponse, rhs: ErrorResponse) -> Bool {
return lhs.error == rhs.error
}
}

struct ThreatMatches: Codable, Equatable {
let matches: [ThreatMatch]

static func ==(lhs: ThreatMatches, rhs: ThreatMatches) -> Bool {
return lhs.matches == rhs.matches
}
}

0 comments on commit 66d799b

Please sign in to comment.