Skip to content

Commit

Permalink
Merge pull request #6 from dji-sdk/dji_uxsdk_5.0_beta_2
Browse files Browse the repository at this point in the history
Dji UXSDK 5.0 beta 2
  • Loading branch information
shane-dji authored May 15, 2020
2 parents 14c0ba0 + 49bbde5 commit e987dab
Show file tree
Hide file tree
Showing 467 changed files with 22,204 additions and 1,232 deletions.
3 changes: 1 addition & 2 deletions DJI-UXSDK-iOS-Beta-Communication.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'DJI-UXSDK-iOS-Beta-Communication'
s.version = '0.1.1'
s.version = '0.2'
s.license = 'MIT'
s.summary = 'Intra-framework, and system communication infrastructure for DJI iOS UX SDK.'
s.homepage = 'https://github.com/dji-sdk/Mobile-UXSDK-Beta-iOS'
Expand All @@ -15,5 +15,4 @@ Pod::Spec.new do |s|
s.pod_target_xcconfig = { 'ENABLE_BITCODE' => 'NO', 'DEFINES_MODULE' => 'YES'}
s.cocoapods_version = '>= 1.7.1'
s.source_files = 'DJIUXSDKCommunication/**/*.{h,swift}'
s.public_header_files = 'DJIUXSDKCommunication/**/*.h'
end
15 changes: 7 additions & 8 deletions DJI-UXSDK-iOS-Beta-Core.podspec
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
Pod::Spec.new do |s|
s.name = 'DJI-UXSDK-iOS-Beta-Core'
s.version = '0.1.1'
s.version = '0.2'
s.license = 'MIT'
s.summary = 'Core utilities for DJI iOS UX SDK.'
s.homepage = 'https://github.com/dji-sdk/Mobile-UXSDK-Beta-iOS'
s.authors = { 'DJI' => '[email protected]' }
s.documentation_url = 'https://github.com/dji-sdk/Mobile-UXSDK-Beta-iOS/wiki'
s.documentation_url = 'https:/github.com//dji-sdk/Mobile-UXSDK-Beta-iOS/wiki'
s.ios.deployment_target = '11.0'
s.requires_arc = true
s.module_name = 'DJIUXSDKCore'
s.xcconfig = { 'OTHER_LDFLAGS' => '-ObjC -all_load' }
s.source = { :git => 'https://github.com/dji-sdk/Mobile-UXSDK-Beta-iOS.git', :tag => s.version.to_s }
s.pod_target_xcconfig = { 'ENABLE_BITCODE' => 'NO', 'DEFINES_MODULE' => 'YES', 'SWIFT_OBJC_BRIDGING_HEADER' => '$(PODS_TARGET_SRCROOT)/'}
s.pod_target_xcconfig = { 'ENABLE_BITCODE' => 'NO', 'DEFINES_MODULE' => 'YES'}
s.cocoapods_version = '>= 1.7.1'
s.source_files = 'DJIUXSDKCore/**/*.{h,m}'
s.public_header_files = 'DJIUXSDKCore/**/*.h'
s.dependency 'DJI-SDK-iOS', '~> 4.11'
s.dependency 'DJI-UXSDK-iOS-Beta-Communication', '0.1.1'
end
s.source_files = 'DJIUXSDKCore/**/*.{h,m,swift}'
s.dependency 'DJI-SDK-iOS', '~> 4.12'
s.dependency 'DJI-UXSDK-iOS-Beta-Communication', '0.2'
end
19 changes: 10 additions & 9 deletions DJI-UXSDK-iOS-Beta-Widgets.podspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Pod::Spec.new do |s|
s.name = 'DJI-UXSDK-iOS-Beta-Widgets'
s.version = '0.1.1'
s.version = '0.2'
s.license = 'MIT'
s.summary = 'A collection of widget, widget model, and related helpers for DJI iOS UX SDK.'
s.summary = 'A collection of widget, widget model, and related helpers for DJI iOS UX SDK 5.0 Open Source (Beta 2).'
s.homepage = 'https://github.com/dji-sdk/Mobile-UXSDK-Beta-iOS'
s.authors = { 'DJI' => '[email protected]' }
s.documentation_url = 'https://github.com/dji-sdk/Mobile-UXSDK-Beta-iOS/wiki'
Expand All @@ -11,11 +11,12 @@ Pod::Spec.new do |s|
s.module_name = 'DJIUXSDKWidgets'
s.xcconfig = { 'OTHER_LDFLAGS' => '-ObjC -all_load' }
s.source = { :git => 'https://github.com/dji-sdk/Mobile-UXSDK-Beta-iOS.git', :tag => s.version.to_s }
s.pod_target_xcconfig = { 'ENABLE_BITCODE' => 'NO', 'DEFINES_MODULE' => 'YES', 'SWIFT_OBJC_BRIDGING_HEADER' => '$(PODS_TARGET_SRCROOT)/'}
s.pod_target_xcconfig = { 'ENABLE_BITCODE' => 'NO', 'DEFINES_MODULE' => 'YES' }
s.cocoapods_version = '>= 1.7.1'
s.source_files = 'DJIUXSDKWidgets/**/*.{h,m}'
s.resource_bundle = { 'DUXBetaAssets' => 'DJIUXSDKWidgets/**/*.xcassets' }
s.dependency 'DJI-SDK-iOS', '~> 4.11'
s.dependency 'DJI-UXSDK-iOS-Beta-Core', '0.1.1'
s.dependency 'DJI-UXSDK-iOS-Beta-Communication', '0.1.1'
end
s.source_files = 'DJIUXSDKWidgets/**/*.{h,m,swift}'
s.resource_bundle = { 'DUXBetaAssets' => 'DJIUXSDKWidgets/**/*.{xcassets,html,otf}' }
s.dependency 'DJI-SDK-iOS', '~> 4.12'
s.dependency 'DJIWidget', '~> 1.6.2'
s.dependency 'DJI-UXSDK-iOS-Beta-Core', '0.2'
s.dependency 'DJI-UXSDK-iOS-Beta-Communication', '0.2'
end
14 changes: 7 additions & 7 deletions DJI-UXSDK-iOS-Beta.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'DJI-UXSDK-iOS-Beta'
s.version = '0.1.1'
s.version = '0.2'
s.license = 'MIT'
s.summary = 'DJI iOS UX SDK'
s.homepage = 'https://github.com/dji-sdk/Mobile-UXSDK-Beta-iOS'
Expand All @@ -11,10 +11,10 @@ Pod::Spec.new do |s|
s.module_name = 'DJIUXSDKBeta'
s.xcconfig = { 'OTHER_LDFLAGS' => '-ObjC -all_load' }
s.source = { :git => 'https://github.com/dji-sdk/Mobile-UXSDK-Beta-iOS.git', :tag => s.version.to_s }
s.pod_target_xcconfig = { 'ENABLE_BITCODE' => 'NO', 'DEFINES_MODULE' => 'YES', 'SWIFT_OBJC_BRIDGING_HEADER' => '$(PODS_TARGET_SRCROOT)/'}
s.pod_target_xcconfig = { 'ENABLE_BITCODE' => 'NO', 'DEFINES_MODULE' => 'YES'}
s.cocoapods_version = '>= 1.7.1'
s.source_files = 'DJIUXSDKBeta/**/*.{h,m}'
s.dependency 'DJI-UXSDK-iOS-Beta-Core', '0.1.1'
s.dependency 'DJI-UXSDK-iOS-Beta-Communication', '0.1.1'
s.dependency 'DJI-UXSDK-iOS-Beta-Widgets', '0.1.1'
end
s.source_files = 'DJIUXSDKBeta/**/*.{h,m,swift}'
s.dependency 'DJI-UXSDK-iOS-Beta-Core', '0.2'
s.dependency 'DJI-UXSDK-iOS-Beta-Communication', '0.2'
s.dependency 'DJI-UXSDK-iOS-Beta-Widgets', '0.2'
end
21 changes: 21 additions & 0 deletions DJIUXSDKBeta/DJIUXSDK.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// DJIUXSDK.h
// DJIUXSDK
//
// Copyright © 2018-2020 DJI. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <DJISDK/DJISDK.h>

//! Project version number for DJIUXSDK.
FOUNDATION_EXPORT double DJIUXSDKVersionNumber;

//! Project version string for DJIUXSDK.
FOUNDATION_EXPORT const unsigned char DJIUXSDKVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <DJIUXSDK/PublicHeader.h>

#import <DJIUXSDKCore/DJIUXSDKCore.h>
#import <DJIUXSDKCommunication/DJIUXSDKCommunication.h>
#import <DJIUXSDKWidgets/DJIUXSDKWidgets.h>
14 changes: 8 additions & 6 deletions DJIUXSDKBeta/DUXBetaSDKAttributes.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//
// DUXBetaSample.h
// DUXBetaSDKAttributes.h
// DJIUXSDK
//
// MIT License
//
//
// Copyright © 2018-2019 DJI
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
Expand All @@ -27,12 +27,14 @@

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface DUXBetaSDKAttributes : NSObject

+ (nonnull NSString *)sdkVersion;

+ (nonnull NSString *)sdkBuildNumber;

+ (nonnull NSArray <NSString *> *)availableWidgets;

@end
@end

NS_ASSUME_NONNULL_END
25 changes: 16 additions & 9 deletions DJIUXSDKBeta/DUXBetaSDKAttributes.m
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//
// DUXBetaSample.m
// DUXBetaSDKAttributes.m
// DJIUXSDK
//
// MIT License
//
//
// Copyright © 2018-2019 DJI
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
Expand Down Expand Up @@ -39,18 +39,25 @@ + (nonnull NSString *)sdkBuildNumber {

+ (nonnull NSArray <NSString *> *)availableWidgets {
return @[
@"AirSense Widget",
@"Altitude Widget",
@"Battery Widget",
@"Compass Widget",
@"Connection Widget",
@"Dashboard Widget",
@"Home Distance Widget",
@"Horizontal Velocity Widget",
@"Flight Mode Widget",
@"FPV Widget",
@"GPS Signal Widget",
@"Map Widget",
@"RC Distance Widget",
@"Vertical Velocity Widget",
@"Remaining Flight Time Widget",
@"Remote Control Signal Widget",
@"Simulator Indicator Widget",
@"System Status Widget",
@"System Status List Widget",
@"Video Signal Widget",
@"Vision Widget",
@"VPS Widget",
@"Top Bar Panel Widget"
];
}

@end
@end
6 changes: 5 additions & 1 deletion DJIUXSDKCommunication/DJIUXSDKCommunication.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// MIT License
//
// Copyright © 2018-2019 DJI
// Copyright © 2018-2020 DJI
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -32,3 +32,7 @@ FOUNDATION_EXPORT double DJIUXSDKCommunicationVersionNumber;

//! Project version string for DJIUXSDKCommunication.
FOUNDATION_EXPORT const unsigned char DJIUXSDKCommunicationVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <DJIUXSDKCommunication/PublicHeader.h>


82 changes: 75 additions & 7 deletions DJIUXSDKCommunication/GlobalPreferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// MIT License
//
// Copyright © 2018-2019 DJI
// Copyright © 2018-2020 DJI
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand All @@ -27,23 +27,41 @@

import Foundation

@objc(DUXBetaMeasureUnitType) public enum MeasureUnitType: Int {
@objc(DUXMeasureUnitType) public enum MeasureUnitType: Int {
case Metric = 1, Imperial = 2, Unknown = 3
}

@objc(DUXFPVCenterViewType) public enum FPVCenterViewType: Int {
case Standard = 1, Cross, NarrowCross, Frame, FrameAndCross, Square, SquareAndCross, Unknown
}

@objc(DUXFPVCenterViewColor) public enum FPVCenterViewColor: Int {
case White = 1, Yellow, Red, Green, Blue, Black, Unknown
}

@objc(DUXFPVGridViewType) public enum FPVGridViewType: Int {
case Parallel = 1, ParallelDiagonal, Unknown
}

enum GlobalPreference: RawRepresentable {
typealias RawValue = String

case MeasureUnitType, AFCEnabled, FPVCenterViewType, FPVCenterViewColor, FPVGridViewType, Unknown

case MeasureUnitType, AFCEnabled, Unknown

static let Prefix = "DUXBetaGlobalPreference"
static let Prefix = "DUXGlobalPreference"

var rawValue: GlobalPreference.RawValue {
switch self {
case .MeasureUnitType:
return GlobalPreference.Prefix + "MeasureUnitType"
case .AFCEnabled:
return GlobalPreference.Prefix + "AFCEnabled"
case .FPVCenterViewType:
return GlobalPreference.Prefix + "FPVCenterViewType"
case .FPVCenterViewColor:
return GlobalPreference.Prefix + "FPVCenterViewColor"
case .FPVGridViewType:
return GlobalPreference.Prefix + "FPVGridViewType"
case .Unknown:
return ""
}
Expand All @@ -55,20 +73,35 @@ enum GlobalPreference: RawRepresentable {
self = .MeasureUnitType
case GlobalPreference.Prefix + "AFCEnabled":
self = .AFCEnabled
case GlobalPreference.Prefix + "FPVCenterViewType":
self = .FPVCenterViewType
case GlobalPreference.Prefix + "FPVCenterViewColor":
self = .FPVCenterViewColor
case GlobalPreference.Prefix + "FPVGridViewType":
self = .FPVGridViewType
default:
self = .Unknown
}
}
}

// To create a custom storage mechanism, implement this protocol then call setSharedGlobalPreferences:
// on DUXBetaSingleton to replace the default implementation with a custom one
// on DUXSingleton to replace the default implementation with a custom one
@objc public protocol GlobalPreferences {
func set(measureUnitType:MeasureUnitType)
func measureUnitType() -> MeasureUnitType

func set(AFCEnabled:Bool)
func afcEnabled() -> Bool

func set(centerViewType: FPVCenterViewType)
func centerViewType() -> FPVCenterViewType

func set(centerViewColor: FPVCenterViewColor)
func centerViewColor() -> FPVCenterViewColor

func set(gridViewType: FPVGridViewType)
func gridViewType() -> FPVGridViewType
}

public class DefaultGlobalPreferences: NSObject, GlobalPreferences {
Expand Down Expand Up @@ -101,8 +134,43 @@ public class DefaultGlobalPreferences: NSObject, GlobalPreferences {
userDefaults.set(AFCEnabled, forKey: GlobalPreference.AFCEnabled.rawValue)
}


public func afcEnabled() -> Bool {
return userDefaults.bool(forKey: GlobalPreference.AFCEnabled.rawValue)
}

public func set(centerViewType: FPVCenterViewType) {
userDefaults.set(centerViewType.rawValue, forKey: GlobalPreference.FPVCenterViewType.rawValue)
}

public func centerViewType() -> FPVCenterViewType {
let rawCenterViewType = userDefaults.integer(forKey: GlobalPreference.FPVCenterViewType.rawValue)
if let centerViewType = FPVCenterViewType(rawValue: rawCenterViewType) {
return centerViewType
}
return .Unknown
}

public func set(centerViewColor: FPVCenterViewColor) {
userDefaults.set(centerViewColor.rawValue, forKey: GlobalPreference.FPVCenterViewColor.rawValue)
}

public func centerViewColor() -> FPVCenterViewColor {
let rawCenterViewColor = userDefaults.integer(forKey: GlobalPreference.FPVCenterViewColor.rawValue)
if let centerViewColor = FPVCenterViewColor(rawValue: rawCenterViewColor) {
return centerViewColor
}
return .Unknown
}

public func set(gridViewType:FPVGridViewType) {
userDefaults.set(gridViewType.rawValue, forKey: GlobalPreference.FPVGridViewType.rawValue)
}

public func gridViewType() -> FPVGridViewType {
let rawGridViewType = userDefaults.integer(forKey: GlobalPreference.FPVGridViewType.rawValue)
if let gridViewType = FPVGridViewType(rawValue: rawGridViewType) {
return gridViewType
}
return .Unknown
}
}
Loading

0 comments on commit e987dab

Please sign in to comment.