Skip to content

Commit

Permalink
Update sample application to latest AppCenter version (microsoft#367)
Browse files Browse the repository at this point in the history
* Fix-android-sample-app
* Fix ios app and update deps

Co-authored-by: Dmitriy Kirakosyan <[email protected]>
  • Loading branch information
AnatolyPristensky and DmitriyKirakosyan authored Aug 6, 2021
1 parent 7e168cf commit 8caaeac
Show file tree
Hide file tree
Showing 18 changed files with 5,637 additions and 8,777 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public boolean getUseDeveloperSupport() {
@Override
protected List<ReactPackage> getPackages() {
List<ReactPackage> packages = new PackageList(this).getPackages();
packages.add(new CodePush(getResources().getString(R.string.reactNativeCodePush_androidDeploymentKey), getApplicationContext(), BuildConfig.DEBUG));

return packages;
}

Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
buildscript {
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 16
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29
supportLibVersion = "29.0.2"
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Thu Dec 19 13:37:41 CST 2019
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
Expand Down
3 changes: 2 additions & 1 deletion android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ rootProject.name = 'AppCenterSample'

apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

include ':app'
include ':app', ':react-native-code-push'
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
670 changes: 163 additions & 507 deletions ios/AppCenterSample.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1130"
LastUpgradeVersion = "1210"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1BEE828C124E6416179B904A9F66D794"
BuildableName = "React"
BlueprintName = "React"
ReferencedContainer = "container:Pods/Pods.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
Expand All @@ -34,39 +20,16 @@
ReferencedContainer = "container:AppCenterSample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
BuildableName = "AppCenterSampleTests.xctest"
BlueprintName = "AppCenterSampleTests"
ReferencedContainer = "container:AppCenterSample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "AppCenterSample.app"
BlueprintName = "AppCenterSample"
ReferencedContainer = "container:AppCenterSample.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "YES">
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
Expand All @@ -75,16 +38,6 @@
ReferencedContainer = "container:AppCenterSample.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F81B57FB2080D79B0066D3CA"
BuildableName = "AppCenterSampleUITests.xctest"
BlueprintName = "AppCenterSampleUITests"
ReferencedContainer = "container:AppCenterSample.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down
6 changes: 3 additions & 3 deletions ios/AppCenterSample/AppCenterSample.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ @implementation AppCenterSample
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
[MSAnalytics trackEvent:@"Color event" withProperties: @{@"Color": @"Yellow"}];
[MSACAnalytics trackEvent:@"Color event" withProperties: @{@"Color": @"Yellow"}];
}];
[alert addAction:(yellow)];

Expand All @@ -34,7 +34,7 @@ @implementation AppCenterSample
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
[MSAnalytics trackEvent:@"Color event" withProperties: @{@"Color": @"Blue"}];
[MSACAnalytics trackEvent:@"Color event" withProperties: @{@"Color": @"Blue"}];
}];
[alert addAction:(blue)];

Expand All @@ -43,7 +43,7 @@ @implementation AppCenterSample
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
[MSAnalytics trackEvent:@"Color event" withProperties: @{@"Color": @"Red"}];
[MSACAnalytics trackEvent:@"Color event" withProperties: @{@"Color": @"Red"}];
}];
[alert addAction:(red)];

Expand Down
12 changes: 2 additions & 10 deletions ios/AppCenterSample/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/

#import <React/RCTBridgeDelegate.h>
#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>
@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>

@property (nonatomic, strong) UIWindow *window;

Expand Down
47 changes: 37 additions & 10 deletions ios/AppCenterSample/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/

#import "AppDelegate.h"
#import <CodePush/CodePush.h>
#import <AppCenterReactNative.h>
#import <AppCenterReactNativeAnalytics.h>
#import <AppCenterReactNativeCrashes.h>

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

#ifdef FB_SONARKIT_ENABLED
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>

static void InitializeFlipper(UIApplication *application) {
FlipperClient *client = [FlipperClient sharedClient];
SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
[client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
[client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
[client addPlugin:[FlipperKitReactPlugin new]];
[client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
[client start];
}
#endif

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
Expand All @@ -26,6 +37,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[AppCenterReactNative register];
[AppCenterReactNativeAnalytics registerWithInitiallyEnabled:true];
[AppCenterReactNativeCrashes registerWithAutomaticProcessing];
#ifdef FB_SONARKIT_ENABLED
InitializeFlipper(application);
#endif


#ifdef DEBUG
Expand All @@ -38,7 +52,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
moduleName:@"AppCenterSample"
initialProperties:nil
launchOptions:launchOptions];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
if (@available(iOS 13.0, *)) {
rootView.backgroundColor = [UIColor systemBackgroundColor];
} else {
rootView.backgroundColor = [UIColor whiteColor];
}

self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
Expand All @@ -48,4 +66,13 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
return YES;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

@end
Loading

0 comments on commit 8caaeac

Please sign in to comment.