Skip to content

Commit

Permalink
chore: fix fmt script and run it
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile committed Jun 27, 2024
1 parent 74a9f1f commit f58321e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 31 deletions.
38 changes: 19 additions & 19 deletions ios/Plugin/AdvertisingId.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,45 +9,45 @@ import AppTrackingTransparency
case Denied
case NotDetermined
case Restricted

func name() -> String {
switch self {
case .Authorized: return "Authorized"
case .Denied: return "Denied"
case .NotDetermined: return "Not Determined"
case .Restricted: return "Restricted"
case .Authorized: return "Authorized"
case .Denied: return "Denied"
case .NotDetermined: return "Not Determined"
case .Restricted: return "Restricted"
}
}
}
@objc public func requestTracking(completion: (@escaping (TrackingStatus)->())) -> Void {

@objc public func requestTracking(completion: (@escaping (TrackingStatus) -> Void)) {
if #available(iOS 14, *) {
ATTrackingManager.requestTrackingAuthorization { status in
switch status {
case .authorized: completion(.Authorized)
case .denied: completion(.Denied)
case .notDetermined: completion(.NotDetermined)
case .restricted: completion(.Restricted)
@unknown default: completion(.NotDetermined)
case .authorized: completion(.Authorized)
case .denied: completion(.Denied)
case .notDetermined: completion(.NotDetermined)
case .restricted: completion(.Restricted)
@unknown default: completion(.NotDetermined)
}
}
} else {
completion(.Authorized)
}
}

@objc public func getAdvertisingId() -> String {
return ASIdentifierManager.shared().advertisingIdentifier.uuidString
}

@objc public func getAdvertisingStatus() -> TrackingStatus {
if #available(iOS 14, *) {
switch ATTrackingManager.trackingAuthorizationStatus {
case .authorized: return .Authorized
case .denied: return .Denied
case .notDetermined: return .NotDetermined
case .restricted: return .Restricted
@unknown default: return .NotDetermined
case .authorized: return .Authorized
case .denied: return .Denied
case .notDetermined: return .NotDetermined
case .restricted: return .Restricted
@unknown default: return .NotDetermined
}
} else {
return .Authorized
Expand Down
4 changes: 2 additions & 2 deletions ios/Plugin/AdvertisingIdPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AdvertisingIdPlugin: CAPPlugin {
call.resolve([ "value": status.name() ])
}
}

@objc func getAdvertisingId(_ call: CAPPluginCall) {
let id = implementation.getAdvertisingId()
let status = implementation.getAdvertisingStatus()
Expand All @@ -19,7 +19,7 @@ public class AdvertisingIdPlugin: CAPPlugin {
"status": status.name()
])
}

@objc func getAdvertisingStatus(_ call: CAPPluginCall) {
let status = implementation.getAdvertisingStatus()
call.resolve([
Expand Down
9 changes: 0 additions & 9 deletions ios/PluginTests/AdvertisingIdPluginTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@ import XCTest
@testable import Plugin

class AdvertisingIdTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}

override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}

func testEcho() {
// This is an example of a functional test case for a plugin.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"verify:android": "cd android && ./gradlew clean build test && cd ..",
"verify:web": "npm run build",
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- autocorrect --format",
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
"eslint": "eslint . --ext ts",
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
"swiftlint": "node-swiftlint",
Expand Down

0 comments on commit f58321e

Please sign in to comment.