-
Notifications
You must be signed in to change notification settings - Fork 7
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
Feature in app referral program #1594
Merged
sultanmyrza-numbersprotocol
merged 14 commits into
develop
from
feature-in-app-referral-program
May 10, 2022
+283
−14
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
41eac36
feat(invitation.page): add empty page for invitation UI
sultanmyrza-numbersprotocol 3e9e166
feat(invitation.page): implement basic ui
sultanmyrza-numbersprotocol cdbb06a
feat(invitation.page): show referral code
sultanmyrza-numbersprotocol bb8dcb4
feat(signup.page): add referral code field
sultanmyrza-numbersprotocol 06ba533
feat(invitation.page): share referral code
sultanmyrza-numbersprotocol 9a00a43
fix(invitation.page): refetch referral code
sultanmyrza-numbersprotocol a1b0eaa
fix(invitation.page.scss): linting
sultanmyrza-numbersprotocol f19b462
fix(invitation.page): remove unused ui element
sultanmyrza-numbersprotocol 73253dc
fix(invitation.page.ts): remove comment, await on promise
sultanmyrza-numbersprotocol 43eb0b2
fix(invitation.page.html): use translations
sultanmyrza-numbersprotocol a170c3a
fix(signup.page.ts): toUpperCase referralCode field
sultanmyrza-numbersprotocol d3aa29e
fix(share.service.ts): get share text via translocoService
sultanmyrza-numbersprotocol 6beb2e1
fix(invitation.page): remove share social icons
sultanmyrza-numbersprotocol e92afde
fix(zh-tw.json): for referralCodeOptional
sultanmyrza-numbersprotocol File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { Routes, RouterModule } from '@angular/router'; | ||
|
||
import { InvitationPage } from './invitation.page'; | ||
|
||
const routes: Routes = [ | ||
{ | ||
path: '', | ||
component: InvitationPage, | ||
}, | ||
]; | ||
|
||
@NgModule({ | ||
imports: [RouterModule.forChild(routes)], | ||
exports: [RouterModule], | ||
}) | ||
export class InvitationPageRoutingModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { SharedModule } from '../../shared/shared.module'; | ||
import { InvitationPageRoutingModule } from './invitation-routing.module'; | ||
import { InvitationPage } from './invitation.page'; | ||
|
||
@NgModule({ | ||
imports: [SharedModule, InvitationPageRoutingModule], | ||
declarations: [InvitationPage], | ||
}) | ||
export class InvitationPageModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<mat-toolbar *transloco="let t"> | ||
<button routerLink=".." routerDirection="back" mat-icon-button> | ||
<mat-icon>arrow_back</mat-icon> | ||
</button> | ||
<span>{{ t('invitation.invitation') }}</span> | ||
</mat-toolbar> | ||
|
||
<ion-content *transloco="let t"> | ||
<ng-container *ngIf="referralCode$ | ngrxPush as referralCode"> | ||
<ion-card> | ||
<ion-grid> | ||
<ion-row> | ||
<ion-col sizeMd="6" offsetMd="3" sizeXs="10" offsetXs="1"> | ||
<div class="title">{{ t('invitation.shareInvitationCode') }}</div> | ||
<div class="subtitle">{{ t('invitation.shareToGetRewarded') }}</div> | ||
|
||
<div class="title">{{ referralCode }}</div> | ||
|
||
<div class="spacer-12"></div> | ||
|
||
<ion-button (click)="shareReferralCode()" expand="block"> | ||
{{ t('share') }} | ||
</ion-button> | ||
</ion-col> | ||
</ion-row> | ||
</ion-grid> | ||
</ion-card> | ||
</ng-container> | ||
|
||
<div class="spacer-24"></div> | ||
</ion-content> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
ion-card { | ||
padding-top: 8px; | ||
padding-bottom: 8px; | ||
background: white; | ||
border-radius: 15px; | ||
} | ||
|
||
.title { | ||
text-align: center; | ||
font-style: normal; | ||
font-weight: 500; | ||
font-size: 24px; | ||
color: black; | ||
} | ||
|
||
.subtitle { | ||
text-align: center; | ||
font-size: 14px; | ||
margin-bottom: 12px; | ||
color: black; | ||
} | ||
|
||
ion-button { | ||
--border-radius: 15px; | ||
--color: white; | ||
--background: #00c9ff; | ||
|
||
font-style: normal; | ||
font-weight: 500; | ||
font-size: 18px; | ||
} | ||
|
||
.spacer-12 { | ||
height: 12px; | ||
} | ||
|
||
.spacer-24 { | ||
height: 24px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; | ||
import { IonicModule } from '@ionic/angular'; | ||
import { SharedTestingModule } from '../../shared/shared-testing.module'; | ||
import { InvitationPage } from './invitation.page'; | ||
|
||
describe('InvitationPage', () => { | ||
let component: InvitationPage; | ||
let fixture: ComponentFixture<InvitationPage>; | ||
|
||
beforeEach( | ||
waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [InvitationPage], | ||
imports: [IonicModule.forRoot(), SharedTestingModule], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(InvitationPage); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}) | ||
); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { DiaBackendAuthService } from '../../shared/dia-backend/auth/dia-backend-auth.service'; | ||
import { ShareService } from '../../shared/share/share.service'; | ||
|
||
@Component({ | ||
selector: 'app-invitation', | ||
templateUrl: './invitation.page.html', | ||
styleUrls: ['./invitation.page.scss'], | ||
}) | ||
export class InvitationPage implements OnInit { | ||
readonly referralCode$ = this.diaBackendAuthService.referralCode$; | ||
|
||
constructor( | ||
private readonly diaBackendAuthService: DiaBackendAuthService, | ||
private readonly shareService: ShareService | ||
) {} | ||
|
||
ngOnInit(): void { | ||
this.refetchReferralCode(); | ||
} | ||
|
||
async refetchReferralCode() { | ||
const referralCode = await this.diaBackendAuthService.getReferralCode(); | ||
if (!referralCode) | ||
await this.diaBackendAuthService.syncProfile$().toPromise(); | ||
} | ||
|
||
async shareReferralCode() { | ||
const referralCode = await this.diaBackendAuthService.getReferralCode(); | ||
this.shareService.shareReferralCode(referralCode); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worrying that doing form validation for lowercase letters would have negative UX impact for users that aren't aware of the fact that the referral code is case-sensitive. It's possible for some users to not understand why the referral code is not working when they type the code in lowercase.
In my opinion converting user's input to uppercase automatically would be a more ideal way. Let me know what do you think.