Skip to content

Commit f94ce01

Browse files
authored
Dynamic links invites app (firebase#76)
2 parents 813ba42 + 3600d95 commit f94ce01

File tree

101 files changed

+1751
-51
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+1751
-51
lines changed

.travis.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
language: android
22
jdk: oraclejdk8
3-
# See https://github.com/travis-ci/travis-ci/issues/5582
43
sudo: required
54
before_cache:
65
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
@@ -11,14 +10,19 @@ cache:
1110
- $HOME/.gradle/wrapper/
1211
- $HOME/.android/build-cache
1312
before_install:
13+
- yes | sdkmanager "platforms;android-28"
1414
- mkdir "$ANDROID_HOME/licenses" || true
1515
- echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e" > "$ANDROID_HOME/licenses/android-sdk-license"
1616
- echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd\n504667f4c0de7af1a06de9f4b1727b84351f2910" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
1717
android:
1818
components:
19-
# https://github.com/travis-ci/travis-ci/issues/6040#issuecomment-219367943
2019
- tools
20+
- build-tools-28.0.3
2121
- tools
22+
licenses:
23+
- android-sdk-preview-license-.+
24+
- android-sdk-license-.+
25+
- google-gdk-license-.+
2226
script:
2327
- python scripts/checksnippets.py
2428
- ./gradlew clean ktlint build

admob/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ dependencies {
2626
implementation "com.android.support:customtabs:28.0.0"
2727
implementation "com.android.support:appcompat-v7:28.0.0"
2828
implementation "com.google.firebase:firebase-ads:17.1.2"
29-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
29+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.0"
3030
}
3131

3232
apply plugin: 'com.google.gms.google-services'

appindexing/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ dependencies {
2525
implementation "com.android.support:support-v4:28.0.0"
2626
implementation "com.android.support:appcompat-v7:28.0.0"
2727
implementation "com.google.firebase:firebase-appindexing:17.1.0"
28-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
28+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.0"
2929
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
3030
}
3131

appindexing/build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ buildscript {
66
jcenter()
77
}
88
dependencies {
9-
// See root build.gradle
10-
9+
classpath 'com.android.tools.build:gradle:3.3.0'
10+
classpath 'com.google.gms:google-services:4.2.0'
11+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.0"
1112
}
1213
}
1314

auth/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ dependencies {
3030
implementation "com.google.firebase:firebase-auth:16.1.0"
3131
implementation "com.firebaseui:firebase-ui-auth:4.3.1"
3232
implementation "com.facebook.android:facebook-android-sdk:4.39.0"
33-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
33+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.0"
3434
implementation "com.android.support.constraint:constraint-layout:1.1.3"
3535
}
3636
repositories {

auth/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ buildscript {
66
jcenter()
77
}
88
dependencies {
9-
// See root build.gradle
9+
classpath 'com.android.tools.build:gradle:3.3.0'
10+
classpath 'com.google.gms:google-services:4.2.0'
11+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.0"
1012
}
1113
}
1214

build.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
buildscript {
3-
ext.kotlin_version = '1.3.0'
43
repositories {
54
google()
65
mavenCentral()
@@ -9,7 +8,7 @@ buildscript {
98
dependencies {
109
classpath 'com.android.tools.build:gradle:3.3.0'
1110
classpath 'com.google.gms:google-services:4.2.0'
12-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.0"
1312
}
1413
}
1514

@@ -66,4 +65,4 @@ task("ktlint", type: JavaExec, group: "verification") {
6665
"--reporter=checkstyle,output=${outputFile}",
6766
"**/*.kt",
6867
]
69-
}
68+
}

crash/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ dependencies {
2525
implementation "com.android.support:support-v4:28.0.0"
2626
implementation "com.android.support:appcompat-v7:28.0.0"
2727
implementation "com.google.firebase:firebase-crash:16.2.1"
28-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
28+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.0"
2929
}
3030

3131
apply plugin: 'com.google.gms.google-services'

crash/build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ buildscript {
66
jcenter()
77
}
88
dependencies {
9-
// See root build.gradle
10-
9+
classpath 'com.android.tools.build:gradle:3.3.0'
10+
classpath 'com.google.gms:google-services:4.2.0'
11+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.0"
1112
}
1213
}
1314

crashlytics/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ dependencies {
2525
implementation "com.android.support:support-v4:28.0.0"
2626
implementation "com.android.support:appcompat-v7:28.0.0"
2727
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
28-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
28+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.0"
2929
}
3030

3131
apply plugin: 'com.google.gms.google-services'

crashlytics/build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ buildscript {
66
jcenter()
77
}
88
dependencies {
9-
// See root build.gradle
10-
9+
classpath 'com.android.tools.build:gradle:3.3.0'
10+
classpath 'com.google.gms:google-services:4.2.0'
11+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.0"
1112
}
1213
}
1314

database/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ dependencies {
3030
implementation "com.android.support:support-v4:28.0.0"
3131
implementation "com.android.support:appcompat-v7:28.0.0"
3232
implementation "com.google.firebase:firebase-database:16.0.5"
33-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
33+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.0"
3434
}
3535

3636
apply plugin: 'com.google.gms.google-services'

database/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ buildscript {
77
jcenter()
88
}
99
dependencies {
10-
// See root build.gradle
10+
classpath 'com.android.tools.build:gradle:3.3.0'
11+
classpath 'com.google.gms:google-services:4.2.0'
12+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.0"
1113
}
1214
}
1315

dl-invites/app/build.gradle

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
apply plugin: 'com.android.application'
2+
apply plugin: 'kotlin-android'
3+
apply plugin: 'kotlin-android-extensions'
4+
5+
android {
6+
compileSdkVersion 28
7+
8+
defaultConfig {
9+
applicationId "com.google.firebase.dynamicinvites"
10+
minSdkVersion 19
11+
targetSdkVersion 28
12+
versionCode 1
13+
versionName "1.0"
14+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15+
}
16+
buildTypes {
17+
release {
18+
minifyEnabled false
19+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
20+
}
21+
}
22+
}
23+
24+
dependencies {
25+
implementation 'com.android.support:support-v4:28.0.0'
26+
implementation 'com.android.support:appcompat-v7:28.0.0'
27+
implementation 'com.android.support:cardview-v7:28.0.0'
28+
implementation 'com.android.support:recyclerview-v7:28.0.0'
29+
implementation 'com.google.firebase:firebase-dynamic-links:16.1.5'
30+
31+
implementation 'com.android.support:design:28.0.0'
32+
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
33+
34+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.0"
35+
}

dl-invites/app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
package="com.google.firebase.dynamicinvites">
5+
6+
<application
7+
android:allowBackup="true"
8+
android:icon="@mipmap/ic_launcher"
9+
android:label="@string/app_name"
10+
android:roundIcon="@mipmap/ic_launcher_round"
11+
android:supportsRtl="true"
12+
android:theme="@style/AppTheme"
13+
tools:ignore="GoogleAppIndexingWarning">
14+
<activity
15+
android:name=".view.MainActivity"
16+
android:label="Invite Members">
17+
<intent-filter>
18+
<action android:name="android.intent.action.MAIN" />
19+
<category android:name="android.intent.category.LAUNCHER" />
20+
</intent-filter>
21+
</activity>
22+
23+
<activity
24+
android:name=".view.AdvancedActivity"
25+
android:label="Refer Members">
26+
<intent-filter>
27+
<action android:name="android.intent.action.MAIN" />
28+
<category android:name="android.intent.category.LAUNCHER" />
29+
</intent-filter>
30+
</activity>
31+
</application>
32+
33+
</manifest>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.google.firebase.dynamicinvites.kotlin.model
2+
3+
import android.net.Uri
4+
5+
// [START ddl_invite_content]
6+
/**
7+
* The content of an invitation, with optional fields to accommodate all presenters.
8+
* This type could be modified to also include an image, for sending invites over email.
9+
*/
10+
data class InviteContent(
11+
/** The subject of the message. Not used for invites without subjects, like SMS. */
12+
val subject: String?,
13+
/** The body of the message. Indispensable content should go here. */
14+
val body: String?,
15+
/** The URL containing the link to invite. In link-copy cases, only this field will be used. */
16+
val link: Uri
17+
)
18+
// [END ddl_invite_content]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.google.firebase.dynamicinvites.kotlin.presenter
2+
3+
import android.content.Context
4+
import android.widget.Toast
5+
6+
import com.google.firebase.dynamicinvites.R
7+
import com.google.firebase.dynamicinvites.kotlin.model.InviteContent
8+
9+
class CopyPresenter(isAvailable: Boolean, content: InviteContent)
10+
: InvitePresenter("Copy Link", R.drawable.ic_content_copy_black_24dp, isAvailable, content) {
11+
12+
override fun sendInvite(context: Context) {
13+
super.sendInvite(context)
14+
Toast.makeText(context, "TODO: Implement link copying", Toast.LENGTH_SHORT).show()
15+
}
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.google.firebase.dynamicinvites.kotlin.presenter
2+
3+
import android.content.Context
4+
import android.widget.Toast
5+
6+
import com.google.firebase.dynamicinvites.R
7+
import com.google.firebase.dynamicinvites.kotlin.model.InviteContent
8+
9+
class EmailPresenter(isAvailable: Boolean, content: InviteContent)
10+
: InvitePresenter("Email", R.drawable.ic_email_black_24dp, isAvailable, content) {
11+
12+
override fun sendInvite(context: Context) {
13+
super.sendInvite(context)
14+
Toast.makeText(context, "TODO: Implement email sending", Toast.LENGTH_SHORT).show()
15+
}
16+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.google.firebase.dynamicinvites.kotlin.presenter
2+
3+
import android.content.Context
4+
import android.support.annotation.DrawableRes
5+
6+
import com.google.firebase.dynamicinvites.kotlin.model.InviteContent
7+
8+
// [START ddl_invite_presenter]
9+
/**
10+
* Presents the invite using a specific method, such as email or social.
11+
*/
12+
open class InvitePresenter(
13+
/** The user-visible name of the invite method, like 'Email' or 'SMS' */
14+
val name: String,
15+
/** An icon representing the invite method. */
16+
@param:DrawableRes @field:DrawableRes
17+
val icon: Int,
18+
/** Whether or not the method is available on this device. For example, SMS is phone only. */
19+
val isAvailable: Boolean,
20+
/** The Content of the invitation */
21+
val content: InviteContent
22+
) {
23+
/**
24+
* Send the invitation using the specified method.
25+
*/
26+
open fun sendInvite(context: Context) {
27+
// ...
28+
}
29+
}
30+
// [END ddl_invite_presenter]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.google.firebase.dynamicinvites.kotlin.presenter
2+
3+
import android.content.Context
4+
import android.widget.Toast
5+
6+
import com.google.firebase.dynamicinvites.R
7+
import com.google.firebase.dynamicinvites.kotlin.model.InviteContent
8+
9+
class MessagePresenter(isAvailable: Boolean, content: InviteContent)
10+
: InvitePresenter("Message", R.drawable.ic_sms_black_24dp, isAvailable, content) {
11+
12+
override fun sendInvite(context: Context) {
13+
super.sendInvite(context)
14+
Toast.makeText(context, "TODO: Implement SMS", Toast.LENGTH_SHORT).show()
15+
}
16+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.google.firebase.dynamicinvites.kotlin.presenter
2+
3+
import android.content.Context
4+
import android.content.Intent
5+
import com.google.firebase.dynamicinvites.R
6+
import com.google.firebase.dynamicinvites.kotlin.model.InviteContent
7+
import com.google.firebase.dynamicinvites.util.DynamicLinksUtil
8+
9+
class MorePresenter(isAvailable: Boolean, content: InviteContent)
10+
: InvitePresenter("More", R.drawable.ic_more_horiz_black_24dp, isAvailable, content) {
11+
12+
override fun sendInvite(context: Context) {
13+
super.sendInvite(context)
14+
val link = DynamicLinksUtil.generateContentLink()
15+
16+
val intent = Intent(Intent.ACTION_SEND)
17+
intent.type = "text/plain"
18+
intent.putExtra(Intent.EXTRA_TEXT, link.toString())
19+
20+
context.startActivity(Intent.createChooser(intent, "Share Link"))
21+
}
22+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.google.firebase.dynamicinvites.kotlin.presenter
2+
3+
import android.content.Context
4+
import android.widget.Toast
5+
6+
import com.google.firebase.dynamicinvites.R
7+
import com.google.firebase.dynamicinvites.kotlin.model.InviteContent
8+
9+
class SocialPresenter(isAvailable: Boolean, content: InviteContent)
10+
: InvitePresenter("Social", R.drawable.ic_people_black_24dp, isAvailable, content) {
11+
12+
override fun sendInvite(context: Context) {
13+
super.sendInvite(context)
14+
Toast.makeText(context, "TODO: Implement social sending", Toast.LENGTH_SHORT).show()
15+
}
16+
}

0 commit comments

Comments
 (0)