Skip to content

Commit fd3f005

Browse files
committed
Fix button
1 parent 4c7412d commit fd3f005

6 files changed

Lines changed: 53 additions & 16 deletions

File tree

android/app/src/main/res/layout/activity_login.xml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,22 @@
2626

2727
<com.google.android.material.button.MaterialButton
2828
android:id="@+id/button"
29+
style="@style/Widget.MaterialComponents.Button.Icon"
2930
android:layout_width="wrap_content"
3031
android:layout_height="wrap_content"
3132
android:layout_marginTop="40dp"
32-
android:textSize="16sp"
33-
android:padding="10dp"
34-
android:textColor="@color/white"
3533
android:backgroundTint="#2196f3"
36-
android:text="@string/sign_in_button"
37-
app:layout_constraintEnd_toEndOf="parent"
38-
app:layout_constraintStart_toStartOf="parent"
3934
android:drawableTint="@color/white"
35+
android:padding="10dp"
36+
android:text="@string/sign_in_button"
37+
android:textColor="@color/white"
38+
android:textSize="16sp"
4039
app:icon="@drawable/ic_login"
4140
app:iconTint="@color/white"
42-
style="@style/Widget.MaterialComponents.Button.Icon"
43-
app:layout_constraintTop_toBottomOf="@+id/textField" />
41+
app:layout_constraintEnd_toEndOf="parent"
42+
app:layout_constraintStart_toStartOf="parent"
43+
app:layout_constraintTop_toBottomOf="@+id/textField"
44+
tools:ignore="TextContrastCheck" />
4445

4546
<ImageView
4647
android:id="@+id/imageView"
@@ -54,4 +55,20 @@
5455
app:layout_constraintTop_toTopOf="parent"
5556
app:srcCompat="@drawable/ic_colored_logo"
5657
tools:ignore="ImageContrastCheck" />
57-
</androidx.constraintlayout.widget.ConstraintLayout>
58+
59+
<TextView
60+
android:id="@+id/textView"
61+
android:layout_width="wrap_content"
62+
android:layout_height="wrap_content"
63+
android:layout_marginBottom="20dp"
64+
android:autoLink="web"
65+
android:lineHeight="28sp"
66+
android:textAlignment="center"
67+
android:textSize="20sp"
68+
android:text="@string/get_your_api_key"
69+
app:layout_constraintBottom_toTopOf="@+id/textField"
70+
app:layout_constraintEnd_toEndOf="parent"
71+
app:layout_constraintHorizontal_bias="0.498"
72+
app:layout_constraintStart_toStartOf="parent" />
73+
74+
</androidx.constraintlayout.widget.ConstraintLayout>

android/app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
<string name="sign_in_button">Login With API Key</string>
99
<string name="text_area_api_key">API Key</string>
1010
<string name="img_http_sms_logo">HTTP Sms Logo</string>
11+
<string name="get_your_api_key">Open\nhttpsms.com/settings\nto get your API key</string>
1112
</resources>

web/components/FirebaseAuth.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</template>
1414

1515
<script lang="ts">
16-
import { Vue, Component } from 'vue-property-decorator'
16+
import { Vue, Component, Prop } from 'vue-property-decorator'
1717
import { ProviderId } from 'firebase/auth'
1818
import { auth } from 'firebaseui'
1919
import { NotificationRequest } from '~/store'
@@ -23,6 +23,8 @@ export default class FirebaseAuth extends Vue {
2323
ui: auth.AuthUI | null = null
2424
firebaseUIInitialized = false
2525
26+
@Prop({ required: false, type: String, default: '/' }) to!: string
27+
2628
beforeDestroy(): void {
2729
if (this.ui) {
2830
this.ui.delete()
@@ -46,7 +48,7 @@ export default class FirebaseAuth extends Vue {
4648
message: 'Login successfull!',
4749
type: 'success',
4850
} as NotificationRequest)
49-
this.$router.push({ name: 'threads' })
51+
this.$router.push({ path: this.to })
5052
return false
5153
},
5254
uiShown: () => {

web/layouts/default.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ export default class DefaultLayout extends Vue {
4444
await this.$store.dispatch('setPolling', true)
4545
4646
const promises = []
47-
if (this.$store.getters.getOwner) {
47+
if (this.$store.getters.getUser && this.$store.getters.getOwner) {
4848
promises.push(
4949
this.$store.dispatch('loadThreads'),
5050
this.$store.dispatch('getHeartbeat'),
5151
this.$store.dispatch('loadPhones', true)
5252
)
5353
}
5454
55-
if (this.$store.getters.hasThread) {
55+
if (this.$store.getters.hasThread && this.$store.getters.getUser) {
5656
promises.push(
5757
this.$store.dispatch(
5858
'loadThreadMessages',

web/middleware/auth.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
import { Context, Middleware } from '@nuxt/types'
2+
import { NotificationRequest } from '~/store'
23

3-
const authMiddleware: Middleware = (context: Context) => {
4+
const authMiddleware: Middleware = async (context: Context) => {
45
if (context.store.getters.getAuthUser === null) {
5-
context.redirect('/login')
6+
const notification: NotificationRequest = {
7+
message: 'Login to continue',
8+
type: 'info',
9+
}
10+
await context.store.dispatch('addNotification', notification)
11+
12+
context.redirect('/login', { to: context.route.path })
613
}
714
}
815

web/pages/login.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<v-card max-width="360" class="mx-auto">
1212
<v-card-text class="px-0">
1313
<no-ssr>
14-
<firebase-auth></firebase-auth>
14+
<firebase-auth :to="to"></firebase-auth>
1515
</no-ssr>
1616
</v-card-text>
1717
</v-card>
@@ -29,5 +29,15 @@ import Vue from 'vue'
2929
export default Vue.extend({
3030
name: 'LoginIndex',
3131
middleware: ['guest'],
32+
data() {
33+
return {
34+
to: '/',
35+
}
36+
},
37+
mounted() {
38+
if (this.$route.query.to) {
39+
this.to = this.$route.query.to as string
40+
}
41+
},
3242
})
3343
</script>

0 commit comments

Comments
 (0)