Skip to content

Commit

Permalink
Create Segmentation SDK structure for source and unit tests. (#3214)
Browse files Browse the repository at this point in the history
* Create Segmentation SDK structure for source and unit tests.

* Review changes: Remove unnecessary files in test folder. Add md-floc-master to CI

* Rename Segmentation directory to FirebaseSegmentation directory. Update podspec to include search header path.
  • Loading branch information
dmandar committed Jul 16, 2019
1 parent 57b4fb5 commit d7d3200
Show file tree
Hide file tree
Showing 7 changed files with 197 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ jobs:
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.rb FirebaseDynamicLinks.podspec
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.rb FirebaseDynamicLinks.podspec --use-libraries
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.rb FirebaseDynamicLinks.podspec --use-modular-headers

env:
- PROJECT=Segmentation PLATFORM=all METHOD=pod-lib-lint
before_install:
- ./scripts/if_changed.sh ./scripts/install_prereqs.sh
script:
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.rb FirebaseSegmentation.podspec
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.rb FirebaseSegmentation.podspec --use-libraries
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.rb FirebaseSegmentation.podspec --use-modular-headers

- stage: test
env:
Expand Down Expand Up @@ -433,3 +442,4 @@ jobs:
branches:
only:
- master
- md-floc-master
45 changes: 45 additions & 0 deletions FirebaseSegmentation.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Pod::Spec.new do |s|
s.name = 'FirebaseSegmentation'
s.version = '0.1.0'
s.summary = 'Firebase Segmentation SDK'
s.description = <<-DESC
Firebase Segmentation enables you to associate your custom application instance ID with Firebase for user segmentation.
DESC

s.homepage = 'https://firebase.google.com'
s.license = { :type => 'Apache', :file => 'LICENSE' }
s.authors = 'Google, Inc.'
s.source = {
:git => 'https://github.com/firebase/firebase-ios-sdk.git',
:tag => 'Segmentation-' + s.version.to_s
}

s.ios.deployment_target = '8.0'

s.cocoapods_version = '>= 1.4.0'
s.static_framework = true
s.prefix_header_file = false

s.source_files = 'FirebaseSegmentation/Sources/**/*'
s.public_header_files = 'FirebaseSegmentation/Public/*.h'

s.dependency 'FirebaseCore', '~> 6.0'
s.dependency 'FirebaseInstanceID', '~> 4.2'

header_search_paths = {
'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}"'
}

s.user_target_xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '$(PLATFORM_DIR)/Developer/Library/Frameworks' }

s.pod_target_xcconfig = {
'GCC_C_LANGUAGE_STANDARD' => 'c99',
'GCC_PREPROCESSOR_DEFINITIONS' => 'FIRSegmentation_VERSION=' + s.version.to_s
}

s.test_spec 'unit' do |unit_tests|
unit_tests.source_files = 'FirebaseSegmentation/Tests/Unit/*.[mh]'
unit_tests.dependency 'OCMock'
end

end
64 changes: 64 additions & 0 deletions FirebaseSegmentation/Public/FIRSegmentation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Copyright 2019 Google
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@class FIRApp;
/**
* The Firebase Segmentation SDK is used to associate a custom, non-Firebase custom installation
* identifier to Firebase. Once this custom installation identifier is set, developers can use the
* current app installation for segmentation purposes. If the custom installation identifier is
* explicitely set to nil, any existing custom installation identifier data will be removed.
*/
NS_SWIFT_NAME(Segmentation)
@interface FIRSegmentation : NSObject

/**
* Singleton instance (scoped to the default FIRApp)
* Returns the FIRSegmentation instance for the default Firebase application. Please make sure you
* call [FIRApp configure] beforehand for a default Firebase app to already be initialized and
* available. This singleton class instance lets you set your own custom identifier to be used for
* user segmentation purposes within Firebase.
*
* @return A shared instance of FIRSegmentation.
*/
+ (nonnull FIRSegmentation *)segmentation NS_SWIFT_NAME(segmentation());

/// Singleton instance (scoped to FIRApp)
/// Returns the FIRSegmentation instance for your Firebase application. This singleton class
/// instance lets you set your own custom identifier to be used for targeting purposes within
/// Firebase.
+ (nonnull FIRSegmentation *)segmentationWithApp:(nonnull FIRApp *)app
NS_SWIFT_NAME(segmentation(app:));

/**
* Unavailable. Use +segmentation instead.
*/
- (instancetype)init __attribute__((unavailable("Use +segmentation instead.")));

/// Set your own custom installation ID to be used for segmentation purposes.
/// This method needs to be called every time (and immediately) upon any changes to the custom
/// installation ID.
/// @param completionHandler Set custom installation ID completion. Returns nil if initialization
/// succeeded or an NSError object if initialization failed.
- (void)setCustomInstallationID:(NSString *)customInstallationID
completion:(void (^)(NSError *))completionHandler;

@end

NS_ASSUME_NONNULL_END
17 changes: 17 additions & 0 deletions FirebaseSegmentation/Public/FirebaseSegmentation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright 2019 Google
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#import "FIRSegmentation.h"
Empty file.
15 changes: 15 additions & 0 deletions FirebaseSegmentation/Sources/FIRSegmentation.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright 2019 Google
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import "FIRSegmentation.h"
46 changes: 46 additions & 0 deletions FirebaseSegmentation/Tests/Unit/SEGInitializationTests.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright 2019 Google
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import <XCTest/XCTest.h>

@interface SEGInitializationTests : XCTestCase

@end

@implementation SEGInitializationTests

- (void)setUp {
// Put setup code here. This method is called before the invocation of each test method in the
// class.
}

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

- (void)testExample {
NSLog(@"this is a test example");
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}

- (void)testPerformanceExample {
// This is an example of a performance test case.
[self measureBlock:^{
// Put the code you want to measure the time of here.
}];
}

@end

0 comments on commit d7d3200

Please sign in to comment.