Skip to content

Commit

Permalink
split SDK targets for iOS and tvOS (#15)
Browse files Browse the repository at this point in the history
* fix for separate SDK targets for iOS and tvOS

* cleanup

* fix test setup

* add top-level module (wip)

* use same name OptimizelySwiftSDK for iOS and tvOS

* fix  SDK project to relative path

* fix for separate SDK targets for iOS and tvOS

* cleanup

* fix test setup

* add top-level module (wip)

* use same name OptimizelySwiftSDK for iOS and tvOS

* wip

* fix  SDK project to relative path

* fix top-level API (wip)

* fix merge conflict

* fix podspec to relative path

* fix SDK deployment target to 9.0

* fix cocoapod version issue
  • Loading branch information
jaeopt authored and thomaszurkan-optimizely committed Jan 14, 2019
1 parent daa5bbc commit 08e8144
Show file tree
Hide file tree
Showing 184 changed files with 3,895 additions and 1,397 deletions.
17 changes: 17 additions & 0 deletions DemoObjCApp/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// AppDelegate.h
// DemoObjcApp
//
// Created by Jae Kim on 1/7/19.
// Copyright © 2019 Optimizely. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;


@end

51 changes: 51 additions & 0 deletions DemoObjCApp/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//
// AppDelegate.m
// DemoObjcApp
//
// Created by Jae Kim on 1/7/19.
// Copyright © 2019 Optimizely. All rights reserved.
//

#import "AppDelegate.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
return YES;
}


- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}


- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}


- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}


- (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}


- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}


@end
770 changes: 770 additions & 0 deletions DemoObjCApp/DemoObjcApp.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6EF7498D21E404BB008B22A0"
BuildableName = "DemoObjciOS.app"
BlueprintName = "DemoObjciOS"
ReferencedContainer = "container:DemoObjcApp.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6EF7498D21E404BB008B22A0"
BuildableName = "DemoObjciOS.app"
BlueprintName = "DemoObjciOS"
ReferencedContainer = "container:DemoObjcApp.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6EF7498D21E404BB008B22A0"
BuildableName = "DemoObjciOS.app"
BlueprintName = "DemoObjciOS"
ReferencedContainer = "container:DemoObjcApp.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6EF7498D21E404BB008B22A0"
BuildableName = "DemoObjciOS.app"
BlueprintName = "DemoObjciOS"
ReferencedContainer = "container:DemoObjcApp.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6EF749A721E404D6008B22A0"
BuildableName = "DemoObjctvOS.app"
BlueprintName = "DemoObjctvOS"
ReferencedContainer = "container:DemoObjcApp.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6EF749A721E404D6008B22A0"
BuildableName = "DemoObjctvOS.app"
BlueprintName = "DemoObjctvOS"
ReferencedContainer = "container:DemoObjcApp.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6EF749A721E404D6008B22A0"
BuildableName = "DemoObjctvOS.app"
BlueprintName = "DemoObjctvOS"
ReferencedContainer = "container:DemoObjcApp.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6EF749A721E404D6008B22A0"
BuildableName = "DemoObjctvOS.app"
BlueprintName = "DemoObjctvOS"
ReferencedContainer = "container:DemoObjcApp.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
15 changes: 15 additions & 0 deletions DemoObjCApp/ViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// ViewController.h
// DemoObjcApp
//
// Created by Jae Kim on 1/7/19.
// Copyright © 2019 Optimizely. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController


@end

23 changes: 23 additions & 0 deletions DemoObjCApp/ViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// ViewController.m
// DemoObjcApp
//
// Created by Jae Kim on 1/7/19.
// Copyright © 2019 Optimizely. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}


@end
16 changes: 16 additions & 0 deletions DemoObjCApp/main.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// main.m
// DemoObjcAppiOS
//
// Created by Jae Kim on 1/7/19.
// Copyright © 2019 Optimizely. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "AppDelegate.h"

int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
78 changes: 78 additions & 0 deletions DemoSwiftApp/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/****************************************************************************
* Copyright 2017-2018, Optimizely, Inc. and contributors *
* *
* 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 UIKit
import OptimizelySwiftSDK
#if os(iOS)
import Amplitude_iOS
import Localytics
import Mixpanel
#elseif os(tvOS)
//
#endif

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

// generate random user ID on each app load
let userId = String(Int(arc4random_uniform(300000)))

// customizable settings
let datafileName = "demoTestDatafile" // default parameter for initializing Optimizely from saved datafile
var projectId:String? // project name: X Mobile - Sample App
var experimentKey = "background_experiment"
var eventKey = "sample_conversion"
let attributes = ["sample_attribute_key":"sample_attribute_value"]
let eventDispatcherDispatchInterval = 1000
let datafileManagerDownloadInterval = 20000
let sdkKey = "AqLkkcss3wRGUbftnKNgh2"


func applicationDidFinishLaunching(_ application: UIApplication) {

}

func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}

func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}

func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

////
func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
NotificationCenter.default.post(name: NSNotification.Name("OPTLYbackgroundFetchDone"), object: nil)
completionHandler(.newData)
}
}

Loading

0 comments on commit 08e8144

Please sign in to comment.