Skip to content

Commit

Permalink
Merge pull request #18 from infinum/fix/update-tool-handling
Browse files Browse the repository at this point in the history
Fix/update tool handling
  • Loading branch information
jabou authored May 26, 2022
2 parents 67dc569 + 0674acd commit e62de8c
Show file tree
Hide file tree
Showing 14 changed files with 505 additions and 511 deletions.
2 changes: 1 addition & 1 deletion Example/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use_frameworks!
platform :ios, '10.0'
platform :ios, '11.0'

target 'Sentinel_Example' do
pod 'Sentinel', :path => '../'
Expand Down
6 changes: 3 additions & 3 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
Sentinel: 520de6ff6a0d15a64eba7130ba94798c5e9d8d08
Sentinel: 2805e6de525f8c38d828045aea0c3acd24ca487d

PODFILE CHECKSUM: e10a3a2088aa5a9d18babe53feee8f6ae6fbb221
PODFILE CHECKSUM: b1ea13fb80f56c4238650f0da0299d23734a6421

COCOAPODS: 1.11.0
COCOAPODS: 1.11.3
12 changes: 6 additions & 6 deletions Example/Pods/Local Podspecs/Sentinel.podspec.json

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

6 changes: 3 additions & 3 deletions Example/Pods/Manifest.lock

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

827 changes: 418 additions & 409 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions Example/Sentinel.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -474,7 +474,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand All @@ -491,7 +491,6 @@
CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = 5F5M64F878;
INFOPLIST_FILE = Sentinel/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "com.infinum.demo.Sentinel-Example";
Expand All @@ -511,7 +510,6 @@
CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = 5F5M64F878;
INFOPLIST_FILE = Sentinel/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "com.infinum.demo.Sentinel-Example";
Expand Down
7 changes: 3 additions & 4 deletions Example/Sentinel/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ private extension AppDelegate {
tools: [
UserDefaultsTool(),
baseUrlTool,
CustomLocationTool(),
// BugsnatchTool(triggerActionConfig: EmailConfig()),
// LoggieTool(),
// AnalyticsCollectorTool(),
CustomLocationTool()
// CollarTool(),
// LoggieTool()
],
preferences: optionSwitchItems
)
Expand Down
19 changes: 6 additions & 13 deletions Sentinel.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'Sentinel'
s.version = '1.0.0'
s.version = '1.1.0'
s.summary = 'Developer\'s toolbox for debugging applications'

s.description = <<-DESC
Expand All @@ -24,7 +24,7 @@ Pod::Spec.new do |s|
s.requires_arc = true
s.platform = :ios
s.swift_version = '5.0'
s.ios.deployment_target = '10.0'
s.ios.deployment_target = '11.0'
s.resource_bundles = {
'Sentinel' => ['Sentinel/Assets/**/*'],
}
Expand Down Expand Up @@ -54,22 +54,15 @@ Pod::Spec.new do |s|
s.subspec 'Loggie' do |sp|
sp.source_files = 'Sentinel/Classes/Loggie/**/*'
sp.dependency 'Sentinel/Core'
sp.dependency 'Loggie', '~> 2.2'
sp.dependency 'Loggie'
end

s.subspec 'Bugsnatch' do |sp|
sp.source_files = 'Sentinel/Classes/Bugsnatch/**/*'
s.subspec 'Collar' do |sp|
sp.source_files = 'Sentinel/Classes/Collar/**/*'
sp.dependency 'Sentinel/Core'
sp.dependency 'Bugsnatch/Core', '~> 1.0'
sp.dependency 'Collar'
end

# This won't work untill AnalyticsCollector is added to main cocapods repo
# s.subspec 'AnalyticsCollector' do |sp|
# sp.source_files = 'Sentinel/Classes/AnalyticsCollector/**/*'
# sp.dependency 'Sentinel/Core'
# pod 'AnalyticsCollector', :git => 'https://github.com/infinum/ios-analytics-collector'
# end

s.subspec 'Default' do |sp|
sp.dependency 'Sentinel/Core'
sp.dependency 'Sentinel/UserDefaults'
Expand Down
17 changes: 0 additions & 17 deletions Sentinel/Classes/AnalyticsCollector/AnalyticsCollectorTool.swift

This file was deleted.

38 changes: 0 additions & 38 deletions Sentinel/Classes/Bugsnatch/BugsnatchTool.swift

This file was deleted.

28 changes: 28 additions & 0 deletions Sentinel/Classes/Collar/CollarTool.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// CollarTool.swift
// ToolBox
//
// Created by Vlaho Poluta on 31/07/2020.
//

import UIKit
import Collar

public class CollarTool: Tool {

// MARK: - Public properties

public let name: String

// MARK: - Init

public init(name: String = "Collar") {
self.name = name
}

// MARK: - Tool

public func presentPreview(from viewController: UIViewController) {
AnalyticsCollectionManager.shared.showLogs(from: viewController)
}
}
20 changes: 20 additions & 0 deletions Sentinel/Classes/Core/Internal/SentinelTabBarController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@ import Foundation

final class SentinelTabBarController: UITabBarController {

// MARK: - Internal properties

var didPreselectAction = false

// MARK: - Lifecycle

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

setPreselectedActionIfNeeded()
}

@IBAction func close(_ sender: Any) {
Expand All @@ -28,3 +36,15 @@ extension SentinelTabBarController {
self.viewControllers = viewControllers
}
}

// MARK: - Private methods -

private extension SentinelTabBarController {

func setPreselectedActionIfNeeded() {
defer { didPreselectAction = true }
guard !didPreselectAction else { return }
// Preselect Tools tab
selectedIndex = 2
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ class SentinelTableViewController: UIViewController {
navigationItem.rightBarButtonItems = nil
}
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

if let selectedIndexPath = tableView.indexPathForSelectedRow {
tableView.deselectRow(at: selectedIndexPath, animated: true)
}
}
}

extension SentinelTableViewController: UITableViewDelegate {
Expand All @@ -49,6 +41,7 @@ extension SentinelTableViewController: UITableViewDelegate {
}

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
toolTable[indexPath].didSelect?(from: self)
}
}
Expand Down
19 changes: 14 additions & 5 deletions Sentinel/Classes/Loggie/LoggieTool.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,24 @@ import UIKit
import Loggie

public class LoggieTool: Tool {


// MARK: - Public properties

public let name: String

// MARK: - Internal properties

private let filter: ((Log) -> Bool)?

public init(filter: ((Log) -> Bool)? = nil) {
// MARK: - Init

public init(name: String = "Loggie", filter: ((Log) -> Bool)? = nil) {
self.name = name
self.filter = filter
}
public var name: String { "Loggie" }

// MARK: - Tool

public func presentPreview(from viewController: UIViewController) {
LoggieManager.shared.showLogs(from: viewController, filter: filter)
}
Expand Down

0 comments on commit e62de8c

Please sign in to comment.