Skip to content

Commit 2f2b90f

Browse files
committed
fix: address Copilot review comments
1 parent c78f9fb commit 2f2b90f

18 files changed

Lines changed: 620 additions & 554 deletions

File tree

packages/google_mlkit_barcode_scanning/ios/google_mlkit_barcode_scanning/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ let package = Package(
2424
name: "google_mlkit_barcode_scanning",
2525
dependencies: [
2626
.product(name: "MLKitBarcodeScanning", package: "google-mlkit-swiftpm"),
27-
.product(name: "google-mlkit-commons", package: "google_mlkit_commons"),
27+
.product(name: "google-mlkit-commons", package: "google-mlkit-commons"),
2828
],
2929
path: "Sources/google_mlkit_barcode_scanning"
3030
)

packages/google_mlkit_digital_ink_recognition/ios/google_mlkit_digital_ink_recognition/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ let package = Package(
1919
.target(
2020
name: "google_mlkit_digital_ink_recognition",
2121
dependencies: [
22-
.product(name: "google-mlkit-commons", package: "google_mlkit_commons")
22+
.product(name: "google-mlkit-commons", package: "google-mlkit-commons")
2323
],
2424
path: "Sources/google_mlkit_digital_ink_recognition"
2525
)

packages/google_mlkit_digital_ink_recognition/ios/google_mlkit_digital_ink_recognition/Sources/google_mlkit_digital_ink_recognition/GoogleMlKitDigitalInkRecognitionPlugin.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public class GoogleMlKitDigitalInkRecognitionPlugin: NSObject, FlutterPlugin {
8585
}
8686

8787
let recognizer: DigitalInkRecognizer
88-
if let existing = instances[uid] {
88+
if let existing = instances[uid] as? DigitalInkRecognizer {
8989
recognizer = existing
9090
} else {
9191
let options = DigitalInkRecognizerOptions(model: model)
@@ -182,9 +182,10 @@ public class GoogleMlKitDigitalInkRecognitionPlugin: NSObject, FlutterPlugin {
182182
return
183183
}
184184
let model = DigitalInkRecognitionModel(modelIdentifier: identifier)
185-
let manager = GenericModelManager()
186-
genericModelManager = manager
187-
manager.manage(model: model, call: call, result: result)
185+
if genericModelManager == nil {
186+
genericModelManager = GenericModelManager()
187+
}
188+
genericModelManager?.manage(model: model, call: call, result: result)
188189
}
189190
#endif
190191
}

packages/google_mlkit_entity_extraction/ios/google_mlkit_entity_extraction/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ let package = Package(
1919
.target(
2020
name: "google_mlkit_entity_extraction",
2121
dependencies: [
22-
.product(name: "google-mlkit-commons", package: "google_mlkit_commons")
22+
.product(name: "google-mlkit-commons", package: "google-mlkit-commons")
2323
],
2424
path: "Sources/google_mlkit_entity_extraction"
2525
)

packages/google_mlkit_entity_extraction/ios/google_mlkit_entity_extraction/Sources/google_mlkit_entity_extraction/GoogleMlKitEntityExtractionPlugin.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public class GoogleMlKitEntityExtractionPlugin: NSObject, FlutterPlugin {
6464
}
6565

6666
let entityExtractor: EntityExtractor
67-
if let existing = instances[uid] {
67+
if let existing = instances[uid] as? EntityExtractor {
6868
entityExtractor = existing
6969
} else {
7070
guard let language = args["language"] as? String else {
@@ -232,9 +232,10 @@ public class GoogleMlKitEntityExtractionPlugin: NSObject, FlutterPlugin {
232232
let modelIdentifier = EntityExtractionModelIdentifier(rawValue: modelTag)
233233
let model = EntityExtractorRemoteModel.entityExtractorRemoteModel(
234234
identifier: modelIdentifier)
235-
let manager = GenericModelManager()
236-
genericModelManager = manager
237-
manager.manage(model: model, call: call, result: result)
235+
if genericModelManager == nil {
236+
genericModelManager = GenericModelManager()
237+
}
238+
genericModelManager?.manage(model: model, call: call, result: result)
238239
}
239240
#endif
240241
}

packages/google_mlkit_face_detection/ios/google_mlkit_face_detection/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ let package = Package(
2424
name: "google_mlkit_face_detection",
2525
dependencies: [
2626
.product(name: "MLKitFaceDetection", package: "google-mlkit-swiftpm"),
27-
.product(name: "google-mlkit-commons", package: "google_mlkit_commons"),
27+
.product(name: "google-mlkit-commons", package: "google-mlkit-commons"),
2828
],
2929
path: "Sources/google_mlkit_face_detection"
3030
)

packages/google_mlkit_face_mesh_detection/ios/google_mlkit_face_mesh_detection/Package.swift

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@
33
import PackageDescription
44

55
let package = Package(
6-
name: "google-mlkit-face-mesh-detection",
7-
platforms: [
8-
.iOS("15.0")
9-
],
10-
products: [
11-
.library(
12-
name: "google-mlkit-face-mesh-detection",
13-
targets: ["google_mlkit_face_mesh_detection"])
14-
],
15-
dependencies: [
16-
.package(path: "../google_mlkit_commons")
17-
],
18-
targets: [
19-
.target(
20-
name: "google_mlkit_face_mesh_detection",
21-
dependencies: [
22-
.product(name: "google-mlkit-commons", package: "google_mlkit_commons")
23-
],
24-
path: "Sources/google_mlkit_face_mesh_detection"
25-
)
26-
]
6+
name: "google-mlkit-face-mesh-detection",
7+
platforms: [
8+
.iOS("15.0")
9+
],
10+
products: [
11+
.library(
12+
name: "google-mlkit-face-mesh-detection",
13+
targets: ["google_mlkit_face_mesh_detection"])
14+
],
15+
dependencies: [
16+
.package(path: "../google_mlkit_commons")
17+
],
18+
targets: [
19+
.target(
20+
name: "google_mlkit_face_mesh_detection",
21+
dependencies: [
22+
.product(name: "google-mlkit-commons", package: "google-mlkit-commons")
23+
],
24+
path: "Sources/google_mlkit_face_mesh_detection"
25+
)
26+
]
2727
)

packages/google_mlkit_image_labeling/ios/google_mlkit_image_labeling/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ let package = Package(
2525
dependencies: [
2626
.product(name: "MLKitImageLabeling", package: "google-mlkit-swiftpm"),
2727
.product(name: "MLKitImageLabelingCustom", package: "google-mlkit-swiftpm"),
28-
.product(name: "google-mlkit-commons", package: "google_mlkit_commons"),
28+
.product(name: "google-mlkit-commons", package: "google-mlkit-commons"),
2929
],
3030
path: "Sources/google_mlkit_image_labeling"
3131
)

0 commit comments

Comments
 (0)