Skip to content

Commit

Permalink
Merge branch 'develop' into issue-13832
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrkhalil authored Sep 20, 2022
2 parents 52abead + f32781a commit 89f295c
Show file tree
Hide file tree
Showing 9 changed files with 163 additions and 12 deletions.
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<meta-data android:name="commitHash" android:value="${commitHash}"/>
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"
Expand Down
4 changes: 2 additions & 2 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
# Version requirements used throughout the Gradle scripts
kotlinVersion=1.3.50
minSdkVersion=23
compileSdkVersion=30
targetSdkVersion=30
compileSdkVersion=31
targetSdkVersion=31
buildToolsVersion=31.0.0
supportLibVersion=28.0.0
# This should match version from nix/mobile/android/maven-and-npm-deps/maven/default.nix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ public int onStartCommand(Intent i, int flags, int startId) {



PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_MUTABLE);
Intent stopIntent = new Intent(PushNotificationHelper.ACTION_TAP_STOP);
PendingIntent stopPendingIntent = PendingIntent.getBroadcast(context, 0, stopIntent, PendingIntent.FLAG_CANCEL_CURRENT);
PendingIntent stopPendingIntent = PendingIntent.getBroadcast(context, 0, stopIntent,
PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_MUTABLE);

Notification notification = new NotificationCompat.Builder(context, CHANNEL_ID)
.setSmallIcon(R.drawable.ic_stat_notify_status)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ public void sendToNotificationCentreWithPicture(final Bundle bundle, Bitmap larg
actionIntent.setPackage(packageName);

PendingIntent pendingActionIntent = PendingIntent.getBroadcast(context, notificationID, actionIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
notification.addAction(new NotificationCompat.Action.Builder(icon, action, pendingActionIntent).build());
Expand Down Expand Up @@ -708,26 +708,30 @@ private PendingIntent createGroupOnDismissedIntent(Context context, int notifica
Intent intent = new Intent(ACTION_DELETE_NOTIFICATION);
intent.putExtra("im.status.ethereum.deepLink", deepLink);
intent.putExtra("im.status.ethereum.groupId", groupId);
return PendingIntent.getBroadcast(context.getApplicationContext(), notificationId, intent, PendingIntent.FLAG_CANCEL_CURRENT);
return PendingIntent.getBroadcast(context.getApplicationContext(), notificationId, intent,
PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_MUTABLE);
}

private PendingIntent createGroupOnTapIntent(Context context, int notificationId, String groupId, String deepLink) {
Intent intent = new Intent(ACTION_TAP_NOTIFICATION);
intent.putExtra("im.status.ethereum.deepLink", deepLink);
intent.putExtra("im.status.ethereum.groupId", groupId);
return PendingIntent.getBroadcast(context.getApplicationContext(), notificationId, intent, PendingIntent.FLAG_CANCEL_CURRENT);
return PendingIntent.getBroadcast(context.getApplicationContext(), notificationId, intent,
PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_MUTABLE);
}

private PendingIntent createOnTapIntent(Context context, int notificationId, String deepLink) {
Intent intent = new Intent(ACTION_TAP_NOTIFICATION);
intent.putExtra("im.status.ethereum.deepLink", deepLink);
return PendingIntent.getBroadcast(context.getApplicationContext(), notificationId, intent, PendingIntent.FLAG_CANCEL_CURRENT);
return PendingIntent.getBroadcast(context.getApplicationContext(), notificationId, intent,
PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_MUTABLE);
}

private PendingIntent createOnDismissedIntent(Context context, int notificationId, String deepLink) {
Intent intent = new Intent(ACTION_DELETE_NOTIFICATION);
intent.putExtra("im.status.ethereum.deepLink", deepLink);
return PendingIntent.getBroadcast(context.getApplicationContext(), notificationId, intent, PendingIntent.FLAG_CANCEL_CURRENT);
return PendingIntent.getBroadcast(context.getApplicationContext(), notificationId, intent,
PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_MUTABLE);
}

public void removeStatusMessage(Bundle bundle) {
Expand Down
2 changes: 1 addition & 1 deletion nix/pkgs/android-sdk/compose.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ androidenv.composeAndroidPackages {
toolsVersion = "26.1.1";
platformToolsVersion = "33.0.1";
buildToolsVersions = [ "31.0.0" ];
platformVersions = [ "30" ];
platformVersions = [ "31" ];
cmakeVersions = [ "3.18.1" ];
ndkVersion = "22.1.7171670";
includeNDK = true;
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ if [[ -n "${OPENSEA_API_KEY}" ]]; then append_env_export 'OPENSEA_API_KEY'; fi

# If no secrets were passed there's no need to pass the 'secretsFile'.
if [[ -s "${SECRETS_FILE_PATH}" ]]; then
nixOpts+=("--option" "extra-sandbox-paths" "${SECRETS_FILE_PATH}")
nixOpts+=("--argstr" "secretsFile" "${SECRETS_FILE_PATH}")
fi
nixOpts+=("--option" "extra-sandbox-paths" "${KEYSTORE_PATH} ${SECRETS_FILE_PATH}")

# Used by Clojure at compile time to include JS modules
nixOpts+=("--argstr" "buildEnv" "$(must_get_env BUILD_ENV)")
Expand Down
72 changes: 72 additions & 0 deletions src/quo2/components/tabs/account_selector.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
(ns quo2.components.tabs.account-selector
(:require
[quo.theme :as theme]
[quo.react-native :as rn]
[quo2.foundations.colors :as colors]
[quo2.components.markdown.text :as quo2]))

(def themes
{:light {:default {:bg colors/neutral-10
:account-text colors/black
:label-text colors/neutral-50}
:transparent {:bg colors/neutral-80-opa-5
:account-text colors/black
:label-text colors/neutral-80-opa-40}}

:dark {:default {:bg colors/neutral-80-opa-80
:account-text colors/white
:label-text colors/neutral-40}
:transparent {:bg colors/white-opa-5
:account-text colors/white
:label-text colors/neutral-40}}})

(defn account-container-row [background-color]
{:padding-vertical 4
:flex-direction :row
:align-items :center
:background-color background-color
:border-radius 12})

(def account-emoji
{:height 16
:width 16})

(def account-emoji-container
{:background-color (colors/custom-color :purple 50)
:padding 8
:justify-content :center
:align-items :center
:border-radius 10
:margin-left 4
:margin-right 8})

(defn get-color-by-type [type key]
(get-in themes [(theme/get-theme) type key]))

(defn account-selector
"[account-selector opts]
opts
{:show-label? true/false ;; hide or show the label
:transparent? true/false ;; implement transparent background styles
:style style ;; any other styling can be passed
:label-text \"Label\" ;; content to show where the label should be shown
:account-text \"My Savings\" ;; content in place of account name
}"
[{:keys [show-label? account-text account-emoji transparent? label-text style]}]
(let [background-color (get-color-by-type (if transparent? :transparent :default) :bg)
account-text-color (get-color-by-type (if transparent? :transparent :default) :account-text)
label-text-color (get-color-by-type (if transparent? :transparent :default) :label-text)]
[rn/view {:style style}
(when show-label? [quo2/text {:weight :medium
:size :paragraph-2
:style {:color label-text-color
:margin-bottom 8}}
label-text])
[rn/view {:style (account-container-row background-color)}
[rn/view {:style account-emoji-container}
[quo2/text account-emoji]]
[quo2/text {:weight :medium
:size :paragraph-1
:style {:color account-text-color}}
account-text]]]))

6 changes: 5 additions & 1 deletion src/quo2/screens/main.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
[quo2.screens.info.lowest-price :as lowest-price]
[quo2.screens.avatars.channel-avatar :as channel-avatar]
[quo2.screens.switcher.switcher-cards :as switcher-cards]
[quo2.screens.tabs.account-selector :as account-selector]
[re-frame.core :as re-frame]))

(def screens-categories
Expand Down Expand Up @@ -93,7 +94,10 @@
:component segmented/preview-segmented}
{:name :tabs
:insets {:top false}
:component tabs/preview-tabs}]
:component tabs/preview-tabs}
{:name :account-selector
:insets {:top false}
:component account-selector/preview-this}]
:tags [{:name :context-tags
:insets {:top false}
:component context-tags/preview-context-tags}
Expand Down
69 changes: 69 additions & 0 deletions src/quo2/screens/tabs/account_selector.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
(ns quo2.screens.tabs.account-selector
(:require [quo.react-native :as rn]
[quo.previews.preview :as preview]
[reagent.core :as reagent]
[quo2.foundations.colors :as colors]
[quo2.components.tabs.account-selector :as quo2]))

(def descriptor [{:label "Show Label?:"
:key :show-label?
:type :boolean}
{:label "Transparent Background?:"
:key :transparent?
:type :boolean}
{:label "Account Text"
:key :account-text
:type :text}
{:label "Label Text"
:key :label-text
:type :text}])

;; keeping this unused data structure in the code for now
;; will reference them when I introduce multiple account support
;; and allow passing lists of accounts instead of just 1 account
(def single-account
[{:account-text "My Savings"
:account-emoji "🍑"
:label-text "Label"}])

(def two-accounts
[{:account-text "My Savings"
:account-emoji "🍑"
:label-text "Label"}
{:account-text "My Current"
:account-emoji "🍎"
:label-text "Label 2"}])

(def many-accounts
[{:account-text "My Savings"
:account-emoji "🍑"
:label-text "Label"}
{:account-text "My Current"
:account-emoji "🍎"
:label-text "Label 2"}
{:account-text "My Reimbursment"
:account-emoji "🍟"
:label-text "Label 3"}])

(defn cool-preview []
(let [state (reagent/atom {:show-label? true
:transparent? false
:style {:width :100%}
:account-text "My Savings"
:account-emoji "🍑"
:label-text "Label"})]
(fn []
[rn/view {:margin-bottom 50
:padding 16}
[preview/customizer state descriptor]
[rn/view {:padding-vertical 60
:align-items :center}
[quo2/account-selector @state]]])))

(defn preview-this []
[rn/view {:background-color (colors/theme-colors colors/white colors/neutral-90)
:flex 1}
[rn/flat-list {:flex 1
:keyboardShouldPersistTaps :always
:header [cool-preview]
:key-fn str}]])

0 comments on commit 89f295c

Please sign in to comment.