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

Feature/swift5.1 #49

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*.db
xcuserdata
Pods/
79 changes: 52 additions & 27 deletions apps/ios/DuoApp/DuoApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
/* Begin PBXFileReference section */
0F1DB515EE056F0A63BADC95 /* Pods_RedBear_Duo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RedBear_Duo.framework; sourceTree = BUILT_PRODUCTS_DIR; };
323FE57F1B24FBA4CDBA837C /* Pods-RedBear Duo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RedBear Duo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RedBear Duo/Pods-RedBear Duo.debug.xcconfig"; sourceTree = "<group>"; };
3CC27F78232B247F00821917 /* RedBear Duo.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "RedBear Duo.entitlements"; sourceTree = "<group>"; };
A11192BB9B67DB6D79B23387 /* Pods-RedBear Duo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RedBear Duo.release.xcconfig"; path = "Pods/Target Support Files/Pods-RedBear Duo/Pods-RedBear Duo.release.xcconfig"; sourceTree = "<group>"; };
A30638AC1D3BC236005499B0 /* AccessPoint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccessPoint.swift; sourceTree = "<group>"; };
A30638AE1D3CA928005499B0 /* RBDuoNavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RBDuoNavigationController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -134,6 +135,7 @@
A31761911D38D76100C52912 = {
isa = PBXGroup;
children = (
3CC27F78232B247F00821917 /* RedBear Duo.entitlements */,
A317619C1D38D76100C52912 /* DuoApp */,
A317619B1D38D76100C52912 /* Products */,
FAF04A82E8E7E4BE0976664F /* Frameworks */,
Expand Down Expand Up @@ -258,7 +260,6 @@
A31761981D38D76100C52912 /* Resources */,
A3AE6D921D559F450019913A /* ShellScript */,
69B916691F3E890858106E78 /* [CP] Embed Pods Frameworks */,
2D3AB72E9F0196B41EC3D5CB /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -275,13 +276,17 @@
A31761921D38D76100C52912 /* Project object */ = {
isa = PBXProject;
attributes = {
KnownAssetTags = (
123,
321,
);
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0810;
LastUpgradeCheck = 1100;
ORGANIZATIONNAME = RedBear;
TargetAttributes = {
A31761991D38D76100C52912 = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = GLKR323QE8;
DevelopmentTeam = 3UDY2NT62F;
LastSwiftMigration = 0810;
SystemCapabilities = {
com.apple.BackgroundModes = {
Expand All @@ -293,7 +298,7 @@
};
buildConfigurationList = A31761951D38D76100C52912 /* Build configuration list for PBXProject "DuoApp" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -334,28 +339,16 @@
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-RedBear Duo-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
2D3AB72E9F0196B41EC3D5CB /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RedBear Duo/Pods-RedBear Duo-resources.sh\"\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
69B916691F3E890858106E78 /* [CP] Embed Pods Frameworks */ = {
Expand All @@ -364,13 +357,26 @@
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-RedBear Duo/Pods-RedBear Duo-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/1PasswordExtension/OnePasswordExtension.framework",
"${BUILT_PRODUCTS_DIR}/AFNetworking/AFNetworking.framework",
"${BUILT_PRODUCTS_DIR}/RWDropdownMenu/RWDropdownMenu.framework",
"${BUILT_PRODUCTS_DIR}/SSZipArchive/SSZipArchive.framework",
"${BUILT_PRODUCTS_DIR}/Spark-SDK/Spark_SDK.framework",
"${BUILT_PRODUCTS_DIR}/SparkSetup/SparkSetup.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OnePasswordExtension.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AFNetworking.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RWDropdownMenu.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SSZipArchive.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Spark_SDK.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SparkSetup.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RedBear Duo/Pods-RedBear Duo-frameworks.sh\"\n";
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RedBear Duo/Pods-RedBear Duo-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
A3AE6D921D559F450019913A /* ShellScript */ = {
Expand All @@ -384,7 +390,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Fabric/run\" c7de6906d4936ce6c4c811e60089d5ee0b544e0a c36bc2c5bd0fac54716fdec96fc7e077b316be54487f79815b5426e883cb9f74";
shellScript = "\"${PODS_ROOT}/Fabric/run\" c7de6906d4936ce6c4c811e60089d5ee0b544e0a c36bc2c5bd0fac54716fdec96fc7e077b316be54487f79815b5426e883cb9f74\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down Expand Up @@ -468,20 +474,28 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
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_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;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
Expand All @@ -503,6 +517,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -517,14 +532,22 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
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_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;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand All @@ -545,6 +568,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
Expand All @@ -556,17 +580,18 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = "RedBear Duo.entitlements";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = 3UDY2NT62F;
INFOPLIST_FILE = DuoApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = cc.redbear.product.duo;
PRODUCT_BUNDLE_IDENTIFIER = adorkable.cc.redbear.product.duo;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_OBJC_BRIDGING_HEADER = "DuoApp/RedBear Duo-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -576,16 +601,16 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = "RedBear Duo.entitlements";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
INFOPLIST_FILE = DuoApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = cc.redbear.product.duo;
PRODUCT_BUNDLE_IDENTIFIER = adorkable.cc.redbear.product.duo;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_OBJC_BRIDGING_HEADER = "DuoApp/RedBear Duo-Bridging-Header.h";
SWIFT_VERSION = 3.0;
};
name = Release;
};
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 apps/ios/DuoApp/DuoApp/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.

application.registerUserNotificationSettings(UIUserNotificationSettings(types: [.sound , .badge , .alert], categories: nil))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "2x"
},
{
Expand Down Expand Up @@ -58,8 +59,9 @@
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "2x"
},
{
Expand All @@ -77,7 +79,7 @@
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "[email protected]",
"filename" : "Icon-App-40x40@1x-1.png",
"scale" : "1x"
},
{
Expand All @@ -104,6 +106,11 @@
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "iphone",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions apps/ios/DuoApp/DuoApp/BLEFramework/BLE/BLE.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class BLE: NSObject, CBCentralManagerDelegate, CBPeripheralDelegate {
centralManager?.scanForPeripherals(withServices: services, options: nil)
}
}
func stopScan() {
@objc func stopScan() {
print("Stop Scanning")
centralManager?.stopScan()
isScanning = false
Expand Down Expand Up @@ -132,21 +132,21 @@ class BLE: NSObject, CBCentralManagerDelegate, CBPeripheralDelegate {
print("Set AP Info")
var buff = [UInt8]()

let passLen = password.characters.count
let len:UInt8 = 9 + UInt8(passLen) + UInt8(ap.ssid.characters.count)
let passLen = password.count
let len:UInt8 = 9 + UInt8(passLen) + UInt8(ap.ssid.count)

buff += [len, BLE_PROVISION_COMMAND_CONFIG_AP, ap.channel]

/// security
buff += [UInt8(ap.security & 0xff), UInt8((ap.security & 0xff00) >> 8), UInt8((ap.security & 0xff0000) >> 16), UInt8((ap.security >> 24) & 0xff)]

// ssid length
buff += [UInt8(ap.ssid.characters.count)]
buff += [UInt8(ap.ssid.count)]
// ssid
buff += ap.ssid.utf8

// password
buff += [UInt8(password.characters.count)]
buff += [UInt8(password.count)]
buff += password.utf8

let data = Data.init(bytes: UnsafePointer<UInt8>(buff),count: buff.count)
Expand Down Expand Up @@ -204,7 +204,7 @@ class BLE: NSObject, CBCentralManagerDelegate, CBPeripheralDelegate {


func peripheral(_ peripheral: CBPeripheral, didUpdateNotificationStateFor characteristic: CBCharacteristic, error: Error?) {
print(error)
print("\(String(describing: error))")
// if characteristic.isNotifying {
// activePeripheral!.readValueForCharacteristic(characteristic)
// }
Expand All @@ -218,7 +218,7 @@ class BLE: NSObject, CBCentralManagerDelegate, CBPeripheralDelegate {
}

let data = characteristic.value
print("\(data)")
print("\(String(describing: data))")
let resultBytes:[UInt8] = Array(UnsafeBufferPointer(start: (data! as NSData).bytes.bindMemory(to: UInt8.self, capacity: data!.count), count: data!.count))


Expand Down
Loading