IOS widget (via Scriptable)

I wanted to write some iOS friendly guides for Vikunja, and wanted to get feelers out on how the community uses their devices. I currently have shortcuts, widgets, and things stored in both Data Jar and Jayson to assist on getting data in where I need it. if anyone would like a shortcut for completing tasks, adding tasks, or getting data into Data Jar, please let me know.

I also have a custom widget via Scriptable that I use for tasks at home:

let me know if I can be of any help!

3 Likes

OMG yes please-please, give me all you got.

I just hate doing IOS shortcuts…

I personally was thinking about the shortcut that records an audio, sends this audio to OpenAI Whisper model for transcription, then does Chet-GPT post-processing to format it nicely and then uses Vicuña API to submit a new task into the default project.

But anyway, please share yours, anything is going to be useful.

any chance of a writeup of how you work with shortcuts and Vikunja? I take it you’d use the API or webhooks to do so, but would appreciate an explainer to get me started.
Thanks!

Hey all :sweat_smile: sorry about ghosting, been going through things in the personal life, here is an edited version of what I posted up top

// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: deep-green; icon-glyph: home;
runsInWidget: true
//This script gets a list of tasks based off of the projectid and veiw id set on cons
// let time = importModule("UTC")
// let today = time
// console.log(today)

const url = 'https://VIK.URL/api/v1/projects/VIEW_NUM/views/PROJECT_NUM/tasks';

var test = url
var req = new Request(test);

req.method = 'GET';
req.headers ={
  'Authorization': 'Bearer API_TOKEN_HERE'
};

//start of unpacking and wrapping the data.this currently pulls task name, id, and due date
var result = await req.loadJSON();
console.log(result)


let w = new ListWidget();

// This pulls an image from the internet
// let imgReq = new Request("https://raw.githubusercontent.com/dracula/wallpaper/master/first-collection/macos.png");
// let img = await imgReq.loadImage();


//This uses a local file, stored in iCloud. 
let fm = FileManager.iCloud();
//for more on how to bookmark a file, check out the Scriptable docs
let dir = fm.bookmarkedPath("Kraken");

let img = fm.readImage(dir)

w.backgroundImage = img;
let font = new Font("Fira Code Regular", 12)
let tfont = new Font("Fira Code Regular", 15)
let top = w.addText("task \t\t\t due date")
w.addSpacer(20)
top.centerAlignText()
top.font=tfont
top.color = new Color("44475a")


let table = new UITable()

let header = new UITableRow()
header.isHeader = true

nameOfCell = UITableCell.text("cell1")
nameOfCell.centerAligned()
nameOfCell.widthWeight = 50
header.addCell(nameOfCell)

nameOfCell2 = UITableCell.text("cell2")
nameOfCell2.centerAligned()
nameOfCell2.widthWeight = 50
header.addCell(nameOfCell2)
table.addRow(header)

// Setting todays date for trxt color check below

var date  = new Date();
// var dd = String(today.getDate()).padStart(2, '0');
// var mm = String(today.getMonth() + 1)//; //January is 0!
// var yyyy = today.getFullYear();

// today = mm + '/' + dd + '/' + yyyy;
let today = date.toLocaleDateString()


let list =[]
let task = result[0];
let result1 = task["title"]
for (i in result){
  let title = result[i];
  let final = title["title"]
  
  //one-liner found from stack overflow to fix date output
  let dueDate = title['due_date']
  let date = new Date(dueDate).toLocaleDateString();
  console.log(dueDate)
  
  identify = title["id"]
  console.log(final + '\t' + date);
  
  let row = new UITableRow()
  cell = UITableCell.text(final)
  cell.centerAligned()
  row.addCell(cell)
  due = UITableCell.text(date)
  due.centerAligned()
  row.addCell(due)

  table.addRow(row)
  
  
  
//   Adds title to list 
  list.push(final)
//   let w = new ListWidget();
//   let str = JSON.stringify(list)
//   let input = w.addText(final + "\t\t\t" + date);
//   w.setPadding(0, 0, 0, 5)
//   w.addSpacer(20)
//   input.centerAlignText()
  
//   color check for date

  if(date > today){
  let input = w.addText(final + "\t\t" + date + "🧛🏻‍♂️");
  w.addSpacer(20)
  input.centerAlignText()
  input.textColor = new Color("50fa7b");
  input.font = font
}else if (date == today){
  let input = w.addText(final + "\t\t" + date + "‼️");
  w.addSpacer(20)
  input.centerAlignText()
  input.textColor = new Color("ffb86c");
  input.font = font
}else{
  let input = w.addText(final + "\t\t" + date + "‼️🎃");
  w.addSpacer(20)
  input.centerAlignText()
  input.textColor = new Color("ff5555");
  input.font = font

}


  Script.setShortcutOutput(list)
  Script.setWidget(w);
  Script.complete();
  

//   for (each in result){
//   console.log(i);
//   let ip = i;
//   let test = i["title"];
//   console.log(test);//}
}

table.present()

Script.complete();
1 Like

Thank you for the widget code.
Any chance you could also share task creation code?
I’ll make sure to wrap it nicely in other topic.

That one is a bit more complex, and it looks like I was utilizing a combination of shortcuts, a-Shell, Scriptable and Jayson. When I have more cycles to work on this i will definitely post it.

2 Likes

Thanks! Would be appreciated. And of course this first “starter for 10” should keep us busy until then :slight_smile:

1 Like

Hey guys,

in case you missed it. I will not be continuing to work on this for the time being. I will be stepping away for now.

1 Like