Deprecated: Function get_magic_quotes_gpc() is deprecated in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 99

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 619

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1169

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176
8000 Allow changing endpoint from Swift Demo UI by matux · Pull Request #292 · rollbar/rollbar-apple · GitHub
Nothing Special   »   [go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Demos/iosAppSwift/iosAppSwift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 61;
CURRENT_PROJECT_VERSION = 70;
DEVELOPMENT_ASSET_PATHS = "\"iosAppSwift/Preview Content\"";
DEVELOPMENT_TEAM = 9P5JVC2F34;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -317,7 +317,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 61;
CURRENT_PROJECT_VERSION = 70;
DEVELOPMENT_ASSET_PATHS = "\"iosAppSwift/Preview Content\"";
DEVELOPMENT_TEAM = 9P5JVC2F34;
ENABLE_PREVIEWS = YES;
Expand Down
28 changes: 22 additions & 6 deletions Demos/iosAppSwift/iosAppSwift/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ enum ExampleError: Error {
}

struct ContentView: View {
@AppStorage("rollbar_endpoint") var endpoint = "https://api.rollbar.com/api/1/item/"
@AppStorage("rollbar_post_client_item_access_token") var accessToken = ""

let example = Example()
Expand All @@ -20,16 +21,22 @@ struct ContentView: View {
.tint(.blue)
}

func restartIfValid(_ accessToken: String) {
guard accessToken.isValid else { return }
func accessTokenIsValid(_ accessToken: String) -> Bool {
#"(^[a-f0-9]{32}$)"#.matches(in: accessToken)?.count == 1
}

func restartIfValid(_ endpoint: String, _ accessToken: String) {
guard accessTokenIsValid(accessToken) else { return }

let config = Rollbar.configuration().mutableCopy()
config.destination.endpoint = endpoint
config.destination.accessToken = accessToken
Rollbar.update(withConfiguration: config)

Rollbar.infoMessage("Rollbar Apple SDK access token changed.")
Rollbar.infoMessage("Rollbar Apple SDK access token and/or endpoint changed.")

print("Rollbar Apple SDK access token changed to \(accessToken)")
print("[Rollbar Demo] Updated endpoint: \(endpoint)")
print("[Rollbar Demo] Updated access token: \(accessToken)")
}

var body: some View {
Expand All @@ -38,13 +45,22 @@ struct ContentView: View {
.font(.title)
.padding(.bottom)

TextField("endpoint", text: $endpoint)
.foregroundColor(.accentColor)
.multilineTextAlignment(.center)
.textFieldStyle(.roundedBorder)
.textContentType(.URL)
.textCase(.lowercase)
.lineLimit(1)
.onChange(of: endpoint) { endpoint in restartIfValid(endpoint, accessToken) }

TextField("post client item access token", text: $accessToken)
.foregroundColor(accessToken.isValid ? .accentColor : .red)
.foregroundColor(accessTokenIsValid(accessToken) ? .accentColor : .red)
.textFieldStyle(.roundedBorder)
.multilineTextAlignment(.center)
.textCase(.lowercase)
.lineLimit(1)
.onChange(of: accessToken, perform: restartIfValid)
.onChange(of: accessToken) { accessToken in restartIfValid(endpoint, accessToken) }
.padding(.bottom)

ScrollView {
Expand Down
6 changes: 0 additions & 6 deletions Demos/iosAppSwift/iosAppSwift/Prelude.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import Foundation

extension String {
var isValid: Bool {
#"(^[a-f0-9]{32}$)"#.matches(in: self)?.count == 1
}
}

extension StringProtocol {

/// Returns an array of `Substring`s by matching the given `String` using
Expand Down
7 changes: 6 additions & 1 deletion Demos/iosAppSwift/iosAppSwift/iosAppSwiftApp.swift
Original file line number Diff line number Diff line change
Expand Up 8469 @@ -13,6 +13,7 @@ struct iosAppSwiftApp: App {
}

class AppDelegate: NSObject, UIApplicationDelegate {
@AppStorage("rollbar_endpoint") var endpoint = "https://api.rollbar.com/api/1/item/"
@AppStorage("rollbar_post_client_item_access_token") var accessToken = ""

func application(
Expand All @@ -29,11 +30,15 @@ class AppDelegate: NSObject, UIApplicationDelegate {
withAccessToken: accessToken,
environment: environment)

// The config endpoint already defaults to `api.rollbar.com` so setting it is unnecessary.
// This is an implementation detail of this application and should very rarely be needed.
config.destination.endpoint = endpoint

config.loggingOptions.codeVersion = codeVersion

// Optionally defined whether rate limited occurrences should be dropped or
// kept in a queue. Defaults to drop.
config.loggingOptions.rateLimitBehavior = .queue
config.loggingOptions.rateLimitBehavior = .drop // or .queue

// Optionally anonymize the IP address
//config.loggingOptions.captureIp = RollbarCaptureIpType.anonymize
Expand Down
0