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
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ android {

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "io.sentry.sentry_mobile"
applicationId "io.sentrymobile.app"
minSdkVersion 18
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.sentry.sentry_mobile">
package="io.sentrymobile.app">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
7 changes: 5 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.sentry.sentry_mobile">
package="io.sentrymobile.app">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<application
android:name="io.flutter.app.FlutterApplication"
android:label="sentry_mobile"
android:label="io.sentrymobile.app"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
Expand Down

This file was deleted.

30 changes: 30 additions & 0 deletions android/app/src/main/kotlin/io/sentrymobile/app/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package io.sentrymobile.app

import androidx.annotation.NonNull
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
import android.os.AsyncTask
import io.sentrymobile.app.NativeCrashJava

class MainActivity: FlutterActivity() {
private val CHANNEL = "app.sentrymobile.io/nativeCrash"

override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler { call, result ->
if (call.method == "crashKotlin") {
crashingMethod()
} else if (call.method == "crashJava") {
NativeCrashJava.crashingFunction()
}
result.success(0)
}
}

private fun crashingMethod() {
AsyncTask.execute {
throw Exception("Native Crash - Android Kotlin")
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.sentrymobile.app;
import android.os.AsyncTask;

public class NativeCrashJava {
public static void crashingFunction() {
AsyncTask.execute(() -> {
String test = null;
test.length();
});
}
}
2 changes: 1 addition & 1 deletion android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.sentry.sentry_mobile">
package="io.sentrymobile.app">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
21 changes: 21 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ PODS:
- Flutter
- flutter_webview_plugin (0.0.1):
- Flutter
- package_info (0.0.1):
- Flutter
- path_provider (0.0.1):
- Flutter
- Sentry (6.0.9):
- Sentry/Core (= 6.0.9)
- Sentry/Core (6.0.9)
- sentry_flutter (0.0.1):
- Flutter
- Sentry (~> 6.0.9)
- shared_preferences (0.0.1):
- Flutter
- url_launcher (0.0.1):
Expand All @@ -19,21 +27,31 @@ DEPENDENCIES:
- Flutter (from `Flutter`)
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
- flutter_webview_plugin (from `.symlinks/plugins/flutter_webview_plugin/ios`)
- package_info (from `.symlinks/plugins/package_info/ios`)
- path_provider (from `.symlinks/plugins/path_provider/ios`)
- sentry_flutter (from `.symlinks/plugins/sentry_flutter/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
- url_launcher (from `.symlinks/plugins/url_launcher/ios`)
- webview_cookie_manager (from `.symlinks/plugins/webview_cookie_manager/ios`)
- webview_flutter (from `.symlinks/plugins/webview_flutter/ios`)

SPEC REPOS:
trunk:
- Sentry

EXTERNAL SOURCES:
Flutter:
:path: Flutter
flutter_secure_storage:
:path: ".symlinks/plugins/flutter_secure_storage/ios"
flutter_webview_plugin:
:path: ".symlinks/plugins/flutter_webview_plugin/ios"
package_info:
:path: ".symlinks/plugins/package_info/ios"
path_provider:
:path: ".symlinks/plugins/path_provider/ios"
sentry_flutter:
:path: ".symlinks/plugins/sentry_flutter/ios"
shared_preferences:
:path: ".symlinks/plugins/shared_preferences/ios"
url_launcher:
Expand All @@ -47,7 +65,10 @@ SPEC CHECKSUMS:
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
flutter_secure_storage: 7953c38a04c3fdbb00571bcd87d8e3b5ceb9daec
flutter_webview_plugin: ed9e8a6a96baf0c867e90e1bce2673913eeac694
package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
Sentry: 388c9dc093b2fd3a264466a5c5b21e25959610a9
sentry_flutter: b304a61350b0cc38a1417fced3eab99f22f2c277
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d
url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef
webview_cookie_manager: eaf920722b493bd0f7611b5484771ca53fed03f7
Expand Down
11 changes: 10 additions & 1 deletion ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 51;
objects = {

/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
1565BABC3730D0B6C35DBDCF /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D5E58C12BBC4010CC2513402 /* Pods_Runner.framework */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
92BDD6D625698B6000937A35 /* NativeCrashObjectiveC.m in Sources */ = {isa = PBXBuildFile; fileRef = 92BDD6D525698B6000937A35 /* NativeCrashObjectiveC.m */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
Expand Down Expand Up @@ -38,6 +39,8 @@
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
92BDD6D525698B6000937A35 /* NativeCrashObjectiveC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NativeCrashObjectiveC.m; sourceTree = "<group>"; };
92BDD6D725698CB700937A35 /* NativeCrashObjectiveC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NativeCrashObjectiveC.h; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -101,6 +104,8 @@
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
92BDD6D725698CB700937A35 /* NativeCrashObjectiveC.h */,
92BDD6D525698B6000937A35 /* NativeCrashObjectiveC.m */,
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
);
path = Runner;
Expand Down Expand Up @@ -273,6 +278,7 @@
files = (
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
92BDD6D625698B6000937A35 /* NativeCrashObjectiveC.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -355,6 +361,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 97JCY7859U;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand Down Expand Up @@ -492,6 +499,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 97JCY7859U;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand Down Expand Up @@ -523,6 +531,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 97JCY7859U;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand Down
36 changes: 29 additions & 7 deletions ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,33 @@ import Flutter

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}

override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {

if let controller = window?.rootViewController as? FlutterViewController {
let batteryChannel = FlutterMethodChannel(
name: "app.sentrymobile.io/nativeCrash",
binaryMessenger: controller.binaryMessenger
)
batteryChannel.setMethodCallHandler {
[weak self] call, result in
if call.method == "crashSwift" {
self?.crashSwift()
} else if call.method == "crashObjectiveC" {
NativeCrashObjectiveC.crashingFunction()
}
}
}

GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}

private func crashSwift() {
let string: String? = nil
print(string!.size) // Force-unwrapping a nil optional crashes the app.
}
}
17 changes: 17 additions & 0 deletions ios/Runner/NativeCrashObjectiveC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// NativeCrashObjectiveC.h
// Runner
//
// Created by Denis Andrašec on 21.11.20.
//

#ifndef NativeCrashObjectiveC_h
#define NativeCrashObjectiveC_h

@interface NativeCrashObjectiveC : NSObject

+ (void)crashingFunction;

@end

#endif /* NativeCrashObjectiveC_h */
23 changes: 23 additions & 0 deletions ios/Runner/NativeCrashObjectiveC.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// NativeCrashObjectiveC.m
// Runner
//
// Created by Denis Andrašec on 21.11.20.
//

#import <Foundation/Foundation.h>

@interface NativeCrashObjectiveC : NSObject

+ (void)crashingFunction;

@end

@implementation NativeCrashObjectiveC

+ (void)crashingFunction {
int* p = (int*)1;
*p = 0; // EXC_BAD_ACCESS
}

@end
1 change: 1 addition & 0 deletions ios/Runner/Runner-Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#import "GeneratedPluginRegistrant.h"
#import "NativeCrashObjectiveC.h"
40 changes: 23 additions & 17 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:sentry_mobile/redux/state/app_state.dart';
import 'package:sentry_mobile/screens/login/login_screen.dart';
import 'package:sentry_mobile/screens/main/main_screen.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

Future<Store<AppState>> createStore() async {
final prefs = await SharedPreferences.getInstance();
Expand All @@ -29,7 +30,7 @@ Future<Store<AppState>> createStore() async {
);
}

void main() async {
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();

SystemChrome.setPreferredOrientations([
Expand All @@ -41,13 +42,21 @@ void main() async {

store.dispatch(RehydrateAction());

runApp(SentryMobile(store: store));
await SentryFlutter.init(
(options) {
options.dsn = 'https://[email protected]/5428562';
},
() {
runApp(StoreProvider(
store: store,
child: SentryMobile(),
));
}
);
}

class SentryMobile extends StatelessWidget {
SentryMobile({this.store});

final Store<AppState> store;
SentryMobile();

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -113,18 +122,15 @@ class SentryMobile extends StatelessWidget {
color: Colors.black45,
)),
)),
home: StoreProvider(
store: store,
child: StoreConnector<AppState, AppState>(
builder: (_, state) {
if (state.globalState.session == null) {
return LoginScreen();
} else {
return MainScreen();
}
},
converter: (store) => store.state,
),
home: StoreConnector<AppState, AppState>(
builder: (_, state) {
if (state.globalState.session == null) {
return LoginScreen();
} else {
return MainScreen();
}
},
converter: (store) => store.state,
)
);
}
Expand Down
Loading