Skip to content

Commit

Permalink
update 1.0.6
Browse files Browse the repository at this point in the history
- alert notif by snackbar
- copy clipboard
  • Loading branch information
dyazincahya committed Jun 29, 2023
1 parent a99fa12 commit d342cfd
Show file tree
Hide file tree
Showing 10 changed files with 156 additions and 23 deletions.
4 changes: 2 additions & 2 deletions App_Resources/Android/app.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
targetSdkVersion 31

// Version Information
versionCode 4
versionName "1.0.2"
versionCode 6
versionName "1.0.6"

generatedDensities = []
}
Expand Down
12 changes: 12 additions & 0 deletions app/_app-common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,18 @@
font-size: 18;
}

.name {
color: #212121;
font-size: 14;
}
.message {
color: #616161;
font-size: 13;
}
.country {
color: #757575;
font-size: 12;
}
.date-time {
color: #757575;
}
Expand Down
5 changes: 4 additions & 1 deletion app/about/about-page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
<Label text="23 Juny 2023" textWrap="true" class="desc" />

<Label text="Current Version" textWrap="true" class="title" marginTop="10" />
<Label text="v1.0.0" textWrap="true" class="desc" />
<Label text="v1.0.5" textWrap="true" class="desc" />

<Label text="Developer" textWrap="true" class="title" marginTop="10" />
<Label text="x-labs.my.id by KANG-CAHYA.COM" textWrap="true" class="desc" />

<Label text="#CREDIT" textWrap="true" fontSize="28" color="#E0E0E0" marginTop="20" horizontalAlignment="right" />

Expand Down
13 changes: 11 additions & 2 deletions app/global_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,17 @@ export function getCurrentTime() {
],
monthName = months[d.getMonth()];

var days = ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jum'at", "Sabtu"],
dayName = days[d.getDay()];
// var days = ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jum'at", "Sabtu"];
var days = [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
];
var dayName = days[d.getDay()];

var result =
dayName +
Expand Down
39 changes: 36 additions & 3 deletions app/history/history-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ import {
Dialogs,
} from "@nativescript/core";
import { shareText } from "@nativescript/social-share";
import { Clipboard } from "@nativescript-use/nativescript-clipboard";
import { SnackBar } from "@nativescript-community/ui-material-snackbar";

var model = GlobalModel([]);
var context;

const dataHistory = new ObservableArray([]);
const clipboard = new Clipboard();
const snackbar = new SnackBar();

export function onLoaded() {
__loadData();
Expand All @@ -33,7 +37,10 @@ export function __loadData() {
if (data.length > 0) {
for (let i = 0; i < data.length; i++) {
dataHistory.push({
name: data[i].name,
phone: data[i].phone,
message: data[i].message,
country: data[i].countryName,
flag: data[i].countryFlag,
dateTime: data[i].dateTime,
});
Expand All @@ -57,7 +64,14 @@ export function clearTap() {
if (result) {
LSdrop();
__loadData();
alert("Successfully cleared history data :)");
snackbar.action({
message: "Successfully cleared history data :)",
actionText: "X",
textColor: "#FFFFFF",
actionTextColor: "#FFFFFF",
backgroundColor: "#1565C0",
hideDelay: 2000,
});
}
});
}
Expand All @@ -75,7 +89,7 @@ export function onItemTap(args) {
title: "Actions for " + itemTapData.phone,
message: "",
cancelButtonText: "Cancel",
actions: ["Go to WhatsApp", "Share To", "Remove"],
actions: ["Go to WhatsApp", "Copy Phone Number", "Share To", "Remove"],
cancelable: true, // Android only
};

Expand All @@ -89,6 +103,18 @@ export function onItemTap(args) {
Utils.openUrl(fullUrl);
break;

case "COPY PHONE NUMBER":
clipboard.copy(itemTapData.phone);
snackbar.action({
message: itemTapData.phone + " has been copied",
actionText: "X",
textColor: "#333333",
actionTextColor: "#333333",
backgroundColor: "#FFEB3B",
hideDelay: 2000,
});
break;

case "SHARE TO":
shareText(itemTapData.phone);
break;
Expand All @@ -103,7 +129,14 @@ export function onItemTap(args) {
if (result === true) {
LSremove(itemIndex);
__loadData();
alert(itemTapData.phone + " has been removed");
snackbar.action({
message: itemTapData.phone + " has been removed",
actionText: "X",
textColor: "#FFFFFF",
actionTextColor: "#FFFFFF",
backgroundColor: "#1565C0",
hideDelay: 2000,
});
}
});
break;
Expand Down
11 changes: 7 additions & 4 deletions app/history/history-page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@
<GridLayout rows="auto,auto,auto,auto" height="100%" class="history">
<ListView height="100%" row="1" items="{{ items }}" itemTap="onItemTap" separatorColor="#40aeff" class="list-group" visibility="{{ items != false ? 'visible' : 'collapsed' }}">
<ListView.itemTemplate>
<GridLayout class="list-group-item" columns="*,auto" rows="auto,auto,auto">
<Label text="{{ flag + ' ' + phone }}" textWrap="true" class="phone" col="0" row="0" />
<Label text="{{ dateTime }}" textWrap="true" class="date-time" col="0" row="1" />
<Label text="Tap here to show actions!" textWrap="true" class="info" col="0" row="2" />
<GridLayout class="list-group-item" columns="*,auto" rows="auto,auto,auto,auto,auto">
<Label text="{{ flag + ' ' + country }}" textWrap="true" class="country" col="0" row="0" />
<Label text="{{ name }}" textWrap="true" class="name" col="0" row="1" visibility="{{ name === false ? 'collapsed' : 'visible' }}" />
<Label text="{{ phone }}" textWrap="true" class="phone" col="0" row="2" />
<Label text="{{ message }}" textWrap="true" class="message" col="0" row="3" visibility="{{ message === false ? 'collapsed' : 'visible' }}" />
<Label text="{{ dateTime }}" textWrap="true" class="date-time" col="0" row="4" />
<!-- <Label text="Tap here to show actions!" textWrap="true" class="info" col="0" row="4" /> -->
</GridLayout>
</ListView.itemTemplate>
</ListView>
Expand Down
6 changes: 5 additions & 1 deletion app/home/home-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function __parseCountry() {
context.set("countryName", currentCountry.name);
context.set("countryDialCode", currentCountry.dial_code);
context.set("countryFlag", currentCountry.flag);
context.set("hint_text", "Type WhatsApp Number...");
context.set("hint_text", "Type Phone Number...");
context.set("phone_number", "");
} catch (error) {
console.error("Error parsing JSON:", error);
Expand All @@ -85,12 +85,16 @@ export function openApps() {
Utils.openUrl(fullUrl);
const dataInsert = {
guid: generateUUID(),
name: false,
phone: phoneNumber,
message: false,
countryName: currentCountry.name,
countryDialCode: currentCountry.dial_code,
countryFlag: currentCountry.flag,
countryCode: currentCountry.code,
dateTime: getCurrentTime(),
mark: false,
archived: false,
};
LSinsert(dataInsert);

Expand Down
4 changes: 2 additions & 2 deletions app/home/home-page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
<Image src="res://logo" height="50%" row="2" textAlignment="center" loadMode="async" />
<GridLayout columns="*,auto" row="4" class="label-select-country" tap="changeCountry">
<Label text="{{ countryFlag + ' ' + countryDialCode + ' ' + countryName }}" col="0" />
<Label text="&#xf0d7;" class=" fas" col="1" />
<Label text="&#xf0d7;" class="fas" col="1" />
</GridLayout>
<TextField hint="{{ hint_text }}" class="input-number" keyboardType="phone" text="{{ phone_number }}" textAlignment="center" maxLength="25" row="6" />
<TextField hint="{{ hint_text }}" class="input-number" keyboardType="phone" text="{{ phone_number }}" textAlignment="center" maxLength="15" row="6" />
<Button text="Start to send message" class="btn-whatsapp" row="8" tap="openApps" />
</GridLayout>
</StackLayout>
Expand Down
83 changes: 75 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"version": "1.0.0",
"private": true,
"dependencies": {
"@nativescript-community/ui-material-snackbar": "^7.1.3",
"@nativescript-use/nativescript-clipboard": "^0.0.3",
"@nativescript/core": "~8.5.0",
"@nativescript/social-share": "^2.3.0",
"@nativescript/theme": "~3.0.2"
Expand Down

0 comments on commit d342cfd

Please sign in to comment.