Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utilise new Push Notification endpoint for 1-on-1 conversations. #1249

Merged
merged 22 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2246a5d
feat: introduce new pns models and wire kotlinx serialization to appl…
0x330a Apr 19, 2023
8d4f244
feat: add support for firebase and split out google services as a dep…
0x330a Apr 20, 2023
7762d53
feat: add no op push manager for de-googled
0x330a Apr 20, 2023
d2e80c3
feat: re-add bencode utility and fix tests to use bytearray instead o…
0x330a Oct 28, 2022
46acd78
New SPNS subscription and notifications
jagerman May 18, 2023
95bb9ee
refactor: remove some unnecessary code for legacy PN registration
0x330a May 24, 2023
ba6eca2
Add FirebasePushManager#unregister
bemusementpark Jun 9, 2023
3f6229f
Remove PushNotificationManager
bemusementpark Jun 9, 2023
01d80ae
cleanup PushNotificationAPI
bemusementpark Jun 9, 2023
be4d742
Unregister v1 push
bemusementpark Jun 9, 2023
b2a1b5f
Add token to FCM logs
bemusementpark Jun 10, 2023
288b70b
Store legacy fcm token to reduce unregister api calls
bemusementpark Jun 13, 2023
153aa4c
Reinstate push v1
bemusementpark Jun 14, 2023
667af27
Utilise TokenManager and ExpiryManager
bemusementpark Jun 16, 2023
5c9dc36
Merge branch 'dev' into add-unregister
bemusementpark Jun 20, 2023
0e0ab91
cleanup
bemusementpark Jun 20, 2023
42cfce0
Refactor v1 and v2
bemusementpark Jun 21, 2023
e3f60eb
Fix individual group subs
bemusementpark Jun 21, 2023
dc7602a
Check fcm is enabled before modifying group sub
bemusementpark Jun 21, 2023
8be088a
Reinstate v1 PNServerJob
bemusementpark Jun 23, 2023
002793b
Merge branch 'dev' into add-unregister
bemusementpark Jul 21, 2023
58cda9b
Fix website
bemusementpark Jul 25, 2023
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ signing.properties
ffpr
*.sh
pkcs11.password
play
app/play
283 changes: 142 additions & 141 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,154 @@ apply plugin: 'kotlin-android'
apply plugin: 'witness'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-parcelize'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlinx-serialization'
apply plugin: 'dagger.hilt.android.plugin'


configurations.all {
exclude module: "commons-logging"
}

def canonicalVersionCode = 354
def canonicalVersionName = "1.17.0"

def postFixSize = 10
def abiPostFix = ['armeabi-v7a' : 1,
'arm64-v8a' : 2,
'x86' : 3,
'x86_64' : 4,
'universal' : 5]

android {
compileSdkVersion androidCompileSdkVersion
namespace 'network.loki.messenger'
useLibrary 'org.apache.http.legacy'

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}

packagingOptions {
exclude 'LICENSE.txt'
exclude 'LICENSE'
exclude 'NOTICE'
exclude 'asm-license.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/proguard/androidx-annotations.pro'
}

splits {
abi {
enable true
reset()
include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
universalApk true
}
}

buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.4.7'
}

defaultConfig {
versionCode canonicalVersionCode * postFixSize
versionName canonicalVersionName

minSdkVersion androidMinimumSdkVersion
targetSdkVersion androidTargetSdkVersion

multiDexEnabled = true

vectorDrawables.useSupportLibrary = true
project.ext.set("archivesBaseName", "session")

buildConfigField "long", "BUILD_TIMESTAMP", getLastCommitTimestamp() + "L"
buildConfigField "String", "CONTENT_PROXY_HOST", "\"contentproxy.signal.org\""
buildConfigField "int", "CONTENT_PROXY_PORT", "443"
buildConfigField "String", "USER_AGENT", "\"OWA\""
buildConfigField "String[]", "LANGUAGES", "new String[]{\"" + autoResConfig().collect { s -> s.replace('-r', '_') }.join('", "') + '"}'
buildConfigField "int", "CANONICAL_VERSION_CODE", "$canonicalVersionCode"

resConfigs autoResConfig()
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// The following argument makes the Android Test Orchestrator run its
// "pm clear" command after each test invocation. This command ensures
// that the app's state is completely cleared between tests.
testInstrumentationRunnerArguments clearPackageData: 'true'
testOptions {
execution 'ANDROIDX_TEST_ORCHESTRATOR'
}
}

sourceSets {
String sharedTestDir = 'src/sharedTest/java'
test.java.srcDirs += sharedTestDir
androidTest.java.srcDirs += sharedTestDir
}

buildTypes {
release {
minifyEnabled false
}
debug {
minifyEnabled false
}
}

flavorDimensions "distribution"
productFlavors {
play {
dimension "distribution"
apply plugin: 'com.google.gms.google-services'
ext.websiteUpdateUrl = "null"
buildConfigField "boolean", "PLAY_STORE_DISABLED", "false"
buildConfigField "String", "NOPLAY_UPDATE_URL", "$ext.websiteUpdateUrl"
}

website {
dimension "distribution"
ext.websiteUpdateUrl = "https://github.com/oxen-io/session-android/releases"
buildConfigField "boolean", "PLAY_STORE_DISABLED", "true"
buildConfigField "String", "NOPLAY_UPDATE_URL", "\"$ext.websiteUpdateUrl\""
}
}

applicationVariants.all { variant ->
variant.outputs.each { output ->
def abiName = output.getFilter("ABI") ?: 'universal'
def postFix = abiPostFix.get(abiName, 0)

if (postFix >= postFixSize) throw new AssertionError("postFix is too large")
output.outputFileName = output.outputFileName = "session-${variant.versionName}-${abiName}.apk"
output.versionCodeOverride = canonicalVersionCode * postFixSize + postFix
}
}

lintOptions {
abortOnError true
baseline file("lint-baseline.xml")
}

testOptions {
unitTests {
includeAndroidResources = true
}
}

buildFeatures {
dataBinding true
viewBinding true
}
}

dependencies {

implementation("com.google.dagger:hilt-android:2.46.1")
Expand All @@ -59,7 +198,7 @@ dependencies {
implementation 'androidx.fragment:fragment-ktx:1.5.3'
implementation "androidx.core:core-ktx:$coreVersion"
implementation "androidx.work:work-runtime-ktx:2.7.1"
implementation ("com.google.firebase:firebase-messaging:18.0.0") {
playImplementation ("com.google.firebase:firebase-messaging:18.0.0") {
exclude group: 'com.google.firebase', module: 'firebase-core'
exclude group: 'com.google.firebase', module: 'firebase-analytics'
exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
Expand Down Expand Up @@ -176,144 +315,6 @@ dependencies {
implementation 'androidx.compose.material:material:1.5.0-alpha02'
}

def canonicalVersionCode = 354
def canonicalVersionName = "1.17.0"

def postFixSize = 10
def abiPostFix = ['armeabi-v7a' : 1,
'arm64-v8a' : 2,
'x86' : 3,
'x86_64' : 4,
'universal' : 5]

android {
compileSdkVersion androidCompileSdkVersion
namespace 'network.loki.messenger'
useLibrary 'org.apache.http.legacy'

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}

packagingOptions {
exclude 'LICENSE.txt'
exclude 'LICENSE'
exclude 'NOTICE'
exclude 'asm-license.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/proguard/androidx-annotations.pro'
}

splits {
abi {
enable true
reset()
include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
universalApk true
}
}

buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.4.7'
}

defaultConfig {
versionCode canonicalVersionCode * postFixSize
versionName canonicalVersionName

minSdkVersion androidMinimumSdkVersion
targetSdkVersion androidTargetSdkVersion

multiDexEnabled = true

vectorDrawables.useSupportLibrary = true
project.ext.set("archivesBaseName", "session")

buildConfigField "long", "BUILD_TIMESTAMP", getLastCommitTimestamp() + "L"
buildConfigField "String", "CONTENT_PROXY_HOST", "\"contentproxy.signal.org\""
buildConfigField "int", "CONTENT_PROXY_PORT", "443"
buildConfigField "String", "USER_AGENT", "\"OWA\""
buildConfigField "String[]", "LANGUAGES", "new String[]{\"" + autoResConfig().collect { s -> s.replace('-r', '_') }.join('", "') + '"}'
buildConfigField "int", "CANONICAL_VERSION_CODE", "$canonicalVersionCode"

resConfigs autoResConfig()
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// The following argument makes the Android Test Orchestrator run its
// "pm clear" command after each test invocation. This command ensures
// that the app's state is completely cleared between tests.
testInstrumentationRunnerArguments clearPackageData: 'true'
testOptions {
execution 'ANDROIDX_TEST_ORCHESTRATOR'
}
}

sourceSets {
String sharedTestDir = 'src/sharedTest/java'
test.java.srcDirs += sharedTestDir
androidTest.java.srcDirs += sharedTestDir
}

buildTypes {
release {
minifyEnabled false
}
debug {
minifyEnabled false
}
}

flavorDimensions "distribution"
productFlavors {
play {
ext.websiteUpdateUrl = "null"
buildConfigField "boolean", "PLAY_STORE_DISABLED", "false"
buildConfigField "String", "NOPLAY_UPDATE_URL", "$ext.websiteUpdateUrl"
}

website {
ext.websiteUpdateUrl = "https://github.com/oxen-io/session-android/releases"
buildConfigField "boolean", "PLAY_STORE_DISABLED", "true"
buildConfigField "String", "NOPLAY_UPDATE_URL", "\"$ext.websiteUpdateUrl\""
}
}

applicationVariants.all { variant ->
variant.outputs.each { output ->
def abiName = output.getFilter("ABI") ?: 'universal'
def postFix = abiPostFix.get(abiName, 0)

if (postFix >= postFixSize) throw new AssertionError("postFix is too large")
output.outputFileName = output.outputFileName = "session-${variant.versionName}-${abiName}.apk"
output.versionCodeOverride = canonicalVersionCode * postFixSize + postFix
}
}

lintOptions {
abortOnError true
baseline file("lint-baseline.xml")
}

testOptions {
unitTests {
includeAndroidResources = true
}
}

buildFeatures {
dataBinding true
viewBinding true
}
}

static def getLastCommitTimestamp() {
new ByteArrayOutputStream().withStream { os ->
return os.toString() + "000"
Expand Down
8 changes: 0 additions & 8 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,6 @@
android:name="android.support.PARENT_ACTIVITY"
android:value="org.thoughtcrime.securesms.home.HomeActivity" />
</activity>
<service
android:name="org.thoughtcrime.securesms.notifications.PushNotificationService"
android:enabled="true"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:enabled="true" android:name="org.thoughtcrime.securesms.service.WebRtcCallService"
android:exported="false" />
<service
Expand Down
Loading