├── .ruby-version
├── Mintfile
├── GoogleDataTransport
├── GDTCCTTests
│ ├── Data
│ │ ├── message-32347456.dat
│ │ ├── message-35458880.dat
│ │ ├── message-39882816.dat
│ │ ├── message-40043840.dat
│ │ └── message-40657984.dat
│ ├── Unit
│ │ └── Helpers
│ │ │ ├── NSData+GDTCOREventDataObject.m
│ │ │ ├── NSData+GDTCOREventDataObject.h
│ │ │ ├── GDTCORMetricsTestHelpers.h
│ │ │ └── GDTCCTTestRequestParser.h
│ └── Monkey
│ │ └── GDTCCTMonkeyTest.swift
├── GDTWatchOSTestApp
│ ├── GDTWatchOSTestAppWatchKitApp
│ │ ├── Assets.xcassets
│ │ │ ├── Contents.json
│ │ │ └── AppIcon.appiconset
│ │ │ │ └── Contents.json
│ │ └── Info.plist
│ ├── GDTWatchOSTestAppWatchKitExtension
│ │ ├── Assets.xcassets
│ │ │ ├── Contents.json
│ │ │ └── Complication.complicationset
│ │ │ │ ├── Circular.imageset
│ │ │ │ └── Contents.json
│ │ │ │ ├── Modular.imageset
│ │ │ │ └── Contents.json
│ │ │ │ ├── Extra Large.imageset
│ │ │ │ └── Contents.json
│ │ │ │ ├── Graphic Bezel.imageset
│ │ │ │ └── Contents.json
│ │ │ │ ├── Graphic Corner.imageset
│ │ │ │ └── Contents.json
│ │ │ │ ├── Utilitarian.imageset
│ │ │ │ └── Contents.json
│ │ │ │ ├── Graphic Circular.imageset
│ │ │ │ └── Contents.json
│ │ │ │ ├── Graphic Large Rectangular.imageset
│ │ │ │ └── Contents.json
│ │ │ │ └── Contents.json
│ │ ├── ExtensionDelegate.swift
│ │ ├── GoogleDataTransportPrivate
│ │ │ └── Bridging-Header.h
│ │ ├── PushNotificationPayload.apns
│ │ ├── Info.plist
│ │ └── NotificationController.swift
│ └── Podfile
├── ProtoSupport
│ ├── README.md
│ ├── Protos
│ │ ├── compliance.options
│ │ ├── external_prequest_context.options
│ │ ├── external_privacy_context.options
│ │ ├── external_prequest_context.proto
│ │ ├── external_privacy_context.proto
│ │ ├── client_metrics.options
│ │ ├── compliance.proto
│ │ └── cct.options
│ └── generate_cct_protos.sh
├── GDTCCTWatchOSTestApp
│ ├── GDTCCTWatchOSCompanionTestApp
│ │ ├── Assets.xcassets
│ │ │ ├── Contents.json
│ │ │ └── AppIcon.appiconset
│ │ │ │ └── Contents.json
│ │ └── Info.plist
│ ├── GDTCCTWatchOSCompanionTestAppExtension
│ │ ├── Assets.xcassets
│ │ │ ├── Contents.json
│ │ │ └── Complication.complicationset
│ │ │ │ ├── Modular.imageset
│ │ │ │ └── Contents.json
│ │ │ │ ├── Circular.imageset
│ │ │ │ └── Contents.json
│ │ │ │ ├── Extra Large.imageset
│ │ │ │ └── Contents.json
│ │ │ │ ├── Utilitarian.imageset
│ │ │ │ └── Contents.json
│ │ │ │ ├── Graphic Bezel.imageset
│ │ │ │ └── Contents.json
│ │ │ │ ├── Graphic Circular.imageset
│ │ │ │ └── Contents.json
│ │ │ │ ├── Graphic Corner.imageset
│ │ │ │ └── Contents.json
│ │ │ │ ├── Graphic Large Rectangular.imageset
│ │ │ │ └── Contents.json
│ │ │ │ └── Contents.json
│ │ ├── ExtensionDelegate.swift
│ │ ├── PushNotificationPayload.apns
│ │ ├── NotificationController.swift
│ │ └── Info.plist
│ ├── GDTCCTiOSTestAppForCompanionWatchApp
│ │ ├── Assets.xcassets
│ │ │ ├── Contents.json
│ │ │ └── AppIcon.appiconset
│ │ │ │ └── Contents.json
│ │ ├── ViewController.swift
│ │ ├── SceneDelegate.swift
│ │ ├── AppDelegate.swift
│ │ ├── Base.lproj
│ │ │ └── LaunchScreen.storyboard
│ │ └── Info.plist
│ ├── GDTCCTWatchOSIndependentTestAppWatchKitApp
│ │ ├── Assets.xcassets
│ │ │ ├── Contents.json
│ │ │ └── AppIcon.appiconset
│ │ │ │ └── Contents.json
│ │ └── Info.plist
│ ├── GDTCCTWatchOSIndependentTestAppWatchKitExtension
│ │ ├── Assets.xcassets
│ │ │ ├── Contents.json
│ │ │ └── Complication.complicationset
│ │ │ │ ├── Modular.imageset
│ │ │ │ └── Contents.json
│ │ │ │ ├── Circular.imageset
│ │ │ │ └── Contents.json
│ │ │ │ ├── Extra Large.imageset
│ │ │ │ └── Contents.json
│ │ │ │ ├── Utilitarian.imageset
│ │ │ │ └── Contents.json
│ │ │ │ ├── Graphic Bezel.imageset
│ │ │ │ └── Contents.json
│ │ │ │ ├── Graphic Circular.imageset
│ │ │ │ └── Contents.json
│ │ │ │ ├── Graphic Corner.imageset
│ │ │ │ └── Contents.json
│ │ │ │ ├── Graphic Large Rectangular.imageset
│ │ │ │ └── Contents.json
│ │ │ │ └── Contents.json
│ │ ├── GDTCCTWatchOSIndependentTestAppWatchKitExtension.entitlements
│ │ ├── PushNotificationPayload.apns
│ │ ├── gdthelpers.swift
│ │ ├── Info.plist
│ │ ├── NotificationController.swift
│ │ └── ExtensionDelegate.swift
│ ├── Podfile
│ └── GDTCCTServiceExtension
│ │ └── Info.plist
├── GDTCORLibrary
│ ├── Internal
│ │ ├── GDTCORStorageSizeBytes.h
│ │ ├── GDTCORReachability.h
│ │ ├── GDTCOREventDropReason.h
│ │ ├── GDTCORUploader.h
│ │ └── GDTCORLifecycle.h
│ ├── Public
│ │ └── GoogleDataTransport
│ │ │ ├── GoogleDataTransport.h
│ │ │ ├── GDTCORProductData.h
│ │ │ ├── GDTCOREventDataObject.h
│ │ │ ├── GDTCOREventTransformer.h
│ │ │ ├── GDTCOREndpoints.h
│ │ │ └── GDTCORTargets.h
│ ├── GDTCORUploadBatch.m
│ ├── Private
│ │ ├── GDTCORFlatFileStorage+Promises.h
│ │ ├── GDTCOREndpoints_Private.h
│ │ ├── GDTCORReachability_Private.h
│ │ ├── GDTCOREvent_Private.h
│ │ ├── GDTCORUploadBatch.h
│ │ ├── GDTCORMetricsController.h
│ │ ├── GDTCORTransformer_Private.h
│ │ ├── GDTCORTransport_Private.h
│ │ ├── GDTCORRegistrar_Private.h
│ │ ├── GDTCORStorageMetadata.h
│ │ ├── GDTCORMetricsMetadata.h
│ │ ├── GDTCORLogSourceMetrics.h
│ │ └── GDTCORTransformer.h
│ ├── GDTCORStorageMetadata.m
│ ├── GDTCORStorageEventSelector.m
│ ├── GDTCORAssert.m
│ ├── GDTCORProductData.m
│ └── GDTCORConsoleLogger.m
├── GDTTestApp
│ ├── globals.swift
│ ├── Bridging-Header.h
│ ├── gdthelpers.swift
│ ├── app.swift
│ └── EventCleanupPerfTest.swift
├── GDTCORTests
│ ├── Common
│ │ ├── Fakes
│ │ │ ├── GDTCORUploadCoordinatorFake.m
│ │ │ ├── GDTCORTransformerFake.m
│ │ │ ├── GDTCORTransformerFake.h
│ │ │ ├── GDTCORUploadCoordinatorFake.h
│ │ │ ├── GDTCORStorageFake.h
│ │ │ ├── GDTCORTransportFake.h
│ │ │ ├── GDTCORApplicationFake.m
│ │ │ ├── GDTCORApplicationFake.h
│ │ │ ├── GDTCORMetricsControllerFake.h
│ │ │ └── GDTCORTransportFake.m
│ │ └── Categories
│ │ │ ├── GDTCORRegistrar+Testing.h
│ │ │ ├── GDTCORRegistrar+Testing.m
│ │ │ ├── GDTCORFlatFileStorage+Testing.h
│ │ │ ├── GDTCORUploadCoordinator+Testing.h
│ │ │ ├── GDTCORFlatFileStorage+Testing.m
│ │ │ └── GDTCORUploadCoordinator+Testing.m
│ ├── Lifecycle
│ │ └── Helpers
│ │ │ ├── GDTCORLifecycleTestUploader.m
│ │ │ └── GDTCORLifecycleTestUploader.h
│ ├── Unit
│ │ ├── GDTCORTestCase.h
│ │ ├── Helpers
│ │ │ ├── GDTCORTestUploader.m
│ │ │ ├── GDTCORAssertHelper.m
│ │ │ ├── GDTCORAssertHelper.h
│ │ │ ├── GDTCORDataObjectTesterClasses.m
│ │ │ ├── GDTCORTestUploader.h
│ │ │ ├── GDTCORDataObjectTesterClasses.h
│ │ │ └── GDTCOREventGenerator.h
│ │ ├── GDTCORDirectorySizeTrackerTests.m
│ │ ├── GDTCORTestCase.m
│ │ ├── GDTCORAssertTest.m
│ │ └── GDTCOREndpointsTest.m
│ ├── Monkey
│ │ └── GDTMonkeyTest.swift
│ └── Integration
│ │ ├── Helpers
│ │ └── GDTCORIntegrationTestUploader.h
│ │ └── TestServer
│ │ └── GDTCORTestServer.h
├── GDTCCTLibrary
│ ├── Private
│ │ ├── GDTCORMetrics+GDTCCTSupport.h
│ │ ├── GDTCCTURLSessionDataResponse.h
│ │ ├── GDTCOREvent+GDTMetricsSupport.h
│ │ ├── GDTCCTCompressionHelper.h
│ │ └── GDTCCTUploader.h
│ ├── GDTCCTURLSessionDataResponse.m
│ ├── Protogen
│ │ └── nanopb
│ │ │ └── external_prequest_context.nanopb.c
│ ├── GDTCOREvent+GDTMetricsSupport.m
│ └── Public
│ │ └── GDTCOREvent+GDTCCTSupport.h
├── GDTCCTTestApp
│ ├── globals.swift
│ ├── gdthelpers.swift
│ └── proto
│ │ └── flltest.proto
├── Resources
│ └── PrivacyInfo.xcprivacy
└── generate_project.sh
├── Gemfile
├── .clang-format
├── .github
├── ISSUE_TEMPLATE
│ ├── issue_report.md
│ └── config.yml
└── workflows
│ ├── spm.yml
│ └── check.yml
├── .swiftformat
├── SwiftPMTests
├── objc-import-test
│ ├── objc-module.m
│ └── objc-header.m
└── swift-test
│ └── main.swift
├── .gitignore
├── setup-scripts.sh
└── CONTRIBUTING.md
/.ruby-version:
--------------------------------------------------------------------------------
1 | ruby-2.7
2 |
--------------------------------------------------------------------------------
/Mintfile:
--------------------------------------------------------------------------------
1 | nicklockwood/SwiftFormat@0.54.0
2 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTTests/Data/message-32347456.dat:
--------------------------------------------------------------------------------
1 | r(*$
2 | "submessage21 id: 1553204839.829770*
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTTests/Data/message-35458880.dat:
--------------------------------------------------------------------------------
1 | r(*$
2 | "submessage21 id: 1553204839.830706*
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTTests/Data/message-39882816.dat:
--------------------------------------------------------------------------------
1 | r(*$
2 | "submessage21 id: 1553204839.831475*
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTTests/Data/message-40043840.dat:
--------------------------------------------------------------------------------
1 | r(*$
2 | "submessage21 id: 1553204839.831100*
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTTests/Data/message-40657984.dat:
--------------------------------------------------------------------------------
1 | r(*$
2 | "submessage21 id: 1553204839.831821*
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTWatchOSTestApp/GDTWatchOSTestAppWatchKitApp/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/ProtoSupport/README.md:
--------------------------------------------------------------------------------
1 | To build the protos:
2 | - `brew install protobuf`
3 | - Verify version in generate_cct_protos.sh
4 | - `./generate_cct_protos.sh`
5 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSCompanionTestApp/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTWatchOSTestApp/GDTWatchOSTestAppWatchKitExtension/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSCompanionTestAppExtension/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTiOSTestAppForCompanionWatchApp/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSIndependentTestAppWatchKitApp/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSIndependentTestAppWatchKitExtension/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | # To update, change version below, run bundle install, test,
2 | # commit Gemfile and Gemfile.lock.
3 | source 'https://rubygems.org'
4 |
5 | gem 'cocoapods', '1.16.2'
6 | gem 'cocoapods-generate', '2.2.5'
7 | gem 'danger', '8.4.5'
8 |
--------------------------------------------------------------------------------
/.clang-format:
--------------------------------------------------------------------------------
1 | BasedOnStyle: Google
2 | ColumnLimit: 100
3 | BinPackParameters: false
4 | AllowAllParametersOfDeclarationOnNextLine: true
5 | ObjCSpaceBeforeProtocolList: true
6 | SpacesInContainerLiterals: true
7 | PointerAlignment: Right
8 | AllowShortFunctionsOnASingleLine: None
9 | IncludeBlocks: Preserve
10 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/issue_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: 🐞 Internal Issue
3 | about: Googlers may file issues here or to track with [Firebase](https://github.com/firebase/firebase-ios-sdk/issues/new/choose)
4 | ---
5 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 | contact_links:
3 | - name: Google Data Transport
4 | url: https://github.com/firebase/firebase-ios-sdk/issues/new/choose
5 | about: Google Data Transport is not supported for direct usage. Please file with the product library that depends on Google Data Transport.
6 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSIndependentTestAppWatchKitExtension/GDTCCTWatchOSIndependentTestAppWatchKitExtension.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | aps-environment
6 | development
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.swiftformat:
--------------------------------------------------------------------------------
1 | # Formatting Options - Mimic Google style
2 | --indent 2
3 | --maxwidth 100
4 | --wrapparameters afterfirst
5 |
6 | # Disabled Rules
7 |
8 | # Too many of our swift files have simplistic examples. While technically
9 | # it's correct to remove the unused argument labels, it makes our examples
10 | # look wrong.
11 | --disable unusedArguments
12 |
13 | # We prefer trailing braces.
14 | --disable wrapMultilineStatementBraces
15 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTWatchOSTestApp/Podfile:
--------------------------------------------------------------------------------
1 | source 'https://github.com/firebase/SpecsDev.git'
2 | source 'https://github.com/firebase/SpecsStaging.git'
3 | source 'https://cdn.cocoapods.org/'
4 |
5 | use_frameworks!
6 |
7 | target 'GDTWatchOSTestAppWatchKitApp' do
8 | platform :watchos, '6.0'
9 |
10 | end
11 |
12 | target 'GDTWatchOSTestAppWatchKitExtension' do
13 | platform :watchos, '6.0'
14 |
15 | # Pods for GDTWatchOSTestAppWatchKitExtension
16 | pod 'GoogleDataTransport', :path => '../../'
17 |
18 | end
19 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTWatchOSTestApp/GDTWatchOSTestAppWatchKitExtension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTWatchOSTestApp/GDTWatchOSTestAppWatchKitExtension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSCompanionTestAppExtension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTWatchOSTestApp/GDTWatchOSTestAppWatchKitExtension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTWatchOSTestApp/GDTWatchOSTestAppWatchKitExtension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTWatchOSTestApp/GDTWatchOSTestAppWatchKitExtension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTWatchOSTestApp/GDTWatchOSTestAppWatchKitExtension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSCompanionTestAppExtension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSCompanionTestAppExtension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSCompanionTestAppExtension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTWatchOSTestApp/GDTWatchOSTestAppWatchKitExtension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/SwiftPMTests/objc-import-test/objc-module.m:
--------------------------------------------------------------------------------
1 | // Copyright 2021 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | @import GoogleDataTransport;
16 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSCompanionTestAppExtension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSCompanionTestAppExtension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSCompanionTestAppExtension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSIndependentTestAppWatchKitExtension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/ProtoSupport/Protos/compliance.options:
--------------------------------------------------------------------------------
1 | # Copyright 2023 Google LLC
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | # Options for compliance.proto
16 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSIndependentTestAppWatchKitExtension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSIndependentTestAppWatchKitExtension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSIndependentTestAppWatchKitExtension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTWatchOSTestApp/GDTWatchOSTestAppWatchKitExtension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSCompanionTestAppExtension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSIndependentTestAppWatchKitExtension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSIndependentTestAppWatchKitExtension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSIndependentTestAppWatchKitExtension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSIndependentTestAppWatchKitExtension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "watch",
5 | "scale" : "2x",
6 | "screen-width" : "<=145"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "scale" : "2x",
11 | "screen-width" : ">161"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "scale" : "2x",
16 | "screen-width" : ">145"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "scale" : "2x",
21 | "screen-width" : ">183"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/ProtoSupport/Protos/external_prequest_context.options:
--------------------------------------------------------------------------------
1 | # Copyright 2023 Google LLC
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | # Options for external_prequest_context.proto
16 |
--------------------------------------------------------------------------------
/GoogleDataTransport/ProtoSupport/Protos/external_privacy_context.options:
--------------------------------------------------------------------------------
1 | # Copyright 2023 Google LLC
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | # Options for external_privacy_context.proto
16 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # OS X
2 | .DS_Store
3 |
4 | # Xcode
5 | build/
6 | *.pbxuser
7 | !default.pbxuser
8 | *.mode1v3
9 | !default.mode1v3
10 | *.mode2v3
11 | !default.mode2v3
12 | *.perspectivev3
13 | !default.perspectivev3
14 | xcuserdata/
15 | *.xccheckout
16 | profile
17 | *.moved-aside
18 | DerivedData
19 | *.hmap
20 | *.ipa
21 |
22 | # Swift Package Manager
23 | .build
24 | Package.resolved
25 |
26 | # Mint package manager
27 | Mint
28 |
29 | # IntelliJ
30 | .idea
31 |
32 | # Vim
33 | *.swo
34 | *.swp
35 | *~
36 |
37 | # Bundler
38 | /.bundle
39 | /vendor
40 |
41 | # Pods
42 | Pods/
43 | Podfile.lock
44 | *.xcworkspace
45 |
46 | # CocoaPods generate
47 | gen/
48 |
49 | #firebase-ios-sdk clone
50 | firebase-ios-sdk/
51 |
52 | #scripts link
53 | scripts
54 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTWatchOSTestApp/GDTWatchOSTestAppWatchKitExtension/ExtensionDelegate.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import WatchKit
18 |
19 | class ExtensionDelegate: NSObject, WKExtensionDelegate {}
20 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Internal/GDTCORStorageSizeBytes.h:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #import
16 |
17 | /// The data type to represent storage size.
18 | typedef uint64_t GDTCORStorageSizeBytes;
19 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSCompanionTestAppExtension/ExtensionDelegate.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import WatchKit
18 |
19 | class ExtensionDelegate: NSObject, WKExtensionDelegate {}
20 |
--------------------------------------------------------------------------------
/GoogleDataTransport/ProtoSupport/Protos/external_prequest_context.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2023 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto2";
16 |
17 | package privacy.context.external;
18 |
19 | message ExternalPRequestContext {
20 | optional int32 origin_associated_product_id = 13;
21 | }
22 |
--------------------------------------------------------------------------------
/SwiftPMTests/objc-import-test/objc-header.m:
--------------------------------------------------------------------------------
1 | // Copyright 2021 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #import "GoogleDataTransport/GDTCORClock.h"
16 | #import "GoogleDataTransport/GDTCORTransport.h"
17 |
18 | #import
19 | #import
20 |
--------------------------------------------------------------------------------
/SwiftPMTests/swift-test/main.swift:
--------------------------------------------------------------------------------
1 | // Copyright 2021 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import Foundation
16 | import GoogleDataTransport
17 |
18 | import XCTest
19 |
20 | class importTest: XCTestCase {
21 | func testImports() throws {
22 | XCTAssertTrue(GDTCORClock.snapshot().timeMillis > 0)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/setup-scripts.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 2021 Google LLC
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an "AS IS" BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
14 | git clone \
15 | --depth 1 \
16 | --no-checkout \
17 | https://github.com/firebase/firebase-ios-sdk.git \
18 | ;
19 | cd firebase-ios-sdk
20 | git checkout main -- scripts
21 | cd ..
22 | ln -s firebase-ios-sdk/scripts scripts
23 |
24 | gem install xcpretty
25 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTWatchOSTestApp/GDTWatchOSTestAppWatchKitExtension/GoogleDataTransportPrivate/Bridging-Header.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORRegistrar.h"
18 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORUploader.h"
19 |
--------------------------------------------------------------------------------
/GoogleDataTransport/ProtoSupport/Protos/external_privacy_context.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2023 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto2";
16 |
17 | package privacy.context.external;
18 |
19 | import "external_prequest_context.proto";
20 |
21 | message ExternalPrivacyContext {
22 | optional ExternalPRequestContext prequest = 2;
23 | }
24 |
--------------------------------------------------------------------------------
/.github/workflows/spm.yml:
--------------------------------------------------------------------------------
1 | name: spm
2 |
3 | on:
4 | pull_request:
5 | schedule:
6 | # Run every day at 11pm (PST) - cron uses UTC times
7 | - cron: '0 7 * * *'
8 |
9 | concurrency:
10 | group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
11 | cancel-in-progress: true
12 |
13 | jobs:
14 | swift-build-run:
15 | runs-on: macOS-latest
16 | strategy:
17 | matrix:
18 | target: [iOS, tvOS, macOS, catalyst]
19 | steps:
20 | - uses: actions/checkout@v3
21 | - uses: ruby/setup-ruby@v1
22 | - name: Setup Scripts Directory
23 | run: ./setup-scripts.sh
24 | - name: Xcode
25 | run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
26 | - name: Initialize xcodebuild
27 | run: xcodebuild -list
28 | - name: iOS Unit Tests
29 | run: scripts/third_party/travis/retry.sh scripts/build.sh GoogleDataTransport ${{ matrix.target }} spm
30 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTTests/Unit/Helpers/NSData+GDTCOREventDataObject.m:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #import "GoogleDataTransport/GDTCCTTests/Unit/Helpers/NSData+GDTCOREventDataObject.h"
16 |
17 | @implementation NSData (GDTCOREventDataObject)
18 |
19 | - (NSData *)transportBytes {
20 | return [self copy];
21 | }
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTiOSTestAppForCompanionWatchApp/ViewController.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import UIKit
18 |
19 | class ViewController: UIViewController {
20 | override func viewDidLoad() {
21 | super.viewDidLoad()
22 | // Do any additional setup after loading the view.
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTTestApp/globals.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import Foundation
18 |
19 | public enum Globals {
20 | public static var SharedViewController: ViewController?
21 |
22 | public static let MonkeyTestLength: TimeInterval = 20.0
23 |
24 | public static let MonkeyTestLengthPlusBuffer: TimeInterval = MonkeyTestLength + 10.0
25 | }
26 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Common/Fakes/GDTCORUploadCoordinatorFake.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORTests/Common/Fakes/GDTCORUploadCoordinatorFake.h"
18 |
19 | @implementation GDTCORUploadCoordinatorFake
20 |
21 | - (void)forceUploadForTarget:(GDTCORTarget)target {
22 | self.forceUploadCalled = YES;
23 | }
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Lifecycle/Helpers/GDTCORLifecycleTestUploader.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORTests/Lifecycle/Helpers/GDTCORLifecycleTestUploader.h"
18 |
19 | @implementation GDTCORLifecycleTestUploader
20 |
21 | - (void)uploadTarget:(GDTCORTarget)target withConditions:(GDTCORUploadConditions)conditions {
22 | }
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Common/Fakes/GDTCORTransformerFake.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORTests/Common/Fakes/GDTCORTransformerFake.h"
18 |
19 | @implementation GDTCORTransformerFake
20 |
21 | - (void)transformEvent:(GDTCOREvent *)event
22 | withTransformers:(NSArray> *)transformers {
23 | }
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTTests/Unit/Helpers/NSData+GDTCOREventDataObject.h:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #import
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCOREventDataObject.h"
18 |
19 | NS_ASSUME_NONNULL_BEGIN
20 |
21 | @interface NSData (GDTCOREventDataObject)
22 |
23 | @end
24 |
25 | NS_ASSUME_NONNULL_END
26 |
--------------------------------------------------------------------------------
/GoogleDataTransport/ProtoSupport/Protos/client_metrics.options:
--------------------------------------------------------------------------------
1 | # Copyright 2022 Google LLC
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | # Options for client_metrics.proto
16 |
17 | gdt_client_metrics.ClientMetrics.log_source_metrics type:FT_POINTER
18 | gdt_client_metrics.ClientMetrics.app_namespace type:FT_POINTER
19 |
20 | gdt_client_metrics.LogSourceMetrics.log_source type:FT_POINTER
21 | gdt_client_metrics.LogSourceMetrics.log_event_dropped type:FT_POINTER
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Common/Fakes/GDTCORTransformerFake.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Private/GDTCORTransformer.h"
18 |
19 | NS_ASSUME_NONNULL_BEGIN
20 |
21 | /** A functionless fake that can be injected into classes that need it. */
22 | @interface GDTCORTransformerFake : GDTCORTransformer
23 |
24 | @end
25 |
26 | NS_ASSUME_NONNULL_END
27 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Common/Fakes/GDTCORUploadCoordinatorFake.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Private/GDTCORUploadCoordinator.h"
18 |
19 | NS_ASSUME_NONNULL_BEGIN
20 |
21 | @interface GDTCORUploadCoordinatorFake : GDTCORUploadCoordinator
22 |
23 | @property(nonatomic) BOOL forceUploadCalled;
24 |
25 | @end
26 |
27 | NS_ASSUME_NONNULL_END
28 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTTestApp/Bridging-Header.h:
--------------------------------------------------------------------------------
1 | // Copyright 2020 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORUploader.h"
16 | #import "GoogleDataTransport/GDTCORLibrary/Private/GDTCORUploadCoordinator.h"
17 | #import "GoogleDataTransport/GDTCORTests/Common/Categories/GDTCORFlatFileStorage+Testing.h"
18 |
19 | #import "GoogleDataTransport/GDTCORTests/Unit/Helpers/GDTCOREventGenerator.h"
20 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GoogleDataTransport.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GDTCORClock.h"
18 | #import "GDTCORConsoleLogger.h"
19 | #import "GDTCOREndpoints.h"
20 | #import "GDTCOREvent.h"
21 | #import "GDTCOREventDataObject.h"
22 | #import "GDTCOREventTransformer.h"
23 | #import "GDTCORProductData.h"
24 | #import "GDTCORTargets.h"
25 | #import "GDTCORTransport.h"
26 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTWatchOSTestApp/GDTWatchOSTestAppWatchKitExtension/PushNotificationPayload.apns:
--------------------------------------------------------------------------------
1 | {
2 | "aps": {
3 | "alert": {
4 | "body": "Test message",
5 | "title": "Optional title",
6 | "subtitle": "Optional subtitle"
7 | },
8 | "category": "myCategory",
9 | "thread-id": "5280"
10 | },
11 |
12 | "WatchKit Simulator Actions": [
13 | {
14 | "title": "First Button",
15 | "identifier": "firstButtonAction"
16 | }
17 | ],
18 |
19 | "customKey": "Use this file to define a testing payload for your notifications. The aps dictionary specifies the category, alert text and title. The WatchKit Simulator Actions array can provide info for one or more action buttons in addition to the standard Dismiss button. Any other top level keys are custom payload. If you have multiple such JSON files in your project, you'll be able to select them when choosing to debug the notification interface of your Watch App."
20 | }
21 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTLibrary/Private/GDTCORMetrics+GDTCCTSupport.h:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #import "GoogleDataTransport/GDTCORLibrary/Private/GDTCORMetrics.h"
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCOREventDataObject.h"
18 |
19 | NS_ASSUME_NONNULL_BEGIN
20 |
21 | @interface GDTCORMetrics (GDTCCTSupport)
22 |
23 | @end
24 |
25 | NS_ASSUME_NONNULL_END
26 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSCompanionTestAppExtension/PushNotificationPayload.apns:
--------------------------------------------------------------------------------
1 | {
2 | "aps": {
3 | "alert": {
4 | "body": "Test message",
5 | "title": "Optional title",
6 | "subtitle": "Optional subtitle"
7 | },
8 | "category": "myCategory",
9 | "thread-id": "5280"
10 | },
11 |
12 | "WatchKit Simulator Actions": [
13 | {
14 | "title": "First Button",
15 | "identifier": "firstButtonAction"
16 | }
17 | ],
18 |
19 | "customKey": "Use this file to define a testing payload for your notifications. The aps dictionary specifies the category, alert text and title. The WatchKit Simulator Actions array can provide info for one or more action buttons in addition to the standard Dismiss button. Any other top level keys are custom payload. If you have multiple such JSON files in your project, you'll be able to select them when choosing to debug the notification interface of your Watch App."
20 | }
21 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTTestApp/globals.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import Foundation
18 |
19 | public enum Globals {
20 | public static var SharedViewController: ViewController?
21 |
22 | public static var IsMonkeyTesting: Bool = false
23 |
24 | public static let MonkeyTestLength: TimeInterval = 60.0
25 |
26 | public static let MonkeyTestLengthPlusBuffer: TimeInterval = MonkeyTestLength + 10.0
27 | }
28 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSIndependentTestAppWatchKitExtension/PushNotificationPayload.apns:
--------------------------------------------------------------------------------
1 | {
2 | "aps": {
3 | "alert": {
4 | "body": "Test message",
5 | "title": "Optional title",
6 | "subtitle": "Optional subtitle"
7 | },
8 | "category": "myCategory",
9 | "thread-id": "5280"
10 | },
11 |
12 | "WatchKit Simulator Actions": [
13 | {
14 | "title": "First Button",
15 | "identifier": "firstButtonAction"
16 | }
17 | ],
18 |
19 | "customKey": "Use this file to define a testing payload for your notifications. The aps dictionary specifies the category, alert text and title. The WatchKit Simulator Actions array can provide info for one or more action buttons in addition to the standard Dismiss button. Any other top level keys are custom payload. If you have multiple such JSON files in your project, you'll be able to select them when choosing to debug the notification interface of your Watch App."
20 | }
21 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSCompanionTestAppExtension/NotificationController.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import Foundation
18 | import UserNotifications
19 | import WatchKit
20 |
21 | class NotificationController: WKUserNotificationInterfaceController {
22 | override init() {
23 | // Initialize variables here.
24 | super.init()
25 | // Configure interface objects here.
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Unit/GDTCORTestCase.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import
18 |
19 | #import "GoogleDataTransport/GDTCORTests/Unit/Helpers/GDTCORAssertHelper.h"
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | /** This class defines shared testing infrastructure across all unit tests in GoogleDataTransport.
24 | */
25 | @interface GDTCORTestCase : XCTestCase
26 |
27 | @end
28 |
29 | NS_ASSUME_NONNULL_END
30 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Unit/Helpers/GDTCORTestUploader.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORTests/Unit/Helpers/GDTCORTestUploader.h"
18 |
19 | @implementation GDTCORTestUploader
20 |
21 | - (void)uploadTarget:(GDTCORTarget)target withConditions:(GDTCORUploadConditions)conditions {
22 | if (self.uploadWithConditionsBlock) {
23 | self.uploadWithConditionsBlock(target, conditions);
24 | }
25 | }
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/GDTCORUploadBatch.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Private/GDTCORUploadBatch.h"
18 |
19 | @implementation GDTCORUploadBatch
20 |
21 | - (instancetype)initWithBatchID:(NSNumber *)batchID events:(NSSet *)events {
22 | self = [super init];
23 | if (self) {
24 | _batchID = batchID;
25 | _events = events;
26 | }
27 | return self;
28 | }
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Lifecycle/Helpers/GDTCORLifecycleTestUploader.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import
18 |
19 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORUploader.h"
20 |
21 | #import "GoogleDataTransport/GDTCORTests/Lifecycle/Helpers/GDTCORLifecycleTestUploader.h"
22 |
23 | /** An integration test uploader. */
24 | @interface GDTCORLifecycleTestUploader : NSObject
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # How to contribute
2 |
3 | We'd love to accept your patches and contributions to this project. There are
4 | just a few small guidelines you need to follow.
5 |
6 | ## Contributor License Agreement
7 |
8 | Contributions to this project must be accompanied by a Contributor License
9 | Agreement. You (or your employer) retain the copyright to your contribution,
10 | this simply gives us permission to use and redistribute your contributions as
11 | part of the project. Head over to to see
12 | your current agreements on file or to sign a new one.
13 |
14 | You generally only need to submit a CLA once, so if you've already submitted one
15 | (even if it was for a different project), you probably don't need to do it
16 | again.
17 |
18 | ## Code reviews
19 |
20 | All submissions, including submissions by project members, require review. We
21 | use GitHub pull requests for this purpose. Consult [GitHub Help] for more
22 | information on using pull requests.
23 |
24 | [GitHub Help]: https://help.github.com/articles/about-pull-requests/
25 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/Podfile:
--------------------------------------------------------------------------------
1 | use_frameworks!
2 |
3 | source 'https://github.com/firebase/SpecsDev.git'
4 | source 'https://github.com/firebase/SpecsStaging.git'
5 | source 'https://cdn.cocoapods.org/'
6 |
7 | target 'GDTCCTWatchOSIndependentTestAppWatchKitExtension' do
8 | platform :watchos, '6.0'
9 |
10 | # Pods for GDTCCTWatchOSIndependentTestAppWatchKitExtension
11 | pod 'SwiftProtobuf', '~> 1.0'
12 | pod 'GoogleDataTransport', :path => '../../'
13 | pod 'FirebaseCore'
14 | pod 'FirebaseMessaging'
15 | pod 'FirebaseStorage', '> 9.0'
16 |
17 | end
18 |
19 | target 'GDTCCTServiceExtension' do
20 | platform :watchos, '6.0'
21 |
22 | # Pods for GDTCCTServiceExtension
23 | pod 'FirebaseMessaging'
24 | pod 'SwiftProtobuf', '~> 1.0'
25 | pod 'GoogleDataTransport', :path => '../../'
26 | end
27 |
28 | target 'GDTCCTWatchOSCompanionTestAppExtension' do
29 | platform :watchos, '6.0'
30 |
31 | # Pods for GDTCCTWatchOSCompanionTestAppExtension
32 | pod 'SwiftProtobuf', '~> 1.0'
33 | pod 'GoogleDataTransport', :path => '../../'
34 |
35 | end
36 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTiOSTestAppForCompanionWatchApp/SceneDelegate.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import UIKit
18 |
19 | class SceneDelegate: UIResponder, UIWindowSceneDelegate {
20 | var window: UIWindow?
21 |
22 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession,
23 | options connectionOptions: UIScene.ConnectionOptions) {
24 | guard let _ = (scene as? UIWindowScene) else { return }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTLibrary/GDTCCTURLSessionDataResponse.m:
--------------------------------------------------------------------------------
1 | // Copyright 2024 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #import "GoogleDataTransport/GDTCCTLibrary/Private/GDTCCTURLSessionDataResponse.h"
16 |
17 | @implementation GDTCCTURLSessionDataResponse
18 |
19 | - (instancetype)initWithResponse:(NSHTTPURLResponse *)response HTTPBody:(NSData *)body {
20 | self = [super init];
21 | if (self) {
22 | _HTTPResponse = response;
23 | _HTTPBody = body;
24 | }
25 | return self;
26 | }
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/GoogleDataTransport/ProtoSupport/Protos/compliance.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2023 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto2";
16 |
17 | package gdt_cct;
18 |
19 | import "external_privacy_context.proto";
20 |
21 | message ComplianceData {
22 | optional privacy.context.external.ExternalPrivacyContext privacy_context = 1;
23 |
24 | enum ProductIdOrigin {
25 | NOT_SET = 0;
26 | EVENT_OVERRIDE = 5;
27 | }
28 |
29 | optional ProductIdOrigin product_id_origin = 2 [default = NOT_SET];
30 | }
31 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Private/GDTCORFlatFileStorage+Promises.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Private/GDTCORFlatFileStorage.h"
18 |
19 | @class FBLPromise;
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | /// The category extends `GDTCORFlatFileStorage` API with `GDTCORStoragePromiseProtocol` methods.
24 | @interface GDTCORFlatFileStorage (Promises)
25 |
26 | @end
27 |
28 | NS_ASSUME_NONNULL_END
29 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTTestApp/gdthelpers.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import GoogleDataTransport
18 |
19 | class FirelogTestMessageHolder: NSObject, GDTCOREventDataObject {
20 | public var root: FirelogTestMessage = .init()
21 |
22 | func transportBytes() -> Data {
23 | do {
24 | let data: Data? = try root.serializedData()
25 | return data!
26 | } catch {
27 | print("There was an error producing proto bytes.")
28 | return Data()
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Private/GDTCOREndpoints_Private.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCOREndpoints.h"
18 |
19 | @interface GDTCOREndpoints ()
20 |
21 | /** Returns the list of all the upload URLs used by the transport library.
22 | *
23 | * @return Map of the transport target and the URL used for uploading the events for that target.
24 | */
25 | + (NSDictionary *)uploadURLs;
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Common/Fakes/GDTCORStorageFake.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORStorageProtocol.h"
18 |
19 | NS_ASSUME_NONNULL_BEGIN
20 |
21 | /** A functionless fake that can be injected into classes that need it. */
22 | @interface GDTCORStorageFake : NSObject
23 |
24 | /// Creates an storage fake.
25 | + (instancetype)storageFake;
26 |
27 | @end
28 |
29 | NS_ASSUME_NONNULL_END
30 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTiOSTestAppForCompanionWatchApp/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import UIKit
18 |
19 | @UIApplicationMain
20 | class AppDelegate: UIResponder, UIApplicationDelegate {
21 | func application(_ application: UIApplication,
22 | didFinishLaunchingWithOptions launchOptions: [UIApplication
23 | .LaunchOptionsKey: Any]?) -> Bool {
24 | // Override point for customization after application launch.
25 | return true
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Internal/GDTCORReachability.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import
18 |
19 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORPlatform.h"
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | /** This class helps determine upload conditions by determining connectivity. */
24 | @interface GDTCORReachability : NSObject
25 |
26 | /** The current set flags indicating network conditions */
27 | + (GDTCORNetworkReachabilityFlags)currentFlags;
28 |
29 | @end
30 |
31 | NS_ASSUME_NONNULL_END
32 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Private/GDTCORReachability_Private.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORReachability.h"
18 |
19 | @interface GDTCORReachability ()
20 |
21 | /** Allows manually setting the flags for testing purposes. */
22 | @property(nonatomic, readwrite) GDTCORNetworkReachabilityFlags flags;
23 |
24 | /** Creates/returns the singleton instance of this class.
25 | *
26 | * @return The singleton instance of this class.
27 | */
28 | + (instancetype)sharedInstance;
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Common/Categories/GDTCORRegistrar+Testing.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORRegistrar.h"
18 | #import "GoogleDataTransport/GDTCORLibrary/Private/GDTCORRegistrar_Private.h"
19 |
20 | NS_ASSUME_NONNULL_BEGIN
21 |
22 | /** Testing-only methods for GDTCORRegistrar. */
23 | @interface GDTCORRegistrar (Testing)
24 |
25 | /** Resets the properties of the singleon, but does not reallocate a new singleton. */
26 | - (void)reset;
27 |
28 | @end
29 |
30 | NS_ASSUME_NONNULL_END
31 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSIndependentTestAppWatchKitExtension/gdthelpers.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import GoogleDataTransport
18 |
19 | class FirelogTestMessageHolder: NSObject, GDTCOREventDataObject {
20 | public var root: FirelogTestMessage = .init()
21 |
22 | func transportBytes() -> Data {
23 | do {
24 | let data: Data? = try root.serializedData()
25 | return data!
26 | } catch {
27 | print("There was an error producing proto bytes.")
28 | return Data()
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCORProductData.h:
--------------------------------------------------------------------------------
1 | // Copyright 2023 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #import
16 |
17 | @interface GDTCORProductData : NSObject
18 |
19 | /// The product ID.
20 | @property(nonatomic, readonly) int32_t productID;
21 |
22 | /// Initializes an instance using the given product ID.
23 | /// - Parameter productID: A 32-bit integer.
24 | - (instancetype)initWithProductID:(int32_t)productID;
25 |
26 | /// This API is unavailable.
27 | - (instancetype)init NS_UNAVAILABLE;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Unit/Helpers/GDTCORAssertHelper.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORTests/Unit/Helpers/GDTCORAssertHelper.h"
18 |
19 | @implementation GDTCORAssertHelper
20 |
21 | // The backing store for the class variable assertionBlock.
22 | static GDTCORAssertionBlock gSharedAssertionBlock;
23 |
24 | + (GDTCORAssertionBlock)assertionBlock {
25 | return gSharedAssertionBlock;
26 | }
27 |
28 | + (void)setAssertionBlock:(GDTCORAssertionBlock)assertionBlock {
29 | gSharedAssertionBlock = assertionBlock;
30 | }
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTLibrary/Private/GDTCCTURLSessionDataResponse.h:
--------------------------------------------------------------------------------
1 | // Copyright 2024 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #import
16 |
17 | NS_ASSUME_NONNULL_BEGIN
18 |
19 | /** The class represents HTTP response received from `NSURLSession`. */
20 | @interface GDTCCTURLSessionDataResponse : NSObject
21 |
22 | @property(nonatomic, readonly) NSHTTPURLResponse *HTTPResponse;
23 | @property(nonatomic, nullable, readonly) NSData *HTTPBody;
24 |
25 | - (instancetype)initWithResponse:(NSHTTPURLResponse *)response HTTPBody:(nullable NSData *)body;
26 |
27 | @end
28 |
29 | NS_ASSUME_NONNULL_END
30 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSIndependentTestAppWatchKitApp/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | $(PRODUCT_NAME)
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleVersion
22 | 1
23 | UISupportedInterfaceOrientations
24 |
25 | UIInterfaceOrientationPortrait
26 | UIInterfaceOrientationPortraitUpsideDown
27 |
28 | WKWatchKitApp
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTWatchOSTestApp/GDTWatchOSTestAppWatchKitApp/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | GDTWatchOSTestApp WatchKit App
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleVersion
22 | 1
23 | UISupportedInterfaceOrientations
24 |
25 | UIInterfaceOrientationPortrait
26 | UIInterfaceOrientationPortraitUpsideDown
27 |
28 | WKWatchKitApp
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Private/GDTCOREvent_Private.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCOREvent.h"
18 |
19 | #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCORClock.h"
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | @interface GDTCOREvent ()
24 |
25 | /** The unique ID of the event. This property is for testing only. */
26 | @property(nonatomic, readwrite) NSString *eventID;
27 |
28 | /** Generates a unique event ID. */
29 | + (NSString *)nextEventID;
30 |
31 | @end
32 |
33 | NS_ASSUME_NONNULL_END
34 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Unit/Helpers/GDTCORAssertHelper.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import
18 |
19 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORAssert.h"
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | /** Allows the setting a block to be used in the GDTCORAssert macro instead of assertion log. */
24 | @interface GDTCORAssertHelper : NSObject
25 |
26 | /** A class property that can be run instead of normal assertion logging. */
27 | @property(class, nullable, nonatomic) GDTCORAssertionBlock assertionBlock;
28 |
29 | @end
30 |
31 | NS_ASSUME_NONNULL_END
32 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTServiceExtension/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | GDTCCTServiceExtension
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleVersion
22 | 1
23 | NSExtension
24 |
25 | NSExtensionPointIdentifier
26 | com.apple.usernotifications.service
27 | NSExtensionPrincipalClass
28 | $(PRODUCT_MODULE_NAME).NotificationService
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Common/Fakes/GDTCORTransportFake.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCORTransport.h"
18 |
19 | NS_ASSUME_NONNULL_BEGIN
20 |
21 | /** A fake for GDTCORTransport that can be used in tests. */
22 | @interface GDTCORTransportFake : GDTCORTransport
23 |
24 | /** All log events that have been logged. */
25 | @property(nonatomic, readonly) NSArray *logEvents;
26 |
27 | /** All logged events are cleared from memory, resetting the fake. */
28 | - (void)reset;
29 |
30 | @end
31 |
32 | NS_ASSUME_NONNULL_END
33 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Internal/GDTCOREventDropReason.h:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #import
16 |
17 | /// The reason the event was "dropped". An event is considered "dropped" when it is no longer
18 | /// tracked by the SDK (i.e. deleted).
19 | typedef NS_ENUM(NSInteger, GDTCOREventDropReason) {
20 | GDTCOREventDropReasonUnknown = 0,
21 | GDTCOREventDropReasonMessageTooOld,
22 | GDTCOREventDropReasonStorageFull,
23 | GDTCOREventDropReasonPayloadTooBig,
24 | GDTCOREventDropReasonMaxRetriesReached,
25 | GDTCOREventDropReasonInvalidPayload,
26 | GDTCOREventDropReasonServerError
27 | };
28 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Monkey/GDTMonkeyTest.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import XCTest
18 |
19 | import GoogleDataTransport_TestApp
20 |
21 | class GDTMonkeyTest: XCTestCase {
22 | func testGDT() {
23 | let viewController: ViewController? = Globals.SharedViewController
24 | XCTAssertNotNil(viewController)
25 |
26 | let expectation: XCTestExpectation = self.expectation(description: "Runs without crashing")
27 | viewController?.beginMonkeyTest {
28 | expectation.fulfill()
29 | }
30 | waitForExpectations(timeout: Globals.MonkeyTestLengthPlusBuffer, handler: nil)
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTTests/Monkey/GDTCCTMonkeyTest.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import XCTest
18 |
19 | import GoogleDataTransport_CCTTestApp
20 |
21 | class GDTMonkeyTest: XCTestCase {
22 | func testGDTCCTAndFLL() {
23 | let viewController: ViewController? = Globals.SharedViewController
24 | XCTAssertNotNil(viewController)
25 |
26 | let expectation: XCTestExpectation = self.expectation(description: "Runs without crashing")
27 | viewController?.beginMonkeyTest {
28 | expectation.fulfill()
29 | }
30 | waitForExpectations(timeout: Globals.MonkeyTestLengthPlusBuffer, handler: nil)
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Common/Categories/GDTCORRegistrar+Testing.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORTests/Common/Categories/GDTCORRegistrar+Testing.h"
18 |
19 | #import "GoogleDataTransport/GDTCORLibrary/Private/GDTCORRegistrar_Private.h"
20 |
21 | @implementation GDTCORRegistrar (Testing)
22 |
23 | - (void)reset {
24 | // These calls occur on the queue.
25 | [self.targetToUploader removeAllObjects];
26 | [self.targetToStorage removeAllObjects];
27 | [self.targetToMetricsController removeAllObjects];
28 | dispatch_sync(self.registrarQueue, ^{
29 | });
30 | }
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Common/Fakes/GDTCORApplicationFake.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORTests/Common/Fakes/GDTCORApplicationFake.h"
18 |
19 | @implementation GDTCORApplicationFake
20 |
21 | @synthesize isRunningInBackground;
22 |
23 | - (GDTCORBackgroundIdentifier)beginBackgroundTaskWithName:(NSString *)name
24 | expirationHandler:(void (^__nullable)(void))handler {
25 | return self.beginTaskHandler(name, handler);
26 | }
27 |
28 | - (void)endBackgroundTask:(GDTCORBackgroundIdentifier)bgID {
29 | self.endTaskHandler(bgID);
30 | }
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/GoogleDataTransport/Resources/PrivacyInfo.xcprivacy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSPrivacyTracking
6 |
7 | NSPrivacyTrackingDomains
8 |
9 |
10 | NSPrivacyCollectedDataTypes
11 |
12 |
13 | NSPrivacyCollectedDataType
14 | NSPrivacyCollectedDataTypeOtherDiagnosticData
15 | NSPrivacyCollectedDataTypeLinked
16 |
17 | NSPrivacyCollectedDataTypeTracking
18 |
19 | NSPrivacyCollectedDataTypePurposes
20 |
21 | NSPrivacyCollectedDataTypePurposeAnalytics
22 |
23 |
24 |
25 | NSPrivacyAccessedAPITypes
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTTestApp/gdthelpers.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import GoogleDataTransport
18 |
19 | // For use by GDT.
20 | class TestDataObject: NSObject, GDTCOREventDataObject {
21 | func transportBytes() -> Data {
22 | return "Normally, some SDK's data object would populate this. \(Date())"
23 | .data(using: String.Encoding.utf8)!
24 | }
25 | }
26 |
27 | class TestUploader: NSObject, GDTCORUploader {
28 | func ready(toUploadTarget target: GDTCORTarget, conditions: GDTCORUploadConditions) -> Bool {
29 | return false
30 | }
31 |
32 | func uploadTarget(_ target: GDTCORTarget, with conditions: GDTCORUploadConditions) {}
33 | }
34 |
--------------------------------------------------------------------------------
/.github/workflows/check.yml:
--------------------------------------------------------------------------------
1 | name: check
2 |
3 | on:
4 | pull_request:
5 | push:
6 | branches: main
7 |
8 | concurrency:
9 | group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
10 | cancel-in-progress: true
11 |
12 | jobs:
13 | check:
14 | runs-on: macos-latest
15 | env:
16 | MINT_PATH: ${{ github.workspace }}/mint
17 | steps:
18 | - uses: actions/checkout@v3
19 |
20 | - uses: actions/setup-python@v3
21 | with:
22 | python-version: '3.10'
23 |
24 | - name: Cache Mint packages
25 | uses: actions/cache@v3
26 | with:
27 | path: ${{ env.MINT_PATH }}
28 | key: ${{ runner.os }}-mint-${{ hashFiles('**/Mintfile') }}
29 | restore-keys: ${{ runner.os }}-mint-
30 |
31 | - name: Setup Scripts Directory
32 | run: ./setup-scripts.sh
33 |
34 | - name: Setup check
35 | run: scripts/setup_check.sh
36 |
37 | - name: Style
38 | run: scripts/style.sh test-only
39 |
40 | - name: Whitespace
41 | run: scripts/check_whitespace.sh
42 |
43 | - name: Filename spaces
44 | run: scripts/check_filename_spaces.sh
45 |
46 | - name: Copyrights
47 | run: scripts/check_copyright.sh
48 |
49 | - name: Imports
50 | run: scripts/check_imports.swift
51 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCOREventDataObject.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import
18 |
19 | NS_ASSUME_NONNULL_BEGIN
20 |
21 | /** This protocol defines the common interface that event protos should implement regardless of the
22 | * underlying transport technology (protobuf, nanopb, etc).
23 | */
24 | @protocol GDTCOREventDataObject
25 |
26 | @required
27 |
28 | /** Returns the serialized proto bytes of the implementing event proto.
29 | *
30 | * @return the serialized proto bytes of the implementing event proto.
31 | */
32 | - (NSData *)transportBytes;
33 |
34 | @end
35 |
36 | NS_ASSUME_NONNULL_END
37 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Unit/Helpers/GDTCORDataObjectTesterClasses.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORTests/Unit/Helpers/GDTCORDataObjectTesterClasses.h"
18 |
19 | @implementation GDTCORDataObjectTesterSimple
20 |
21 | - (instancetype)init {
22 | self = [super init];
23 | if (self) {
24 | _aString = @"test";
25 | }
26 | return self;
27 | }
28 |
29 | - (instancetype)initWithString:(NSString *)aString {
30 | self = [super init];
31 | if (self) {
32 | _aString = aString;
33 | }
34 | return self;
35 | }
36 |
37 | - (NSData *)transportBytes {
38 | return [_aString dataUsingEncoding:NSUTF8StringEncoding];
39 | }
40 |
41 | @end
42 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTWatchOSTestApp/GDTWatchOSTestAppWatchKitExtension/Assets.xcassets/Complication.complicationset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "assets" : [
3 | {
4 | "idiom" : "watch",
5 | "filename" : "Circular.imageset",
6 | "role" : "circular"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "filename" : "Extra Large.imageset",
11 | "role" : "extra-large"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "filename" : "Graphic Bezel.imageset",
16 | "role" : "graphic-bezel"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "filename" : "Graphic Circular.imageset",
21 | "role" : "graphic-circular"
22 | },
23 | {
24 | "idiom" : "watch",
25 | "filename" : "Graphic Corner.imageset",
26 | "role" : "graphic-corner"
27 | },
28 | {
29 | "idiom" : "watch",
30 | "filename" : "Graphic Large Rectangular.imageset",
31 | "role" : "graphic-large-rectangular"
32 | },
33 | {
34 | "idiom" : "watch",
35 | "filename" : "Modular.imageset",
36 | "role" : "modular"
37 | },
38 | {
39 | "idiom" : "watch",
40 | "filename" : "Utilitarian.imageset",
41 | "role" : "utilitarian"
42 | }
43 | ],
44 | "info" : {
45 | "version" : 1,
46 | "author" : "xcode"
47 | }
48 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/generate_project.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 2018 Google
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 | #
17 |
18 | # From https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
19 |
20 | # USAGE: generate_project.sh [platform]
21 | # platform is ios, macos, or tvos
22 |
23 | platform="ios"
24 | if [[ $# -gt 0 ]]; then
25 | platform="$1"
26 | fi
27 |
28 | echo $platform
29 |
30 | readonly DIR="$(git rev-parse --show-toplevel)"
31 |
32 | "$DIR/GoogleDataTransport/ProtoSupport/generate_cct_protos.sh" || echo "Something went wrong generating protos.";
33 |
34 | GDT_TEST=1 pod gen "$DIR/GoogleDataTransport.podspec" --auto-open --local-sources=./ --gen-directory="$DIR/gen" --platforms=${platform} --clean
35 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSCompanionTestAppExtension/Assets.xcassets/Complication.complicationset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "assets" : [
3 | {
4 | "idiom" : "watch",
5 | "filename" : "Circular.imageset",
6 | "role" : "circular"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "filename" : "Extra Large.imageset",
11 | "role" : "extra-large"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "filename" : "Graphic Bezel.imageset",
16 | "role" : "graphic-bezel"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "filename" : "Graphic Circular.imageset",
21 | "role" : "graphic-circular"
22 | },
23 | {
24 | "idiom" : "watch",
25 | "filename" : "Graphic Corner.imageset",
26 | "role" : "graphic-corner"
27 | },
28 | {
29 | "idiom" : "watch",
30 | "filename" : "Graphic Large Rectangular.imageset",
31 | "role" : "graphic-large-rectangular"
32 | },
33 | {
34 | "idiom" : "watch",
35 | "filename" : "Modular.imageset",
36 | "role" : "modular"
37 | },
38 | {
39 | "idiom" : "watch",
40 | "filename" : "Utilitarian.imageset",
41 | "role" : "utilitarian"
42 | }
43 | ],
44 | "info" : {
45 | "version" : 1,
46 | "author" : "xcode"
47 | }
48 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSIndependentTestAppWatchKitExtension/Assets.xcassets/Complication.complicationset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "assets" : [
3 | {
4 | "idiom" : "watch",
5 | "filename" : "Circular.imageset",
6 | "role" : "circular"
7 | },
8 | {
9 | "idiom" : "watch",
10 | "filename" : "Extra Large.imageset",
11 | "role" : "extra-large"
12 | },
13 | {
14 | "idiom" : "watch",
15 | "filename" : "Graphic Bezel.imageset",
16 | "role" : "graphic-bezel"
17 | },
18 | {
19 | "idiom" : "watch",
20 | "filename" : "Graphic Circular.imageset",
21 | "role" : "graphic-circular"
22 | },
23 | {
24 | "idiom" : "watch",
25 | "filename" : "Graphic Corner.imageset",
26 | "role" : "graphic-corner"
27 | },
28 | {
29 | "idiom" : "watch",
30 | "filename" : "Graphic Large Rectangular.imageset",
31 | "role" : "graphic-large-rectangular"
32 | },
33 | {
34 | "idiom" : "watch",
35 | "filename" : "Modular.imageset",
36 | "role" : "modular"
37 | },
38 | {
39 | "idiom" : "watch",
40 | "filename" : "Utilitarian.imageset",
41 | "role" : "utilitarian"
42 | }
43 | ],
44 | "info" : {
45 | "version" : 1,
46 | "author" : "xcode"
47 | }
48 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSCompanionTestApp/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | GDTCCTiOSTestAppForCompanionWatchApp
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleVersion
22 | 1
23 | UISupportedInterfaceOrientations
24 |
25 | UIInterfaceOrientationPortrait
26 | UIInterfaceOrientationPortraitUpsideDown
27 |
28 | WKCompanionAppBundleIdentifier
29 | GoogleDataTransport.GDTCCTiOSTestAppForCompanionWatchApp
30 | WKWatchKitApp
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Common/Categories/GDTCORFlatFileStorage+Testing.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import
18 |
19 | #import "GoogleDataTransport/GDTCORLibrary/Private/GDTCORFlatFileStorage.h"
20 |
21 | @class GDTCORDirectorySizeTracker;
22 |
23 | NS_ASSUME_NONNULL_BEGIN
24 |
25 | /** Testing-only methods for GDTCORFlatFileStorage. */
26 | @interface GDTCORFlatFileStorage (Testing)
27 |
28 | /** Resets the properties of the singleon, but does not reallocate a new singleton. This also
29 | * doesn't remove stored files from disk.
30 | */
31 | - (void)reset;
32 |
33 | @property(nonatomic, readonly) GDTCORDirectorySizeTracker *sizeTracker;
34 |
35 | @end
36 |
37 | NS_ASSUME_NONNULL_END
38 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Common/Categories/GDTCORUploadCoordinator+Testing.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Private/GDTCORUploadCoordinator.h"
18 |
19 | NS_ASSUME_NONNULL_BEGIN
20 |
21 | @interface GDTCORUploadCoordinator (Testing)
22 |
23 | /** Resets the properties of the singleton, but does not reallocate a new singleton. */
24 | - (void)reset;
25 |
26 | /** The time interval, in nanoseconds, that the time should be called on. */
27 | @property(nonatomic, readwrite) uint64_t timerInterval;
28 |
29 | /** The time interval, in nanoseconds, that should be given as leeway to the timer callbacks. */
30 | @property(nonatomic, readwrite) uint64_t timerLeeway;
31 |
32 | @end
33 |
34 | NS_ASSUME_NONNULL_END
35 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Unit/GDTCORDirectorySizeTrackerTests.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import
18 |
19 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORDirectorySizeTracker.h"
20 |
21 | @interface GDTCORDirectorySizeTrackerTests : XCTestCase
22 |
23 | @end
24 |
25 | @implementation GDTCORDirectorySizeTrackerTests
26 |
27 | - (void)testDirectoryContentSizeDoesNotCrashWhenDirectoryPathContainsWhitespaces {
28 | NSString *pathWithSpaces = [NSTemporaryDirectory() stringByAppendingPathComponent:@"some dir"];
29 | GDTCORDirectorySizeTracker *tracker =
30 | [[GDTCORDirectorySizeTracker alloc] initWithDirectoryPath:pathWithSpaces];
31 |
32 | XCTAssertNoThrow([tracker directoryContentSize]);
33 | }
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCOREventTransformer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import
18 |
19 | @class GDTCOREvent;
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | /** Defines the API that event transformers must adopt. */
24 | @protocol GDTCOREventTransformer
25 |
26 | @required
27 |
28 | /** Transforms an event by applying some logic to it. Events returned can be nil, for example, in
29 | * instances where the event should be sampled.
30 | *
31 | * @param event The event to transform.
32 | * @return A transformed event, or nil if the transformation dropped the event.
33 | */
34 | - (nullable GDTCOREvent *)transformGDTEvent:(GDTCOREvent *)event;
35 |
36 | @end
37 |
38 | NS_ASSUME_NONNULL_END
39 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Private/GDTCORUploadBatch.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import
18 |
19 | @class GDTCOREvent;
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | /// A data object representing a batch of events scheduled for upload.
24 | @interface GDTCORUploadBatch : NSObject
25 |
26 | /// An ID used to identify the batch in the storage.
27 | @property(nonatomic, readonly) NSNumber *batchID;
28 |
29 | /// The collection of the events in the batch.
30 | @property(nonatomic, readonly) NSSet *events;
31 |
32 | /// The default initializer. See also docs for the corresponding properties.
33 | - (instancetype)initWithBatchID:(NSNumber *)batchID events:(NSSet *)events;
34 |
35 | @end
36 |
37 | NS_ASSUME_NONNULL_END
38 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Common/Fakes/GDTCORApplicationFake.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import
18 |
19 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORPlatform.h"
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | typedef GDTCORBackgroundIdentifier (^GDTCORFakeBeginBackgroundTaskHandler)(
24 | NSString *name, dispatch_block_t handler);
25 | typedef void (^GDTCORFakeEndBackgroundTaskHandler)(GDTCORBackgroundIdentifier);
26 |
27 | @interface GDTCORApplicationFake : NSObject
28 |
29 | @property(nonatomic, copy, nullable) GDTCORFakeBeginBackgroundTaskHandler beginTaskHandler;
30 | @property(nonatomic, copy, nullable) GDTCORFakeEndBackgroundTaskHandler endTaskHandler;
31 |
32 | @end
33 |
34 | NS_ASSUME_NONNULL_END
35 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Unit/Helpers/GDTCORTestUploader.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import
18 |
19 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORUploader.h"
20 |
21 | @class GDTCORUploadPackage;
22 |
23 | NS_ASSUME_NONNULL_BEGIN
24 |
25 | /** This class implements a backend uploader protocol for testing purposes, providing APIs to allow
26 | * tests to alter the uploader behavior without creating a bunch of specialized classes.
27 | */
28 | @interface GDTCORTestUploader : NSObject
29 |
30 | /** A block that can be ran in -uploadPackage:. */
31 | @property(nullable, nonatomic) void (^uploadWithConditionsBlock)
32 | (GDTCORTarget target, GDTCORUploadConditions conditions);
33 |
34 | @end
35 |
36 | NS_ASSUME_NONNULL_END
37 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTLibrary/Private/GDTCOREvent+GDTMetricsSupport.h:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #import
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCOREvent.h"
18 |
19 | #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCORTargets.h"
20 |
21 | @class GDTCORMetrics;
22 |
23 | NS_ASSUME_NONNULL_BEGIN
24 |
25 | @interface GDTCOREvent (GDTMetricsSupport)
26 |
27 | /// Creates and returns an event for the given target with the given metrics.
28 | /// @param metrics The metrics to set at the event's data.
29 | /// @param target The backend target that the event corresponds to.
30 | + (GDTCOREvent *)eventWithMetrics:(GDTCORMetrics *)metrics forTarget:(GDTCORTarget)target;
31 |
32 | @end
33 |
34 | NS_ASSUME_NONNULL_END
35 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSCompanionTestAppExtension/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | $(PRODUCT_NAME)
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleVersion
22 | 1
23 | NSExtension
24 |
25 | NSExtensionAttributes
26 |
27 | WKAppBundleIdentifier
28 | GoogleDataTransport.GDTCCTiOSTestAppForCompanionWatchApp.watchkitapp
29 |
30 | NSExtensionPointIdentifier
31 | com.apple.watchkit
32 |
33 | WKExtensionDelegateClassName
34 | $(PRODUCT_MODULE_NAME).ExtensionDelegate
35 |
36 |
37 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCOREndpoints.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import
18 | #import "GDTCORTargets.h"
19 |
20 | NS_ASSUME_NONNULL_BEGIN
21 |
22 | /* Class that manages the endpoints used by Google data transport library. */
23 | @interface GDTCOREndpoints : NSObject
24 |
25 | - (instancetype)init NS_UNAVAILABLE;
26 |
27 | /** Returns the upload URL for a target specified. If the target is not available, returns nil.
28 | *
29 | * @param target GoogleDataTransport target for which the upload URL is being looked up for.
30 | * @return URL that will be used for uploading the events for the provided target.
31 | */
32 | + (nullable NSURL *)uploadURLForTarget:(GDTCORTarget)target;
33 |
34 | @end
35 |
36 | NS_ASSUME_NONNULL_END
37 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Private/GDTCORMetricsController.h:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #import
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORMetricsControllerProtocol.h"
18 |
19 | @protocol GDTCORStoragePromiseProtocol;
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | @interface GDTCORMetricsController : NSObject
24 |
25 | /// Returns the event metrics controller singleton.
26 | + (instancetype)sharedInstance;
27 |
28 | /// Designated initializer.
29 | /// @param storage The storage object to read and write metrics data from.
30 | - (instancetype)initWithStorage:(id)storage NS_DESIGNATED_INITIALIZER;
31 |
32 | /// This API is unavailable.
33 | - (instancetype)init NS_UNAVAILABLE;
34 |
35 | @end
36 |
37 | NS_ASSUME_NONNULL_END
38 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Unit/Helpers/GDTCORDataObjectTesterClasses.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import
18 |
19 | #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCOREventDataObject.h"
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | /** A class to represent a simple data object proto. */
24 | @interface GDTCORDataObjectTesterSimple : NSObject
25 |
26 | /** A string that will be turned into bytes. */
27 | @property(nonatomic) NSString *aString;
28 |
29 | /** Initializes an instance using the given string.
30 | *
31 | * @param aString A string whose UTF8 encoded bytes will be used for -transportBytes.
32 | * @return An instance of this class.
33 | */
34 | - (instancetype)initWithString:(NSString *)aString;
35 |
36 | @end
37 |
38 | NS_ASSUME_NONNULL_END
39 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTWatchOSTestApp/GDTWatchOSTestAppWatchKitExtension/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | GDTWatchOSTestApp WatchKit Extension
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleVersion
22 | 1
23 | NSExtension
24 |
25 | NSExtensionAttributes
26 |
27 | WKAppBundleIdentifier
28 | GoogleDataTransport.GDTWatchOSTestApp.watchkitapp
29 |
30 | NSExtensionPointIdentifier
31 | com.apple.watchkit
32 |
33 | WKExtensionDelegateClassName
34 | $(PRODUCT_MODULE_NAME).ExtensionDelegate
35 | WKWatchOnly
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/external_prequest_context.nanopb.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /* Automatically generated nanopb constant definitions */
18 | /* Generated by nanopb-0.3.9.9 */
19 |
20 | #include "GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/external_prequest_context.nanopb.h"
21 |
22 | /* @@protoc_insertion_point(includes) */
23 | #if PB_PROTO_HEADER_VERSION != 30
24 | #error Regenerate this file with the current version of nanopb generator.
25 | #endif
26 |
27 |
28 |
29 | const pb_field_t privacy_context_external_ExternalPRequestContext_fields[2] = {
30 | PB_FIELD( 13, INT32 , OPTIONAL, STATIC , FIRST, privacy_context_external_ExternalPRequestContext, origin_associated_product_id, origin_associated_product_id, 0),
31 | PB_LAST_FIELD
32 | };
33 |
34 |
35 | /* @@protoc_insertion_point(eof) */
36 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Private/GDTCORTransformer_Private.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Private/GDTCORTransformer.h"
18 |
19 | @protocol GDTCORApplicationProtocol;
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | @interface GDTCORTransformer ()
24 |
25 | /** The queue on which all work will occur. */
26 | @property(nonatomic) dispatch_queue_t eventWritingQueue;
27 |
28 | /** The application instance that is used to begin/end background tasks. */
29 | @property(nonatomic, readonly) id application;
30 |
31 | /** The internal initializer. Should be used in tests only to create an instance with a
32 | * particular(fake) application instance. */
33 | - (instancetype)initWithApplication:(id)application;
34 |
35 | @end
36 |
37 | NS_ASSUME_NONNULL_END
38 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Unit/GDTCORTestCase.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORTests/Unit/GDTCORTestCase.h"
18 |
19 | #import "GoogleDataTransport/GDTCORTests/Common/Categories/GDTCORFlatFileStorage+Testing.h"
20 | #import "GoogleDataTransport/GDTCORTests/Common/Categories/GDTCORUploadCoordinator+Testing.h"
21 |
22 | #import "GoogleDataTransport/GDTCORLibrary/Private/GDTCORReachability_Private.h"
23 |
24 | @implementation GDTCORTestCase
25 |
26 | - (void)setUp {
27 | [GDTCORReachability sharedInstance].flags = kSCNetworkReachabilityFlagsReachable;
28 | [[GDTCORUploadCoordinator sharedInstance] stopTimer];
29 | [[GDTCORUploadCoordinator sharedInstance] reset];
30 | [[GDTCORFlatFileStorage sharedInstance] reset];
31 | }
32 |
33 | - (void)tearDown {
34 | [GDTCORAssertHelper setAssertionBlock:nil];
35 | }
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTTestApp/proto/flltest.proto:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | // This proto should rarely, if ever, need to be updated. If the need for a
18 | // regenerate is needed, do the following:
19 | // brew install protobuf swift-protobuf
20 | // cd
21 | // protoc --swift_out=. GoogleDataTransportCCTSupport/GDTCCTTestApp/proto/flltest.proto
22 |
23 | syntax = "proto3";
24 |
25 | message FirelogTestMessage {
26 |
27 | string identifier = 1;
28 |
29 | SubMessageOne sub_message = 14;
30 |
31 | repeated string repeated_id = 15;
32 |
33 | int32 warrior_championships = 16;
34 | }
35 |
36 | message SubMessageOne {
37 |
38 | repeated SubMessageTwo repeated_sub_message = 5;
39 |
40 | bool ignore_this_message = 6;
41 |
42 | bytes star_trek_data = 7;
43 | }
44 |
45 | message SubMessageTwo {
46 |
47 | double sampling_percentage = 5;
48 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/GDTCORStorageMetadata.m:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #import
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Private/GDTCORStorageMetadata.h"
18 |
19 | @implementation GDTCORStorageMetadata
20 |
21 | - (instancetype)initWithCurrentCacheSize:(GDTCORStorageSizeBytes)currentCacheSize
22 | maxCacheSize:(GDTCORStorageSizeBytes)maxCacheSize {
23 | self = [super init];
24 | if (self) {
25 | _currentCacheSize = currentCacheSize;
26 | _maxCacheSize = maxCacheSize;
27 | }
28 | return self;
29 | }
30 |
31 | + (instancetype)metadataWithCurrentCacheSize:(GDTCORStorageSizeBytes)currentCacheSize
32 | maxCacheSize:(GDTCORStorageSizeBytes)maxCacheSize {
33 | return [[self alloc] initWithCurrentCacheSize:currentCacheSize maxCacheSize:maxCacheSize];
34 | }
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Integration/Helpers/GDTCORIntegrationTestUploader.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import
18 |
19 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORUploader.h"
20 |
21 | @class GDTCORTestServer;
22 |
23 | /** An integration test uploader. */
24 | @interface GDTCORIntegrationTestUploader : NSObject
25 |
26 | /** Instantiates an instance of this uploader with the given server URL.
27 | *
28 | * @param serverURL The server URL this uploader should upload to.
29 | * @return An instance of this class.
30 | */
31 | - (instancetype)initWithServer:(GDTCORTestServer *)serverURL;
32 |
33 | /** Spins runloop until upload finishes or timeout.
34 | * @return YES if upload finishes, NO in the case of timeout.
35 | */
36 | - (BOOL)waitForUploadFinishedWithTimeout:(NSTimeInterval)timeout;
37 |
38 | @end
39 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSIndependentTestAppWatchKitExtension/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | FirebaseAppDelegateProxyEnabled
6 |
7 | CFBundleDevelopmentRegion
8 | $(DEVELOPMENT_LANGUAGE)
9 | CFBundleDisplayName
10 | $(PRODUCT_NAME)
11 | CFBundleExecutable
12 | $(EXECUTABLE_NAME)
13 | CFBundleIdentifier
14 | $(PRODUCT_BUNDLE_IDENTIFIER)
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | $(PRODUCT_NAME)
19 | CFBundlePackageType
20 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleVersion
24 | 1
25 | NSExtension
26 |
27 | NSExtensionAttributes
28 |
29 | WKAppBundleIdentifier
30 | com.google.firebase.extensions.dev.WatchKitApp
31 |
32 | NSExtensionPointIdentifier
33 | com.apple.watchkit
34 |
35 | WKExtensionDelegateClassName
36 | $(PRODUCT_MODULE_NAME).ExtensionDelegate
37 | WKWatchOnly
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTLibrary/Private/GDTCCTCompressionHelper.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import
18 |
19 | NS_ASSUME_NONNULL_BEGIN
20 |
21 | /** A class with methods to help with gzipped data. */
22 | @interface GDTCCTCompressionHelper : NSObject
23 |
24 | /** Compresses the given data and returns a new data object.
25 | *
26 | * @note Reduced version from GULNSData+zlib.m of GoogleUtilities.
27 | * @return Compressed data, or nil if there was an error.
28 | */
29 | + (nullable NSData *)gzippedData:(NSData *)data;
30 |
31 | /** Returns YES if the data looks like it was gzip compressed by checking for the gzip magic number.
32 | *
33 | * @note: From https://en.wikipedia.org/wiki/Gzip, gzip's magic number is 1f 8b.
34 | * @return YES if the data appears gzipped, NO otherwise.
35 | */
36 | + (BOOL)isGzipped:(NSData *)data;
37 |
38 | @end
39 |
40 | NS_ASSUME_NONNULL_END
41 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Private/GDTCORTransport_Private.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCORTransport.h"
18 |
19 | @class GDTCORTransformer;
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | @interface GDTCORTransport ()
24 |
25 | /** The mapping identifier that the target backend will use to map the transport bytes to proto. */
26 | @property(nonatomic) NSString *mappingID;
27 |
28 | /** The transformers that will operate on events sent by this transport. */
29 | @property(nonatomic) NSArray> *transformers;
30 |
31 | /** The target backend of this transport. */
32 | @property(nonatomic) NSInteger target;
33 |
34 | /** The transformer instance to used to transform events. Allows injecting a fake during testing. */
35 | @property(nonatomic) GDTCORTransformer *transformerInstance;
36 |
37 | @end
38 |
39 | NS_ASSUME_NONNULL_END
40 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/GDTCORStorageEventSelector.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORStorageEventSelector.h"
18 |
19 | @implementation GDTCORStorageEventSelector
20 |
21 | + (instancetype)eventSelectorForTarget:(GDTCORTarget)target {
22 | return [[self alloc] initWithTarget:target eventIDs:nil mappingIDs:nil qosTiers:nil];
23 | }
24 |
25 | - (instancetype)initWithTarget:(GDTCORTarget)target
26 | eventIDs:(nullable NSSet *)eventIDs
27 | mappingIDs:(nullable NSSet *)mappingIDs
28 | qosTiers:(nullable NSSet *)qosTiers {
29 | self = [super init];
30 | if (self) {
31 | _selectedTarget = target;
32 | _selectedEventIDs = eventIDs;
33 | _selectedMappingIDs = mappingIDs;
34 | _selectedQosTiers = qosTiers;
35 | }
36 | return self;
37 | }
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Unit/GDTCORAssertTest.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #undef NS_BLOCK_ASSERTIONS
18 |
19 | #import
20 |
21 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORAssert.h"
22 |
23 | @interface GDTCORAssertNotBlockedTest : XCTestCase
24 |
25 | @end
26 |
27 | @implementation GDTCORAssertNotBlockedTest
28 |
29 | /** Tests that asserting is innocuous and doesn't throw. */
30 | - (void)testNonFatallyAssertingDoesntThrow {
31 | GDTCORAssert(NO, @"test assertion");
32 | }
33 |
34 | /** Tests that fatally asserting throws. */
35 | - (void)testFatallyAssertingThrows {
36 | void (^assertionBlock)(void) = ^{
37 | GDTCORFatalAssert(NO, @"test assertion")
38 | };
39 | void (^assertionBlock2)(void) = ^{
40 | GDTCORFatalAssert(NO, @"%@", @"test assertion with a format");
41 | };
42 | XCTAssertThrows(assertionBlock());
43 | XCTAssertThrows(assertionBlock2());
44 | }
45 | @end
46 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Private/GDTCORRegistrar_Private.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORRegistrar.h"
18 |
19 | @interface GDTCORRegistrar ()
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | /** The concurrent queue on which all registration occurs. */
24 | @property(nonatomic, readonly) dispatch_queue_t registrarQueue;
25 |
26 | /** A map of targets to backend implementations. */
27 | @property(atomic, readonly) NSMutableDictionary> *targetToUploader;
28 |
29 | /** A map of targets to storage instances. */
30 | @property(atomic, readonly)
31 | NSMutableDictionary> *targetToStorage;
32 |
33 | /** A map of targets to metrics controller instances. */
34 | @property(atomic, readonly)
35 | NSMutableDictionary> *targetToMetricsController;
36 |
37 | @end
38 |
39 | NS_ASSUME_NONNULL_END
40 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCORTargets.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import
18 |
19 | /** The list of targets supported by the shared transport infrastructure.
20 | * These targets map to a specific backend designed to accept GDT payloads. If
21 | * adding a new target, please use the previous value +1.
22 | */
23 | typedef NS_ENUM(NSInteger, GDTCORTarget) {
24 |
25 | /** Target used for testing purposes. */
26 | kGDTCORTargetTest = 999,
27 |
28 | /** Target used by internal clients. See go/firelog for more information. */
29 | kGDTCORTargetCCT = 1000,
30 |
31 | /** Target mapping to the Firelog backend. See go/firelog for more information. */
32 | kGDTCORTargetFLL = 1001,
33 |
34 | /** Special-purpose Crashlytics target. Please do not use it without permission. */
35 | kGDTCORTargetCSH = 1002,
36 |
37 | /** Target used for integration testing. */
38 | kGDTCORTargetINT = 1003,
39 | };
40 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTLibrary/Private/GDTCCTUploader.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import
18 |
19 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORUploader.h"
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | /** Class capable of uploading events to the CCT backend. */
24 | @interface GDTCCTUploader : NSObject
25 |
26 | /** Creates and/or returns the singleton instance of this class.
27 | *
28 | * @return The singleton instance of this class.
29 | */
30 | + (instancetype)sharedInstance;
31 |
32 | #if GDT_TEST
33 | /** An upload URL used across all targets. For testing only. */
34 | @property(class, nullable, nonatomic) NSURL *testServerURL;
35 |
36 | /** Spins runloop until upload finishes or timeout.
37 | * @return YES if upload finishes, NO in the case of timeout.
38 | */
39 | - (BOOL)waitForUploadFinishedWithTimeout:(NSTimeInterval)timeout;
40 |
41 | #endif // GDT_TEST
42 |
43 | @end
44 |
45 | NS_ASSUME_NONNULL_END
46 |
--------------------------------------------------------------------------------
/GoogleDataTransport/ProtoSupport/Protos/cct.options:
--------------------------------------------------------------------------------
1 | # Copyright 2019 Google
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 |
16 | # Options for cct.proto
17 |
18 | gdt_cct.IosClientInfo.os_major_version type:FT_POINTER
19 | gdt_cct.IosClientInfo.os_full_version type:FT_POINTER
20 | gdt_cct.IosClientInfo.application_build type:FT_POINTER
21 | gdt_cct.IosClientInfo.country type:FT_POINTER
22 | gdt_cct.IosClientInfo.model type:FT_POINTER
23 | gdt_cct.IosClientInfo.language_code type:FT_POINTER
24 | gdt_cct.IosClientInfo.application_bundle_id type:FT_POINTER
25 |
26 | gdt_cct.MacClientInfo.os_major_version type:FT_POINTER
27 | gdt_cct.MacClientInfo.os_full_version type:FT_POINTER
28 | gdt_cct.MacClientInfo.application_build type:FT_POINTER
29 | gdt_cct.MacClientInfo.application_bundle_id type:FT_POINTER
30 |
31 | gdt_cct.LogRequest.log_event type:FT_POINTER
32 |
33 | gdt_cct.BatchedLogRequest.log_request type:FT_POINTER
34 |
35 | gdt_cct.QosTiersOverride.qos_tier_configuration type:FT_POINTER
36 |
37 | gdt_cct.LogEvent.source_extension type:FT_POINTER
38 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTLibrary/GDTCOREvent+GDTMetricsSupport.m:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #import "GoogleDataTransport/GDTCCTLibrary/Private/GDTCOREvent+GDTMetricsSupport.h"
16 |
17 | #import "GoogleDataTransport/GDTCCTLibrary/Private/GDTCORMetrics+GDTCCTSupport.h"
18 | #import "GoogleDataTransport/GDTCORLibrary/Private/GDTCORMetrics.h"
19 |
20 | /// The mapping ID that represents the `LogSource` for GDT metrics.
21 | static NSString *const kMetricEventMappingID = @"1710";
22 |
23 | @implementation GDTCOREvent (GDTMetricsSupport)
24 |
25 | + (GDTCOREvent *)eventWithMetrics:(GDTCORMetrics *)metrics forTarget:(GDTCORTarget)target {
26 | GDTCOREvent *metricsEvent = [[GDTCOREvent alloc] initWithMappingID:kMetricEventMappingID
27 | target:target];
28 | metricsEvent.dataObject = metrics;
29 |
30 | return metricsEvent;
31 | }
32 |
33 | @end
34 |
35 | /// Stub used to force the linker to include the categories in this file.
36 | void GDTCCTInclude_GDTCOREvent_GDTMetricsSupport_Category(void) {
37 | }
38 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/GDTCORAssert.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORAssert.h"
18 |
19 | GDTCORAssertionBlock GDTCORAssertionBlockToRunInstead(void) {
20 | // This class is only compiled in by unit tests, and this should fail quickly in optimized builds.
21 | Class GDTCORAssertClass = NSClassFromString(@"GDTCORAssertHelper");
22 | if (__builtin_expect(!!GDTCORAssertClass, 0)) {
23 | SEL assertionBlockSEL = NSSelectorFromString(@"assertionBlock");
24 | if (assertionBlockSEL) {
25 | IMP assertionBlockIMP = [GDTCORAssertClass methodForSelector:assertionBlockSEL];
26 | if (assertionBlockIMP) {
27 | GDTCORAssertionBlock assertionBlock =
28 | ((GDTCORAssertionBlock (*)(id, SEL))assertionBlockIMP)(GDTCORAssertClass,
29 | assertionBlockSEL);
30 | if (assertionBlock) {
31 | return assertionBlock;
32 | }
33 | }
34 | }
35 | }
36 | return NULL;
37 | }
38 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTWatchOSTestApp/GDTWatchOSTestAppWatchKitExtension/NotificationController.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import Foundation
18 | import UserNotifications
19 | import WatchKit
20 |
21 | class NotificationController: WKUserNotificationInterfaceController {
22 | override init() {
23 | // Initialize variables here.
24 | super.init()
25 |
26 | // Configure interface objects here.
27 | }
28 |
29 | override func willActivate() {
30 | // This method is called when watch view controller is about to be visible to user
31 | super.willActivate()
32 | }
33 |
34 | override func didDeactivate() {
35 | // This method is called when watch view controller is no longer visible
36 | super.didDeactivate()
37 | }
38 |
39 | override func didReceive(_ notification: UNNotification) {
40 | // This method is called when a notification needs to be presented.
41 | // Implement it if you use a dynamic notification interface.
42 | // Populate your dynamic notification interface as quickly as possible.
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Common/Categories/GDTCORFlatFileStorage+Testing.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORTests/Common/Categories/GDTCORFlatFileStorage+Testing.h"
18 |
19 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORDirectorySizeTracker.h"
20 |
21 | @implementation GDTCORFlatFileStorage (Testing)
22 |
23 | // Defined privately.
24 | @dynamic sizeTracker;
25 |
26 | - (void)reset {
27 | dispatch_sync(self.storageQueue, ^{
28 | [[NSFileManager defaultManager] removeItemAtPath:GDTCORRootDirectory().path error:nil];
29 | [[GDTCORFlatFileStorage sharedInstance].sizeTracker resetCachedSize];
30 | });
31 |
32 | dispatch_semaphore_t sema = dispatch_semaphore_create(0);
33 | [[GDTCORFlatFileStorage sharedInstance] storageSizeWithCallback:^(uint64_t storageSize) {
34 | NSAssert(storageSize == 0, @"Storage should contain nothing after a reset");
35 | dispatch_semaphore_signal(sema);
36 | }];
37 | dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
38 | [GDTCORFlatFileStorage load];
39 | }
40 |
41 | @end
42 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSIndependentTestAppWatchKitExtension/NotificationController.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import Foundation
18 | import UserNotifications
19 | import WatchKit
20 |
21 | class NotificationController: WKUserNotificationInterfaceController {
22 | override init() {
23 | // Initialize variables here.
24 | super.init()
25 |
26 | // Configure interface objects here.
27 | }
28 |
29 | override func willActivate() {
30 | // This method is called when watch view controller is about to be visible to user
31 | super.willActivate()
32 | }
33 |
34 | override func didDeactivate() {
35 | // This method is called when watch view controller is no longer visible
36 | super.didDeactivate()
37 | }
38 |
39 | override func didReceive(_ notification: UNNotification) {
40 | // This method is called when a notification needs to be presented.
41 | // Implement it if you use a dynamic notification interface.
42 | // Populate your dynamic notification interface as quickly as possible.
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Unit/Helpers/GDTCOREventGenerator.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | #import
17 |
18 | #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCOREvent.h"
19 | #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCORTargets.h"
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | @interface GDTCOREventGenerator : NSObject
24 |
25 | /** Generates 3 stored events with consecutive clock snapshots.
26 | *
27 | * @return A set of 3 generated stored events.
28 | */
29 | + (NSMutableSet *)generate3Events;
30 |
31 | /** Generates an event with the given params, or random ones if none are given.
32 | *
33 | * @param target The target to generate an event for.
34 | * @param qosTier The qosTier of the event, or nil for a random one.
35 | * @param mappingID The mappingID of the event, or nil for a random one.
36 | * @return A newly generated event.
37 | */
38 | + (GDTCOREvent *)generateEventForTarget:(GDTCORTarget)target
39 | qosTier:(nullable NSNumber *)qosTier
40 | mappingID:(nullable NSString *)mappingID;
41 |
42 | @end
43 |
44 | NS_ASSUME_NONNULL_END
45 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSIndependentTestAppWatchKitExtension/ExtensionDelegate.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import WatchKit
18 |
19 | import FirebaseCore
20 | import FirebaseMessaging
21 |
22 | class ExtensionDelegate: NSObject, WKExtensionDelegate, MessagingDelegate {
23 | func applicationDidFinishLaunching() {
24 | // Perform any final initialization of your application.
25 | FirebaseApp.configure()
26 | let center = UNUserNotificationCenter.current()
27 | center.requestAuthorization(options: [.alert, .sound]) { granted, error in
28 | if granted {
29 | WKExtension.shared().registerForRemoteNotifications()
30 | }
31 | }
32 | Messaging.messaging().delegate = self
33 | }
34 |
35 | // MessagingDelegate
36 | func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
37 | print("token:\n" + (fcmToken ?? "Missing token"))
38 | }
39 |
40 | // WKExtensionDelegate
41 | func didRegisterForRemoteNotifications(withDeviceToken deviceToken: Data) {
42 | // Swizzling should be disabled in Messaging for watchOS, set APNS token manually.
43 | Messaging.messaging().apnsToken = deviceToken
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Common/Categories/GDTCORUploadCoordinator+Testing.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORTests/Common/Categories/GDTCORUploadCoordinator+Testing.h"
18 |
19 | #import
20 |
21 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORRegistrar.h"
22 | #import "GoogleDataTransport/GDTCORLibrary/Private/GDTCORFlatFileStorage.h"
23 |
24 | @implementation GDTCORUploadCoordinator (Testing)
25 |
26 | - (void)reset {
27 | dispatch_sync(self.coordinationQueue, ^{
28 | self.registrar = [GDTCORRegistrar sharedInstance];
29 | });
30 | }
31 |
32 | - (void)setTimerInterval:(uint64_t)timerInterval {
33 | [self setValue:@(timerInterval) forKey:@"_timerInterval"];
34 |
35 | dispatch_source_t timer = self.timer;
36 | if (timer) {
37 | dispatch_source_set_timer(timer, DISPATCH_TIME_NOW, timerInterval, self.timerLeeway);
38 | }
39 | }
40 |
41 | - (void)setTimerLeeway:(uint64_t)timerLeeway {
42 | [self setValue:@(timerLeeway) forKey:@"_timerLeeway"];
43 |
44 | dispatch_source_t timer = self.timer;
45 | if (timer) {
46 | dispatch_source_set_timer(timer, DISPATCH_TIME_NOW, self.timerInterval, timerLeeway);
47 | }
48 | }
49 |
50 | @end
51 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTiOSTestAppForCompanionWatchApp/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Common/Fakes/GDTCORMetricsControllerFake.h:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #import
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCOREventDropReason.h"
18 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORMetricsControllerProtocol.h"
19 | #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCORTargets.h"
20 |
21 | @class FBLPromise;
22 | @class GDTCOREvent;
23 | @class GDTCORMetrics;
24 |
25 | NS_ASSUME_NONNULL_BEGIN
26 |
27 | @interface GDTCORMetricsControllerFake : NSObject
28 |
29 | @property(nonatomic, copy, nullable) void (^onLogEventsDroppedHandler)
30 | (GDTCOREventDropReason reason, NSSet *events);
31 |
32 | @property(nonatomic, copy, nullable) FBLPromise * (^onGetAndResetMetricsHandler)
33 | (void);
34 |
35 | @property(nonatomic, copy, nullable) void (^onOfferMetricsHandler)(GDTCORMetrics *metrics);
36 |
37 | @property(nonatomic, copy, nullable) void (^onStorageDidDropEvent)(GDTCOREvent *event);
38 |
39 | @property(nonatomic, copy, nullable) void (^onStorageDidRemoveExpiredEvents)
40 | (NSSet *events);
41 |
42 | @end
43 |
44 | NS_ASSUME_NONNULL_END
45 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Private/GDTCORStorageMetadata.h:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #import
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORStorageSizeBytes.h"
18 |
19 | NS_ASSUME_NONNULL_BEGIN
20 |
21 | /// A model object that contains metadata about the current state of the SDK's storage container.
22 | @interface GDTCORStorageMetadata : NSObject
23 |
24 | /// The number of bytes the event cache is consuming in storage.
25 | @property(nonatomic, readonly) GDTCORStorageSizeBytes currentCacheSize;
26 |
27 | /// The maximum number of bytes that the event cache may consume in storage.
28 | @property(nonatomic, readonly) GDTCORStorageSizeBytes maxCacheSize;
29 |
30 | /// Creates a storage metadata object with the provided information.
31 | /// @param currentCacheSize The current number of bytes the event cache is consuming.
32 | /// @param maxCacheSize The current maximum capacity (in bytes) that the event cache may consume.
33 | + (instancetype)metadataWithCurrentCacheSize:(GDTCORStorageSizeBytes)currentCacheSize
34 | maxCacheSize:(GDTCORStorageSizeBytes)maxCacheSize;
35 |
36 | /// This API is unavailable.
37 | - (instancetype)init NS_UNAVAILABLE;
38 |
39 | @end
40 |
41 | NS_ASSUME_NONNULL_END
42 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Integration/TestServer/GDTCORTestServer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import
18 |
19 | #import
20 | #import
21 | #import
22 |
23 | NS_ASSUME_NONNULL_BEGIN
24 |
25 | @class GCDWebServerRequest;
26 | @class GCDWebServerResponse;
27 |
28 | /** This class provides a hermetic test service that runs on the test device/simulator. */
29 | @interface GDTCORTestServer : NSObject
30 |
31 | /** The URL of the server. */
32 | @property(nonatomic, readonly) NSURL *serverURL;
33 |
34 | /** Just before responding, this block will be scheduled to run on a global queue. */
35 | @property(nonatomic, copy, nullable) void (^responseCompletedBlock)
36 | (GCDWebServerRequest *request, GCDWebServerResponse *response);
37 |
38 | /** Registers the paths used for testing. */
39 | - (void)registerTestPaths;
40 |
41 | /** Starts the server. Can be called after calling `-stop`. */
42 | - (void)start;
43 |
44 | /** Stops the server. */
45 | - (void)stop;
46 |
47 | /** Returns YES if the server is running, NO otherwise.
48 | *
49 | * @return YES if the server is running, NO otherwise.
50 | */
51 | - (BOOL)isRunning;
52 |
53 | @end
54 |
55 | NS_ASSUME_NONNULL_END
56 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTTests/Unit/Helpers/GDTCORMetricsTestHelpers.h:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #import
16 | #import
17 |
18 | #include "GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/client_metrics.nanopb.h"
19 |
20 | @class GDTCORMetrics;
21 |
22 | NS_ASSUME_NONNULL_BEGIN
23 |
24 | /// A test utility class that provides helpers when working with ``GDTCORMetrics`` instances.
25 | @interface GDTCORMetricsTestHelpers : NSObject
26 |
27 | /// Creates and returns ``GDTCORMetrics`` instance with randomly generated dropped event counters
28 | /// and storage metadata.
29 | + (GDTCORMetrics *)metricsWithGeneratedDroppedEventCounters;
30 |
31 | /// Creates and returns ``GDTCORMetrics`` instance with empty dropped event counters.
32 | + (GDTCORMetrics *)metricsWithEmptyDroppedEventCounters;
33 |
34 | /// Converts the given proto to a metrics object and then uses ``XCTAssertEqualObjects`` to assert
35 | /// that the reconstructed metrics object equals the given metrics object.
36 | /// @param metrics A given metrics object to compare.
37 | /// @param metricsProto The given proto to reconstruct a metrics object with for comparison.
38 | + (void)assertMetrics:(GDTCORMetrics *)metrics
39 | correspondToProto:(gdt_client_metrics_ClientMetrics)metricsProto;
40 |
41 | @end
42 |
43 | NS_ASSUME_NONNULL_END
44 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Common/Fakes/GDTCORTransportFake.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORTests/Common/Fakes/GDTCORTransportFake.h"
18 |
19 | @interface GDTCORTransportFake ()
20 |
21 | /**
22 | * Internal array that stores all log events that have been logged.
23 | * All access to this array is protected by @synchronized.
24 | */
25 | @property(nonatomic, readonly) NSMutableArray *events;
26 |
27 | @end
28 |
29 | @implementation GDTCORTransportFake
30 |
31 | - (instancetype)initWithMappingID:(NSString *)mappingID
32 | transformers:(nullable NSArray> *)transformers
33 | target:(GDTCORTarget)target {
34 | self = [super initWithMappingID:mappingID transformers:transformers target:target];
35 |
36 | if (self) {
37 | _events = [NSMutableArray array];
38 | }
39 | return self;
40 | }
41 |
42 | - (void)sendDataEvent:(GDTCOREvent *)event {
43 | @synchronized(self.events) {
44 | [self.events addObject:event];
45 | }
46 | }
47 |
48 | - (NSArray *)logEvents {
49 | @synchronized(self.events) {
50 | return [self.events copy];
51 | }
52 | }
53 |
54 | - (void)reset {
55 | @synchronized(self.events) {
56 | [self.events removeAllObjects];
57 | }
58 | }
59 |
60 | @end
61 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTWatchOSTestApp/GDTWatchOSTestAppWatchKitApp/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "24x24",
5 | "idiom" : "watch",
6 | "scale" : "2x",
7 | "role" : "notificationCenter",
8 | "subtype" : "38mm"
9 | },
10 | {
11 | "size" : "27.5x27.5",
12 | "idiom" : "watch",
13 | "scale" : "2x",
14 | "role" : "notificationCenter",
15 | "subtype" : "42mm"
16 | },
17 | {
18 | "size" : "29x29",
19 | "idiom" : "watch",
20 | "role" : "companionSettings",
21 | "scale" : "2x"
22 | },
23 | {
24 | "size" : "29x29",
25 | "idiom" : "watch",
26 | "role" : "companionSettings",
27 | "scale" : "3x"
28 | },
29 | {
30 | "size" : "40x40",
31 | "idiom" : "watch",
32 | "scale" : "2x",
33 | "role" : "appLauncher",
34 | "subtype" : "38mm"
35 | },
36 | {
37 | "size" : "44x44",
38 | "idiom" : "watch",
39 | "scale" : "2x",
40 | "role" : "appLauncher",
41 | "subtype" : "40mm"
42 | },
43 | {
44 | "size" : "50x50",
45 | "idiom" : "watch",
46 | "scale" : "2x",
47 | "role" : "appLauncher",
48 | "subtype" : "44mm"
49 | },
50 | {
51 | "size" : "86x86",
52 | "idiom" : "watch",
53 | "scale" : "2x",
54 | "role" : "quickLook",
55 | "subtype" : "38mm"
56 | },
57 | {
58 | "size" : "98x98",
59 | "idiom" : "watch",
60 | "scale" : "2x",
61 | "role" : "quickLook",
62 | "subtype" : "42mm"
63 | },
64 | {
65 | "size" : "108x108",
66 | "idiom" : "watch",
67 | "scale" : "2x",
68 | "role" : "quickLook",
69 | "subtype" : "44mm"
70 | },
71 | {
72 | "idiom" : "watch-marketing",
73 | "size" : "1024x1024",
74 | "scale" : "1x"
75 | }
76 | ],
77 | "info" : {
78 | "version" : 1,
79 | "author" : "xcode"
80 | }
81 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSCompanionTestApp/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "24x24",
5 | "idiom" : "watch",
6 | "scale" : "2x",
7 | "role" : "notificationCenter",
8 | "subtype" : "38mm"
9 | },
10 | {
11 | "size" : "27.5x27.5",
12 | "idiom" : "watch",
13 | "scale" : "2x",
14 | "role" : "notificationCenter",
15 | "subtype" : "42mm"
16 | },
17 | {
18 | "size" : "29x29",
19 | "idiom" : "watch",
20 | "role" : "companionSettings",
21 | "scale" : "2x"
22 | },
23 | {
24 | "size" : "29x29",
25 | "idiom" : "watch",
26 | "role" : "companionSettings",
27 | "scale" : "3x"
28 | },
29 | {
30 | "size" : "40x40",
31 | "idiom" : "watch",
32 | "scale" : "2x",
33 | "role" : "appLauncher",
34 | "subtype" : "38mm"
35 | },
36 | {
37 | "size" : "44x44",
38 | "idiom" : "watch",
39 | "scale" : "2x",
40 | "role" : "appLauncher",
41 | "subtype" : "40mm"
42 | },
43 | {
44 | "size" : "50x50",
45 | "idiom" : "watch",
46 | "scale" : "2x",
47 | "role" : "appLauncher",
48 | "subtype" : "44mm"
49 | },
50 | {
51 | "size" : "86x86",
52 | "idiom" : "watch",
53 | "scale" : "2x",
54 | "role" : "quickLook",
55 | "subtype" : "38mm"
56 | },
57 | {
58 | "size" : "98x98",
59 | "idiom" : "watch",
60 | "scale" : "2x",
61 | "role" : "quickLook",
62 | "subtype" : "42mm"
63 | },
64 | {
65 | "size" : "108x108",
66 | "idiom" : "watch",
67 | "scale" : "2x",
68 | "role" : "quickLook",
69 | "subtype" : "44mm"
70 | },
71 | {
72 | "idiom" : "watch-marketing",
73 | "size" : "1024x1024",
74 | "scale" : "1x"
75 | }
76 | ],
77 | "info" : {
78 | "version" : 1,
79 | "author" : "xcode"
80 | }
81 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSIndependentTestAppWatchKitApp/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "24x24",
5 | "idiom" : "watch",
6 | "scale" : "2x",
7 | "role" : "notificationCenter",
8 | "subtype" : "38mm"
9 | },
10 | {
11 | "size" : "27.5x27.5",
12 | "idiom" : "watch",
13 | "scale" : "2x",
14 | "role" : "notificationCenter",
15 | "subtype" : "42mm"
16 | },
17 | {
18 | "size" : "29x29",
19 | "idiom" : "watch",
20 | "role" : "companionSettings",
21 | "scale" : "2x"
22 | },
23 | {
24 | "size" : "29x29",
25 | "idiom" : "watch",
26 | "role" : "companionSettings",
27 | "scale" : "3x"
28 | },
29 | {
30 | "size" : "40x40",
31 | "idiom" : "watch",
32 | "scale" : "2x",
33 | "role" : "appLauncher",
34 | "subtype" : "38mm"
35 | },
36 | {
37 | "size" : "44x44",
38 | "idiom" : "watch",
39 | "scale" : "2x",
40 | "role" : "appLauncher",
41 | "subtype" : "40mm"
42 | },
43 | {
44 | "size" : "50x50",
45 | "idiom" : "watch",
46 | "scale" : "2x",
47 | "role" : "appLauncher",
48 | "subtype" : "44mm"
49 | },
50 | {
51 | "size" : "86x86",
52 | "idiom" : "watch",
53 | "scale" : "2x",
54 | "role" : "quickLook",
55 | "subtype" : "38mm"
56 | },
57 | {
58 | "size" : "98x98",
59 | "idiom" : "watch",
60 | "scale" : "2x",
61 | "role" : "quickLook",
62 | "subtype" : "42mm"
63 | },
64 | {
65 | "size" : "108x108",
66 | "idiom" : "watch",
67 | "scale" : "2x",
68 | "role" : "quickLook",
69 | "subtype" : "44mm"
70 | },
71 | {
72 | "idiom" : "watch-marketing",
73 | "size" : "1024x1024",
74 | "scale" : "1x"
75 | }
76 | ],
77 | "info" : {
78 | "version" : 1,
79 | "author" : "xcode"
80 | }
81 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTTestApp/app.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import GoogleDataTransport
18 |
19 | // iOS and tvOS specifics.
20 | #if os(iOS) || os(tvOS)
21 | import UIKit
22 |
23 | @UIApplicationMain
24 | class AppDelegate: UIResponder, UIApplicationDelegate {
25 | var window: UIWindow?
26 |
27 | func application(_ application: UIApplication,
28 | didFinishLaunchingWithOptions launchOptions: [UIApplication
29 | .LaunchOptionsKey: Any]?) -> Bool {
30 | GDTCORConsoleLoggerLoggingLevel = GDTCORLoggingLevel.debug.rawValue
31 | return true
32 | }
33 | }
34 |
35 | public class ViewController: UIViewController {
36 | let transport = GDTCORTransport(
37 | mappingID: "1234",
38 | transformers: nil,
39 | target: GDTCORTarget.test
40 | )!
41 | @IBOutlet var statusLabel: UILabel!
42 | }
43 |
44 | // macOS specifics.
45 | #elseif os(macOS)
46 | import Cocoa
47 |
48 | @NSApplicationMain class Main: NSObject, NSApplicationDelegate {
49 | var windowController: NSWindowController!
50 |
51 | func applicationDidFinishLaunching(aNotification: NSNotification) {}
52 | }
53 |
54 | public class ViewController: NSViewController {
55 | let transport = GDTCORTransport(
56 | mappingID: "1234",
57 | transformers: nil,
58 | target: GDTCORTarget.test
59 | )!
60 | }
61 | #endif
62 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTLibrary/Public/GDTCOREvent+GDTCCTSupport.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCOREvent.h"
18 |
19 | NS_ASSUME_NONNULL_BEGIN
20 |
21 | /** A string sets in customBytes as a key paired to @YES if current event needs to
22 | * populate network connection info data, @NO otherwise.
23 | */
24 | FOUNDATION_EXPORT NSString *const GDTCCTNeedsNetworkConnectionInfo;
25 |
26 | /** A string sets in customBytes as a key paired to the network connection info data
27 | * of current event.
28 | */
29 | FOUNDATION_EXPORT NSString *const GDTCCTNetworkConnectionInfo;
30 |
31 | /** A category that uses the customBytes property of a GDTCOREvent to store network connection info.
32 | */
33 | @interface GDTCOREvent (GDTCCTSupport)
34 |
35 | /** If YES, needs the network connection info field set during prioritization.
36 | * @note Uses the GDTCOREvent customBytes property.
37 | */
38 | @property(nonatomic) BOOL needsNetworkConnectionInfoPopulated;
39 |
40 | /** The network connection info as collected at the time of the event.
41 | * @note Uses the GDTCOREvent customBytes property.
42 | */
43 | @property(nullable, nonatomic) NSData *networkConnectionInfoData;
44 |
45 | /** Code that identifies the event to be sent to the CCT backend.
46 | */
47 | @property(nullable, nonatomic) NSNumber *eventCode;
48 |
49 | @end
50 |
51 | NS_ASSUME_NONNULL_END
52 |
--------------------------------------------------------------------------------
/GoogleDataTransport/ProtoSupport/generate_cct_protos.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 2019 Google
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 | #
17 |
18 | # Example usage:
19 | # ./build_protos
20 |
21 | # Dependencies: git, protobuf, python-protobuf, pyinstaller
22 |
23 | readonly DIR="$( git rev-parse --show-toplevel )"
24 |
25 | # Current release of nanopb being used to build the CCT protos
26 | readonly NANOPB_VERSION="0.3.9.9"
27 | readonly NANOPB_TEMPDIR="${DIR}/GoogleDataTransport/nanopb_temp"
28 |
29 | readonly LIBRARY_DIR="${DIR}/GoogleDataTransport/GDTCCTLibrary/"
30 | readonly PROTO_DIR="${DIR}/GoogleDataTransport/ProtoSupport/Protos/"
31 | readonly PROTOGEN_DIR="${LIBRARY_DIR}/Protogen/"
32 |
33 | rm -rf "${NANOPB_TEMPDIR}"
34 |
35 | echo "Downloading nanopb..."
36 | git clone --branch "${NANOPB_VERSION}" https://github.com/nanopb/nanopb.git "${NANOPB_TEMPDIR}"
37 |
38 | echo "Building nanopb..."
39 | pushd "${NANOPB_TEMPDIR}"
40 | ./tools/make_mac_package.sh
41 | GIT_DESCRIPTION=`git describe --always`-macosx-x86
42 | NANOPB_BIN_DIR="dist/${GIT_DESCRIPTION}"
43 | popd
44 |
45 | echo "Removing existing CCT protos..."
46 | rm -rf "${PROTOGEN_DIR}/*"
47 |
48 | echo "Generating CCT protos..."
49 | python "${DIR}/GoogleDataTransport/ProtoSupport/proto_generator.py" \
50 | --nanopb \
51 | --protos_dir="${PROTO_DIR}" \
52 | --pythonpath="${NANOPB_TEMPDIR}/${NANOPB_BIN_DIR}/generator" \
53 | --output_dir="${PROTOGEN_DIR}" \
54 | --include="${PROTO_DIR}"
55 |
56 | rm -rf "${NANOPB_TEMPDIR}"
57 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTiOSTestAppForCompanionWatchApp/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "60x60",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "3x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "20x20",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "20x20",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "29x29",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "29x29",
61 | "scale" : "2x"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "size" : "40x40",
66 | "scale" : "1x"
67 | },
68 | {
69 | "idiom" : "ipad",
70 | "size" : "40x40",
71 | "scale" : "2x"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "size" : "76x76",
76 | "scale" : "1x"
77 | },
78 | {
79 | "idiom" : "ipad",
80 | "size" : "76x76",
81 | "scale" : "2x"
82 | },
83 | {
84 | "idiom" : "ipad",
85 | "size" : "83.5x83.5",
86 | "scale" : "2x"
87 | },
88 | {
89 | "idiom" : "ios-marketing",
90 | "size" : "1024x1024",
91 | "scale" : "1x"
92 | }
93 | ],
94 | "info" : {
95 | "version" : 1,
96 | "author" : "xcode"
97 | }
98 | }
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORTests/Unit/GDTCOREndpointsTest.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import
18 |
19 | #import "GoogleDataTransport/GDTCORLibrary/Private/GDTCOREndpoints_Private.h"
20 | #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCOREndpoints.h"
21 |
22 | @interface GDTCOREndpointsTest : XCTestCase
23 |
24 | @end
25 |
26 | @implementation GDTCOREndpointsTest
27 |
28 | /* Verify if the upload URLs are not empty for different endpoints. */
29 | - (void)testUploadURLsAreNotEmpty {
30 | XCTAssertNotNil([GDTCOREndpoints uploadURLForTarget:kGDTCORTargetCCT]);
31 | XCTAssertNotNil([GDTCOREndpoints uploadURLForTarget:kGDTCORTargetFLL]);
32 | XCTAssertNotNil([GDTCOREndpoints uploadURLForTarget:kGDTCORTargetCSH]);
33 | XCTAssertNotNil([GDTCOREndpoints uploadURLForTarget:kGDTCORTargetINT]);
34 | }
35 |
36 | /* Verify if the upload URLs are correct for different endpoints. */
37 | - (void)testUploadURLsAreCorrect {
38 | NSDictionary *uploadURLs = [GDTCOREndpoints uploadURLs];
39 | XCTAssertEqualObjects([GDTCOREndpoints uploadURLForTarget:kGDTCORTargetCCT],
40 | uploadURLs[@(kGDTCORTargetCCT)]);
41 | XCTAssertEqualObjects([GDTCOREndpoints uploadURLForTarget:kGDTCORTargetFLL],
42 | uploadURLs[@(kGDTCORTargetFLL)]);
43 | XCTAssertEqualObjects([GDTCOREndpoints uploadURLForTarget:kGDTCORTargetCSH],
44 | uploadURLs[@(kGDTCORTargetCSH)]);
45 | XCTAssertEqualObjects([GDTCOREndpoints uploadURLForTarget:kGDTCORTargetINT],
46 | uploadURLs[@(kGDTCORTargetINT)]);
47 | }
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/GDTCORProductData.m:
--------------------------------------------------------------------------------
1 | // Copyright 2023 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #import
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCORProductData.h"
18 |
19 | @implementation GDTCORProductData
20 |
21 | - (instancetype)initWithProductID:(int32_t)productID {
22 | self = [super init];
23 | if (self) {
24 | _productID = productID;
25 | }
26 | return self;
27 | }
28 |
29 | - (nonnull id)copyWithZone:(nullable NSZone *)zone {
30 | return [[[self class] alloc] initWithProductID:self.productID];
31 | }
32 |
33 | #pragma mark - Equality
34 |
35 | - (BOOL)isEqualToProductData:(GDTCORProductData *)otherProductData {
36 | return self.productID == otherProductData.productID;
37 | }
38 |
39 | - (BOOL)isEqual:(nullable id)object {
40 | if (object == nil) {
41 | return NO;
42 | }
43 |
44 | if (self == object) {
45 | return YES;
46 | }
47 |
48 | if (![object isKindOfClass:[self class]]) {
49 | return NO;
50 | }
51 |
52 | return [self isEqualToProductData:(GDTCORProductData *)object];
53 | }
54 |
55 | - (NSUInteger)hash {
56 | return self.productID;
57 | }
58 |
59 | #pragma mark - NSSecureCoding
60 |
61 | /// NSCoding key for `productID` property.
62 | static NSString *kProductIDKey = @"GDTCORProductDataProductIDKey";
63 |
64 | + (BOOL)supportsSecureCoding {
65 | return YES;
66 | }
67 |
68 | - (nullable instancetype)initWithCoder:(nonnull NSCoder *)coder {
69 | int32_t productID = [coder decodeInt32ForKey:kProductIDKey];
70 | return [self initWithProductID:productID];
71 | }
72 |
73 | - (void)encodeWithCoder:(nonnull NSCoder *)coder {
74 | [coder encodeInt32:self.productID forKey:kProductIDKey];
75 | }
76 |
77 | @end
78 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Private/GDTCORMetricsMetadata.h:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #import
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCOREventDropReason.h"
18 |
19 | @class GDTCORLogSourceMetrics;
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | /// An encodable model object that contains metadata that is persisted in storage until ready to be
24 | /// used to create a ``GDTCORMetrics`` instance.
25 | @interface GDTCORMetricsMetadata : NSObject
26 |
27 | /// The start of the time window over which the metrics were collected.
28 | @property(nonatomic, copy, readonly) NSDate *collectionStartDate;
29 |
30 | /// The log source metrics associated with the metrics.
31 | @property(nonatomic, copy, readonly) GDTCORLogSourceMetrics *logSourceMetrics;
32 |
33 | /// Creates a metrics metadata object with the provided information.
34 | /// @param collectedSinceDate The start of the time window over which the metrics were collected.
35 | /// @param logSourceMetrics The metrics object that tracks metrics for each log source.
36 | + (instancetype)metadataWithCollectionStartDate:(NSDate *)collectedSinceDate
37 | logSourceMetrics:(GDTCORLogSourceMetrics *)logSourceMetrics;
38 |
39 | /// This API is unavailable.
40 | - (instancetype)init NS_UNAVAILABLE;
41 |
42 | /// Returns a Boolean value that indicates whether the receiving metrics metadata is equal to
43 | /// the given metrics metadata.
44 | /// @param otherMetricsMetadata The metrics metadata with which to compare the
45 | /// receiving metrics metadata.
46 | - (BOOL)isEqualToMetricsMetadata:(GDTCORMetricsMetadata *)otherMetricsMetadata;
47 |
48 | @end
49 |
50 | NS_ASSUME_NONNULL_END
51 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Internal/GDTCORUploader.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import
18 |
19 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORLifecycle.h"
20 | #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCORClock.h"
21 | #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCORTargets.h"
22 |
23 | NS_ASSUME_NONNULL_BEGIN
24 |
25 | /** Options that define a set of upload conditions. This is used to help minimize end user data
26 | * consumption impact.
27 | */
28 | typedef NS_OPTIONS(NSInteger, GDTCORUploadConditions) {
29 |
30 | /** An upload shouldn't be attempted, because there's no network. */
31 | GDTCORUploadConditionNoNetwork = 1 << 0,
32 |
33 | /** An upload would likely use mobile data. */
34 | GDTCORUploadConditionMobileData = 1 << 1,
35 |
36 | /** An upload would likely use wifi data. */
37 | GDTCORUploadConditionWifiData = 1 << 2,
38 |
39 | /** An upload uses some sort of network connection, but it's unclear which. */
40 | GDTCORUploadConditionUnclearConnection = 1 << 3,
41 |
42 | /** A high priority event has occurred. */
43 | GDTCORUploadConditionHighPriority = 1 << 4,
44 | };
45 |
46 | /** This protocol defines the common interface for uploader implementations. */
47 | @protocol GDTCORUploader
48 |
49 | @required
50 |
51 | /** Uploads events to the backend using this specific backend's chosen format.
52 | *
53 | * @param conditions The conditions that the upload attempt is likely to occur under.
54 | */
55 | - (void)uploadTarget:(GDTCORTarget)target withConditions:(GDTCORUploadConditions)conditions;
56 |
57 | @end
58 |
59 | NS_ASSUME_NONNULL_END
60 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTiOSTestAppForCompanionWatchApp/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UIApplicationSceneManifest
24 |
25 | UIApplicationSupportsMultipleScenes
26 |
27 | UISceneConfigurations
28 |
29 | UIWindowSceneSessionRoleApplication
30 |
31 |
32 | UISceneConfigurationName
33 | Default Configuration
34 | UISceneDelegateClassName
35 | $(PRODUCT_MODULE_NAME).SceneDelegate
36 | UISceneStoryboardFile
37 | Main
38 |
39 |
40 |
41 |
42 | UILaunchStoryboardName
43 | LaunchScreen
44 | UIMainStoryboardFile
45 | Main
46 | UIRequiredDeviceCapabilities
47 |
48 | armv7
49 |
50 | UISupportedInterfaceOrientations
51 |
52 | UIInterfaceOrientationPortrait
53 | UIInterfaceOrientationLandscapeLeft
54 | UIInterfaceOrientationLandscapeRight
55 |
56 | UISupportedInterfaceOrientations~ipad
57 |
58 | UIInterfaceOrientationPortrait
59 | UIInterfaceOrientationPortraitUpsideDown
60 | UIInterfaceOrientationLandscapeLeft
61 | UIInterfaceOrientationLandscapeRight
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/GDTCORConsoleLogger.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCORConsoleLogger.h"
18 |
19 | volatile NSInteger GDTCORConsoleLoggerLoggingLevel = GDTCORLoggingLevelErrors;
20 |
21 | /** The console logger prefix. */
22 | static NSString *kGDTCORConsoleLogger = @"[GoogleDataTransport]";
23 |
24 | NSString *GDTCORMessageCodeEnumToString(GDTCORMessageCode code) {
25 | return [[NSString alloc] initWithFormat:@"I-GDTCOR%06ld", (long)code];
26 | }
27 |
28 | void GDTCORLog(GDTCORMessageCode code, GDTCORLoggingLevel logLevel, NSString *format, ...) {
29 | // Don't log anything in not debug builds.
30 | #if !NDEBUG
31 | if (logLevel >= GDTCORConsoleLoggerLoggingLevel) {
32 | NSString *logFormat = [NSString stringWithFormat:@"%@[%@] %@", kGDTCORConsoleLogger,
33 | GDTCORMessageCodeEnumToString(code), format];
34 | va_list args;
35 | va_start(args, format);
36 | NSLogv(logFormat, args);
37 | va_end(args);
38 | }
39 | #endif // !NDEBUG
40 | }
41 |
42 | void GDTCORLogAssert(
43 | BOOL wasFatal, NSString *_Nonnull file, NSInteger line, NSString *_Nullable format, ...) {
44 | // Don't log anything in not debug builds.
45 | #if !NDEBUG
46 | GDTCORMessageCode code = wasFatal ? GDTCORMCEFatalAssertion : GDTCORMCEGeneralError;
47 | NSString *logFormat =
48 | [NSString stringWithFormat:@"%@[%@] (%@:%ld) : %@", kGDTCORConsoleLogger,
49 | GDTCORMessageCodeEnumToString(code), file, (long)line, format];
50 | va_list args;
51 | va_start(args, format);
52 | NSLogv(logFormat, args);
53 | va_end(args);
54 | #endif // !NDEBUG
55 | }
56 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Internal/GDTCORLifecycle.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import
18 |
19 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORPlatform.h"
20 |
21 | @class GDTCOREvent;
22 |
23 | NS_ASSUME_NONNULL_BEGIN
24 |
25 | /** A protocol defining the lifecycle events objects in the library must respond to immediately. */
26 | @protocol GDTCORLifecycleProtocol
27 |
28 | @optional
29 |
30 | /** Indicates an imminent app termination in the rare occurrence when -applicationWillTerminate: has
31 | * been called.
32 | *
33 | * @param app The GDTCORApplication instance.
34 | */
35 | - (void)appWillTerminate:(GDTCORApplication *)app;
36 |
37 | /** Indicates that the app is moving to background and eventual suspension or the current UIScene is
38 | * deactivating.
39 | *
40 | * @param app The GDTCORApplication instance.
41 | */
42 | - (void)appWillBackground:(GDTCORApplication *)app;
43 |
44 | /** Indicates that the app is resuming operation or a UIScene is activating.
45 | *
46 | * @param app The GDTCORApplication instance.
47 | */
48 | - (void)appWillForeground:(GDTCORApplication *)app;
49 |
50 | @end
51 |
52 | /** This class manages the library's response to app lifecycle events.
53 | *
54 | * When backgrounding, the library doesn't stop processing events, it's just that several background
55 | * tasks will end up being created for every event that's sent, and the stateful objects of the
56 | * library (GDTCORStorage and GDTCORUploadCoordinator instances) will deserialize themselves from
57 | * and to disk before and after every operation, respectively.
58 | */
59 | @interface GDTCORLifecycle : NSObject
60 |
61 | @end
62 |
63 | NS_ASSUME_NONNULL_END
64 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTTestApp/EventCleanupPerfTest.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Google LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import Foundation
18 |
19 | import GoogleDataTransport
20 |
21 | import os.signpost
22 |
23 | /// The test actions to run under the profiler to measure performance of
24 | /// `GDTCORFlatFileStorage.checkForExpirations()` method.
25 | enum EventCleanupPerfTest {
26 | static let log = OSLog(subsystem: "GoogleDataTransport-TestApp", category: "EventCleanupPerfTest")
27 |
28 | static func run(completion: @escaping () -> Void) {
29 | let signpostID = OSSignpostID(log: log)
30 |
31 | os_signpost(.begin, log: log, name: "checkForExpirations", signpostID: signpostID)
32 | GDTCORFlatFileStorage.sharedInstance().checkForExpirations()
33 |
34 | GDTCORFlatFileStorage.sharedInstance().storageQueue.async {
35 | os_signpost(.end, log: log, name: "checkForExpirations", signpostID: signpostID)
36 | completion()
37 | }
38 | }
39 |
40 | static func generateTestEvents(count: Int, _ completion: @escaping () -> Void) {
41 | let signpostID = OSSignpostID(log: log)
42 |
43 | let group = DispatchGroup()
44 |
45 | os_signpost(.begin, log: log, name: "generateTestEvents", signpostID: signpostID)
46 |
47 | _ = (0 ..< count).compactMap { _ -> GDTCOREvent? in
48 | group.enter()
49 | let event = GDTCOREventGenerator.generateEvent(for: .test, qosTier: nil, mappingID: nil)
50 | GDTCORFlatFileStorage.sharedInstance().store(event) { _, _ in
51 | group.leave()
52 | }
53 |
54 | return event
55 | }
56 |
57 | group.notify(queue: .main) {
58 | os_signpost(.end, log: log, name: "generateTestEvents", signpostID: signpostID)
59 | completion()
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCCTTests/Unit/Helpers/GDTCCTTestRequestParser.h:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #import
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCOREvent.h"
18 |
19 | #import "GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h"
20 | #include "GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/client_metrics.nanopb.h"
21 |
22 | NS_ASSUME_NONNULL_BEGIN
23 |
24 | /// A test utility class for parsing data or protos to their corresponding type.
25 | @interface GDTCCTTestRequestParser : NSObject
26 |
27 | /// Parses the batched log request proto from the provided data.
28 | /// @param data The given data to parse.
29 | /// @param outError If the return value is `nil`, an ``NSError`` indicating why the parsing
30 | /// operation failed.
31 | /// @return An instance of ``gdt_cct_BatchedLogRequest``.
32 | + (gdt_cct_BatchedLogRequest)requestWithData:(NSData *)data error:(NSError **)outError;
33 |
34 | /// Parses the client metrics proto from the provided data.
35 | /// @param data The given data to parse.
36 | /// @param outError If the return value is `nil`, an ``NSError`` indicating why the parsing
37 | /// operation failed.
38 | /// @return An instance of ``gdt_client_metrics_ClientMetrics``. The instance will have default
39 | /// values in the case of an error (check `outError`).
40 | + (gdt_client_metrics_ClientMetrics)metricsProtoWithData:(NSData *)data error:(NSError **)outError;
41 |
42 | /// Parses the ``GDTCOREvent``s used in the given batch log request proto.
43 | /// @param batchRequest The given proto to parse.
44 | /// @return An array of ``GDTCOREvent`` objects from the request.
45 | + (NSArray *)eventsWithBatchRequest:(gdt_cct_BatchedLogRequest)batchRequest;
46 |
47 | @end
48 |
49 | NS_ASSUME_NONNULL_END
50 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Private/GDTCORLogSourceMetrics.h:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #import
16 |
17 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCOREventDropReason.h"
18 |
19 | @class GDTCOREvent;
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | /// A model object that tracks, per log source, the number of events dropped for a variety of
24 | /// reasons. An event is considered "dropped" when the event is no longer persisted by the SDK.
25 | @interface GDTCORLogSourceMetrics : NSObject
26 |
27 | /// Creates an empty log source metrics instance.
28 | + (instancetype)metrics;
29 |
30 | /// Creates a log source metrics for a collection of events that were dropped for a given reason.
31 | /// @param events The collection of events that were dropped.
32 | /// @param reason The reason for which given events were dropped.
33 | + (instancetype)metricsWithEvents:(NSArray *)events
34 | droppedForReason:(GDTCOREventDropReason)reason;
35 |
36 | /// This API is unavailable.
37 | - (instancetype)init NS_UNAVAILABLE;
38 |
39 | /// Returns a log source metrics instance created by merging the receiving log
40 | /// source metrics with the given log source metrics.
41 | /// @param logSourceMetrics The given log source metrics to merge with.
42 | - (GDTCORLogSourceMetrics *)logSourceMetricsByMergingWithLogSourceMetrics:
43 | (GDTCORLogSourceMetrics *)logSourceMetrics;
44 |
45 | /// Returns a Boolean value that indicates whether the receiving log source metrics is equal to
46 | /// the given log source metrics.
47 | /// @param otherLogSourceMetrics The log source metrics with which to compare the
48 | /// receiving log source metrics.
49 | - (BOOL)isEqualToLogSourceMetrics:(GDTCORLogSourceMetrics *)otherLogSourceMetrics;
50 |
51 | @end
52 |
53 | NS_ASSUME_NONNULL_END
54 |
--------------------------------------------------------------------------------
/GoogleDataTransport/GDTCORLibrary/Private/GDTCORTransformer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Google
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #import
18 |
19 | #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORLifecycle.h"
20 |
21 | @class GDTCOREvent;
22 |
23 | @protocol GDTCOREventTransformer;
24 |
25 | NS_ASSUME_NONNULL_BEGIN
26 |
27 | /** Manages the transforming of events. It's desirable for this to be its own class
28 | * because running all events through a single instance ensures that transformers are thread-safe.
29 | * Having a per-transport queue to run on isn't sufficient because transformer objects could
30 | * maintain state (or at least, there's nothing to stop them from doing that) and the same instances
31 | * may be used across multiple instances.
32 | */
33 | @interface GDTCORTransformer : NSObject
34 |
35 | /** Instantiates or returns the event transformer singleton.
36 | *
37 | * @return The singleton instance of the event transformer.
38 | */
39 | + (instancetype)sharedInstance;
40 |
41 | /** Writes the result of applying the given transformers' `transformGDTEvent:` method on the given
42 | * event.
43 | *
44 | * @note If the app is suspended, a background task will be created to complete work in-progress,
45 | * but this method will not send any further events until the app is resumed.
46 | *
47 | * @param event The event to apply transformers on.
48 | * @param transformers The list of transformers to apply.
49 | * @param completion A block to run when an event was written to disk or dropped.
50 | */
51 | - (void)transformEvent:(GDTCOREvent *)event
52 | withTransformers:(nullable NSArray> *)transformers
53 | onComplete:(void (^_Nullable)(BOOL wasWritten, NSError *_Nullable error))completion;
54 |
55 | @end
56 |
57 | NS_ASSUME_NONNULL_END
58 |
--------------------------------------------------------------------------------