Skip to content

Commit

Permalink
import contact data
Browse files Browse the repository at this point in the history
  • Loading branch information
strukturart committed Feb 4, 2024
1 parent ac524c8 commit 96dc997
Show file tree
Hide file tree
Showing 13 changed files with 562 additions and 311 deletions.
76 changes: 76 additions & 0 deletions application/assets/images/call.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
132 changes: 132 additions & 0 deletions application/assets/images/person.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions application/assets/js/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ const helper = (() => {
}

let request = sdcard.get(filepath);
console.log(filepath);

request.onsuccess = function (e) {
const file = e.target.result; // The retrieved file
Expand All @@ -284,7 +283,6 @@ const helper = (() => {

reader.addEventListener("load", function (event) {
callback(event.target.result);
console.log(event.target.result);
});

reader.readAsText(file);
Expand Down Expand Up @@ -330,7 +328,7 @@ const helper = (() => {
// success copy and delete
let a = new_filename + "." + file_extension;

callback(a);
callback(a, filename);

helper.side_toaster("successfully renamed", 3000);
};
Expand Down
2 changes: 2 additions & 0 deletions application/assets/js/ical.min.js

Large diffs are not rendered by default.

80 changes: 80 additions & 0 deletions application/assets/js/mozactivity.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,89 @@ const mozactivity = (() => {
}
};

let pickContact = (callback) => {
try {
let pick = new MozActivity({
name: "pick",
data: {
type: ["webcontacts/contact"],
},
});

pick.onsuccess = function (e) {
callback(pick.result.contact, "k2");
};

pick.onerror = function () {
general.blocker = false;
console.log("The activity encounter en error: " + this.error);
};
} catch (e) {
console.log(e);
general.blocker = false;
}

if ("b2g" in navigator) {
let pick = new WebActivity("pick", {
type: "webcontacts/contact",
});

pick.start().then(
(rv) => {
general.blocker = false;

callback(rv.contact, "k3");
},
(err) => {
general.blocker = false;

console.log(err);
}
);
}
};

var sms = (n) => {
const smsLink = document.createElement("a");

smsLink.href = "sms:" + n;

smsLink.textContent = "Call Now";

document.body.appendChild(smsLink);

smsLink.addEventListener("click", function () {});

smsLink.click();
document.body.removeChild(smsLink);
};

let dial = (n) => {
// Create the <a> element
const telLink = document.createElement("a");

// Set the href attribute with the tel: protocol
telLink.href = "tel:" + n;

// Set the text content of the link
telLink.textContent = "Call Now";

// Append the link to the body (or any other desired container)
document.body.appendChild(telLink);

telLink.addEventListener("click", function () {});

telLink.click();

document.body.removeChild(telLink);
};

return {
photo,
openSettings,
pickGallery,
dial,
sms,
pickContact,
};
})();
Loading

0 comments on commit 96dc997

Please sign in to comment.