Skip to content

Commit

Permalink
Update project for Xcode 16
Browse files Browse the repository at this point in the history
Includes:
 - Silenced "Extension declares a conformance of imported type 'CGSize'
   to imported protocol 'CustomStringConvertible'" warning;
 - Updated demo app;
 - Updated CI workflow;
 - Updated gems;
 - Updated README.
  • Loading branch information
mgutski committed Oct 10, 2024
1 parent cef3fdb commit cc41f89
Show file tree
Hide file tree
Showing 21 changed files with 158 additions and 385 deletions.
21 changes: 14 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ concurrency:
jobs:
lint:
name: Lint
runs-on: macos-13
runs-on: macos-14
env:
DEVELOPER_DIR: "/Applications/Xcode_15.0.app/Contents/Developer"
DEVELOPER_DIR: "/Applications/Xcode_16.0.app/Contents/Developer"

steps:
- name: Checkout
Expand All @@ -41,15 +41,22 @@ jobs:
tests:
name: Tests (Xcode ${{ matrix.xcode }})
needs: [lint]
runs-on: macos-13
runs-on: macos-${{ matrix.macos }}
env:
DEVELOPER_DIR: "/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer"
strategy:
matrix:
xcode:
- "14.1" # Swift 5.7
- "14.3" # Swift 5.8
- "15.0" # Swift 5.9
include:
- macos: 13
xcode: '14.1' # Swift 5.7
- macos: 13
xcode: '14.3.1' # Swift 5.8
- macos: 14
xcode: '15.0' # Swift 5.9
- macos: 14
xcode: '15.3' # Swift 5.10
- macos: 14
xcode: '16.0' # Swift 6.0

steps:
- name: Runner Overview
Expand Down
216 changes: 20 additions & 196 deletions DemoApp/DemoApp.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1330"
LastUpgradeVersion = "1600"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.220",
"green" : "0.408",
"red" : "0.992"
"blue" : "0x38",
"green" : "0x68",
"red" : "0xFC"
}
},
"idiom" : "universal"
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion DemoApp/DemoApp/DemoApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
//

import SwiftUI
import FingerprintJS

@main
struct DemoApp: App {

var body: some Scene {
WindowGroup {
FingerprintGeneratorView()
Expand Down
36 changes: 15 additions & 21 deletions DemoApp/DemoApp/FingeprintGenerator/FingerprintGeneratorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@
// Created by Petr Palata on 22.03.2022.
//

import SwiftUI
import FingerprintJS
import SwiftUI

struct FingerprintGeneratorView: View {
@ObservedObject var viewModel: FingerprintGeneratorViewModel = FingerprintGeneratorViewModel()
@State var showPrivacyPolicy: Bool = false

var body: some View {
NavigationView {
VStack(alignment: .center) {
VStack {
HStack(alignment: .center) {
Image("fingerprint")
Image("FingerprintImage")
Text("FingerprintJS")
.fontWeight(.bold)
.font(.system(size: 30))
}

Text("Generate your unique device fingerprint")
.foregroundColor(.gray)
.padding(
Expand All @@ -35,45 +35,45 @@ struct FingerprintGeneratorView: View {
)
}
.padding()

switch viewModel.state {
case .notGenerated:
VStack {
Button("Get Device Fingerprint", action: computeFingerprint)
.frame(maxWidth: .infinity)
.padding()
.background(Color.fpOrange)
.background(Color.accentColor)
.clipShape(RoundedRectangle(cornerRadius: 5))
.foregroundColor(.white)
}.padding()

case .generating:
ProgressView()
.progressViewStyle(
CircularProgressViewStyle(tint: Color.fpOrange)
CircularProgressViewStyle(tint: Color.accentColor)
)
.scaleEffect(1.3)
.padding(EdgeInsets(top: 30, leading: 0, bottom: 0, trailing: 0))

case .fingerprintReady(let tree):
VStack(alignment: .center, spacing: 20) {
FingerprintView(fingerprintTree: tree)
let detailView = FingerprintDetailView(
fingerprintTree: tree // ,
// rawInfo: viewModel.deviceInfo.debugDescription
fingerprintTree: tree // ,
// rawInfo: viewModel.deviceInfo.debugDescription
)

NavigationLink(destination: detailView) {
HStack {
Text("Show details")
Image(systemName: "arrow.right")
}.padding(Edge.Set(.leading), 18)
}

Button("Generate Again", action: computeFingerprint)
.padding()
.frame(minWidth: 0, idealWidth: .infinity, maxWidth: .infinity, alignment: .center)
.background(Color.fpOrange)
.background(Color.accentColor)
.clipShape(RoundedRectangle(cornerRadius: 5))
.foregroundColor(.white)
}
Expand All @@ -86,7 +86,7 @@ struct FingerprintGeneratorView: View {
.navigationBarHidden(false)
}.navigationViewStyle(StackNavigationViewStyle())
}

private func computeFingerprint() {
Task.init {
await viewModel.generateTree()
Expand All @@ -100,12 +100,6 @@ struct FingerprintGeneratorView_Previews: PreviewProvider {
}
}

extension Color {
static var fpOrange: Self {
return Self("FingerprintJS Orange")
}
}

extension FingerprintGeneratorState {
var largeMargin: Bool {
switch self {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,18 @@ enum FingerprintGeneratorState {
case fingerprintReady(FingerprintTree)
}

class FingerprintGeneratorViewModel: ObservableObject {
@MainActor
final class FingerprintGeneratorViewModel: ObservableObject {

private let fingerprinter = FingerprinterFactory.getInstance()

@Published var state: FingerprintGeneratorState = .notGenerated
@Published var loading: Bool = false
@Published var fingerprintTree: FingerprintTree? = nil
// @Published var deviceInfo: DeviceInfo? = nil


@Published private(set) var state: FingerprintGeneratorState = .notGenerated

func generateTree() async {
// let deviceInfoProvider = DeviceInfoProvider()
// deviceInfo = await deviceInfoProvider.getDeviceInfo()
state = .generating
fingerprintTree = await fingerprinter.getFingerprintTree()
if let fingerprintTree = fingerprintTree {
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.3) { [weak self] in
self?.state = .fingerprintReady(fingerprintTree)
}
} else {
state = .notGenerated
let fingerprintTree = await fingerprinter.getFingerprintTree()
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
self.state = .fingerprintReady(fingerprintTree)
}
}

}
6 changes: 3 additions & 3 deletions DemoApp/DemoApp/FingeprintGenerator/FingerprintView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
// Created by Petr Palata on 22.03.2022.
//

import SwiftUI
import FingerprintJS
import SwiftUI

struct FingerprintView: View {
let fingerprintTree: FingerprintTree

var body: some View {
VStack(spacing: 16) {
Text("Device Fingerprint").font(.system(size: 25))
Divider()
Text(fingerprintTree.fingerprint)
.fontWeight(.medium)
.foregroundColor(Color.fpOrange)
.foregroundColor(Color.accentColor)
}
.padding()
.background(Color.white)
Expand Down
6 changes: 3 additions & 3 deletions DemoApp/DemoApp/FingerprintDetail/InfoTreeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
// Created by Petr Palata on 20.03.2022.
//

import SwiftUI
import FingerprintJS
import SwiftUI

struct InfoTreeView: View {
let tree: FingerprintTree

var body: some View {
VStack {
if let children = tree.children {
Expand All @@ -32,7 +32,7 @@ struct InfoTreeView: View {
}
}

extension FingerprintTree: Identifiable {
extension FingerprintTree: Swift.Identifiable {
public var id: String {
return fingerprint + info.label
}
Expand Down
File renamed without changes.

This file was deleted.

14 changes: 3 additions & 11 deletions DemoApp/Podfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
platform :ios, '14.0'
use_frameworks!

target 'DemoApp' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!

pod 'FingerprintJS', '~> 1.0'

target 'DemoAppUITests' do
# Pods for testing
end

pod 'FingerprintJS', '~> 1.5'
end
14 changes: 9 additions & 5 deletions DemoApp/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
PODS:
- FingerprintJS (1.0.0)
- FingerprintJS (1.5.0):
- FingerprintJS/Core (= 1.5.0)
- FingerprintJS/Core (1.5.0):
- FingerprintJS/SystemControl
- FingerprintJS/SystemControl (1.5.0)

DEPENDENCIES:
- FingerprintJS (~> 1.0)
- FingerprintJS (~> 1.5)

SPEC REPOS:
trunk:
- FingerprintJS

SPEC CHECKSUMS:
FingerprintJS: 2c0bae1d2f1b65c3c46098edbdefca4a0e72c76d
FingerprintJS: 96410117a394cca04d0f1e2374944c8697f2cceb

PODFILE CHECKSUM: f501a0d0aaa742f83340245876e881fc1d89f6c6
PODFILE CHECKSUM: e711991b69c78b606d26a268b0e7878603d8626e

COCOAPODS: 1.11.3
COCOAPODS: 1.15.2
Loading

0 comments on commit cc41f89

Please sign in to comment.