Skip to content

Commit

Permalink
Merge pull request #56 from gojek/task/merge-rename_sdk-to-main
Browse files Browse the repository at this point in the history
Task/merge rename sdk to main
  • Loading branch information
rcrahul43 authored Apr 8, 2024
2 parents 5085253 + fd85313 commit 63fb81a
Show file tree
Hide file tree
Showing 23 changed files with 922 additions and 858 deletions.
Binary file added .DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion .github/workflows/bump_pod_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
branches:
- main
- rename_sdk
types: [closed]

# Allows you to run this workflow manually from the Actions tab
Expand All @@ -25,4 +26,4 @@ jobs:
python-version: '3.9.6'

- name: version bump
run: python3 auto_version_bump.py
run: python3 auto_version_bump.py
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ playground.xcworkspace
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
Pods/
Podfile.lock
#
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace
Expand Down
4 changes: 2 additions & 2 deletions Clickstream.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = "Clickstream"
s.version = "2.0.14"
s.version = "2.0.20"
s.summary = "Real time Analytics SDK"
s.description = "Clickstream is an event agnostic, real-time data ingestion analytics SDK"

Expand All @@ -27,7 +27,7 @@ Pod::Spec.new do |s|
s.exclude_files = "Sources/ETETestSuite/**/*.swift"
s.frameworks = "UIKit", "Foundation", "CoreTelephony"
s.dependency "SwiftProtobuf", "~> 1.10"
s.dependency "ReachabilitySwift", "~> 5.0"
s.dependency "ReachabilitySwift", '>= 5.0.0'
s.dependency "GRDB.swift", "~> 6.7"

s.default_subspec = 'Core'
Expand Down
1,630 changes: 830 additions & 800 deletions Clickstream.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1320"
version = "1.3">
LastUpgradeVersion = "1530"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
Expand All @@ -26,7 +27,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class KeepAliveServiceTests: XCTestCase {
//when
sut.start {
callbackCount += 1
print(callbackCount)
}

mockQueue.asyncAfter(deadline: .now() + 4.5) {
Expand Down
4 changes: 4 additions & 0 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
9A266FAC27F6ADA9000D6C36 /* User.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A266FA927F6ADA9000D6C36 /* User.pb.swift */; };
9A266FAF27F6ADA9000D6C36 /* Device.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A266FAA27F6ADA9000D6C36 /* Device.pb.swift */; };
9A266FB227F6ADA9000D6C36 /* App.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A266FAB27F6ADA9000D6C36 /* App.pb.swift */; };
9A65B31F2B4BAEBB00730CE9 /* EventVisualizer+ClickStreamContracts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A65B31E2B4BAEBB00730CE9 /* EventVisualizer+ClickStreamContracts.swift */; };
9AA23CF3249C7589001BE490 /* AnalyticsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AA23CF2249C7589001BE490 /* AnalyticsManager.swift */; };
9AEA265024924B340018931D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AEA264F24924B340018931D /* AppDelegate.swift */; };
9AEA265724924B340018931D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9AEA265524924B340018931D /* Main.storyboard */; };
Expand All @@ -34,6 +35,7 @@
9A266FA927F6ADA9000D6C36 /* User.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = User.pb.swift; sourceTree = "<group>"; };
9A266FAA27F6ADA9000D6C36 /* Device.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Device.pb.swift; sourceTree = "<group>"; };
9A266FAB27F6ADA9000D6C36 /* App.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = App.pb.swift; sourceTree = "<group>"; };
9A65B31E2B4BAEBB00730CE9 /* EventVisualizer+ClickStreamContracts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "EventVisualizer+ClickStreamContracts.swift"; sourceTree = "<group>"; };
9AA23CF2249C7589001BE490 /* AnalyticsManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsManager.swift; sourceTree = "<group>"; };
9AEA264C24924B340018931D /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
9AEA264F24924B340018931D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -119,6 +121,7 @@
9A266FAB27F6ADA9000D6C36 /* App.pb.swift */,
9A266FAA27F6ADA9000D6C36 /* Device.pb.swift */,
9A266FA927F6ADA9000D6C36 /* User.pb.swift */,
9A65B31E2B4BAEBB00730CE9 /* EventVisualizer+ClickStreamContracts.swift */,
);
path = Contracts;
sourceTree = "<group>";
Expand Down Expand Up @@ -272,6 +275,7 @@
9AA23CF3249C7589001BE490 /* AnalyticsManager.swift in Sources */,
9A266FAF27F6ADA9000D6C36 /* Device.pb.swift in Sources */,
9AEA265024924B340018931D /* AppDelegate.swift in Sources */,
9A65B31F2B4BAEBB00730CE9 /* EventVisualizer+ClickStreamContracts.swift in Sources */,
9A266FA727F6ACFB000D6C36 /* User.proto in Sources */,
BDDC8AE129E95D4B0024ED8C /* Constants.swift in Sources */,
9A266FB227F6ADA9000D6C36 /* App.pb.swift in Sources */,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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>
8 changes: 2 additions & 6 deletions Example/Example/src/Contracts/App.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
//
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/
#if EVENT_VISUALIZER_ENABLED
import Clickstream
#endif

import Foundation
import SwiftProtobuf

Expand Down Expand Up @@ -44,9 +42,7 @@ struct App {

init() {}
}
#if EVENT_VISUALIZER_ENABLED
extension App: CollectionMapper { }
#endif

// MARK: - Code below here is support for the SwiftProtobuf runtime.

extension App: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
Expand Down
8 changes: 2 additions & 6 deletions Example/Example/src/Contracts/Device.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
//
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/
#if EVENT_VISUALIZER_ENABLED
import Clickstream
#endif

import Foundation
import SwiftProtobuf

Expand Down Expand Up @@ -53,9 +51,7 @@ struct Device {

init() {}
}
#if EVENT_VISUALIZER_ENABLED
extension Device: CollectionMapper { }
#endif

// MARK: - Code below here is support for the SwiftProtobuf runtime.

extension Device: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// EventVisualizer+ClickStreamContracts.swift
// Example
//
// Created by Abhijeet Mallick on 08/01/24.
// Copyright © 2024 Gojek. All rights reserved.
//

import Foundation
import SwiftProtobuf

#if EVENT_VISUALIZER_ENABLED
import Clickstream

extension User: CollectionMapper { }
extension Device: CollectionMapper { }
extension App: CollectionMapper { }
extension SwiftProtobuf.Google_Protobuf_Timestamp: CollectionMapper { }
#endif
8 changes: 2 additions & 6 deletions Example/Example/src/Contracts/User.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
//
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/
#if EVENT_VISUALIZER_ENABLED
import Clickstream
#endif

import Foundation
import SwiftProtobuf

Expand Down Expand Up @@ -95,9 +93,7 @@ struct User {
fileprivate var _device: Device? = nil
fileprivate var _deviceTimestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil
}
#if EVENT_VISUALIZER_ENABLED
extension User: CollectionMapper { }
#endif

// MARK: - Code below here is support for the SwiftProtobuf runtime.

extension User: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
Expand Down
2 changes: 1 addition & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ workspace 'Clickstream.xcworkspace'

def clickstream_pods
pod 'SwiftProtobuf', '~> 1.10'
pod 'ReachabilitySwift', '~> 5.0'
pod 'ReachabilitySwift', '>= 5.0.0'
pod 'GRDB.swift', '~> 6.7'
end

Expand Down
19 changes: 9 additions & 10 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
PODS:
- GRDB.swift (6.14.0):
- GRDB.swift/standard (= 6.14.0)
- GRDB.swift/standard (6.14.0)
- GRDB.swift (6.24.1):
- GRDB.swift/standard (= 6.24.1)
- GRDB.swift/standard (6.24.1)
- ReachabilitySwift (5.0.0)
- SwiftProtobuf (1.21.0)
- SwiftProtobuf (1.25.2)

DEPENDENCIES:
- GRDB.swift (~> 6.7)
- ReachabilitySwift (~> 5.0)
- ReachabilitySwift (>= 5.0.0)
- SwiftProtobuf (~> 1.10)

SPEC REPOS:
https://github.com/CocoaPods/Specs.git:
- GRDB.swift
trunk:
- ReachabilitySwift
- SwiftProtobuf

SPEC CHECKSUMS:
GRDB.swift: d31072a99e8d3d9f5410f1a938018ccb51b881e2
GRDB.swift: 136dcb5d8dddca50aae3ba7d77475f79e7232cd8
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
SwiftProtobuf: afced68785854575756db965e9da52bbf3dc45e7
SwiftProtobuf: 407a385e97fd206c4fbe880cc84123989167e0d1

PODFILE CHECKSUM: 2c97fb10dcb1fcd309b15a9c7e84ddc137998638
PODFILE CHECKSUM: f24f9da678cf7c77fd3275d27f766a88682ecadf

COCOAPODS: 1.12.1
COCOAPODS: 1.15.2
2 changes: 1 addition & 1 deletion Sources/Clickstream/Core/Data/Constants/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ enum Constants {
static var eventGuid = "meta.eventGuid"
static var guid = "guid"
static var eventTimestamp = "eventTimestamp"
static var deviceTimestamp = "_deviceTimestamp"
static var deviceTimestamp = "deviceTimestamp"
}
}
4 changes: 2 additions & 2 deletions Sources/Clickstream/NetworkManager/Core/RetryMechanism.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ final class DefaultRetryMechanism: Retryable {
self.persistence = persistence
self.keepAliveService = keepAliveService

self.observeNetworkConnectivity()
self.establishConnection()
self.observeDeviceStatus()
self.observeAppStateChanges()
self.observeNetworkConnectivity()
self.keepConnectionAlive()
}

Expand All @@ -132,7 +132,6 @@ final class DefaultRetryMechanism: Retryable {

private func observeNetworkConnectivity() {
do {
try reachability.startNotifier()
reachability.whenReachable = { [weak self] (_) in
guard let checkedSelf = self else { return }
checkedSelf.establishConnection()
Expand All @@ -141,6 +140,7 @@ final class DefaultRetryMechanism: Retryable {
guard let checkedSelf = self else { return }
checkedSelf.terminateConnection()
}
try reachability.startNotifier()
} catch {
print("Unable to start notifier")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ import Foundation
/// crashes that occur from calling resume multiple times on a timer that is
/// already resumed (noted by https://github.com/SiftScience/sift-ios/issues/52)
class RepeatingTimer {

static let shared = RepeatingTimer()

static let shared = RepeatingTimer()
var timeInterval: TimeInterval = 0

private var suspensionCount = 0

private init() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,9 @@ final class EventDetailsViewModel: EventDetailsModelInput {
(value as? Double != nil) ||
(value is NSArray) ||
/// checking if value is of enum type
Mirror(reflecting: value).displayStyle?.equals(displayCase: .enum) ?? false ? true : false
}
if let timestamp = selectedMessage?["_\(Constants.EventVisualizer.eventTimestamp)"] as? SwiftProtobuf.Google_Protobuf_Timestamp {
displayedMessage?.append(("eventTimestamp", "\(timestamp.date)"))
Mirror(reflecting: value).displayStyle?.equals(displayCase: .enum) ?? false ? true : false ||
// checking if value is of Date type for showing SwiftProtobuf.Google_Protobuf_Timestamp.Date field's value in EV details screen
(value is Date)
}
}

Expand Down
18 changes: 11 additions & 7 deletions Sources/EventVisualizer/src/EventsList/EventsListViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,22 @@ final class EventsListViewModel: EventsListViewModelInput {
var state = ""
if let message = messages[index.row] as? CollectionMapper {
if let eventGuid = message.asDictionary[Constants.EventVisualizer.eventGuid] as? String {
if let timestamp = message.asDictionary["_\(Constants.EventVisualizer.eventTimestamp)"] as? SwiftProtobuf.Google_Protobuf_Timestamp {
eventTimeStamp = "\(timestamp.date)"
} else if let timestamp = message.asDictionary["\(Constants.EventVisualizer.eventTimestamp)"] as? SwiftProtobuf.Google_Protobuf_Timestamp {
eventTimeStamp = "\(timestamp.date)"
if let timestamp = message.asDictionary["_\(Constants.EventVisualizer.eventTimestamp)"] as? Date {
eventTimeStamp = "\(timestamp)"
} else if let timestamp = message.asDictionary["\(Constants.EventVisualizer.eventTimestamp)"] as? Date {
eventTimeStamp = "\(timestamp)"
}
state = EventsHelper.shared.getState(of: eventGuid)
} else if let eventGuid = message.asDictionary["storage.\(Constants.EventVisualizer.eventGuid)"] as? String,
let timestamp = message.asDictionary["storage.\(Constants.EventVisualizer.eventTimestamp)"] as? SwiftProtobuf.Google_Protobuf_Timestamp {
eventTimeStamp = "\(timestamp.date)"
let timestamp = message.asDictionary["storage.\(Constants.EventVisualizer.eventTimestamp)"] as? Date {
eventTimeStamp = "\(timestamp)"
state = EventsHelper.shared.getState(of: eventGuid)
} else if let eventGuid = message.asDictionary["\(Constants.EventVisualizer.guid)"] as? String,
let timestamp = message.asDictionary["\(Constants.EventVisualizer.deviceTimestamp)"] as? SwiftProtobuf.Google_Protobuf_Timestamp {
let timestamp = message.asDictionary["\(Constants.EventVisualizer.deviceTimestamp)"] as? Date {
eventTimeStamp = "\(timestamp)"
state = EventsHelper.shared.getState(of: eventGuid)
} else if let eventGuid = message.asDictionary["storage.meta.storage.\(Constants.EventVisualizer.eventGID)"] as? String,
let timestamp = message.asDictionary["storage.\(Constants.EventVisualizer.eventTimestamp)"] as? SwiftProtobuf.Google_Protobuf_Timestamp {
eventTimeStamp = "\(timestamp.date)"
state = EventsHelper.shared.getState(of: eventGuid)
} else if let eventGuid = message.asDictionary["storage.meta.storage.\(Constants.EventVisualizer.eventGID)"] as? String,
Expand Down
8 changes: 8 additions & 0 deletions Sources/EventVisualizer/src/Helpers/CollectionMapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import Foundation
import SwiftProtobuf

public protocol CollectionMapper {
var asDictionary: [String: Any] { get }
Expand All @@ -20,6 +21,13 @@ public extension CollectionMapper {
guard label != "unknownFields" else { return nil }

if let dict = value as? CollectionMapper {
// Check if value is Google_Protobuf_Timestamp type and then show Date value of it.
// If you remove this check then it will show seconds and nanos value in EV details screen
// For this to work we have conformed Google_Protobuf_Timestamp with CollectionMapper
if let timestamp = value as? Google_Protobuf_Timestamp {
let label = label.replacingOccurrences(of: "_", with: "").replacingOccurrences(of: "storage.", with: "")
return (label, timestamp.date)
}
return (label, dict.asDictionary)
}
return (label, value)
Expand Down
6 changes: 3 additions & 3 deletions auto_version_bump.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os, sys
import fileinput

project_name = 'Clickstream'
podspec_file_name = 'Clickstream.podspec'
project_name = 'ClickstreamLib'
podspec_file_name = 'ClickstreamLib.podspec'

new_tag = ""
lib_command = ""
Expand All @@ -23,7 +23,7 @@ def podCommandEdit():
lib_command = 'pod lib lint --allow-warnings'
pod_push_command = 'pod trunk push ' + podspec_file_name + ' --allow-warnings'
git_add = 'git add .'
git_commit = 'git commit -m "Updating Clickstream.podspec version"'
git_commit = 'git commit -m "Updating ClickstreamLib.podspec version"'
git_push = 'git push origin main'


Expand Down

0 comments on commit 63fb81a

Please sign in to comment.