Skip to content

Commit

Permalink
Merge pull request #37 from Circle-Company/fix-1.0.3-release
Browse files Browse the repository at this point in the history
Fix 1.0.3 release #26
  • Loading branch information
tiagosavioli authored Nov 13, 2024
2 parents a43151e + 1068f3a commit 952db21
Show file tree
Hide file tree
Showing 17 changed files with 154 additions and 127 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ android {
applicationId "com.circlecompany.circleapp"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 3
versionName "1.0.2"
versionCode 4
versionName "1.0.3"
}
signingConfigs {
release {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "circle",
"version": "1.0.2",
"version": "1.0.3",
"private": true,
"scripts": {
"android": "react-native run-android",
Expand Down
24 changes: 16 additions & 8 deletions src/components/auth/password_input.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
import React, { useState, useEffect } from "react"
import React, { useState } from "react"
import { Pressable, TextInput, useColorScheme } from "react-native"
import ColorTheme, { colors } from "../../layout/constants/colors"
import fonts from "../../layout/constants/fonts"
import Icon from "../../assets/icons/svgs/lock.svg"
import { Text, View } from "../Themed"
import CheckIcon from "../../assets/icons/svgs/check_circle.svg"
import XIcon from "../../assets/icons/svgs/close.svg"
import Eye from "../../assets/icons/svgs/eye.svg"
import EyeSlash from "../../assets/icons/svgs/eye_slash.svg"
import sizes from "../../layout/constants/sizes"
import api from "../../services/Api"
import Icon from "../../assets/icons/svgs/lock.svg"
import AuthContext from "../../contexts/auth"
import ColorTheme, { colors } from "../../layout/constants/colors"
import fonts from "../../layout/constants/fonts"
import sizes from "../../layout/constants/sizes"
import { Text, View } from "../Themed"

export default function PasswordInput({ sign = true }: { sign?: boolean }) {
const isDarkMode = useColorScheme() === "dark"
const { setSignInputPassword, signInputUsername } = React.useContext(AuthContext)
const [password, setPassword] = useState("")
const [showStatusMessage, setShowStatusMessage] = useState(false)
const [statusMessage, setStatusMessage] = useState("")
const [isValidPassword, setIsValidPassword] = useState(true)
const [isValidPassword, setIsValidPassword] = useState(false)
const [isVisible, setIsVisible] = useState(false)
const inputRef = React.useRef<TextInput>(null)

Expand Down Expand Up @@ -147,6 +146,15 @@ export default function PasswordInput({ sign = true }: { sign?: boolean }) {
}
}, [password, inputRef])

React.useEffect(() => {
if (password.length <= 5) {
setIsValidPassword(false)
setStatusMessage("The Password needs least 6 characters.")
setShowStatusMessage(true)
setSignInputPassword("")
}
})

return (
<View style={styles.container}>
<View style={styles.inputContainer}>
Expand Down
2 changes: 1 addition & 1 deletion src/components/moment/components/moment-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function Container({
React.useContext(MomentContext)
const { session } = React.useContext(PersistedContext)
const { commentEnabled, setFocusedMoment } = React.useContext(FeedContext)
const navigation = useNavigation()
const navigation: any = useNavigation()

const container: any = {
...momentSize,
Expand Down
27 changes: 20 additions & 7 deletions src/components/moment/components/moment-like.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import ColorTheme, { colors } from "../../../layout/constants/colors"
import fonts from "../../../layout/constants/fonts"
import sizes from "../../../layout/constants/sizes"
import { Vibrate } from "../../../lib/hooks/useHapticFeedback"
import { useLikeMutation, useUnlikeMutation } from "../../../state/queries/like"
import api from "../../../services/Api"
import { Text } from "../../Themed"
import MomentContext from "../context"
import { MomentLikeProps } from "../moment-types"
Expand All @@ -28,9 +28,6 @@ export default function like({
var animatedScaleIconPressed = React.useRef(new Animated.Value(1)).current
var animatedScaleIcon = React.useRef(new Animated.Value(1)).current

const likeMutation = useLikeMutation({ momentId: momentData.id, userId: session.user.id })
const unlikeMutation = useUnlikeMutation({ momentId: momentData.id, userId: session.user.id })

React.useEffect(() => {
animatedScale.setValue(1)
}, [])
Expand Down Expand Up @@ -104,7 +101,7 @@ export default function like({
const blur_container_likePressed = {
backgroundColor: ColorTheme().like,
}
const pressable_container = {
const pressable_container: any = {
overflow: "hidden",
borderRadius: Number([sizes.buttons.width / 4]) / 2,
}
Expand All @@ -127,13 +124,29 @@ export default function like({
Vibrate("effectClick")
HandleButtonAnimation()
momentUserActions.handleLikeButtonPressed({ likedValue: true })
likeMutation.mutate()
await api.post(
`/moments/${momentData.id}/like`,
{},
{
headers: {
authorization_token: session.account.jwtToken,
},
}
)
}
async function onUnlikeAction() {
Vibrate("effectTick")
HandleButtonAnimation()
momentUserActions.handleLikeButtonPressed({ likedValue: false })
unlikeMutation.mutate()
await api.post(
`/moments/${momentData.id}/unlike`,
{},
{
headers: {
authorization_token: session.account.jwtToken,
},
}
)
}

const like_fill: string = String(colors.gray.white)
Expand Down
14 changes: 2 additions & 12 deletions src/config/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
import {
API_VERSION,
APP_VERSION,
DEBUG,
DEVELOPMENT_API_ENDPOINT,
LOG_DEBUG,
LOG_LEVEL,
MIXPANEL_KEY,
NODE_ENV,
PRODUCTION_API_ENDPOINT,
} from "@env"
import { API_VERSION, APP_VERSION, DEBUG, LOG_DEBUG, LOG_LEVEL, MIXPANEL_KEY, NODE_ENV } from "@env"
import emails from "./emails"
import metadata from "./metadata"

Expand All @@ -22,7 +12,7 @@ const environment = {

const api = {
API_VERSION: API_VERSION,
ENDPOINT: environment.PRODUCTION ? PRODUCTION_API_ENDPOINT : DEVELOPMENT_API_ENDPOINT,
ENDPOINT: "192.168.15.10:3000", //"52.202.133.96:3000",
}

const analytics = {
Expand Down
2 changes: 1 addition & 1 deletion src/contexts/Persisted/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function Provider({ children }: PersistedProviderProps) {
}
}
)
}, [sessionAccount])
}, [])

React.useEffect(() => {
const isSigned = checkIsSigned()
Expand Down
89 changes: 49 additions & 40 deletions src/contexts/Persisted/persistedAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const storageKey = storageKeys().account

export interface AccountState extends AccountDataType {
setUnreadNotificationsCount: (value: number) => void
setFirebasePushToken: (value: string) => void
setJwtToken: (value: string) => void
setJwtExpiration: (value: string) => void
setBlocked: (value: boolean) => void
Expand All @@ -19,7 +18,6 @@ export interface AccountState extends AccountDataType {

export const useAccountStore = create<AccountState>((set) => ({
unreadNotificationsCount: storage.getNumber(storageKey.unreadNotificationsCount) || 0,
firebasePushToken: storage.getString(storageKey.firebasePushToken) || "",
jwtToken: storage.getString(storageKey.jwt.token) || "",
jwtExpiration: storage.getString(storageKey.jwt.expiration) || "",
blocked: storage.getBoolean(storageKey.blocked) || false,
Expand All @@ -28,65 +26,78 @@ export const useAccountStore = create<AccountState>((set) => ({
last_login_at: storage.getString(storageKey.last_login_at) || new Date().toString(),

setUnreadNotificationsCount: (value: number) => {
storage.set(storageKey.unreadNotificationsCount, Number(value))
set({ unreadNotificationsCount: value })
},

setFirebasePushToken: (value: string) => {
storage.set(storageKey.firebasePushToken, value.toString())
set({ firebasePushToken: value })
if (typeof value === "number") {
storage.set(storageKey.unreadNotificationsCount, value)
set({ unreadNotificationsCount: value })
}
},

setJwtToken: (value: string) => {
if (value) storage.set(storageKey.jwt.token, value)
set({ jwtToken: value })
if (typeof value === "string") {
storage.set(storageKey.jwt.token, value)
set({ jwtToken: value })
}
},

setJwtExpiration: (value: string) => {
if (value) storage.set(storageKey.jwt.expiration, value)
set({ jwtExpiration: value })
if (typeof value === "string") {
storage.set(storageKey.jwt.expiration, value)
set({ jwtExpiration: value })
}
},

setBlocked: (value: boolean) => {
storage.set(storageKey.blocked, value)
set({ blocked: value })
if (typeof value === "boolean") {
storage.set(storageKey.blocked, value)
set({ blocked: value })
}
},

setMuted: (value: boolean) => {
storage.set(storageKey.muted, value)
set({ muted: value })
if (typeof value === "boolean") {
storage.set(storageKey.muted, value)
set({ muted: value })
}
},

setLastActiveAt: (value: string) => {
storage.set(storageKey.last_active_at, value)
set({ last_active_at: value })
if (typeof value === "string") {
storage.set(storageKey.last_active_at, value)
set({ last_active_at: value })
}
},

setLastLoginAt: (value: string) => {
storage.set(storageKey.last_login_at, value)
set({ last_login_at: value })
if (typeof value === "string") {
storage.set(storageKey.last_login_at, value)
set({ last_login_at: value })
}
},

set: (value: AccountDataType) => {
set({
unreadNotificationsCount: 0,
firebasePushToken: value.firebasePushToken,
blocked: value.blocked,
muted: value.muted,
last_active_at: value.last_active_at,
last_login_at: value.last_login_at,
jwtToken: value.jwtToken,
jwtExpiration: value.jwtExpiration,
unreadNotificationsCount: value.unreadNotificationsCount || 0,
blocked: value.blocked || false,
muted: value.muted || false,
last_active_at: value.last_active_at || new Date().toString(),
last_login_at: value.last_login_at || new Date().toString(),
jwtToken: value.jwtToken || "",
jwtExpiration: value.jwtExpiration || "",
})
storage.set(storageKey.unreadNotificationsCount, 0)
storage.set(storageKey.firebasePushToken, value.firebasePushToken.toString())
storage.set(storageKey.blocked, value.blocked)
storage.set(storageKey.jwt.token, value.jwtToken)
storage.set(storageKey.jwt.expiration, value.jwtExpiration)
storage.set(storageKey.muted, value.blocked)
storage.set(storageKey.last_active_at, value.last_active_at)
storage.set(storageKey.last_login_at, value.last_login_at)

/**
storage.set(storageKey.unreadNotificationsCount, value.unreadNotificationsCount || 0)
storage.set(storageKey.blocked, value.blocked || false)
storage.set(storageKey.muted, value.muted || false)
storage.set(storageKey.jwt.token, value.jwtToken || "")
storage.set(storageKey.jwt.expiration, value.jwtExpiration || "")
storage.set(storageKey.last_active_at, value.last_active_at || new Date().toString())
storage.set(storageKey.last_login_at, value.last_login_at || new Date().toString())*/
},
load: () => {
set({
unreadNotificationsCount: storage.getNumber(storageKey.unreadNotificationsCount) || 0,
firebasePushToken: storage.getString(storageKey.firebasePushToken) || "",
blocked: storage.getBoolean(storageKey.blocked) || false,
muted: storage.getBoolean(storageKey.muted) || false,
jwtToken: storage.getString(storageKey.jwt.token) || "",
Expand All @@ -97,7 +108,6 @@ export const useAccountStore = create<AccountState>((set) => ({
},
remove: () => {
storage.delete(storageKey.unreadNotificationsCount)
storage.delete(storageKey.firebasePushToken)
storage.delete(storageKey.blocked)
storage.delete(storageKey.muted)
storage.delete(storageKey.jwt.token)
Expand All @@ -107,7 +117,6 @@ export const useAccountStore = create<AccountState>((set) => ({

set({
unreadNotificationsCount: 0,
firebasePushToken: "",
blocked: false,
muted: false,
jwtToken: "",
Expand Down
1 change: 0 additions & 1 deletion src/contexts/Persisted/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export type AccountDataType = {
muted: boolean
last_active_at: string
last_login_at: string
firebasePushToken: string
jwtToken: string
jwtExpiration: string
}
Expand Down
Loading

0 comments on commit 952db21

Please sign in to comment.