Skip to content

Commit

Permalink
Merge pull request #68 from nstack-io/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mariusc authored Sep 23, 2020
2 parents d5664a2 + 07f291a commit a4b1634
Show file tree
Hide file tree
Showing 16 changed files with 143 additions and 66 deletions.
37 changes: 37 additions & 0 deletions NStackSDK.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#
# Be sure to run `pod lib lint TuvaUI.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |s|
s.name = 'NStackSDK'
s.version = '5.1.3'
s.summary = 'NStackSDK is the companion software development kit to the NStack backend.'

# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!
s.description = <<-DESC
NStack is Nodes\' "Backend as a Service" product that enables clients to manage many aspects of their products by themselves.
DESC

s.homepage = 'https://github.com/nstack-io/nstack-ios-sdk'
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "Nodes Agency - iOS" => "[email protected]" }
s.source = { :git => 'https://github.com/nstack-io/nstack-ios-sdk', :tag => s.version.to_s }

s.ios.deployment_target = "11"
s.swift_version = '5.2'

s.default_subspecs = "Core"
s.dependency 'NLocalizationManager'

s.subspec 'Core' do |core|
core.source_files = [ 'NStackSDK/**/*.swift']
end
end
24 changes: 10 additions & 14 deletions NStackSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,8 @@
2346FDA2233B6BC40025B68D /* Countries.json in Resources */ = {isa = PBXBuildFile; fileRef = 2346FD6D233B65400025B68D /* Countries.json */; };
2346FDA3233B6C680025B68D /* Countries.json in Resources */ = {isa = PBXBuildFile; fileRef = 2346FD6D233B65400025B68D /* Countries.json */; };
23BD95C322CD00DB001759CE /* AppOpenMockRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23BD95C222CD00DB001759CE /* AppOpenMockRepository.swift */; };
2909463824211DEF00BA254F /* LocalizationManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29A72DF623FFECE500CE8483 /* LocalizationManager.framework */; };
29A72DF023FFEC9600CE8483 /* LocalizationManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29A72DEF23FFEC9600CE8483 /* LocalizationManager.framework */; };
29A72DF323FFECD700CE8483 /* LocalizationManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29A72DF223FFECD700CE8483 /* LocalizationManager.framework */; };
29A72DF723FFECE500CE8483 /* LocalizationManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29A72DF623FFECE500CE8483 /* LocalizationManager.framework */; };
29A72DFB23FFECED00CE8483 /* LocalizationManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29A72DFA23FFECED00CE8483 /* LocalizationManager.framework */; };
29A72DFF24000DFD00CE8483 /* LocalizationConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29A72DFE24000DFD00CE8483 /* LocalizationConfig.swift */; };
29A72E002400166400CE8483 /* LocalizationConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29A72DFE24000DFD00CE8483 /* LocalizationConfig.swift */; };
Expand Down Expand Up @@ -186,6 +184,8 @@
A83A140922F2CB5C002A7682 /* SectionKeyHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = A83A140822F2CB5C002A7682 /* SectionKeyHelper.swift */; };
A864BBEC22F31AD200CC2BFF /* LocalizationItemIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = A864BBEB22F31AD200CC2BFF /* LocalizationItemIdentifier.swift */; };
A8ECFA3022F44E2D009D2175 /* ProposalViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8ECFA2E22F44E2D009D2175 /* ProposalViewController.swift */; };
B4369B1D242A1A8800156B68 /* LocalizationManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B4369B1C242A1A8800156B68 /* LocalizationManager.framework */; };
B4369B1E242A1A8800156B68 /* LocalizationManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B4369B1C242A1A8800156B68 /* LocalizationManager.framework */; };
C0D852CE215A2C390090B7C5 /* Codable+Dictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0D852CD215A2C390090B7C5 /* Codable+Dictionary.swift */; };
C0D852CF215A2C390090B7C5 /* Codable+Dictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0D852CD215A2C390090B7C5 /* Codable+Dictionary.swift */; };
C0D852D0215A2C390090B7C5 /* Codable+Dictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0D852CD215A2C390090B7C5 /* Codable+Dictionary.swift */; };
Expand Down Expand Up @@ -327,7 +327,6 @@
23BD95C222CD00DB001759CE /* AppOpenMockRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppOpenMockRepository.swift; sourceTree = "<group>"; };
29A72DEF23FFEC9600CE8483 /* LocalizationManager.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LocalizationManager.framework; path = Carthage/Build/Mac/LocalizationManager.framework; sourceTree = "<group>"; };
29A72DF223FFECD700CE8483 /* LocalizationManager.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LocalizationManager.framework; path = Carthage/Build/iOS/LocalizationManager.framework; sourceTree = "<group>"; };
29A72DF623FFECE500CE8483 /* LocalizationManager.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LocalizationManager.framework; path = Carthage/Build/tvOS/LocalizationManager.framework; sourceTree = "<group>"; };
29A72DFA23FFECED00CE8483 /* LocalizationManager.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LocalizationManager.framework; path = Carthage/Build/watchOS/LocalizationManager.framework; sourceTree = "<group>"; };
29A72DFE24000DFD00CE8483 /* LocalizationConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalizationConfig.swift; sourceTree = "<group>"; };
29D7EB5223FAB71900C622EA /* TranslationManager.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = TranslationManager.framework; path = Carthage/Build/iOS/TranslationManager.framework; sourceTree = "<group>"; };
Expand All @@ -348,7 +347,6 @@
33E222ED1FA8C5280013CCC3 /* Validation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Validation.swift; path = Classes/Model/Validation.swift; sourceTree = "<group>"; };
33E223021FA9F4EA0013CCC3 /* IPAddress.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = IPAddress.swift; path = Classes/Model/IPAddress.swift; sourceTree = "<group>"; };
33E2230A1FA9F5010013CCC3 /* Continent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Continent.swift; path = Classes/Model/Continent.swift; sourceTree = "<group>"; };
7579C77123C346CE00A05022 /* APIFeedbackManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIFeedbackManager.swift; sourceTree = "<group>"; };
82CB55491C8DEAC200389D2B /* AppOpenResponse.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AppOpenResponse.swift; path = Classes/Model/AppOpenResponse.swift; sourceTree = "<group>"; };
82CB554A1C8DEAC200389D2B /* LanguageData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LanguageData.swift; path = Classes/Model/LanguageData.swift; sourceTree = "<group>"; };
839497BE1DC21DBF007FE281 /* Country.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Country.swift; path = Classes/Model/Country.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -376,6 +374,8 @@
A83A140822F2CB5C002A7682 /* SectionKeyHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SectionKeyHelper.swift; sourceTree = "<group>"; };
A864BBEB22F31AD200CC2BFF /* LocalizationItemIdentifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalizationItemIdentifier.swift; sourceTree = "<group>"; };
A8ECFA2E22F44E2D009D2175 /* ProposalViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProposalViewController.swift; sourceTree = "<group>"; };
B4369B1B242A19DF00156B68 /* NStackSDK.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; path = NStackSDK.podspec; sourceTree = "<group>"; };
B4369B1C242A1A8800156B68 /* LocalizationManager.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LocalizationManager.framework; path = Carthage/Build/tvOS/LocalizationManager.framework; sourceTree = "<group>"; };
C0D852CD215A2C390090B7C5 /* Codable+Dictionary.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Codable+Dictionary.swift"; sourceTree = "<group>"; };
C0D852D7215A373F0090B7C5 /* Routes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Routes.swift; sourceTree = "<group>"; };
C0D852E2215A42EE0090B7C5 /* URLSession+Request.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URLSession+Request.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -426,7 +426,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
29A72DF723FFECE500CE8483 /* LocalizationManager.framework in Frameworks */,
B4369B1D242A1A8800156B68 /* LocalizationManager.framework in Frameworks */,
E3689BF91D9EBA14004620D6 /* Foundation.framework in Frameworks */,
E3689BFA1D9EBA14004620D6 /* UIKit.framework in Frameworks */,
);
Expand All @@ -437,7 +437,7 @@
buildActionMask = 2147483647;
files = (
E3689BEB1D9EB9EB004620D6 /* NStackSDK.framework in Frameworks */,
2909463824211DEF00BA254F /* LocalizationManager.framework in Frameworks */,
B4369B1E242A1A8800156B68 /* LocalizationManager.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -572,7 +572,6 @@
29A72DD023FAC8A000CE8483 /* Recovered References */ = {
isa = PBXGroup;
children = (
7579C77123C346CE00A05022 /* APIFeedbackManager.swift */,
29D7EB5223FAB71900C622EA /* TranslationManager.framework */,
);
name = "Recovered References";
Expand Down Expand Up @@ -611,8 +610,8 @@
children = (
29A72DEF23FFEC9600CE8483 /* LocalizationManager.framework */,
29A72DF223FFECD700CE8483 /* LocalizationManager.framework */,
29A72DF623FFECE500CE8483 /* LocalizationManager.framework */,
29A72DFA23FFECED00CE8483 /* LocalizationManager.framework */,
B4369B1C242A1A8800156B68 /* LocalizationManager.framework */,
83100E952333B13C00F84217 /* watchOS */,
83100E942333B13600F84217 /* macOS */,
83100E932333B13100F84217 /* tvOS */,
Expand All @@ -625,6 +624,7 @@
30A3D83D1B9DB94100C2D15C = {
isa = PBXGroup;
children = (
B4369B1B242A19DF00156B68 /* NStackSDK.podspec */,
30A3D8491B9DB94100C2D15C /* NStackSDK */,
30A3D8551B9DB94100C2D15C /* NStackSDK Tests */,
304C42851BA074CB00AE3D6F /* Frameworks */,
Expand Down Expand Up @@ -1563,7 +1563,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TVOS_DEPLOYMENT_TARGET = 9.0;
VERSIONING_SYSTEM = "apple-generic";
Expand Down Expand Up @@ -1619,7 +1619,7 @@
LD_RUNPATH_SEARCH_PATHS = "";
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TVOS_DEPLOYMENT_TARGET = 9.0;
VALIDATE_PRODUCT = YES;
Expand Down Expand Up @@ -1659,7 +1659,6 @@
STRIP_INSTALLED_PRODUCT = NO;
SUPPORTS_MACCATALYST = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand Down Expand Up @@ -1694,7 +1693,6 @@
SUPPORTS_MACCATALYST = NO;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down Expand Up @@ -1787,7 +1785,6 @@
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 10.2;
};
Expand Down Expand Up @@ -1824,7 +1821,6 @@
SKIP_INSTALL = YES;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 10.2;
};
Expand Down
8 changes: 8 additions & 0 deletions NStackSDK.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
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>
29 changes: 0 additions & 29 deletions NStackSDK/APIFeedbackManager.swift

This file was deleted.

5 changes: 5 additions & 0 deletions NStackSDK/Classes/Managers/GeographyManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import Foundation
#if os(iOS)
import UIKit
#endif
#if canImport(LocalizationManager)
import LocalizationManager
#endif
#if canImport(NLocalizationManager)
import NLocalizationManager
#endif

public class GeographyManager {

Expand Down
6 changes: 6 additions & 0 deletions NStackSDK/Classes/Model/AppOpenData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ import AppKit
#else
import UIKit
#endif
#if canImport(LocalizationManager)
import LocalizationManager
#endif
#if canImport(NLocalizationManager)
import NLocalizationManager
#endif


struct AppOpenData: Codable {
let count: Int?
Expand Down
5 changes: 5 additions & 0 deletions NStackSDK/Classes/Model/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ import AppKit
#else
import UIKit
#endif
#if canImport(LocalizationManager)
import LocalizationManager
#endif
#if canImport(NLocalizationManager)
import NLocalizationManager
#endif

public struct UpdateOptions: OptionSet {
public let rawValue: Int
Expand Down
6 changes: 6 additions & 0 deletions NStackSDK/Classes/Model/LocalizationItemProposal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ import AppKit
#else
import UIKit
#endif
#if canImport(LocalizationManager)
import LocalizationManager
#endif
#if canImport(NLocalizationManager)
import NLocalizationManager
#endif


struct LocalizationItemProposal {
let value: String
Expand Down
5 changes: 5 additions & 0 deletions NStackSDK/Classes/Model/LocalizationsResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ import AppKit
#else
import UIKit
#endif
#if canImport(LocalizationManager)
import LocalizationManager
#endif
#if canImport(NLocalizationManager)
import NLocalizationManager
#endif

public struct LocalizationsResponse: Codable {
let localization: [String: Any]
Expand Down
5 changes: 5 additions & 0 deletions NStackSDK/Classes/NStack Manager/ConnectionManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ import AppKit
#else
import UIKit
#endif
#if canImport(LocalizationManager)
import LocalizationManager
#endif
#if canImport(NLocalizationManager)
import NLocalizationManager
#endif

struct DataModel<T: Codable>: WrapperModelType {
let model: T
Expand Down
11 changes: 8 additions & 3 deletions NStackSDK/Classes/NStack Manager/LocalizationWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ import WatchKit
#elseif os(macOS)
import AppKit
#endif
#if canImport(LocalizationManager)
import LocalizationManager
#endif
#if canImport(NLocalizationManager)
import NLocalizationManager
#endif

#if os(iOS) || os(tvOS)
public typealias NStackLocalizableView = UIView
Expand Down Expand Up @@ -135,7 +140,7 @@ extension LocalizationWrapper: LocalizationWrappable {

/**
Fetches a localized string value for the `identifier` and adds that to the `component`

If a proposed value exists, use that, otherwise fetch a value from the `localizationManager`.
*/
public func localize(component: NStackLocalizable, for identifier: LocalizationItemIdentifier) {
Expand Down Expand Up @@ -187,10 +192,10 @@ extension LocalizationWrapper: LocalizationWrappable {

/**
stores proposed text value locally.

*Note:* this method does not call the NStack API for saving of the proposal - we do that first and then
come back here to store the proposal locally

- Parameter value: proposed value
- Parameter key: NStack key/identifier
*/
Expand Down
10 changes: 8 additions & 2 deletions NStackSDK/Classes/NStack Manager/NStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ import AppKit
#else
import UIKit
#endif
#if canImport(LocalizationManager)
import LocalizationManager
#endif
#if canImport(NLocalizationManager)
import NLocalizationManager
#endif


public class NStack {

Expand Down Expand Up @@ -106,7 +112,7 @@ public class NStack {
localizationUrlOverride: configuration.localizationUrlOverride,
nmeta: NMeta(environment: configuration.currentEnvironmentAPIString)
)
repository = configuration.useMock ? MockConnectionManager() : ConnectionManager(configuration: apiConfiguration)
repository = ConnectionManager(configuration: apiConfiguration)

// Observe if necessary
if configuration.updateOptions.contains(.onDidBecomeActive) {
Expand Down Expand Up @@ -174,7 +180,7 @@ public class NStack {
/// *Note:* By default, this is automatically invoked after *NStack.start()* has been called and subsequently on applicationDidBecomeActive.
/// To override this behavior, see the properties on the *configuration* struct.
///
/// - Parameter completion: This is run after the call has finished.
/// - Parameter completion: This is run after the call has finished.
/// If *error* was nil, localization strings are up-to-date.
// swiftlint:disable:next cyclomatic_complexity
public func update(_ completion: ((_ error: NStackError.Manager?) -> Void)? = nil) {
Expand Down
5 changes: 5 additions & 0 deletions NStackSDK/Classes/Repository/Repository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ import WatchKit
#elseif os(macOS)
import AppKit
#endif
#if canImport(LocalizationManager)
import LocalizationManager
#endif
#if canImport(NLocalizationManager)
import NLocalizationManager
#endif

public typealias Result<T> = Swift.Result<T, Error>

Expand Down
Loading

0 comments on commit a4b1634

Please sign in to comment.