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

Feat/stories promocode #122

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
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
10 changes: 5 additions & 5 deletions DemoApp/REES46.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@
607FACEE1AFB9204008FA782 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
defaultConfigurationName = Debug;
};
607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "REES46Demo" */ = {
isa = XCConfigurationList;
Expand All @@ -1037,7 +1037,7 @@
607FACF11AFB9204008FA782 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
defaultConfigurationName = Debug;
};
607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "REES46Tests" */ = {
isa = XCConfigurationList;
Expand All @@ -1046,7 +1046,7 @@
607FACF41AFB9204008FA782 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
defaultConfigurationName = Debug;
};
9A7A95ED25BC40E900FFA40A /* Build configuration list for PBXNativeTarget "REESNotificationContentExtension" */ = {
isa = XCConfigurationList;
Expand All @@ -1055,7 +1055,7 @@
9A7A95EC25BC40E900FFA40A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
defaultConfigurationName = Debug;
};
9A7A961525BC436D00FFA40A /* Build configuration list for PBXNativeTarget "REESNotificationServiceExtension" */ = {
isa = XCConfigurationList;
Expand All @@ -1064,7 +1064,7 @@
9A7A961725BC436D00FFA40A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
defaultConfigurationName = Debug;
};
/* End XCConfigurationList section */
};
Expand Down
150 changes: 0 additions & 150 deletions DemoApp/REES46.xcodeproj/xcshareddata/xcschemes/REES46Demo.xcscheme

This file was deleted.

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public class PromocodeBanner: UIView {
public func setView(view: UIView) {
view.frame = CGRect(x: 0, y: 0, width: frame.width, height: frame.height)
view.clipsToBounds = true
view.translatesAutoresizingMaskIntoConstraints = true
addSubview(view)
}

Expand Down
41 changes: 21 additions & 20 deletions REES46/Classes/Sdk/impl/SimplePersonalizationSDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,14 @@ class SimplePersonalizationSDK: PersonalizationSDK {

if let popup = response.popup {
DispatchQueue.main.async {
guard let parentVC = parentViewController else {
fatalError("parentViewController must not be nil")
if parentViewController == nil {
print("parentViewController is nil")
}else{
self.notificationWidget = NotificationWidget(
parentViewController: parentViewController!,
popup: popup
)
}
self.notificationWidget = NotificationWidget(
parentViewController: parentVC,
popup: popup
)
}
}

Expand Down Expand Up @@ -791,13 +792,13 @@ class SimplePersonalizationSDK: PersonalizationSDK {
} else if let resultResponse = handleKeychainInitData(initFileNamePath: initFileNamePath) {
completion(.success(resultResponse))
}

}

serialSemaphore.wait()
}


private func prepareRequestParameters() -> [String: String] {
let secondsFromGMT = TimeZone.current.secondsFromGMT()
let hours = secondsFromGMT / 3600
Expand Down Expand Up @@ -865,7 +866,7 @@ class SimplePersonalizationSDK: PersonalizationSDK {
identifier: sdkBundleId!,
instanceKeychainService: appBundleId!
),
let jsonSecret = try? JSONSerialization.jsonObject(with: keychainIpfsSecret) as? [String: Any] else {
let jsonSecret = try? JSONSerialization.jsonObject(with: keychainIpfsSecret) as? [String: Any] else {
return nil
}

Expand Down Expand Up @@ -1014,20 +1015,20 @@ class SimplePersonalizationSDK: PersonalizationSDK {

func getRequest(path: String, params: [String: String], _ isInit: Bool = false, completion: @escaping (Result<[String: Any], SdkError>) -> Void) {
let urlString = baseURL + path
#if DEBUG
#if DEBUG
print("LOG: getRequest to: \(urlString)")
#endif

#endif
var url = URLComponents(string: urlString)

var queryItems = [URLQueryItem]()
for item in params {
queryItems.append(URLQueryItem(name: item.key, value: item.value))
}

queryItems.append(URLQueryItem(name: "stream", value: stream))
url?.queryItems = queryItems

if needReInitialization {
print("Reinitialization needed. Clearing saved data...")
let convertedInitJsonFileName = self.shopId + baseInitJsonFileName
Expand All @@ -1041,7 +1042,7 @@ class SimplePersonalizationSDK: PersonalizationSDK {
print("Error deleting saved data: \(error)")
}
}

if let endUrl = url?.url {
urlSession.dataTask(with: endUrl) { result in
switch result {
Expand All @@ -1061,7 +1062,7 @@ class SimplePersonalizationSDK: PersonalizationSDK {
try self.saveDataToJsonFile(data, jsonInitFileName: convertedInitJsonFileName)
try InitService.insertKeychainDidToken(data, identifier: self.sdkBundleId!, instanceKeychainService: self.appBundleId!)
}

let json = try JSONSerialization.jsonObject(with: data)
if let jsonObject = json as? [String: Any] {
completion(.success(jsonObject))
Expand All @@ -1074,7 +1075,7 @@ class SimplePersonalizationSDK: PersonalizationSDK {
case .failure:
let networkManager = NetworkStatus.nManager
let connectionStatus = networkManager.connectionStatus

if connectionStatus == .Online {
completion(.failure(.invalidResponse))
} else if connectionStatus == .Offline {
Expand Down
Loading