-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from capacitor-community/shared-ios-pod
AppCenterCapacitorShared ios pod
- Loading branch information
Showing
210 changed files
with
11,647 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
AppCenterCapacitorShared/ios/AppCenterCapacitorShared/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# OS X | ||
.DS_Store | ||
|
||
# Xcode | ||
build/ | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
xcuserdata/ | ||
*.xccheckout | ||
profile | ||
*.moved-aside | ||
DerivedData | ||
*.hmap | ||
*.ipa | ||
|
||
# Bundler | ||
.bundle | ||
|
||
# Add this line if you want to avoid checking in source code from Carthage dependencies. | ||
# Carthage/Checkouts | ||
|
||
Carthage/Build | ||
|
||
# We recommend against adding the Pods directory to your .gitignore. However | ||
# you should judge for yourself, the pros and cons are mentioned at: | ||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control | ||
# | ||
# Note: if you ignore the Pods directory, make sure to uncomment | ||
# `pod install` in .travis.yml | ||
# | ||
# Pods/ |
14 changes: 14 additions & 0 deletions
14
AppCenterCapacitorShared/ios/AppCenterCapacitorShared/.travis.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# references: | ||
# * https://www.objc.io/issues/6-build-tools/travis-ci/ | ||
# * https://github.com/supermarin/xcpretty#usage | ||
|
||
osx_image: xcode7.3 | ||
language: objective-c | ||
# cache: cocoapods | ||
# podfile: Example/Podfile | ||
# before_install: | ||
# - gem install cocoapods # Since Travis is not always on latest version | ||
# - pod install --project-directory=Example | ||
script: | ||
- set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace Example/AppCenterCapacitorShared.xcworkspace -scheme AppCenterCapacitorShared-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty | ||
- pod lib lint |
15 changes: 15 additions & 0 deletions
15
AppCenterCapacitorShared/ios/AppCenterCapacitorShared/AppCenterCapacitorShared.podspec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Pod::Spec.new do |s| | ||
s.name = 'AppCenterCapacitorShared' | ||
s.version = '0.1.0' | ||
s.summary = 'Shared utility to assist with bootstrapping AppCenter for Capacitor plugin.' | ||
s.homepage = 'https://github.com/capacitor-community/appcenter-sdk-capacitor' | ||
s.license = { :type => 'MIT', :file => 'LICENSE' } | ||
s.author = { 'johnborges' => '[email protected]' } | ||
s.source = { :http => 'https://github.com/capacitor-community/appcenter-sdk-capacitor/releases/download/0.1.0/AppCenter-SDK-Capacitor-iOS-Pod-0.1.0.zip' } | ||
s.social_media_url = 'https://twitter.com/johnborges' | ||
s.ios.deployment_target = '12.0' | ||
s.swift_version = '5.1' | ||
s.source_files = '*.swift' | ||
s.dependency 'AppCenter/Core', '4.1.1' | ||
s.static_framework = true | ||
end |
70 changes: 70 additions & 0 deletions
70
AppCenterCapacitorShared/ios/AppCenterCapacitorShared/AppCenterCapacitorShared.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import Foundation | ||
import AppCenter | ||
|
||
public class AppCenterCapacitorShared: NSObject { | ||
|
||
static var startAutomatically: Bool = true | ||
static var configuration: NSDictionary = [:] | ||
static var appSecret: String? | ||
static var wrapperSdk: WrapperSdk? | ||
// plist keys | ||
static var kAppCenterSecretKey = "AppSecret" | ||
static var kAppCenterStartAutomaticallyKey = "StartAutomatically" | ||
static var kAppCenterConfigResource = "AppCenter-Config" | ||
|
||
public static func getConfiguration() -> NSDictionary { | ||
return configuration | ||
} | ||
|
||
public static func setStartAutomatically (_ shouldStartAutomatically: Bool) { | ||
startAutomatically = shouldStartAutomatically; | ||
} | ||
|
||
public static func configureWithSettings() { | ||
if AppCenter.isConfigured { | ||
return | ||
} | ||
|
||
let wrapperSdk = WrapperSdk(wrapperSdkVersion: "0.1.0", wrapperSdkName: "appcenter.capacitor", wrapperRuntimeVersion: nil, liveUpdateReleaseLabel: nil, liveUpdateDeploymentKey: nil, liveUpdatePackageHash: nil) | ||
|
||
setWrapperSdk(wrapperSdk!) | ||
getAppSecret() | ||
|
||
if startAutomatically { | ||
if appSecret!.count == 0 { | ||
AppCenter.configure() | ||
} | ||
else { | ||
AppCenter.configure(withAppSecret: appSecret) | ||
} | ||
} | ||
} | ||
|
||
public static func setAppSecret(_ secret: String) { | ||
appSecret = secret | ||
} | ||
|
||
public static func getAppSecret() { | ||
if appSecret == nil { | ||
// get values from config plist | ||
let plist = Bundle.main.path(forResource: AppCenterCapacitorShared.kAppCenterConfigResource, ofType: "plist") | ||
configuration = NSDictionary(contentsOfFile: plist!)! | ||
appSecret = configuration[AppCenterCapacitorShared.kAppCenterSecretKey] as? String | ||
|
||
// start automatically flag true by default | ||
if let rawStartAutomatically = configuration[AppCenterCapacitorShared.kAppCenterStartAutomaticallyKey] as? Bool { | ||
startAutomatically = rawStartAutomatically | ||
} | ||
} | ||
} | ||
|
||
public static func getWrapperSdk() -> WrapperSdk? { | ||
return wrapperSdk | ||
} | ||
|
||
public static func setWrapperSdk(_ sdk: WrapperSdk) { | ||
wrapperSdk = sdk | ||
AppCenter.wrapperSdk = sdk | ||
} | ||
|
||
} |
Empty file.
Empty file.
Oops, something went wrong.