Skip to content

Commit

Permalink
Merge pull request #749 from salemove/release/2.1.0
Browse files Browse the repository at this point in the history
Release/2.1.0
  • Loading branch information
DavDo authored Sep 5, 2023
2 parents c54b473 + 07cd096 commit 864f2fc
Show file tree
Hide file tree
Showing 291 changed files with 10,069 additions and 4,243 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
widgetssdk/src/test/snapshots/**/*.png filter=lfs diff=lfs merge=lfs -text
2 changes: 1 addition & 1 deletion .github/workflows/increment-project-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
- uses: actions/checkout@v3
- name: Runs the increment project version workflow in Bitrise
run: |
curl https://app.bitrise.io/app/${{ secrets.BITRISE_APP_ID }}/build/start.json --data '{"hook_info":{"type":"bitrise","build_trigger_token":"${{ secrets.BITRISE_BUILD_TRIGGER_TOKEN }}"},"build_params":{"branch":"master","workflow_id":"authenticated_increment_project_version","environments":[{"mapped_to":"GITHUB_VERSION_INCREMENT_TYPE","value":"${{ github.event.inputs.type }}","is_expand":true}]},"triggered_by":"curl"}'
curl https://app.bitrise.io/app/${{ secrets.BITRISE_APP_ID }}/build/start.json --data '{"hook_info":{"type":"bitrise","build_trigger_token":"${{ secrets.BITRISE_BUILD_TRIGGER_TOKEN }}"},"build_params":{"branch":"development","workflow_id":"authenticated_increment_project_version","environments":[{"mapped_to":"GITHUB_VERSION_INCREMENT_TYPE","value":"${{ github.event.inputs.type }}","is_expand":true}]},"triggered_by":"curl"}'
2 changes: 1 addition & 1 deletion .github/workflows/post-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ jobs:
- uses: actions/checkout@v3
- name: Runs the post-release workflow in Bitrise
run: |
curl https://app.bitrise.io/app/${{ secrets.BITRISE_APP_ID }}/build/start.json --data '{"hook_info":{"type":"bitrise","build_trigger_token":"${{ secrets.BITRISE_BUILD_TRIGGER_TOKEN }}"},"build_params":{"branch":"master","workflow_id":"post_release","environments":[{"mapped_to":"NEW_VERSION","value":"${{ github.event.inputs.version }}","is_expand":true}]},"triggered_by":"curl"}'
curl https://app.bitrise.io/app/${{ secrets.BITRISE_APP_ID }}/build/start.json --data '{"hook_info":{"type":"bitrise","build_trigger_token":"${{ secrets.BITRISE_BUILD_TRIGGER_TOKEN }}"},"build_params":{"branch":"development","workflow_id":"post_release","environments":[{"mapped_to":"NEW_VERSION","value":"${{ github.event.inputs.version }}","is_expand":true}]},"triggered_by":"curl"}'
12 changes: 7 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,20 @@ android {
p.each { name, value -> ext[name] = value }
}

initEnvProperty('GLIA_REGION', "beta")
initEnvProperty('GLIA_API_KEY_SECRET')
initEnvProperty('GLIA_API_KEY_ID')
initEnvProperty('GLIA_SITE_ID')
initEnvProperty('GLIA_QUEUE_ID')
initEnvProperty('GLIA_JWT', "")
initEnvProperty('FIREBASE_PROJECT_ID')
initEnvProperty('FIREBASE_API_KEY')
initEnvProperty('FIREBASE_APP_ID')
initEnvProperty('FIREBASE_APP_ID_DEBUG')
initEnvProperty('FIREBASE_APP_ID', "")
initEnvProperty('FIREBASE_APP_ID_DEBUG', "")

buildTypes {
all {
resValue("string", "environment", GLIA_REGION)
resValue("string", "site_id", GLIA_SITE_ID)
resValue("string", "glia_api_key_id", GLIA_API_KEY_ID)
resValue("string", "glia_api_key_secret", GLIA_API_KEY_SECRET)
Expand All @@ -63,12 +65,12 @@ android {
debug {
signingConfig signingConfigs.debug
applicationIdSuffix '.debug'
resValue("string", "firebase_app_id", FIREBASE_APP_ID_DEBUG ?: "")
resValue("string", "firebase_app_id", FIREBASE_APP_ID_DEBUG)
}
release {
initWith debug
applicationIdSuffix ''
resValue("string", "firebase_app_id", FIREBASE_APP_ID ?: "")
resValue("string", "firebase_app_id", FIREBASE_APP_ID)
}
}
lint {
Expand Down Expand Up @@ -107,7 +109,7 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"


debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.10'
// debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.10'
testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$testLibraryVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVersion"
Expand Down
100 changes: 50 additions & 50 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:name=".Application"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.GliaAndroidSDKWidgetsExample">

<activity android:name=".Activity" />

<activity-alias
android:name="LauncherActivity"
android:exported="true"
android:targetActivity=".Activity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="Deep Link Runner">
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="widgets"
android:pathPrefix="/token"
android:scheme="glia" />

<data
android:host="widgets"
android:pathPrefix="/secret"
android:scheme="glia" />

</intent-filter>
</activity-alias>

<service
android:name="com.glia.androidsdk.fcm.GliaFcmService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>

<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_notification" />
</application>
<application
android:name=".Application"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.GliaAndroidSDKWidgetsExample">

<activity
android:name=".Activity"
android:exported="true">
<nav-graph android:value="@navigation/nav_graph" />
</activity>

<activity-alias
android:name="LauncherActivity"
android:exported="true"
android:targetActivity=".Activity">

<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="Deep Link Runner">
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="glia" />
<data android:host="widgets" />
<data android:pathPrefix="/token" />
<data android:pathPrefix="/secret" />

</intent-filter>
</activity-alias>

<service
android:name="com.glia.androidsdk.fcm.GliaFcmService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>

<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_notification" />
</application>
</manifest>
8 changes: 8 additions & 0 deletions app/src/main/java/com/glia/exampleapp/Activity.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.glia.exampleapp;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.navigation.Navigation;

import com.glia.androidsdk.Glia;
import com.glia.widgets.GliaWidgets;
Expand All @@ -24,4 +26,10 @@ private void initGliaWidgetsWithDeepLink() {
GliaWidgets.init(GliaWidgetsConfigManager.obtainConfigFromDeepLink(uri, getApplicationContext()));
}
}

@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
Navigation.findNavController(this, R.id.nav_host_fragment).handleDeepLink(intent);
}
}
19 changes: 16 additions & 3 deletions app/src/main/java/com/glia/exampleapp/GliaWidgetsConfigManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ object GliaWidgetsConfigManager {
private const val QUEUE_ID_KEY = "queue_id"
private const val VISITOR_CONTEXT_ASSET_ID_KEY = "visitor_context_asset_id"
private const val REGION_KEY = "environment"
private const val REGION_BETA = "beta"
private const val REGION_ACCEPTANCE = "acceptance"
private const val BASE_DOMAIN = "base_domain"
private const val DEFAULT_BASE_DOMAIN = "at.samo.io"

@JvmStatic
fun obtainConfigFromDeepLink(data: Uri, applicationContext: Context): GliaWidgetsConfig {
saveRegionIfPresent(data, applicationContext)
saveQueueIdToPrefs(data, applicationContext)
saveVisitorContextAssetIdIfPresent(data, applicationContext)
saveSiteIdToPrefs(data, applicationContext)
Expand All @@ -53,6 +53,15 @@ object GliaWidgetsConfigManager {
)
}

private fun saveRegionIfPresent(data: Uri, applicationContext: Context) {
val visitorContextAssetId = data.getQueryParameter(REGION_KEY) ?: return
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(applicationContext)
sharedPreferences.edit().putString(
applicationContext.getString(R.string.pref_environment),
visitorContextAssetId
).apply()
}

private fun saveVisitorContextAssetIdIfPresent(data: Uri, applicationContext: Context) {
val visitorContextAssetId = data.getQueryParameter(VISITOR_CONTEXT_ASSET_ID_KEY) ?: return
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(applicationContext)
Expand Down Expand Up @@ -95,10 +104,14 @@ object GliaWidgetsConfigManager {
context: Context,
uiJsonRemoteConfig: String? = null,
runtimeConfig: UiTheme? = null,
region: String = REGION_BETA,
region: String? = null,
baseDomain: String = DEFAULT_BASE_DOMAIN,
preferences: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
): GliaWidgetsConfig {
val siteRegion = region ?: preferences.getString(
context.getString(R.string.pref_environment),
context.getString(R.string.environment)
)
val apiKeyId = preferences.getString(
context.getString(R.string.pref_api_key_id),
context.getString(R.string.glia_api_key_id)
Expand Down Expand Up @@ -128,7 +141,7 @@ object GliaWidgetsConfigManager {
return GliaWidgetsConfig.Builder()
.setSiteApiKey(SiteApiKey(apiKeyId!!, apiKeySecret!!))
.setSiteId(siteId)
.setRegion(region)
.setRegion(siteRegion)
.setBaseDomain(baseDomain)
.setCompanyName(companyName)
.setUseOverlay(useOverlay)
Expand Down
Loading

0 comments on commit 864f2fc

Please sign in to comment.