Skip to content

Commit

Permalink
Merge pull request #61 from TheRealAgentK/master
Browse files Browse the repository at this point in the history
4.0.0 release
  • Loading branch information
TheRealAgentK authored Jun 18, 2019
2 parents d7420dc + 7b8d390 commit 037ad08
Show file tree
Hide file tree
Showing 18 changed files with 259 additions and 54 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Changelog

- Towards v4.0.0-beta3:
- v4.0.0:
- Minor internal changes to memory handling
- Linting cleanup

- v4.0.0-beta3:
- API changes for setting and working with custom data: the field userCustomData is now being referred to as customData. This is reflected in API method changes.
- Documentation for both Raygun4Android Gradle tasks
- Added Timber 4.7.1 dependency for debug/prod logging
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ Supports Android 4.1+ (API 16+).

## IMPORTANT

### 6 May 2019
### 17 Juni 2019

Raygun4Android is currently actively being worked on for a release of version 4.
Raygun4Android 4.0 is considered stable.

With the release of beta2, the 4.0.0 development branch has now been merged into master and is now the mainstream development line. The code is quite stable and we encourage you to use the 4.0.0-beta2 release.
Raygun4Android is currently actively being worked on towards a release of version 4.1.

If you want the fully stable version 3.0.6 please check out the changeset labelled with v3.0.6 and go from there.
With the release of 4.0.0-beta2, the 4.0.0 development branch has been merged into master and is now the mainstream development line.

The master branch of this repository is currently heading towards a beta3 release.
If you want the older stable version 3.0.6 please check out the change set labelled with v3.0.6 and go from there.

## Requirements

Expand All @@ -41,7 +41,7 @@ Then add the following to your **module's** build.gradle:
```gradle
dependencies {
...
implementation 'com.raygun:raygun4android:4.0.0-beta2'
implementation 'com.raygun:raygun4android:4.0.0'
}
```

Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ dependencies {
// Build from local provider library src
implementation project(':provider')
// Build from external repo
//implementation 'com.raygun:raygun4android:4.0.0-beta1'
//implementation 'com.raygun:raygun4android:4.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
</intent-filter>
</activity>

<activity
android:name=".SecondActivity"
android:parentActivityName=".MainActivity">
</activity>

<service
android:name="com.raygun.raygun4android.services.CrashReportingPostService"
android:exported="false"
Expand Down
22 changes: 14 additions & 8 deletions app/src/main/java/com/raygun/raygun4android/sample/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ class MainActivity : AppCompatActivity() {

RaygunClient.setCustomData(initialCustomData)

val buttonSend = findViewById(R.id.button_send) as Button
val buttonCrash = findViewById(R.id.button_crash) as Button
val buttonHandleException = findViewById(R.id.button_handleException) as Button
val buttonSetUserAnon = findViewById(R.id.button_set_user_anon) as Button
val buttonSetUserA = findViewById(R.id.button_set_user_A) as Button
val buttonSetUserB = findViewById(R.id.button_set_user_B) as Button
val textViewAppVersion = findViewById(R.id.textView_appVersion) as TextView
val textViewProviderVersion = findViewById(R.id.textView_providerVersion) as TextView
val buttonSend = findViewById<Button>(R.id.button_send)
val buttonCrash = findViewById<Button>(R.id.button_crash)
val buttonHandleException = findViewById<Button>(R.id.button_handleException)
val buttonSetUserAnon = findViewById<Button>(R.id.button_set_user_anon)
val buttonSetUserA = findViewById<Button>(R.id.button_set_user_A)
val buttonSetUserB = findViewById<Button>(R.id.button_set_user_B)
val textViewAppVersion = findViewById<TextView>(R.id.textView_appVersion)
val textViewProviderVersion = findViewById<TextView>(R.id.textView_providerVersion)
val buttonSecondActivity = findViewById<Button>(R.id.button_secondActivity)

buttonSend.setOnClickListener {
val tw = HashMap<String,String>()
Expand Down Expand Up @@ -80,6 +81,11 @@ class MainActivity : AppCompatActivity() {
RaygunClient.setUser(user)
}

buttonSecondActivity.setOnClickListener {
startActivity(SecondActivity.getIntent(this@MainActivity))
}


textViewAppVersion.text = "App ${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE} ${BuildConfig.BUILD_TYPE})"
textViewProviderVersion.text = "Provider ${com.raygun.raygun4android.BuildConfig.VERSION_NAME} (${com.raygun.raygun4android.BuildConfig.VERSION_CODE} ${BuildConfig.BUILD_TYPE})"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package com.raygun.raygun4android.sample

import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.util.Log
import android.widget.Button
import android.widget.TextView
import com.raygun.raygun4android.RaygunClient
import com.raygun.raygun4android.messages.shared.RaygunUserInfo

class SecondActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_second)

supportActionBar?.setDisplayHomeAsUpEnabled(true)

val buttonSend = findViewById<Button>(R.id.button_send)
val buttonCrash = findViewById<Button>(R.id.button_crash)
val buttonHandleException = findViewById<Button>(R.id.button_handleException)
val buttonSetUserAnon = findViewById<Button>(R.id.button_set_user_anon)
val buttonSetUserA = findViewById<Button>(R.id.button_set_user_A)
val buttonSetUserB = findViewById<Button>(R.id.button_set_user_B)
val textViewAppVersion = findViewById<TextView>(R.id.textView_appVersion)
val textViewProviderVersion = findViewById<TextView>(R.id.textView_providerVersion)

buttonSend.setOnClickListener {
val tw = HashMap<String,String>()
tw["secondkey"] = "secondvalue"

// Manual exception creation & sending
RaygunClient.send(Exception("Congratulations, you have sent errors with Raygun4Android from SecondActivity"), null, tw)
}

buttonCrash.setOnClickListener {
// A real exception will be thrown here, which will be caught & sent by RaygunClient
val i = 3 / 0
Log.d("Raygun4Android-Sample", "This is here purely so that our division by zero calculation in i gets used and not optimised away in a release build: $i")
}

buttonHandleException.setOnClickListener {
// Handle an exception yourself - nothing should be sent to Raygun
try {
val i = 3 / 0
Log.d("Raygun4Android-Sample", "This is here purely so that our division by zero calculation in i gets used and not optimised away in a release build: $i")
} catch (ex: Exception) {
val i = 4
Log.d("Raygun4Android-Sample", "This is here purely so that our alternative value for i gets used and not optimised away in a release build: $i")
}
}

buttonSetUserAnon.setOnClickListener {
val user = RaygunUserInfo()
RaygunClient.setUser(user)
}

buttonSetUserA.setOnClickListener {
val user = RaygunUserInfo("superuser3")
user.fullName = "User Name C"
user.firstName = "User C"
user.email = "[email protected]"
RaygunClient.setUser(user)
}

buttonSetUserB.setOnClickListener{
val user = RaygunUserInfo("superuser4")
user.fullName = "User Name D"
user.firstName = "User D"
user.email = "[email protected]"
RaygunClient.setUser(user)
}

textViewAppVersion.text = "App ${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE} ${BuildConfig.BUILD_TYPE})"
textViewProviderVersion.text = "Provider ${com.raygun.raygun4android.BuildConfig.VERSION_NAME} (${com.raygun.raygun4android.BuildConfig.VERSION_CODE} ${BuildConfig.BUILD_TYPE})"
}

companion object {
fun getIntent(context: Context): Intent = Intent(context, SecondActivity::class.java)
}
}
9 changes: 9 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,13 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button_crash" />

<Button
android:id="@+id/button_secondActivity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Go to a second Activity"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button_set_user_B" />

</android.support.constraint.ConstraintLayout>
94 changes: 94 additions & 0 deletions app/src/main/res/layout/activity_second.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.378" />

<Button
android:id="@+id/button_send"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Send an error"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" />

<Button
android:id="@+id/button_crash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Crash app"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button_send" />

<Button
android:id="@+id/button_set_user_anon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Set user anonymous"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button_handleException" />

<Button
android:id="@+id/button_set_user_A"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Set user A"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button_set_user_anon" />

<Button
android:id="@+id/button_set_user_B"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Set user B"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button_set_user_A" />

<TextView
android:id="@+id/textView_appVersion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/textView_providerVersion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView_appVersion" />

<Button
android:id="@+id/button_handleException"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Handle Crash"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button_crash" />

</android.support.constraint.ConstraintLayout>
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ org.gradle.jvmargs=-Xmx1536m
# 5.3.3-beta2-SNAPSHOT
#
# Adding -SNAPSHOT to VERSION_NAME triggers publishing to a snapshot server at Maven Central.
VERSION_NAME=4.0.0-beta3
VERSION_NAME=4.0.0

# Use a numeric value for VERSION_CODE
#
Expand All @@ -40,7 +40,7 @@ VERSION_NAME=4.0.0-beta3
# 4.0.0-alpha1 -> 40000031
# 5.2.3 -> 50203000
# 5.3.3-beta2 -> 50303072
VERSION_CODE=40000073
VERSION_CODE=40000099

GROUP=com.raygun

Expand Down
2 changes: 1 addition & 1 deletion provider/gradle-mvn-push.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ apply plugin: 'maven'
apply plugin: 'signing'

def isReleaseBuild() {
return VERSION_NAME.contains("SNAPSHOT") == false
return !VERSION_NAME.contains("SNAPSHOT")
}

def getReleaseRepositoryUrl() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ static void postCachedMessages() {
ois = new ObjectInputStream(new FileInputStream(f));
SerializedMessage serializedMessage = (SerializedMessage) ois.readObject();
enqueueWorkForCrashReportingService(RaygunClient.getApiKey(), serializedMessage.message);
f.delete();
if (!f.delete()) {
RaygunLogger.w("Couldn't delete cached report (" + f.getName() + ")");
}
} finally {
if (ois != null) {
ois.close();
Expand Down
Loading

0 comments on commit 037ad08

Please sign in to comment.